/* public/style.css — shared styling for the upload + gallery pages */

/* Decorative display face for the couple's names (freeware, non-commercial).
   WOFF2/WOFF first — iOS Safari rejects the raw .ttf, so it's only a fallback. */
@font-face {
  font-family: 'Million Astteroids';
  src: url('/fonts/MillionAstteroids.woff2') format('woff2'),
       url('/fonts/MillionAstteroids.woff') format('woff'),
       url('/fonts/MillionAstteroids.ttf') format('truetype');
  font-display: swap;
}

:root {
  --ivory: #faf7f2;
  --ivory-2: #f3ede3;
  --wash: #eef3e9;        /* sage-tinted page background */
  --sage-mist: #e7eedd;   /* soft sage surface (dropzone, pills) */
  --card: #ffffff;
  --ink: #3a3833;
  --ink-soft: #6f6a61;
  --sage: #7c8a6b;
  --sage-dark: #5f6c50;
  --sage-deep: #4a5740;   /* strong sage for accents/text */
  --gold: #c2a36b;
  --line: #dfe7d6;        /* hairline, sage-tinted */
  --sage-line: #cdd8bf;   /* dashed borders / connector */
  --shadow: 0 16px 38px rgba(95, 108, 80, 0.13);
  --radius: 22px;
  /* Montserrat throughout — --serif kept as the name for display/heading text. */
  --serif: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Million Astteroids', 'Montserrat', sans-serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win even over display:flex/grid rules below. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 50% -160px, #f6faf1 0%, rgba(246,250,241,0) 62%),
    var(--wash);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  min-height: 100vh;
}

/* Gentle staggered reveal on load. */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.masthead { animation: rise .6s ease both; }
.intro { animation: rise .6s ease .08s both; }
.panel { animation: rise .6s ease .16s both; }
.foot { animation: rise .6s ease .24s both; }
@media (prefers-reduced-motion: reduce) {
  .masthead, .intro, .panel, .foot { animation: none; }
}

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.wrap--wide { max-width: 1100px; }

/* ---------- Header ---------- */
.masthead {
  text-align: center;
  padding: 26px 0 8px;
}
.masthead .eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 11px;
  color: var(--gold);
  margin: 0 0 10px;
}
.masthead h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(44px, 11vw, 76px);
  line-height: 1.05;
  margin: 0;
  color: var(--ink);
}
.masthead .tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(17px, 4.4vw, 22px);
  color: var(--ink-soft);
  margin: 8px 0 0;
}
/* Botanical sprig divider: a thin sage line each side of a small leaf. */
.sprig {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 18px auto 0;
}
.sprig-line {
  height: 1px;
  width: 42px;
  background: var(--sage-line);
}
.sprig-leaf {
  width: 17px;
  height: 17px;
  color: var(--sage);
  flex: 0 0 auto;
}

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.intro {
  text-align: center;
  color: var(--ink-soft);
  font-size: 16px;
  margin: 18px auto 22px;
  max-width: 560px;
}

/* ---------- Name field ---------- */
.field {
  margin: 0 0 18px;
}
.field label {
  display: block;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 6px;
}
.field input {
  width: 100%;
  padding: 13px 15px;
  font-size: 16px; /* >=16px prevents iOS zoom-on-focus */
  font-family: var(--sans);
  color: var(--ink);
  background: var(--ivory);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(124, 138, 107, 0.18);
}

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--sage-line);
  border-radius: 18px;
  background: var(--sage-mist);
  padding: 34px 22px;
  text-align: center;
  transition: border-color .15s, background .15s, transform .05s;
  cursor: pointer;
}
.dropzone.drag {
  border-color: var(--sage);
  background: #e0e9d2;
}
.dropzone .dz-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--sage);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  box-shadow: 0 8px 18px rgba(95, 108, 80, 0.30);
  transition: transform .15s;
}
.dropzone:hover .dz-badge { transform: translateY(-1px); }
.dropzone .dz-badge svg { display: block; }
.dropzone .dz-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  color: var(--ink);
  margin: 0 0 4px;
}
.dropzone .dz-sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--sage);
  color: #fff;
  box-shadow: 0 8px 18px rgba(95, 108, 80, 0.28);
  transition: background .15s, transform .12s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { background: var(--sage-dark); transform: translateY(-1px); box-shadow: 0 12px 24px rgba(95, 108, 80, 0.34); }
.btn:active { transform: translateY(0); }
.btn--block { display: flex; width: 100%; justify-content: center; margin-top: 18px; }
.btn--ghost {
  background: transparent;
  color: var(--sage-dark);
  box-shadow: none;
  border: 1px solid var(--sage-line);
}
.btn--ghost:hover { background: var(--sage-mist); transform: translateY(-1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Upload progress ---------- */
.uprogress { margin-top: 22px; }
.uprogress-info {
  text-align: center;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}
.bar {
  height: 8px; border-radius: 999px; background: var(--ivory-2);
  margin-top: 10px; overflow: hidden;
}
.bar > span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--sage), var(--gold));
  transition: width .2s ease;
}

.summary {
  margin-top: 20px; text-align: center; color: var(--ink-soft); font-size: 15px;
}

/* ---------- Footer links ---------- */
.foot {
  text-align: center;
  margin-top: 26px;
}
.foot a { color: var(--sage-dark); }
.note {
  text-align: center; color: var(--ink-soft); font-size: 12.5px; margin-top: 16px;
}
.note .lock { color: var(--sage); }

/* ---------- Gallery ---------- */
.gallery {
  columns: 2;
  column-gap: 12px;
}
@media (min-width: 560px) { .gallery { columns: 3; } }
@media (min-width: 900px) { .gallery { columns: 4; } }

.tile {
  break-inside: avoid;
  margin: 0 0 12px;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--ivory-2);
  box-shadow: var(--shadow);
  display: block;
  cursor: pointer;
  border: 0; padding: 0; width: 100%;
}
.tile img {
  width: 100%;
  display: block;
  background: var(--ivory-2);
  min-height: 120px;
}
.tile .who {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 10px 8px;
  font-size: 12px; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0));
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  opacity: 0; transition: opacity .15s;
}
.tile:hover .who { opacity: 1; }
.tile .play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff; font-size: 44px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  background: rgba(0,0,0,0.12);
}

.empty {
  text-align: center; color: var(--ink-soft);
  padding: 60px 20px;
  font-family: var(--serif); font-size: 22px; font-style: italic;
}

.toolbar {
  display: flex; justify-content: center; gap: 12px; margin: 6px 0 22px;
  flex-wrap: wrap;
}
.count { color: var(--ink-soft); font-size: 13px; text-align: center; margin-bottom: 14px; }

/* ---------- View toggle (Grid / Timeline) ---------- */
.viewtoggle {
  display: flex;
  width: fit-content;
  margin: 0 auto 16px;
  background: var(--sage-mist);
  border: 1px solid var(--sage-line);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.vt-btn {
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.vt-btn.is-active {
  background: var(--card);
  color: var(--sage-dark);
  box-shadow: 0 1px 3px rgba(70, 60, 40, 0.12);
}

/* ---------- Timeline view: connected "snake" of linked photos ---------- */
.gallery.snake {
  column-count: 1;
  columns: 1;
  position: relative;
  max-width: 560px;
  margin: 6px auto 0;
  padding: 26px 0 10px;
}
/* The connecting line sits behind the cards; only the gaps between photos show. */
.snake-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}
.snake-line path {
  fill: none;
  stroke: var(--sage);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.6;
}
/* Date "milestone" pill — drawn on top so the line tucks behind it. */
.snake-date {
  position: relative;
  z-index: 2;
  width: fit-content;
  margin: 8px auto 24px;
  padding: 6px 16px;
  background: var(--sage-mist);
  border: 1px solid var(--sage-line);
  border-radius: 999px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--sage-deep);
}
.snake-card {
  position: relative;
  z-index: 1;
  max-width: 250px;
  margin: 0;
}
.snake-card .tile { width: 100%; margin: 0; }
/* Keep each photo's natural shape (like the grid) — no forced square crop. */
.snake-card .tile img { width: 100%; height: auto; }
/* Timestamp: a bold label centred on the connecting line, between the photos. */
.snake-time {
  position: relative;
  z-index: 2;
  width: fit-content;
  margin: 18px auto;
  padding: 2px 14px;
  background: var(--wash);
  color: var(--sage-deep);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 16px;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(28, 24, 18, 0.92);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%; max-height: 90vh;
  border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox .close {
  position: absolute; top: 16px; right: 20px;
  color: #fff; font-size: 34px; cursor: pointer;
  background: none; border: 0; line-height: 1;
}

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--sage);
  animation: spin .8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
