/* ============================================================
   WAYFARER · a painted ledger of wandered worlds
   One continuous color story: dawn sky → Resembool gold →
   Frieren mist → night. Single amber accent throughout.
   ============================================================ */

:root {
  --ink: #38332a;
  --ink-soft: #6e6553;
  --paper: #f5efe1;
  --paper-card: #fffdf6;
  --paper-line: #e4d5b2;
  --gold-wash: #f2e5c9;
  --sage-wash: #eef1e7;
  --sage-line: #cfdcc8;
  --night: #131a33;
  --night-deep: #0b1024;
  --night-text: #f2ead6;
  --night-soft: #a9b2cc;
  --accent: #a3611c;        /* ember amber: buttons, seals, focus */
  --accent-deep: #7f4a12;
  --accent-glow: #e6bb62;
  --serif: 'Cormorant Garamond', 'Georgia', serif;
  --sans: 'Karla', 'Segoe UI', sans-serif;
  --r-card: 16px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* the hidden attribute always wins, even over explicit display values */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

::selection { background: rgba(230, 187, 98, 0.45); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* paper grain over everything */
.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================== NAV ============================== */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 70;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.nav.scrolled {
  background: rgba(245, 239, 225, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(56, 51, 42, 0.08);
}

.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.nav-right { display: flex; align-items: center; gap: 1.1rem; }

.nav-count {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ============================== BUTTONS ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.6rem;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s ease, background 0.18s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff9ec;
  box-shadow: 0 10px 24px -10px rgba(163, 97, 28, 0.55);
}
.btn-primary:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(56, 51, 42, 0.35);
  color: var(--ink);
}
.btn-ghost:hover { background: rgba(56, 51, 42, 0.07); }

.btn-danger {
  background: transparent;
  border: 1px solid #a8503a;
  color: #8f3f27;
}
.btn-danger:hover { background: rgba(168, 80, 58, 0.08); }

.btn-small { padding: 0.5rem 1.1rem; font-size: 0.85rem; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 1.15rem;
  color: var(--ink-soft);
  transition: background 0.15s ease;
}
.icon-btn:hover { background: rgba(56, 51, 42, 0.08); }

/* ============================== HERO : DAWN ============================== */

.hero {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

.hero-sky {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg,
    #a9c3dc 0%,
    #c8d5da 32%,
    #ecdcc2 64%,
    #f6e7c4 100%);
}

/* the Resembool painting is the landing itself */
.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

.sun-glow {
  position: absolute;
  left: 68%; top: 72%;
  width: 60vw; height: 60vw;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(255, 236, 190, 0.85) 0%,
    rgba(255, 226, 170, 0.35) 32%,
    transparent 68%);
}

/* soft painted clouds, drifting */
.cloud {
  position: absolute;
  background: rgba(255, 253, 247, 0.75);
  border-radius: 50%;
  filter: blur(22px);
  animation: drift 90s ease-in-out infinite alternate;
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud-a { width: 340px; height: 90px; top: 14%; left: 8%; }
.cloud-a::before { width: 180px; height: 110px; top: -45px; left: 60px; }
.cloud-a::after  { width: 140px; height: 80px;  top: -20px; left: 190px; }

.cloud-b { width: 420px; height: 100px; top: 26%; left: 58%; animation-duration: 120s; animation-delay: -30s; }
.cloud-b::before { width: 220px; height: 130px; top: -55px; left: 90px; }
.cloud-b::after  { width: 150px; height: 90px;  top: -25px; left: 260px; }

.cloud-c { width: 260px; height: 70px; top: 48%; left: 24%; opacity: 0.6; animation-duration: 140s; animation-delay: -60s; }
.cloud-c::before { width: 130px; height: 80px; top: -35px; left: 50px; }

.cloud-d { width: 300px; height: 80px; top: 8%; left: 72%; opacity: 0.7; animation-duration: 100s; animation-delay: -15s; }
.cloud-d::before { width: 150px; height: 90px; top: -40px; left: 70px; }

.cloud-e { width: 220px; height: 60px; top: 60%; left: 68%; opacity: 0.5; animation-duration: 160s; animation-delay: -80s; }
.cloud-e::before { width: 110px; height: 66px; top: -28px; left: 44px; }

@keyframes drift {
  from { transform: translateX(-4vw); }
  to   { transform: translateX(5vw); }
}

.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 1.5rem;
  max-width: 720px;
}

/* morning haze behind the title so ink stays readable over the painting */
.hero-inner::before {
  content: "";
  position: absolute;
  inset: -4rem -6rem;
  z-index: -1;
  background: radial-gradient(ellipse at center,
    rgba(246, 239, 225, 0.8) 0%,
    rgba(246, 239, 225, 0.45) 45%,
    transparent 72%);
  pointer-events: none;
}

.hero-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(4.2rem, 11vw, 8.5rem);
  line-height: 1;
  letter-spacing: -0.01em;
  color: #3c3527;
}

.hero-sub {
  margin: 1.4rem auto 2.2rem;
  max-width: 36ch;
  font-size: 1.06rem;
  line-height: 1.6;
  color: #574e3c;
}

.hero-ctas {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* melt the horizon into the paper of the next page */
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 16vh;
  z-index: 1;
  background: linear-gradient(180deg, transparent, var(--paper));
  pointer-events: none;
}

/* ==================== SCROLL WINDOWS (the paintings) ==================== */

.window-sec { position: relative; }
#ch-resembool { background: var(--paper); }
#ch-frieren   { background: var(--gold-wash); }
#ch-wano      { background: #dfe6da; }

/* painted fallbacks: if a chapter's art file is missing, the window
   still opens onto a soft gradient sky instead of a broken image */
#ch-resembool .window-frame { background: linear-gradient(180deg, #8fb6d8 0%, #d9dcc0 55%, #c9b96a 100%); }
#ch-frieren   .window-frame { background: linear-gradient(180deg, #b9c7cd 0%, #cfd8c8 55%, #9db58a 100%); }
#ch-wano      .window-frame { background: linear-gradient(180deg, #332c52 0%, #5a4569 45%, #b97a5e 82%, #dfa468 100%); }

/* atmosphere inside the windows: clipped with the painting */
.atmo { position: absolute; pointer-events: none; }

.atmo.motes, .atmo.petals { inset: 0; overflow: hidden; }

/* dust motes drifting up through the workshop lamplight */
.mote {
  position: absolute;
  border-radius: 50%;
  background: #ffe9b4;
  box-shadow: 0 0 8px 2px rgba(255, 226, 160, 0.4);
  animation: mote-rise var(--dur, 14s) linear infinite;
  animation-delay: var(--delay, 0s);
  left: var(--px, 50%);
  bottom: -4%;
  opacity: 0;
}
@keyframes mote-rise {
  0%   { transform: translate3d(0, 0, 0); opacity: 0; }
  12%  { opacity: 0.75; }
  70%  { opacity: 0.35; }
  100% { transform: translate3d(var(--drift, 30px), -105vh, 0); opacity: 0; }
}

.atmo-mist {
  bottom: 16%; left: -15%;
  width: 70%; height: 18%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.45), transparent 70%);
  filter: blur(16px);
  animation: mist-drift 60s ease-in-out infinite alternate;
}
.mist-high {
  bottom: 34%;
  width: 55%; height: 12%;
  opacity: 0.7;
  animation-duration: 85s;
  animation-delay: -30s;
}
@keyframes mist-drift {
  from { transform: translateX(-8%); }
  to   { transform: translateX(65%); }
}

.atmo-glow {
  inset: 0;
  background: radial-gradient(ellipse at 50% 72%, rgba(255, 182, 92, 0.26), transparent 55%);
  animation: glow-pulse 6s ease-in-out infinite alternate;
}
@keyframes glow-pulse {
  from { opacity: 0.5; }
  to   { opacity: 1; }
}

.window-pin {
  height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.window-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.window-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

/* legibility scrim behind the chapter title */
.window-frame::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 52%;
  background: linear-gradient(180deg, transparent, rgba(24, 20, 10, 0.55));
  pointer-events: none;
}

.window-title {
  position: absolute;
  left: clamp(1.25rem, 6vw, 5rem);
  bottom: clamp(2.5rem, 9vh, 6rem);
  z-index: 2;
  max-width: 34rem;
}

.chapter-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #ffe9bd;
  margin-bottom: 0.9rem;
}

.window-title h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1;
  color: #fff8ea;
  text-shadow: 0 2px 30px rgba(20, 16, 8, 0.45);
}

.window-title p {
  margin-top: 0.8rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  color: #ffeecd;
}

/* ==================== CHAPTER I ENTRIES : the footpath ==================== */

.entries {
  position: relative;
  isolation: isolate;
}

.entries-home {
  background: linear-gradient(180deg, var(--paper) 0%, var(--gold-wash) 100%);
  padding: clamp(6rem, 12vh, 10rem) 1.5rem clamp(7rem, 14vh, 11rem);
}

.footpath {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 200px;
  height: 100%;
  transform: translateX(-50%);
  fill: none;
  stroke: #b98d4f;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 2 16;
  opacity: 0.5;
  z-index: -1;
}

.path-list {
  list-style: none;
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(3rem, 8vh, 5.5rem);
}

.path-list li { display: flex; }
.path-list li:nth-child(odd)  { justify-content: flex-start; }
.path-list li:nth-child(even) { justify-content: flex-end; }

/* a postcard pinned beside the road */
.postcard {
  position: relative;
  display: flex;
  gap: 1.15rem;
  width: min(480px, 100%);
  padding: 1.1rem;
  background: var(--paper-card);
  border: 1px solid var(--paper-line);
  border-radius: var(--r-card);
  box-shadow: 0 22px 44px -20px rgba(122, 90, 38, 0.38);
  cursor: pointer;
  text-align: left;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
}
.path-list li:nth-child(odd)  .postcard { transform: rotate(-1.3deg); }
.path-list li:nth-child(even) .postcard { transform: rotate(1.1deg); }
.postcard:hover {
  transform: rotate(0deg) translateY(-5px);
  box-shadow: 0 30px 54px -22px rgba(122, 90, 38, 0.48);
}

.postcard .poster {
  width: 92px;
  height: 130px;
  flex: none;
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid #f0e3c2;
}

.postcard-body { min-width: 0; padding-right: 2rem; }

.entry-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.15;
  color: var(--ink);
}

.entry-meta {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.entry-note {
  margin-top: 0.6rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.08rem;
  line-height: 1.45;
  color: #5c5340;
  white-space: pre-line;
}

/* festival tickets stay compact; the full note lives in the editor */
.stall .entry-note {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* the wax-stamp score seal */
.seal {
  position: absolute;
  top: -16px;
  right: -12px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f9eed4, #f0dfb8);
  border: 2px solid var(--accent);
  transform: rotate(-8deg);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent-deep);
  box-shadow: 0 6px 14px -6px rgba(122, 80, 24, 0.5);
}
.seal::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px dashed rgba(163, 97, 28, 0.55);
}

.seal.seal-ten {
  background: radial-gradient(circle at 35% 30%, #f7df9d, #ecc766);
  border-color: #a67717;
  color: #6d4c0a;
}

/* ==================== CHAPTER II ENTRIES : the waymarkers ==================== */

.entries-road {
  background: linear-gradient(180deg, #e9eee3 0%, var(--sage-wash) 55%, #dfe6da 100%);
  padding: clamp(6rem, 12vh, 10rem) 1.5rem clamp(7rem, 14vh, 11rem);
}

.ledger {
  list-style: none;
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.waymarker {
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 1.25rem;
  align-items: center;
  width: 100%;
  padding: 1rem 1.5rem 1rem 1.25rem;
  background: linear-gradient(135deg, #f6f8f2, #ecf1e6);
  border: 1px solid var(--sage-line);
  border-radius: var(--r-card);
  box-shadow: 0 16px 34px -18px rgba(84, 104, 72, 0.35);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
}
.waymarker::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #8aa87b, #b9cba9);
}
.waymarker:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 44px -20px rgba(84, 104, 72, 0.45);
}

.waymarker .poster {
  width: 76px;
  height: 106px;
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid #e3ead9;
}

.waymarker .seal {
  position: static;
  transform: rotate(-6deg);
  width: 54px;
  height: 54px;
  font-size: 1.2rem;
}

/* ==================== CHAPTER III ENTRIES : festival night ====================
   The page ends here, under the lanterns. */

.entries-festival {
  overflow: hidden;
  background: linear-gradient(180deg, #4a3a5e 0%, #322a4d 45%, #201b38 100%);
  padding: clamp(6rem, 12vh, 10rem) 1.5rem 3rem;
}

/* warm spill from the festival street above */
.entries-festival::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 14vh;
  background: linear-gradient(180deg, rgba(150, 108, 88, 0.4), transparent);
  pointer-events: none;
}

.entries-festival > .festival,
.entries-festival > .afterglow,
.entries-festival > .footer,
.entries-festival > .empty-state {
  position: relative;
  z-index: 2;
}

/* sakura drifting down the whole section */
.petals {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.petal {
  position: absolute;
  top: -5vh;
  left: var(--px, 50%);
  width: 9px;
  height: 7px;
  background: #f2bccb;
  border-radius: 62% 38% 55% 45%;
  opacity: 0;
  animation: petal-fall var(--dur, 13s) linear infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes petal-fall {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  6%   { opacity: 0.85; }
  80%  { opacity: 0.7; }
  100% { transform: translate3d(var(--drift, 50px), 106vh, 0) rotate(560deg); opacity: 0; }
}

.festival {
  list-style: none;
  max-width: 880px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
}

/* a festival stall ticket, glowing like lantern paper against the night */
.stall {
  position: relative;
  display: flex;
  gap: 1rem;
  align-items: center;
  width: 100%;
  padding: 0.9rem 1.1rem;
  background: #fdf3e2;
  border: 1px solid #dcbb8d;
  border-radius: var(--r-card);
  box-shadow:
    0 0 34px -8px rgba(255, 186, 100, 0.4),
    0 18px 34px -18px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  text-align: left;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
}
.stall::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  border-radius: var(--r-card) var(--r-card) 0 0;
  background: linear-gradient(90deg, #e59aae, #f2cf9b);
}
.stall:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 46px -6px rgba(255, 196, 110, 0.55),
    0 24px 40px -18px rgba(0, 0, 0, 0.6);
}

.stall .poster {
  width: 60px;
  height: 84px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
  border: 3px solid #f2ded4;
}

.stall .entry-title { font-size: 1.2rem; }

.stall .seal {
  position: static;
  flex: none;
  margin-left: auto;
  transform: rotate(-6deg);
  width: 48px;
  height: 48px;
  font-size: 1.05rem;
}

/* ==================== AFTERGLOW : backlog + stats, under the lanterns ==================== */

.afterglow {
  max-width: 900px;
  margin: clamp(5rem, 10vh, 8rem) auto 0;
  text-align: center;
}

.later-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: #cbb7d6;
  margin-bottom: 1.6rem;
}

.lanterns {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.1rem;
}

.lantern {
  border: 1px solid rgba(255, 214, 140, 0.3);
  border-radius: 999px;
  padding: 0.68rem 1.35rem;
  background: rgba(255, 214, 140, 0.07);
  color: #f4e5bf;
  font-size: 0.95rem;
  cursor: pointer;
  animation: bob 7s ease-in-out infinite alternate;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.lantern:hover {
  background: rgba(255, 214, 140, 0.16);
  box-shadow: 0 0 24px -4px rgba(255, 217, 122, 0.35);
}
@keyframes bob {
  from { transform: translateY(0); }
  to   { transform: translateY(-7px); }
}

.stats {
  display: flex;
  justify-content: center;
  gap: clamp(2rem, 7vw, 4.5rem);
  margin-top: clamp(4rem, 9vh, 6.5rem);
  flex-wrap: wrap;
}

.stat { display: flex; flex-direction: column; gap: 0.3rem; }

.stat-num {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  color: #f2e2b6;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #99a3c2;
}

.footer {
  position: relative;
  z-index: 2;
  margin-top: clamp(5rem, 12vh, 8rem);
  padding: 0 1.5rem 3rem;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: #a3adcb;
}

.footer-quiet {
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.8rem;
  color: #7f89a9;
}

.ledger-tools {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn-dusk {
  background: transparent;
  border: 1px solid rgba(255, 214, 140, 0.35);
  color: #f4e5bf;
}
.btn-dusk:hover { background: rgba(255, 214, 140, 0.12); }

.tools-hint {
  margin-top: 0.7rem;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.8rem;
  color: #c9b8e0;
  min-height: 1.2em;
}

/* ==================== EMPTY STATES ==================== */

.empty-state {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.empty-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.empty-dusk .empty-line { color: #cfc3e2; }

/* ==================== THE JOURNAL OVERLAY ==================== */

.journal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.journal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(18, 14, 6, 0.55);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.journal-page {
  position: relative;
  width: min(620px, 100%);
  max-height: 92dvh;
  overflow-y: auto;
  background: linear-gradient(160deg, #fbf6ea, #f4ecd9);
  border: 1px solid #e2d3ae;
  border-radius: 20px;
  box-shadow: 0 44px 90px -28px rgba(20, 14, 4, 0.55);
  padding: 1.7rem 2rem 2.1rem;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.3s ease, transform 0.35s var(--ease-out);
}
.journal.open .journal-page {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.journal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}

.journal-head h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.7rem;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.55rem;
}
.field-label em {
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
}

.search-wrap { position: relative; }
.search-wrap i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--ink-soft);
}

#searchInput, #noteInput {
  width: 100%;
  border: 1px solid #d8c69c;
  border-radius: 12px;
  background: var(--paper-card);
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
}
#searchInput {
  height: 52px;
  padding: 0 1rem 0 46px;
}
#noteInput {
  min-height: 120px;
  padding: 0.75rem 1rem;
  line-height: 1.55;
  resize: vertical;
}

.note-count {
  margin-top: 0.4rem;
  text-align: right;
  font-size: 0.75rem;
  color: var(--ink-soft);
}
#searchInput::placeholder, #noteInput::placeholder { color: #8a7f68; }
#searchInput:focus, #noteInput:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.field-hint {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.field-hint.is-error { color: #8f3f27; font-weight: 600; }

.results {
  list-style: none;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.result-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 0.9rem;
  align-items: center;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}
.result-row:hover { background: #f1e6cc; }

.result-row img {
  width: 44px;
  height: 62px;
  object-fit: cover;
  border-radius: 8px;
}

.result-name {
  font-weight: 600;
  font-size: 0.97rem;
  line-height: 1.25;
  color: var(--ink);
}
.result-sub {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.result-score {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* skeleton shimmer while the archive answers */
.skel {
  height: 62px;
  border-radius: 12px;
  background: linear-gradient(100deg, #efe5cd 40%, #f8f1de 50%, #efe5cd 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer {
  from { background-position: 120% 0; }
  to   { background-position: -80% 0; }
}

/* stage 2 : rating */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  margin-bottom: 1.1rem;
}
.back-link:hover { color: var(--ink); }

.chosen {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 1.1rem;
  align-items: center;
  padding: 1rem;
  background: var(--paper-card);
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  margin-bottom: 1.6rem;
}
.chosen img {
  width: 84px;
  height: 118px;
  object-fit: cover;
  border-radius: 10px;
}
.chosen .entry-title { font-size: 1.35rem; }

.rate-block { margin-bottom: 1.3rem; }

.rate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}
.rate-row .field-label { margin-bottom: 0; }

.seal-preview {
  position: static;
  width: 62px;
  height: 62px;
  font-size: 1.45rem;
  flex: none;
}

#scoreRange {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
}

.backlog-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1.4rem;
  font-size: 0.92rem;
  cursor: pointer;
}
.backlog-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.rate-block.is-disabled { opacity: 0.35; pointer-events: none; }

.journal-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1.6rem;
}

/* ==================== SCROLL REVEAL (JS adds .reveal) ==================== */

.reveal {
  opacity: 0;
  translate: 0 28px;
  transition: opacity 0.7s ease, translate 0.7s var(--ease-out);
}
.reveal.in {
  opacity: 1;
  translate: 0 0;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .nav-count { display: none; }

  .footpath { display: none; }

  .path-list li,
  .path-list li:nth-child(odd),
  .path-list li:nth-child(even) { justify-content: center; }

  .postcard { width: 100%; }

  .waymarker {
    grid-template-columns: 64px 1fr;
    padding-right: 1rem;
  }
  .waymarker .poster { width: 64px; height: 90px; }
  .waymarker .seal {
    position: absolute;
    top: -14px;
    right: -8px;
    width: 50px;
    height: 50px;
    font-size: 1.1rem;
  }
  .waymarker { overflow: visible; }

  .festival { grid-template-columns: 1fr; }

  .journal-page { padding: 1.3rem 1.2rem 1.6rem; }
  .chosen { grid-template-columns: 64px 1fr; }
  .chosen img { width: 64px; height: 90px; }
}

/* ==================== REDUCED MOTION ==================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .cloud, .petal, .mote, .lantern, .skel,
  .atmo-mist, .atmo-glow { animation: none; }
  .petal { opacity: 0.5; transform: translate3d(0, 40vh, 0) rotate(90deg); }
  .mote { opacity: 0.4; transform: translate3d(0, -30vh, 0); }
  .atmo-mist { transform: translateX(60%); }

  .reveal {
    opacity: 1;
    translate: 0 0;
    transition: none;
  }

  .btn, .postcard, .waymarker, .journal-page { transition: none; }
}
