/* Tavi & Nori website. Their living room at night: an evening plum ground, cream ink, and two
   colours spent only on the two of them, Tavi's lavender and Nori's cinnamon. */

@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("/assets/fonts/fredoka-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("/assets/fonts/fredoka-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ground: #15111c;
  --ground-lit: #221a2c;
  --surface: #1e1828;
  --hairline: #352b42;
  --ink: #f6efe4;
  --muted: #c9bfd2;
  --faint: #a499b0;
  --tavi: #a994d6;
  --nori: #c9773f;
  --lamp: #f2b45a;

  --display: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  --gutter: clamp(2.5rem, 1rem + 5vw, 7rem);
  --measure: 34rem;
  --chapter: clamp(5rem, 3rem + 7vw, 10rem);
  --radius-frame: clamp(22px, 1rem + 1.5vw, 34px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
  accent-color: var(--tavi);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--ground);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--hairline) var(--ground);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
cite { font-style: normal; color: var(--ink); }

::selection { background: var(--tavi); color: var(--ground); }

a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--tavi) 70%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.2s, color 0.2s;
}
a:hover { text-decoration-color: var(--nori); }

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--ground);
  border-radius: 999px;
}
.skip:focus { top: 1rem; }

/* ---------- Header and footer ---------- */

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  padding: 1.25rem var(--gutter);
}

.mark { width: 2.1em; height: 1.26em; flex: none; }
.mark-tavi { fill: var(--tavi); }
.mark-nori { fill: var(--nori); mix-blend-mode: screen; }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font: 600 1.35rem/1 var(--display);
  text-decoration: none;
}

.site-header nav,
.site-footer nav { display: flex; align-items: center; gap: 0.35rem 1.4rem; flex-wrap: wrap; }
.site-header nav a,
.site-footer nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  padding-block: 0.4rem;
}
.site-header nav a:hover,
.site-footer nav a:hover,
.site-footer nav a[aria-current] { color: var(--ink); }
.site-header .lang-switch {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
}
.site-header .lang-switch:hover { border-color: var(--faint); }

.site-footer {
  border-top: 1px solid var(--hairline);
  margin-top: var(--chapter);
  padding-block: 2rem 2.5rem;
  color: var(--faint);
  font-size: 0.9375rem;
}
.footer-sign { display: flex; align-items: center; gap: 0.75rem; }

/* ---------- Home: the threads ---------- */

.threads { position: relative; }
.threads > .band {
  position: relative;
  z-index: 1;
  padding-inline: max(var(--gutter), (100% - 76rem) / 2);
}
.threads-svg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
  display: none;
}
.has-threads .threads-svg { display: block; }

.thread,
.thread-wake { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.thread { stroke-width: 2.5; }
.thread-wake { stroke-width: 1.5; opacity: 0.16; }
.thread--tavi, .thread-wake--tavi { stroke: var(--tavi); }
.thread--nori, .thread-wake--nori { stroke: var(--nori); }

.node .node-fill,
.node .node-tavi,
.node .node-nori { transition: fill 0.5s var(--ease-out), transform 0.5s var(--ease-out); }
.node--t .node-fill { fill: var(--ground); stroke: var(--tavi); stroke-width: 2; }
.node--n .node-fill { fill: var(--ground); stroke: var(--nori); stroke-width: 2; }
.node--tn .node-tavi,
.node--tn .node-nori { fill: var(--ground); }
.node--tn .node-ring { fill: none; stroke: var(--ink); stroke-opacity: 0.5; stroke-width: 1.5; }
.node.is-lit.node--t .node-fill { fill: var(--tavi); }
.node.is-lit.node--n .node-fill { fill: var(--nori); }
.node.is-lit .node-tavi { fill: var(--tavi); }
.node.is-lit .node-nori { fill: var(--nori); }
.node.is-lit .node-ring { stroke-opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .node .node-fill,
  .node .node-tavi,
  .node .node-nori { transition: none; }
}

.anchor { display: inline-block; width: 0; height: 0; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  gap: 2.5rem;
  padding-block: clamp(2rem, 1rem + 4vw, 4.5rem) var(--chapter);
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.6rem, 1.3rem + 4.2vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
}
/* Each sentence its own line, so a narrow screen never strands "Two" on a line by itself. */
.hero h1 span { display: block; }
.lede {
  margin-top: 1.4rem;
  max-width: var(--measure);
  font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.3rem);
  line-height: 1.55;
  color: var(--muted);
}

.cast {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: flex;
  gap: 1.75rem;
  font: 600 1.35rem/1 var(--display);
}
.cast a { text-decoration: none; display: inline-flex; align-items: center; gap: 0.6rem; padding-block: 0.3rem; }
.cast a::before { content: ""; width: 0.8rem; height: 0.8rem; border-radius: 50%; }
.cast-tavi a::before { background: var(--tavi); }
.cast-nori a::before { background: var(--nori); }
.cast a:hover { color: var(--muted); }

.hero-figure {
  position: relative;
  margin: 0 auto;
  width: min(72vw, 21.25rem, calc((100dvh - 9rem) * 0.5));
  min-width: 15rem;
}
/* One warm lamp behind the frame: the only light in the room. */
.hero-figure::before {
  content: "";
  position: absolute;
  inset: -16% -75% -4%;
  z-index: -1;
  /* The frame covers the core, so the warm stops sit far enough out to show around its edges. */
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--lamp) 34%, var(--ground-lit)) 0 32%,
    color-mix(in srgb, var(--lamp) 16%, var(--ground-lit)) 52%,
    var(--ground-lit) 70%,
    transparent 100%);
  pointer-events: none;
}
.hero-figure figcaption {
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--faint);
  text-align: center;
}
.anchor--exit-left,
.anchor--exit-right { position: absolute; top: 42%; }
.anchor--exit-left { left: 0; }
.anchor--exit-right { right: 0; }

/* On a phone the picture comes straight after the headline, so both share the first screen;
   the lede and the names follow it. */
@media (max-width: 55.99rem) {
  .hero { gap: 1.75rem; }
  .hero-text { display: contents; }
  .hero h1 { order: 1; }
  .hero-figure { order: 2; width: min(66vw, 21.25rem, calc((100dvh - 20rem) * 0.5625)); }
  .hero .lede { order: 3; margin-top: 0.5rem; }
  .hero .cast { order: 4; margin-top: 0; }
}

@media (min-width: 56rem) {
  .hero { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 3rem; }
  .hero-figure { margin-inline: auto 3rem; }
}

/* ---------- Frames ---------- */

.frame-screen {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-frame);
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1.75rem 3.5rem -1.5rem rgb(0 0 0 / 0.75), 0 0 0 1px rgb(255 255 255 / 0.07);
}
.frame-screen img,
.frame-screen video { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The frame's own surface shows until the poster arrives. */
.frame-screen video { background: var(--surface); }

/* The screen a film hasn't reached yet: the frame is there, lit faintly from where the two
   threads meet, and empty. */
.frame--empty .frame-screen {
  background:
    radial-gradient(70% 45% at 50% 58%, color-mix(in srgb, var(--tavi) 16%, transparent), transparent 70%),
    radial-gradient(60% 40% at 52% 62%, color-mix(in srgb, var(--nori) 14%, transparent), transparent 70%),
    var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--hairline);
}

/* ---------- Who's who ---------- */

.two { padding-block: 0 var(--chapter); }
.two h2,
.episodes-head h2,
.sheets h2 {
  font-size: clamp(2rem, 1.3rem + 2.4vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
}
.pair {
  display: grid;
  gap: 3.5rem;
  margin-top: 2.5rem;
}
.person { margin: 0; position: relative; }
.person .anchor { position: absolute; top: 30%; }
.person img {
  width: min(100%, 22rem);
  border-radius: var(--radius-frame);
  background: #dcd7d2;
}
.person figcaption { margin-top: 1.5rem; max-width: var(--measure); }
.person h3 { font-size: 2.25rem; line-height: 1; display: flex; align-items: center; gap: 0.75rem; }
.person h3::before { content: ""; width: 0.6em; height: 0.6em; border-radius: 50%; }
.person--tavi h3::before { background: var(--tavi); }
.person--nori h3::before { background: var(--nori); }
.person-look { margin-top: 0.75rem; color: var(--ink); }

@media (min-width: 48rem) {
  .pair { grid-template-columns: 1fr 1fr; gap: clamp(2rem, 4vw, 5rem); }
  .person--nori { margin-top: 6rem; }
}

/* ---------- Episodes ---------- */

.episodes { padding-block: 0 calc(var(--chapter) * 0.6); }
.episodes-head { max-width: 40rem; }
.episode-list {
  display: grid;
  gap: 3.5rem;
  margin-top: clamp(2.5rem, 1.5rem + 3vw, 4rem);
}
.episode { display: grid; gap: 1.5rem; align-content: start; }
.episode .frame { width: min(72vw, 20rem); }
.episode h3 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.4rem); line-height: 1.05; }
.episode-place { margin-top: 0.4rem; font-size: 0.875rem; color: var(--faint); }
.episode-setup,
.episode-ending { margin-top: 0.9rem; max-width: 26rem; }
.episode-setup { color: var(--muted); }
.episode-ending { color: var(--ink); font-weight: 500; position: relative; }
/* Where the threads meet: in the gutter on a phone, in the gap between still and text wider up. */
.anchor--meet { position: absolute; left: -1.25rem; top: 0.8em; }
.episode-status {
  display: inline-block;
  margin-top: 1.1rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--muted);
}

/* On a phone the empty screen shrinks to a thumbnail beside its line, so it doesn't cost a
   whole screen of scrolling. */
.episode--next { grid-template-columns: 5.5rem minmax(0, 1fr); align-items: center; gap: 1.25rem; }
.episode--next .frame { width: 100%; }
.episode--next .frame-screen { border-radius: 14px; }

@media (min-width: 48rem) {
  .episode-list { grid-template-columns: minmax(0, 1fr) minmax(0, 13rem); gap: clamp(3rem, 6vw, 6rem); align-items: end; }
  /* Episodes stack in the wide column; the empty "next" screen takes the narrow one beside the
     last episode (sparse auto-placement puts it in that episode's row). */
  .episode:not(.episode--next) { grid-column: 1; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); column-gap: 4rem; align-items: center; }
  .episode--next { grid-column: 2; }
  .episode .frame { width: 100%; }
  .anchor--meet { left: -2rem; }
  .episode--next { grid-template-columns: none; align-items: start; gap: 1.5rem; }
  .episode--next .frame { opacity: 0.85; }
  .episode--next .frame-screen { border-radius: var(--radius-frame); }
}

/* ---------- Sheets ---------- */

.sheets { padding-block: var(--chapter) 0; }
.sheets-intro { margin-top: 1.25rem; max-width: var(--measure); color: var(--muted); }
.sheet-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
.sheet { margin: 0; }
.sheet img { width: 100%; border-radius: 18px; }
.sheet figcaption { margin-top: 0.6rem; font-size: 0.875rem; color: var(--faint); }

@media (min-width: 56rem) {
  .sheet-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
  .sheet--room { grid-column: 1 / -1; }
}


/* ---------- Language entry point and 404 ---------- */

.chooser,
.not-found {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.25rem;
  padding: var(--gutter);
  text-align: center;
}
.chooser-mark .mark { width: 4.5rem; height: 2.7rem; }
.chooser h1 { font-size: clamp(2.6rem, 2rem + 3vw, 4rem); }
.chooser-links { display: flex; gap: 1rem; }
.chooser-links a {
  text-decoration: none;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
}
.chooser-links a:hover { border-color: var(--tavi); }
.not-found-pair { display: grid; gap: 2.5rem; max-width: 52rem; }
.not-found h1,
.not-found h2 { font-size: clamp(1.8rem, 1.4rem + 2vw, 2.8rem); line-height: 1.05; }
.not-found p { margin-top: 0.8rem; color: var(--muted); }
@media (min-width: 48rem) { .not-found-pair { grid-template-columns: 1fr 1fr; text-align: left; } }
