:root {
  --bg: #040a07;
  --bg-2: #08130d;
  --panel: #0c1a13;
  --panel-2: #10231a;
  --text: #e3f2e9;
  --text-dim: #8fac9b;
  --text-faint: #5b7767;
  --line: rgba(140, 255, 200, 0.09);
  --line-strong: rgba(140, 255, 200, 0.2);
  --jade: #4fe0a2;
  --jade-deep: #1d7a52;
  --glow: #b8f7d4;
  --aurora: linear-gradient(90deg, #0f5c3c, #2fb87e, #9ff5c8, #3fd1b5, #2fb87e, #0f5c3c);
  --radius: 14px;
  --nav-h: 64px;

  --ink-jade: #6ff0b6;
  --ink-moss: #b5dc8f;
  --ink-teal: #6fd6d6;
  --ink-mint: #d2f8e4;
  --ink-gold: #e8cf86;
  --ink-violet: #bda8ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* slow drifting fog behind everything */
body::before, body::after {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  pointer-events: none;
}
body::before {
  background:
    radial-gradient(40% 35% at 20% 30%, rgba(31, 122, 82, 0.22), transparent 70%),
    radial-gradient(35% 40% at 80% 70%, rgba(20, 90, 80, 0.2), transparent 70%),
    radial-gradient(30% 30% at 60% 15%, rgba(60, 160, 110, 0.12), transparent 70%);
  animation: fog-drift 38s ease-in-out infinite alternate;
}
body::after {
  background:
    radial-gradient(30% 25% at 70% 40%, rgba(80, 200, 150, 0.08), transparent 70%),
    radial-gradient(45% 30% at 30% 85%, rgba(15, 70, 50, 0.25), transparent 70%);
  animation: fog-drift 52s ease-in-out infinite alternate-reverse;
}
@keyframes fog-drift {
  0% { transform: translate3d(-3%, -2%, 0) scale(1); }
  100% { transform: translate3d(4%, 3%, 0) scale(1.08); }
}

/* Fireflies, adapted from Mike Golus — https://codepen.io/mikegolus/pen/Jegvym (MIT).
   Per-firefly paths/timings are generated in fireflies.js. */
.fireflies {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.firefly {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 0.4vw;
  height: 0.4vw;
  min-width: 4px;
  min-height: 4px;
  margin: -0.2vw 0 0 9.8vw;
  animation: ease 200s alternate infinite;
  pointer-events: none;
}
.firefly::before,
.firefly::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform-origin: -10vw;
}
.firefly::before {
  background: #000;
  opacity: 0.4;
  animation: ff-drift ease alternate infinite;
}
.firefly::after {
  background: #e6fff0;
  opacity: 0;
  box-shadow: 0 0 0 0 #4fe0a2;
  animation: ff-drift ease alternate infinite, ff-flash ease infinite;
}

@keyframes ff-drift {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes ff-flash {
  0%, 30%, 100% { opacity: 0; box-shadow: 0 0 0 0 #4fe0a2; }
  5% { opacity: 1; box-shadow: 0 0 2vw 0.4vw #4fe0a2; }
}

img { display: block; max-width: 100%; }
a { color: var(--jade); }

@keyframes aurora-pan {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.aurora-text {
  background: var(--aurora);
  background-size: 200% 100%;
  animation: aurora-pan 8s linear infinite;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hand { font-family: "Caveat", "Segoe Print", cursive; }

/* ---------------- nav ---------------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  background: rgba(4, 10, 7, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
}

.nav-brand {
  font-family: "Cinzel", serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-brand .leaf-mark { width: 22px; height: 22px; filter: drop-shadow(0 0 6px rgba(79, 224, 162, 0.6)); }

.nav-links { display: flex; gap: clamp(14px, 3vw, 36px); }
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 2px;
  position: relative;
  transition: color 0.25s;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: 0;
  height: 2px;
  background: var(--aurora);
  background-size: 200% 100%;
  animation: aurora-pan 8s linear infinite;
  transition: right 0.3s ease;
  box-shadow: 0 0 8px rgba(79, 224, 162, 0.7);
}
.nav-links a:hover, .nav-links a.current { color: var(--text); }
.nav-links a:hover::after, .nav-links a.current::after { right: 0; }

.page-main { padding-top: 28px; }

/* ---------------- buttons & inputs ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  font: 500 0.9rem "Inter", sans-serif;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s, box-shadow 0.25s, background 0.25s, border-color 0.25s;
}
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.btn-jade {
  background: linear-gradient(135deg, #2fb87e, #1d7a52);
  color: #effff6;
  box-shadow: 0 0 0 1px rgba(159, 245, 200, 0.25) inset, 0 8px 30px rgba(47, 184, 126, 0.28);
}
.btn-jade:hover { box-shadow: 0 0 0 1px rgba(159, 245, 200, 0.4) inset, 0 10px 40px rgba(79, 224, 162, 0.45); }

.btn-ghost {
  background: rgba(10, 26, 18, 0.5);
  color: var(--text);
  border-color: var(--line-strong);
  backdrop-filter: blur(6px);
}
.btn-ghost:hover { border-color: var(--jade); box-shadow: 0 0 20px rgba(79, 224, 162, 0.2); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-danger { background: transparent; color: #ff9a9a; border-color: rgba(255, 120, 120, 0.3); }
.btn-danger:hover { border-color: #ff8a8a; }

.input, .textarea, .select {
  width: 100%;
  background: rgba(4, 12, 8, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  font: 400 0.95rem "Inter", sans-serif;
  padding: 10px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(79, 224, 162, 0.15);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }

label.lbl {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ---------------- cover ---------------- */

.cover {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 30px 20px 60px;
  overflow: hidden;
}

.book {
  position: relative;
  width: min(440px, 88vw);
  aspect-ratio: 3 / 4;
  border-radius: 6px 16px 16px 6px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(120, 230, 170, 0.12), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #123826, #0a2218 55%, #061710);
  box-shadow:
    -14px 0 0 -6px #04110b,
    inset 10px 0 18px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(159, 245, 200, 0.12),
    0 40px 90px rgba(0, 0, 0, 0.7),
    0 0 120px rgba(47, 184, 126, 0.18);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 44px 36px;
  animation: book-float 7s ease-in-out infinite;
}
@keyframes book-float {
  0%, 100% { transform: translateY(0) rotate(-0.4deg); }
  50% { transform: translateY(-10px) rotate(0.4deg); }
}

/* spine */
.book::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 22px;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(90deg, #031009, #0d2c1e 60%, #061710);
  box-shadow: inset -1px 0 0 rgba(159, 245, 200, 0.1);
}
/* embossed frame */
.book::after {
  content: "";
  position: absolute;
  inset: 22px 18px 22px 40px;
  border: 1px solid rgba(184, 247, 212, 0.25);
  border-radius: 4px;
  outline: 1px solid rgba(184, 247, 212, 0.1);
  outline-offset: 6px;
  pointer-events: none;
}

.book-inner { position: relative; z-index: 1; padding-left: 14px; }
.book-sigil { width: 70px; height: 70px; margin: 0 auto 18px; filter: drop-shadow(0 0 14px rgba(79, 224, 162, 0.7)); animation: sigil-pulse 4s ease-in-out infinite; }
@keyframes sigil-pulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }

.book-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.book-title {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: clamp(2.3rem, 7vw, 3.4rem);
  line-height: 1.05;
  margin: 10px 0 6px;
  text-shadow: 0 0 30px rgba(79, 224, 162, 0.35);
}
.book-sub {
  font-family: "Cinzel", serif;
  letter-spacing: 0.18em;
  font-size: 0.95rem;
  color: var(--glow);
  opacity: 0.85;
}
.book-dedication {
  margin-top: 22px;
  font-size: 1.35rem;
  color: var(--text-dim);
  line-height: 1.3;
}
.book-date {
  margin-top: 14px;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.cover-actions {
  position: relative;
  margin-top: 40px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.cover-stack { position: relative; display: flex; flex-direction: column; align-items: center; }

.scroll-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-faint);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  animation: hint 2.4s ease-in-out infinite;
}
@keyframes hint { 0%, 100% { opacity: 0.3; transform: translate(-50%, 0); } 50% { opacity: 1; transform: translate(-50%, 6px); } }

/* ---------------- sealed state ---------------- */

.seal-wrap { margin-top: 34px; text-align: center; position: relative; }
.countdown { display: flex; gap: 14px; justify-content: center; }
.countdown div {
  min-width: 72px;
  padding: 10px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(8, 19, 13, 0.6);
  backdrop-filter: blur(6px);
}
.countdown b { display: block; font: 600 1.7rem "Cinzel", serif; color: var(--glow); }
.countdown span { font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); }
.seal-note { margin-top: 16px; color: var(--text-dim); font-size: 0.9rem; }

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

.section {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 100px) clamp(16px, 4vw, 48px);
}
.section-head { margin-bottom: 34px; text-align: center; }
.section-head h2 {
  font-family: "Cinzel", serif;
  font-weight: 500;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  letter-spacing: 0.04em;
}
.section-head p { color: var(--text-dim); margin-top: 6px; }
.flourish {
  display: block;
  width: 180px;
  height: 14px;
  margin: 14px auto 0;
  opacity: 0.7;
}

/* ---------------- friend cards (table of contents) ---------------- */

.friend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 34px 26px;
}

.friend-card {
  position: relative;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(180deg, #e8f3ec, #d3e6da);
  padding: 12px 12px 16px;
  border-radius: 3px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.2);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), box-shadow 0.35s;
}
.friend-card:hover {
  transform: rotate(0deg) translateY(-8px) scale(1.03);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(79, 224, 162, 0.25);
  z-index: 2;
}
/* washi tape */
.friend-card::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 84px;
  height: 22px;
  transform: translateX(-50%) rotate(calc(var(--tilt, 0deg) * -2));
  background: repeating-linear-gradient(135deg, rgba(79, 224, 162, 0.55) 0 6px, rgba(47, 184, 126, 0.45) 6px 12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  opacity: 0.85;
}
.friend-photo {
  aspect-ratio: 1;
  background: #0a1d14;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.friend-photo img { width: 100%; height: 100%; object-fit: cover; }
.friend-photo .initial { font: 700 3.4rem "Cinzel", serif; color: var(--jade); opacity: 0.6; }
.friend-card .who { font-size: 1.7rem; line-height: 1.1; color: #12321f; margin-top: 10px; text-align: center; }
.friend-card .what { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: #4d6b59; text-align: center; margin-top: 2px; }

.empty-note { text-align: center; color: var(--text-faint); padding: 40px 0; font-style: italic; }

/* ---------------- masonry gallery ---------------- */

.masonry { columns: 3 300px; column-gap: 16px; }
.tile {
  break-inside: avoid;
  margin-bottom: 16px;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--line);
}
.tile img { width: 100%; height: auto; transition: transform 0.6s ease, filter 0.6s; filter: saturate(0.92); }
.tile:hover img { transform: scale(1.04); filter: saturate(1.05); }
.tile .cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 30px 14px 10px;
  background: linear-gradient(180deg, transparent, rgba(2, 10, 6, 0.9));
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s;
}
.tile:hover .cap { opacity: 1; transform: none; }
.tile .cap small { display: block; color: var(--jade); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 28px; }
.chip {
  border: 1px solid var(--line-strong);
  background: rgba(8, 19, 13, 0.6);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 14px;
  font: 400 0.8rem "Inter", sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { color: var(--text); border-color: var(--jade); }
.chip.on { background: var(--jade-deep); color: #fff; border-color: var(--jade); }

/* ---------------- friend page: the book spread ---------------- */

.spread {
  position: relative;
  max-width: 1180px;
  margin: 40px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 8px;
  box-shadow: 0 50px 100px rgba(0, 0, 0, 0.7), 0 0 80px rgba(47, 184, 126, 0.12);
}
.spread::after {
  /* the fold in the middle */
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 60px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.45) 48%, rgba(159, 245, 200, 0.06) 50%, rgba(0, 0, 0, 0.35) 52%, transparent);
  pointer-events: none;
}

.leaf {
  position: relative;
  padding: clamp(28px, 4vw, 54px);
  background:
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(140, 255, 200, 0.07) 33px 34px),
    radial-gradient(ellipse at 50% 0%, rgba(80, 200, 140, 0.08), transparent 60%),
    linear-gradient(180deg, #0e2118, #0a1912);
  background-position: 0 14px, 0 0, 0 0;
  min-height: 640px;
}
.leaf.left { border-radius: 8px 0 0 8px; }
.leaf.right { border-radius: 0 8px 8px 0; }
.leaf.left::before {
  /* margin line */
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: clamp(18px, 2.5vw, 34px);
  width: 1px;
  background: rgba(79, 224, 162, 0.18);
}

.leaf-title {
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.leaf-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }

.portrait-row { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 26px; }
.polaroid {
  flex: 0 0 auto;
  width: 170px;
  background: #e4f0e8;
  padding: 9px 9px 30px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transform: rotate(-3deg);
  position: relative;
}
.polaroid::before {
  content: "";
  position: absolute;
  top: -9px; left: 50%;
  width: 64px; height: 18px;
  transform: translateX(-50%) rotate(4deg);
  background: repeating-linear-gradient(135deg, rgba(79, 224, 162, 0.55) 0 5px, rgba(47, 184, 126, 0.45) 5px 10px);
}
.polaroid .ph { aspect-ratio: 1; background: #0a1d14; display: grid; place-items: center; overflow: hidden; }
.polaroid .ph img { width: 100%; height: 100%; object-fit: cover; }
.polaroid .ph .initial { font: 700 3rem "Cinzel", serif; color: var(--jade); opacity: 0.6; }

.big-name { font-family: "Cinzel", serif; font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.1; }
.char-line { color: var(--text-dim); font-size: 0.9rem; margin-top: 6px; }
.char-line b { color: var(--jade); font-weight: 500; }

.facts { display: grid; gap: 0; }
.fact {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: baseline;
  min-height: 34px;
  padding-top: 2px;
}
.fact .q { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.fact .a { font-size: 1.45rem; line-height: 1.35; }

.story { margin-bottom: 18px; }
.story .q {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.story .a { font-size: 1.5rem; line-height: 34px; white-space: pre-wrap; }

.signature-block { margin-top: 30px; text-align: right; }
.signature-block .sig { font-size: 2.6rem; line-height: 1; }
.signature-block .sig-line { display: inline-block; min-width: 220px; border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 4px; font-size: 0.65rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--text-faint); }

/* ink colours chosen by each friend */
.ink-jade { color: var(--ink-jade); }
.ink-moss { color: var(--ink-moss); }
.ink-teal { color: var(--ink-teal); }
.ink-mint { color: var(--ink-mint); }
.ink-gold { color: var(--ink-gold); }
.ink-violet { color: var(--ink-violet); }

.page-nav {
  max-width: 1180px;
  margin: 26px auto 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.shots-head { max-width: 1180px; margin: 70px auto 22px; }

/* scrapbook strip of screenshots on a friend page */
.scrap {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px 26px;
}
.scrap figure {
  background: #e4f0e8;
  padding: 10px 10px 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
  cursor: zoom-in;
}
.scrap figure:hover { transform: rotate(0) scale(1.03); }
.scrap img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.scrap figcaption { color: #183a27; font-size: 1.35rem; line-height: 1.2; margin-top: 8px; text-align: center; min-height: 1.2em; }

/* ---------------- footer ---------------- */

.footer {
  text-align: center;
  padding: 60px 20px 50px;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.footer .rule { display: block; width: 120px; height: 1px; margin: 0 auto 18px; background: var(--aurora); background-size: 200% 100%; animation: aurora-pan 8s linear infinite; }
.footer .hand { font-size: 1.4rem; color: var(--text-dim); }

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 8, 5, 0.94);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lb-figure { max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lb-figure img { max-width: 92vw; max-height: 80vh; object-fit: contain; border-radius: 6px; box-shadow: 0 0 80px rgba(47, 184, 126, 0.2); }
.lb-figure figcaption { text-align: center; color: var(--text-dim); font-size: 0.9rem; }
.lb-figure figcaption .hand { font-size: 1.6rem; color: var(--text); display: block; }
.lb-close, .lb-arrow {
  position: absolute;
  background: rgba(10, 26, 18, 0.7);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.2s, transform 0.2s;
}
.lb-close:hover, .lb-arrow:hover { border-color: var(--jade); }
.lb-close { top: 20px; right: 20px; width: 44px; height: 44px; font-size: 1.6rem; }
.lb-arrow { top: 50%; transform: translateY(-50%); width: 54px; height: 54px; font-size: 2rem; }
.lb-arrow:hover { transform: translateY(-50%) scale(1.08); }
.lb-prev { left: 22px; }
.lb-next { right: 22px; }

/* ---------------- write page (friends fill in their page) ---------------- */

.write-wrap { max-width: 980px; margin: 0 auto; padding: 40px clamp(16px, 4vw, 40px) 80px; }
.write-hero { text-align: center; margin: 30px 0 40px; }
.write-hero h1 { font-family: "Cinzel", serif; font-weight: 500; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.write-hero p { color: var(--text-dim); max-width: 620px; margin: 10px auto 0; }

.card {
  background: linear-gradient(180deg, rgba(16, 35, 26, 0.85), rgba(10, 25, 18, 0.85));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 32px);
  margin-bottom: 24px;
  backdrop-filter: blur(6px);
}
.card h2 {
  font-family: "Cinzel", serif;
  font-weight: 500;
  font-size: 1.25rem;
  margin-bottom: 4px;
}
.card .hint { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 20px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }

.avatar-row { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.avatar-row .polaroid { width: 140px; transform: rotate(-2deg); }

.ink-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.ink-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--line-strong);
  transition: transform 0.2s;
}
.ink-dot:hover { transform: scale(1.1); }
.ink-dot.on { border-color: #fff; box-shadow: 0 0 14px currentColor; }

.sig-preview { font-size: 2.4rem; min-height: 52px; margin-top: 8px; }

.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--jade); background: rgba(47, 184, 126, 0.07); color: var(--text); }
.dropzone b { color: var(--jade); font-weight: 500; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 20px; }
.thumb { background: rgba(4, 12, 8, 0.6); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.thumb .tools { padding: 10px; display: grid; gap: 8px; }
.thumb .tools .row { display: flex; gap: 6px; justify-content: space-between; }
.thumb .input { font-size: 0.85rem; padding: 7px 10px; }

.savebar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 150;
  background: rgba(8, 19, 13, 0.9);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.82rem;
  color: var(--text-dim);
  backdrop-filter: blur(10px);
  display: flex;
  gap: 10px;
  align-items: center;
  transition: opacity 0.3s;
}
.savebar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--jade); box-shadow: 0 0 8px var(--jade); }
.savebar.saving .dot { background: #e8cf86; box-shadow: 0 0 8px #e8cf86; }
.savebar.error .dot { background: #ff7b7b; box-shadow: 0 0 8px #ff7b7b; }

.sign-card { text-align: center; }
.sign-card .status { margin-bottom: 16px; color: var(--text-dim); }
.sign-card .status b { color: var(--jade); }

.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 14px; display: none; }
.progress.on { display: block; }
.progress i { display: block; height: 100%; width: 0; background: var(--aurora); background-size: 200% 100%; animation: aurora-pan 2s linear infinite; transition: width 0.2s; }

.error-page { text-align: center; padding: 160px 20px; color: var(--text-dim); }
.error-page h1 { font-family: "Cinzel", serif; color: var(--text); font-weight: 500; margin-bottom: 10px; }

/* ---------------- responsive ---------------- */

@media (max-width: 860px) {
  .spread { grid-template-columns: 1fr; }
  .spread::after { display: none; }
  .leaf.left { border-radius: 8px 8px 0 0; }
  .leaf.right { border-radius: 0 0 8px 8px; }
  .leaf { min-height: 0; }
  .fact { grid-template-columns: 1fr; gap: 0; margin-bottom: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .portrait-row { flex-direction: column; align-items: center; text-align: center; }
}

@media (max-width: 600px) {
  .lb-arrow { width: 42px; height: 42px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .nav-brand span { display: none; }
  .countdown div { min-width: 60px; }
}

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

/* keep long words / narrow screens from forcing horizontal overflow */
.spread { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.leaf, .story .a, .fact .a, .big-name { min-width: 0; overflow-wrap: anywhere; }
.scrap { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.friend-grid { grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); }
.thumbs { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
@media (max-width: 860px) { .spread { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) {
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 0.72rem; letter-spacing: 0.04em; }
  .countdown { gap: 8px; }
  .countdown div { min-width: 0; flex: 1; }
}

/* skip toggles + custom questions on the write page */
.lbl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lbl-row .lbl { margin-bottom: 6px; }
.skip-toggle {
  background: none;
  border: 0;
  color: var(--text-faint);
  font: 400 0.72rem "Inter", sans-serif;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color 0.2s;
}
.skip-toggle:hover { color: var(--text); }
.q-field.is-skipped .lbl { text-decoration: line-through; color: var(--text-faint); }
.q-field.is-skipped .skip-toggle { color: var(--ink-gold); }
.q-field.is-skipped .input, .q-field.is-skipped .textarea { opacity: 0.35; }
.custom-q { display: grid; gap: 8px; }
.custom-q .lbl-row { margin-bottom: -2px; }
.sub-head { font-family: "Cinzel", serif; font-weight: 500; font-size: 1.05rem; margin: 34px 0 4px; padding-top: 24px; border-top: 1px solid var(--line); }

/* kiwi emblem on the book cover: tinted to read as mint foil stamped into the cover */
.book-kiwi {
  width: 92px;
  height: 92px;
  margin-bottom: 20px;
  opacity: 0.85;
  /* jade foil, toned down */
  filter: grayscale(1) sepia(1) hue-rotate(95deg) saturate(1.6) brightness(0.82)
          drop-shadow(0 0 1px rgba(4, 20, 12, 0.9))
          drop-shadow(0 0 10px rgba(79, 224, 162, 0.28));
  animation: sigil-pulse 5s ease-in-out infinite;
}

/* ---------------- text on the paper lines ----------------
   Every row on a page is exactly one ruled line (--rule) tall; a paper line sits
   at the bottom of each row. Labels are pushed down to rest on their line and the
   handwriting is nudged down so its baseline touches the line. */
.leaf {
  --rule: 34px;
  --hand-drop: 9px;   /* handwriting: distance from row centre down to the line */
  padding-top: var(--rule);
  padding-bottom: var(--rule);
  min-height: calc(var(--rule) * 19);
  background:
    repeating-linear-gradient(180deg, transparent 0 calc(var(--rule) - 1px), rgba(140, 255, 200, 0.07) calc(var(--rule) - 1px) var(--rule)),
    radial-gradient(ellipse at 50% 0%, rgba(80, 200, 140, 0.08), transparent 60%),
    linear-gradient(180deg, #0e2118, #0a1912);
  background-position: 0 0;
}

/* single-line labels: one row, text resting on the line */
.leaf-title,
.fact .q,
.story .q {
  height: var(--rule);
  margin: 0;
  display: flex;
  align-items: flex-end;
  padding-bottom: 5px;
  line-height: 1.2;
}
.leaf-title { margin-bottom: var(--rule); }
.leaf-title::after { align-self: flex-end; margin-bottom: -5px; } /* lands on the paper line */
.fact .q { height: auto; min-height: var(--rule); }

/* handwriting: rows of exactly one line, nudged onto the line */
.fact .a,
.story .a {
  line-height: var(--rule);
  position: relative;
  top: var(--hand-drop);
}
.fact { min-height: var(--rule); padding-top: 0; align-items: start; grid-template-columns: 200px 1fr; }
.story { margin-bottom: 0; }
.story + .story { margin-top: 0; }

/* portrait block occupies a whole number of rows */
.portrait-row { height: calc(var(--rule) * 6); margin-bottom: 0; }
.big-name { line-height: calc(var(--rule) * 2); position: relative; top: 11px; }
.char-line { line-height: var(--rule); margin-top: 0; position: relative; top: 9px; }

/* signature: two rows of ink, then the caption on the next line */
.signature-block { margin-top: var(--rule); }
.signature-block .sig { line-height: calc(var(--rule) * 2); position: relative; top: 13px; }
.signature-block .sig-line { height: var(--rule); margin-top: 0; padding-top: 6px; line-height: 1.2; vertical-align: top; }

.leaf .empty-note { padding: 0; line-height: var(--rule); }

@media (max-width: 860px) {
  .fact { grid-template-columns: 1fr; gap: 0; margin-bottom: 0; }
  .portrait-row { height: auto; min-height: calc(var(--rule) * 10); }
  .leaf { min-height: 0; }
}

/* ---------------- focus point editor ---------------- */
.focal-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(2, 8, 5, 0.85);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.focal-modal[hidden] { display: none; }
.focal-card {
  position: relative;
  width: min(1100px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: linear-gradient(180deg, #10231a, #0a1912);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 30px);
}
.focal-card h2 { font-family: "Cinzel", serif; font-weight: 500; font-size: 1.3rem; }
.focal-card .lb-close { top: 14px; right: 14px; width: 38px; height: 38px; font-size: 1.4rem; }
.focal-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
.focal-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: crosshair;
  background: #000;
  user-select: none;
  touch-action: none;
}
.focal-wrap img { width: 100%; pointer-events: none; }
.focal-marker {
  position: absolute;
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 2px solid #c9ffe4;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 18px rgba(79, 224, 162, 0.8);
  pointer-events: none;
}
.focal-marker::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #c9ffe4; }
.focal-previews { display: grid; gap: 16px; }
.focal-preview .frame { width: 100%; border-radius: 8px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px var(--line-strong); }
.focal-preview .frame img { width: 100%; height: 100%; object-fit: cover; }
.focal-preview figcaption { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-top: 6px; }
.focal-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.focal-status { flex: 1; font-size: 0.82rem; color: var(--text-dim); }
.thumb img.focusable { cursor: pointer; }
@media (max-width: 760px) { .focal-grid { grid-template-columns: 1fr; } }
/* keep tall screenshots inside the window; the wrapper hugs the image so the marker % stays exact */
.focal-wrap { width: fit-content; max-width: 100%; justify-self: center; }
.focal-wrap img { width: auto; max-width: 100%; max-height: min(70vh, 720px); }
.focal-preview .frame { margin: 0 auto; }
.focal-preview figcaption { text-align: center; }

/* small way back to the cover on the friend pages and Memories (there is no menu bar) */
.back-link {
  display: inline-block;
  margin: 0 0 4px clamp(0px, 1vw, 8px);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.back-link:hover { color: var(--jade); }
.page-main > .back-link { max-width: 1180px; display: block; margin-left: auto; margin-right: auto; }
.page-main > .section { padding-top: 24px; }

/* ---------------- signature styles ----------------
   Script fonts differ a lot in size, so each gets its own scale to look about as big as Caveat. */
.sig-font-caveat   { font-family: "Caveat", cursive; }
.sig-font-dancing  { font-family: "Dancing Script", cursive; font-weight: 600; font-size: 0.85em; }
.sig-font-vibes    { font-family: "Great Vibes", cursive; font-size: 1.05em; }
.sig-font-homemade { font-family: "Homemade Apple", cursive; font-size: 0.6em; }
.sig-font-satisfy  { font-family: "Satisfy", cursive; font-size: 0.85em; }
.sig-font-pinyon   { font-family: "Pinyon Script", cursive; font-size: 0.95em; }
/* on the page the signature sets its own size, so apply the scale to that */
.signature-block .sig.sig-font-dancing  { font-size: 2.25rem; }
.signature-block .sig.sig-font-vibes    { font-size: 2.8rem; }
.signature-block .sig.sig-font-homemade { font-size: 1.6rem; }
.signature-block .sig.sig-font-satisfy  { font-size: 2.2rem; }
.signature-block .sig.sig-font-pinyon   { font-size: 2.5rem; }
.sig-preview.sig-font-dancing  { font-size: 2.05rem; }
.sig-preview.sig-font-vibes    { font-size: 2.6rem; }
.sig-preview.sig-font-homemade { font-size: 1.45rem; }
.sig-preview.sig-font-satisfy  { font-size: 2rem; }
.sig-preview.sig-font-pinyon   { font-size: 2.3rem; }

.sigfont-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.sigfont-opt {
  background: rgba(4, 12, 8, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1.7rem;
  line-height: 1.3;
  min-height: 62px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sigfont-opt.sig-font-dancing  { font-size: 1.45rem; }
.sigfont-opt.sig-font-vibes    { font-size: 1.8rem; }
.sigfont-opt.sig-font-homemade { font-size: 1rem; }
.sigfont-opt.sig-font-satisfy  { font-size: 1.4rem; }
.sigfont-opt.sig-font-pinyon   { font-size: 1.6rem; }
.sigfont-opt:hover { border-color: var(--jade); }
.sigfont-opt.on { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(79, 224, 162, 0.18), 0 0 18px rgba(79, 224, 162, 0.2); }
