/* =============================================================================
   LAYOUT — top bar, hero, ribbons, footer
   ========================================================================== */

/* ---------- Top bar --------------------------------------------------------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  pointer-events: none;
  transform: translateY(-130%);
  transition: transform .8s var(--ease-out) .5s;
}
.topbar.is-shown { transform: none; }
.topbar > * { pointer-events: auto; }

.glass {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 250, 244, .78);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm);
}

.brand {
  padding: 10px 16px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.01em;
  font-variation-settings: "SOFT" 100;
  text-decoration: none;
  white-space: nowrap;
}
.brand span { color: var(--cherry); }

.explored-wrap { position: relative; }
.explored {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: transform .3s var(--ease-spring);
}
.explored:active { transform: scale(.95); }
.explored.is-bump { animation: pop .55s var(--ease-spring); }
.explored-hearts { display: flex; gap: 3px; }
.explored-hearts .icon {
  width: 12px;
  height: 12px;
  color: rgba(73, 52, 61, .16);
  transition: color .4s, transform .5s var(--ease-spring);
}
.explored-hearts .icon.is-on { color: var(--cherry); }
.explored-hearts .icon.is-new { animation: pop .6s var(--ease-spring); }
.explored-label b { font-variant-numeric: tabular-nums; }
.explored-word { color: var(--ink-2); font-weight: 500; }

@media (max-width: 400px) {
  .explored-word { display: none; }
  .brand { padding-inline: 14px; font-size: .95rem; }
  .explored { padding-inline: 12px; gap: 8px; }
  .explored-hearts .icon { width: 10px; height: 10px; }
}

.explored-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(290px, calc(100vw - 2 * var(--gutter)));
  padding: 8px;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  transform-origin: top right;
  animation: pop-in .35s var(--ease-spring);
}
.explored-menu-title {
  padding: 10px 12px 6px;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cherry);
}
.explored-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--ink);
  font-size: .94rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .2s;
}
.explored-menu a:hover { background: var(--cream-deep); }
.explored-menu .icon { width: 16px; height: 16px; color: rgba(73, 52, 61, .18); }
.explored-menu .is-seen .icon { color: var(--cherry); }
.explored-menu .em-num {
  margin-left: auto;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-3);
}

/* ---------- Hero ------------------------------------------------------------ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 110px 0 70px;
  overflow: hidden;
}
.hero-inner { position: relative; z-index: 1; text-align: center; }
.hero-doodles { position: absolute; inset: 0; pointer-events: none; }

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
}
.hero-blob--a {
  width: min(90vw, 760px);
  aspect-ratio: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  background: radial-gradient(closest-side, rgba(247, 221, 226, .9), rgba(247, 221, 226, 0));
}
.hero-blob--b {
  width: min(60vw, 420px);
  aspect-ratio: 1;
  right: -8%;
  bottom: 4%;
  background: radial-gradient(closest-side, rgba(244, 212, 138, .3), rgba(244, 212, 138, 0));
}

/* Hero items wait for the intro curtain, then rise in */
.js .h-anim { opacity: 0; }
.is-entered .h-anim { animation: rise-in 1s var(--ease-out) var(--d, 0s) both; }

.hero-title {
  margin-top: 22px;
  font-family: var(--font-display);
  font-size: clamp(3.3rem, 15vw, 9.4rem);
  font-weight: 600;
  line-height: .9;
  letter-spacing: -.05em;
  font-variation-settings: "SOFT" 100;
}
.hero-line { display: block; }
.hero-title em {
  position: relative;
  display: inline-block;
  font-style: italic;
  font-weight: 400;
  color: var(--cherry);
  padding-right: .05em;
}
.hero-underline {
  position: absolute;
  left: 2%;
  right: 4%;
  bottom: -.12em;
  width: 94%;
  height: .2em;
  overflow: visible;
}
.hero-underline path {
  fill: none;
  stroke: var(--rose);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
}
.is-entered .hero-underline path { animation: draw 1.1s var(--ease-out) 1.2s forwards; }

.hero-heart {
  display: inline-block;
  width: .52em;
  height: .52em;
  margin-left: .06em;
  vertical-align: .08em;
  fill: var(--cherry);
}
.hero-line--2 { position: relative; width: fit-content; margin-inline: auto; }
.is-entered .hero-heart { animation: heartbeat 2.6s ease-in-out 2s infinite; }

.hero-arrow-note {
  position: absolute;
  right: -.2em;
  bottom: -.55em;
  display: none;
  font-family: var(--font-hand);
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink-2);
  transform: rotate(-6deg);
  white-space: nowrap;
}
@media (min-width: 720px) { .hero-arrow-note { display: block; } }

.hero-tagline {
  max-width: 24ch;
  margin: 30px auto 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 4.2vw, 1.6rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.32;
  color: var(--ink-2);
  font-variation-settings: "SOFT" 100;
  text-wrap: balance;
}
.hero-note { margin-top: 18px; max-width: 30ch; font-size: 1.4rem; }

/* Notebook-style table of contents */
.hero-index {
  position: relative;
  width: min(100%, 440px);
  margin: 44px auto 0;
  padding: 26px 22px 14px;
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow-md), inset 0 0 0 1px var(--line);
  text-align: left;
}
.is-entered .hero-index { animation-name: index-in; }
@keyframes index-in {
  from { opacity: 0; transform: translateY(26px) rotate(0); }
  to { opacity: 1; transform: rotate(-1.2deg); }
}
.hero-index-title {
  margin-bottom: 6px;
  font-family: var(--font-hand);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--cherry);
}
.hero-index a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px dashed var(--line-strong);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transition: color .2s, padding .3s var(--ease-out);
}
.hero-index li:first-child a { border-top: 0; }
.hero-index a:hover { color: var(--cherry); padding-left: 6px; }
.idx-num {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--cherry);
  min-width: 1.6em;
}
.idx-name { flex: 0 1 auto; }
.idx-dots {
  flex: 1;
  min-width: 12px;
  border-bottom: 2px dotted var(--line-strong);
  transform: translateY(-4px);
}
.hero-index .icon { width: 16px; height: 16px; transform: translateY(3px); transition: transform .3s var(--ease-spring); }
.hero-index a:hover .icon { transform: translate(4px, 3px); }

.scroll-hint {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 40px;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
}
.scroll-hint .icon { width: 22px; height: 22px; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(6px); } }

/* ---------- Ribbons ---------------------------------------------------------- */
.ribbon-wrap {
  overflow: hidden;
  padding-block: 28px;
}
.ribbon {
  width: 112%;
  margin-left: -6%;
  padding: 14px 0;
  overflow: hidden;
  transform: rotate(-2.2deg);
  box-shadow: var(--shadow-md);
}
.ribbon--cherry { background: var(--cherry); color: var(--cream); }
.ribbon--plum { background: var(--plum); color: var(--cream); transform: rotate(1.8deg); }
.ribbon-track {
  display: flex;
  width: max-content;
  animation: marquee 38s linear infinite;
}
.ribbon--plum .ribbon-track { animation-direction: reverse; animation-duration: 44s; }
.ribbon-item {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  padding-right: 22px;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.4vw, 1.5rem);
  font-style: italic;
  font-weight: 400;
  white-space: nowrap;
  font-variation-settings: "SOFT" 100;
}
.ribbon-item .icon { width: .7em; height: .7em; color: var(--rose); }
.ribbon--plum .ribbon-item .icon { color: var(--butter); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Footer ----------------------------------------------------------- */
.footer {
  padding: 40px 0 calc(110px + env(safe-area-inset-bottom));
  text-align: center;
}
.footer-big {
  display: inline-flex;
  align-items: center;
  gap: .25em;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 9vw, 4rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.03em;
  line-height: 1;
  font-variation-settings: "SOFT" 100;
}
.footer-big .icon { width: .7em; height: .7em; color: var(--cherry); animation: heartbeat 2.6s ease-in-out infinite; }
.footer-note {
  margin-top: 10px;
  font-family: var(--font-hand);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--cherry);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 26px;
  margin-top: 26px;
}
.footer-tiny {
  margin-top: 26px;
  font-size: .8rem;
  color: var(--ink-3);
}
