/* Story Imprint — shared styles. No external fonts or scripts. */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #1f2a36;        /* blue-black ink */
  --rubbing: #6e737b;    /* secondary text, from the grey seal */
  --cinnabar: #c1180d;   /* sampled from the seal */
  --wash: #f1f2f0;       /* footer band */
  --rule: #d9dbdc;
  /* Latin serifs first so curly quotes never fall back to full-width CJK glyphs */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, "DejaVu Serif", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --song: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}
::selection { background: #f5d9d6; }
img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
    text-decoration-color: var(--rubbing); }
a:hover { text-decoration-color: var(--cinnabar); color: var(--cinnabar); }
:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 3px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--gutter); top: 0.5rem; background: var(--paper); padding: 0.25rem 0.5rem; }

/* Header */
.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 1.5rem var(--gutter) 0;
}
.wordmark { font-size: 1.125rem; letter-spacing: 0.01em; text-decoration: none; }
.site-nav { display: flex; gap: 1.5rem; font-size: 1rem; }
.site-nav a { text-decoration: none; color: var(--rubbing); }
.site-nav a:hover { color: var(--cinnabar); }
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline;
  text-decoration-color: var(--cinnabar); }

main { padding: 0 var(--gutter); }

/* Home hero: the title and the seal that gives the studio its name */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem clamp(1.5rem, 5vw, 5rem);
  padding: clamp(4rem, 14vh, 9rem) 0 clamp(3rem, 8vh, 5rem);
  border-bottom: 1px solid var(--rule);
}
.hero h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(3.25rem, 10.5vw, 8.5rem);
  line-height: 0.92;
  letter-spacing: -0.025em;
}
.hero h1 span { display: block; }
.hero h1 span + span { padding-left: 0.62em; }
.tagline {
  margin: 1.75rem 0 0;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  font-style: italic;
  line-height: 1.35;
  color: var(--rubbing);
}
.seal { margin: 0; width: clamp(7.5rem, 20vw, 15rem); }
.seal img { width: 100%; }
.seal figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--rubbing);
}
.seal figcaption span { font-family: var(--song); }

@media (prefers-reduced-motion: no-preference) {
  .seal img { animation: press 900ms cubic-bezier(.2,.7,.2,1) 250ms both; }
  @keyframes press {
    0%   { opacity: 0; transform: scale(1.12) rotate(-2deg); filter: blur(2px); }
    60%  { opacity: 1; transform: scale(0.985) rotate(0deg); filter: blur(0); }
    100% { opacity: 1; transform: scale(1); }
  }
}

/* Home: studio and research side by side, kept visibly separate */
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: clamp(2.5rem, 6vh, 4rem) 0 clamp(4rem, 10vh, 6rem);
}
.split > section { max-width: var(--measure); }
.split > section + section {
  border-left: 1px solid var(--rule);
  padding-left: clamp(1.5rem, 4vw, 3.5rem);
}
.split > section:first-child { padding-right: clamp(1.5rem, 4vw, 3.5rem); }
.split h2 { margin: 0 0 0.25rem; font-size: 1.625rem; font-weight: 400; line-height: 1.25; }
.split .who { margin: 0 0 1.25rem; font-style: italic; color: var(--rubbing); }
.split p { margin: 0 0 1.25rem; }

/* Inner pages */
.page { max-width: 46rem; padding: clamp(3rem, 10vh, 6rem) 0 clamp(4rem, 10vh, 6rem); }
.page h1 {
  margin: 0; font-weight: 400;
  font-size: clamp(2.75rem, 7vw, 4.75rem); line-height: 1; letter-spacing: -0.02em;
}
.page .native { margin: 0.75rem 0 0; font-family: var(--song); font-size: 1.375rem;
  color: var(--rubbing); letter-spacing: 0.1em; }
.lede { margin: 2rem 0 0; font-size: clamp(1.25rem, 2.2vw, 1.5rem); line-height: 1.5;
  max-width: var(--measure); }
.prose { max-width: var(--measure); }
.prose h2 { margin: 3.5rem 0 0.75rem; font-size: 1.5rem; font-weight: 400; line-height: 1.25; }
.prose p { margin: 0 0 1.1rem; }
.prose ul { margin: 0 0 1.1rem; padding-left: 1.1rem; }
.prose li { margin-bottom: 0.5rem; }
.prose li::marker { color: var(--cinnabar); }
.prose .empty { color: var(--rubbing); font-style: italic; }
.zh { font-family: var(--song); }

/* Poster wall on the screenwriting page: one row, as in the studio deck */
.posters {
  list-style: none; margin: 0 0 clamp(4rem, 10vh, 6rem); padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.5rem, 1.2vw, 1rem);
}
.posters img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: var(--wash); }
.posters figure { margin: 0; }
.posters figcaption { margin-top: 0.75rem; font-size: 0.9375rem; line-height: 1.4; }
.posters figcaption .zh { display: block; margin-top: 0.2rem; color: var(--rubbing); font-size: 0.875rem; }
.posters figcaption .credit { display: block; margin-top: 0.35rem; font-size: 0.875rem;
  font-style: italic; color: var(--rubbing); }
.also { max-width: var(--measure); margin: -2rem 0 clamp(4rem, 10vh, 6rem); font-size: 1rem; }
.also > p { margin: 0 0 0.5rem; color: var(--rubbing); }
.also ul { list-style: none; margin: 0; padding: 0; }
.also li { padding: 0.55rem 0; border-top: 1px solid var(--rule); }
.also li:last-child { border-bottom: 1px solid var(--rule); }
.also .zh { color: var(--rubbing); margin-left: 0.4rem; }
.also .credit { display: block; font-size: 0.875rem; font-style: italic; color: var(--rubbing); }
.also.also-page { margin: 3rem 0 0; }

/* Nested units of a script: each box sits inside the one it serves */
.nest { margin: 1.5rem 0 1.75rem; font-size: 0.9375rem; font-style: italic; color: var(--rubbing); }
.nest div { border: 1px solid var(--rule); padding: 0.35rem 0 0.6rem 0.6rem; margin-top: 0.35rem; }
.nest > div { margin-top: 0; padding-right: 0.6rem; }
.nest div div { margin-right: 0.6rem; }
.nest div div div div div { border-color: var(--cinnabar); color: var(--cinnabar);
  padding-bottom: 0.35rem; }

/* Story loop: same box language as .nest; the return arrow carries the accent */
.loop {
  display: grid; grid-template-columns: minmax(0, 1.6fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch; column-gap: 0.5rem;
  margin: 0.9rem 0 1.6rem; font-size: 0.9375rem; font-style: italic; color: var(--rubbing);
}
.loop .box { border: 1px solid var(--rule); padding: 0.35rem 0.6rem; min-width: 0; overflow-wrap: anywhere; }
.loop > .box:not(.situation) { display: flex; align-items: center; }
.loop .situation { padding-bottom: 0.6rem; }
.loop .situation .box { margin-top: 0.35rem; }
.loop .arrow { font-style: normal; align-self: center; }
/* Return path: down from result, along the bottom, up into situation */
.loop .back-start, .loop .back-mid, .loop .back-end {
  height: 1.4rem; align-self: start; border-bottom: 1px solid var(--cinnabar);
}
.loop .back-start { grid-column: 1; margin-left: 50%; border-left: 1px solid var(--cinnabar); position: relative; }
.loop .back-start::before {     /* arrowhead pointing up into situation */
  content: ""; position: absolute; left: -6px; top: -2px;
  border: 5.5px solid transparent; border-bottom: 8px solid var(--cinnabar); border-top: 0;
}
.loop .back-mid { grid-column: 2 / 5; margin: 0 -0.5rem; position: relative; }
.loop .back-mid span {
  position: absolute; left: 50%; bottom: -0.75em; transform: translateX(-50%);
  padding: 0 0.4rem; background: var(--paper); color: var(--cinnabar); white-space: nowrap;
}
.loop .back-end { grid-column: 5; margin-right: 50%; border-right: 1px solid var(--cinnabar); }

/* Contact lines on the personal page */
.contact { list-style: none; margin: 2rem 0 0; padding: 0; }
.contact li { margin: 0 0 0.35rem; }
.contact .k { display: inline-block; min-width: 4.5rem; color: var(--rubbing); }

/* Research page: two strands of work */
.strand { margin-top: 3.5rem; }
.strand h2 { margin: 0 0 0.25rem; }
.strand .status { margin: 0 0 1rem; font-style: italic; color: var(--rubbing); }
.topics { list-style: none; padding: 0; margin: 0 0 1.1rem; }
.topics li { padding: 0.55rem 0; border-bottom: 1px solid var(--rule); margin: 0; }
.topics li:first-child { border-top: 1px solid var(--rule); }
.people { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

.back { margin-top: 4rem; font-size: 1rem; }

/* Review-draft markers. Delete .review notes and .pending classes before publishing. */
.review {
  margin: 0; padding: 0.5rem var(--gutter);
  background: #fbeceb; color: var(--cinnabar); font-size: 0.875rem;
}
/* The red bar sits outside the text column, so marked text stays aligned with the rest */
.pending { position: relative; }
.pending::before { content: ""; position: absolute; top: 0; bottom: 0; left: -0.9rem;
  width: 3px; background: var(--cinnabar); }
.prose .topics { padding-left: 0; }

/* Footer */
.site-footer {
  background: var(--wash);
  padding: 2rem var(--gutter) 2.5rem;
  font-size: 0.9375rem; line-height: 1.55; color: var(--rubbing);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem;
}
.site-footer p { margin: 0; }
.site-footer .zh { color: var(--ink); }

@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  .hero { grid-template-columns: 1fr; padding-top: 2.5rem; }

  .seal { order: -1; }
  .hero h1 span + span { padding-left: 0.4em; }
  .seal { display: flex; align-items: flex-end; gap: 0.75rem; width: auto; justify-self: start; }
  .seal img { width: 5.5rem; }
  .seal figcaption { margin: 0; max-width: 11rem; }
  .posters {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter);
  }
  .posters li { flex: 0 0 62%; scroll-snap-align: start; }
  .split { grid-template-columns: 1fr; }
  .split > section:first-child { padding-right: 0; padding-bottom: 2rem; }
  .split > section + section { border-left: 0; padding-left: 0;
    border-top: 1px solid var(--rule); padding-top: 2rem; }
}
