/* Drive Share viewer.
   Neutral greys on purpose: a warm background tints every photo on the page.
   Coral appears once per screen, on the one action worth taking. */

:root {
  --coral: #e8603c;
  --coral-deep: #cf4f2d;
  --on-coral: #ffffff;

  --bg: #f5f5f4;
  --surface: #ffffff;
  --tile: #e8e8e6;
  --line: #e1e1de;
  --line-2: #cfcfcb;

  --ink: #16161a;
  --ink-2: #6e6e73;
  --ink-3: #97978f;

  --lift: 0 1px 2px rgba(20, 20, 22, .045);
  --r: 10px;

  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
          "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --coral: #f4714e;
  --coral-deep: #ff8362;
  --on-coral: #1a0f0b;

  --bg: #111112;
  --surface: #1a1a1c;
  --tile: #232326;
  --line: #2b2b2f;
  --line-2: #3c3c41;

  --ink: #f2f2f0;
  --ink-2: #a0a0a4;
  --ink-3: #7a7a7e;

  --lift: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
  border-radius: 4px;
}

#app { padding: 0 14px 56px; }
@media (min-width: 640px) { #app { padding: 0 26px 72px; } }
@media (min-width: 1200px) { #app { padding: 0 36px 72px; } }

/* ---------- entrance ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

body.ready .hero > * { animation: rise .5s cubic-bezier(.22, .68, .3, 1) both; }
body.ready .hero > *:nth-child(1) { animation-delay: 0ms; }
body.ready .hero > *:nth-child(2) { animation-delay: 70ms; }
body.ready .hero > *:nth-child(3) { animation-delay: 140ms; }
body.ready .hero > *:nth-child(4) { animation-delay: 210ms; }
body.ready #sections { animation: rise .5s cubic-bezier(.22, .68, .3, 1) 260ms both; }

/* ---------- header ---------- */

.hero { text-align: center; padding: 52px 8px 26px; }
@media (min-width: 640px) { .hero { padding: 72px 8px 34px; } }

.title {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
@media (min-width: 640px) { .title { font-size: 36px; } }

/* the count line, set like a label on a gallery wall */
.subtitle {
  margin: 12px 0 0;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.subtitle .dot { color: var(--coral); margin: 0 .55em; }

.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; margin-top: 26px; }
.tabs[hidden] { display: none; }

.tab {
  font: 500 13px/1 var(--sans);
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.tab:hover { color: var(--ink); border-color: var(--line-2); }
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tab .n { margin-left: 6px; opacity: .55; font-variant-numeric: tabular-nums; }

.tools { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.tools[hidden] { display: none; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 14px/1 var(--sans);
  padding: 11px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  transition: background .16s, border-color .16s, transform .12s, opacity .16s;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--coral); border-color: var(--coral); color: var(--on-coral); }
.btn.primary:hover:not(:disabled) { background: var(--coral-deep); border-color: var(--coral-deep); }

.progress { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress[hidden] { display: none; }

/* ---------- states ---------- */

.state {
  max-width: 420px; margin: 56px auto; padding: 30px 26px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift);
  color: var(--ink-2); font-size: 14px; line-height: 1.6;
}
.state[hidden] { display: none; }
.state strong { display: block; color: var(--ink); font-size: 16px; font-weight: 600; margin-bottom: 7px; letter-spacing: -0.01em; }
.state .spinner { margin: 0 auto 16px; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--coral);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- sections ---------- */

.section[hidden] { display: none; }

.section-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 30px 2px 14px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
}
.section-head .count { font-weight: 400; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }

.group-label {
  margin: 22px 2px 11px; font-size: 11px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
.group-label[hidden] { display: none; }

/* ---------- media ---------- */

.masonry { column-count: 2; column-gap: 8px; }
@media (min-width: 620px) { .masonry { column-count: 3; column-gap: 10px; } }
@media (min-width: 1000px) { .masonry { column-count: 4; } }
@media (min-width: 1500px) { .masonry { column-count: 5; } }
.masonry[hidden] { display: none; }

.tile {
  position: relative; break-inside: avoid; margin: 0 0 8px;
  border-radius: var(--r); overflow: hidden; background: var(--tile); cursor: pointer;
}
@media (min-width: 620px) { .tile { margin-bottom: 10px; } }
.tile[hidden] { display: none; }

.tile img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s, transform .5s; }
.tile img.on { opacity: 1; }
.tile:hover img { transform: scale(1.025); }
.tile.video { aspect-ratio: 16 / 9; }

.tile .shim {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 34%, rgba(255,255,255,.42) 50%, transparent 66%);
  background-size: 220% 100%; animation: shim 1.6s infinite linear;
}
:root[data-theme="dark"] .tile .shim { background-image: linear-gradient(100deg, transparent 34%, rgba(255,255,255,.06) 50%, transparent 66%); }
@keyframes shim { from { background-position: 200% 0 } to { background-position: -200% 0 } }

.tile .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.tile .play i { width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.42); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); display: flex; align-items: center; justify-content: center; }
.tile .play svg { width: 19px; height: 19px; fill: #fff; transform: translateX(1.5px); }

.tile .veil {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .22s;
  background: linear-gradient(to top, rgba(0,0,0,.46), transparent 52%);
}
.tile:hover .veil, .tile:focus-within .veil { opacity: 1; }

.tile .cap, .tile .get {
  position: absolute; bottom: 8px; font-size: 11px; line-height: 1;
  color: #fff; padding: 5px 8px; border-radius: 6px;
  background: rgba(0,0,0,.42); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .22s;
}
.tile:hover .cap, .tile:hover .get, .tile:focus-within .get { opacity: 1; }
.tile .cap { left: 8px; max-width: 56%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tile .get { right: 8px; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.tile .get svg { width: 11px; height: 11px; }
@media (hover: none) { .tile .cap, .tile .get { opacity: 1; } }

/* ---------- files ---------- */

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 8px; }
.files[hidden] { display: none; }

.file {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 16px 14px 14px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--lift);
  transition: border-color .16s, transform .12s;
}
.file[hidden] { display: none; }
.file:hover { border-color: var(--line-2); transform: translateY(-1px); }
.file:hover .ico { color: var(--coral); }
.file .ico { width: 26px; height: 26px; color: var(--ink-3); margin-bottom: 10px; transition: color .16s; }
.file .fname { font-size: 12.5px; font-weight: 500; line-height: 1.35; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .fmeta { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed; inset: 0; z-index: 40; background: rgba(8, 8, 9, .975);
  display: flex; flex-direction: column; color: #fff;
  padding-top: env(safe-area-inset-top); animation: fade .16s ease;
}
.lightbox[hidden] { display: none; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.lb-bar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; flex: none; }
.lb-count { font-size: 11px; letter-spacing: .1em; color: rgba(255,255,255,.5); font-variant-numeric: tabular-nums; flex: none; }
.lb-name { font-size: 13px; color: rgba(255,255,255,.78); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-tools { display: flex; gap: 2px; flex: none; }
.lb-btn { width: 38px; height: 38px; border: 0; background: transparent; border-radius: 999px; color: rgba(255,255,255,.82); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.lb-btn svg { width: 17px; height: 17px; }
.lb-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

.lb-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 0 8px; touch-action: pan-y; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 3px; opacity: 0; transition: opacity .2s; user-select: none; -webkit-user-drag: none; }
.lb-stage img.on { opacity: 1; }
.lb-stage iframe { width: 100%; max-width: 1060px; aspect-ratio: 16/9; max-height: 100%; border: 0; border-radius: 8px; background: #000; }
.lb-stage .spinner { position: absolute; border-color: rgba(255,255,255,.18); border-top-color: rgba(255,255,255,.8); }
.lb-stage .spinner[hidden] { display: none; }

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.07); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lb-nav svg { width: 24px; height: 24px; }
.lb-nav:hover { background: rgba(255,255,255,.15); }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
@media (max-width: 680px) { .lb-nav { display: none; } }

.lb-strip { flex: none; display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.lb-strip::-webkit-scrollbar { display: none; }
.lb-strip img { height: 46px; width: 46px; object-fit: cover; border-radius: 4px; flex: none; cursor: pointer; opacity: .38; transition: opacity .18s, box-shadow .18s; }
.lb-strip img:hover { opacity: .8; }
.lb-strip img.on { opacity: 1; box-shadow: 0 0 0 2px var(--coral); }

body.locked { overflow: hidden; }
