/* Ren — one object, light, paper, and one ribbon of jade silk that the mark pours into and gathers back from. */
@font-face {
  font-family: "Source Serif 4";
  src: url("assets/fonts/SourceSerif4-variable-latin.woff2") format("woff2-variations"), url("assets/fonts/SourceSerif4-variable-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-stretch: normal;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f6f1e6;
  --ink: #2e4038;
  --jade: #2e8b57;
  --jade-deep: #0d6642;
  --quiet: #7a817b;
  --wordmark-cap: 18px;
  --face: "Source Serif 4", ui-serif, serif;
  --quiet-ink: #5c665f;
  --edge-x: clamp(22px, 3.3vw, 48px);
  --edge-y: clamp(22px, 3vw, 44px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--face); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--jade); outline-offset: 6px; border-radius: 2px; }

/* The resting hero is unchanged. */
.runway { position: relative; height: auto; }
.hero {
  position: relative; top: 0; touch-action: pan-y;
  height: 100vh; height: 100dvh;
  isolation: isolate; background: transparent;
}
html.reduced .runway { height: auto; }
html.reduced .hero { position: relative; }
#light { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.6s cubic-bezier(.16, 1, .3, 1); }
#light.ready { opacity: var(--story-canvas-o, 1); }
#light.story-controlled { transition-duration: .22s; }

/* No-WebGL fallback uses a baked frame of the same hero. */
.fallback { position: absolute; inset: 0; display: grid; place-items: center; background: var(--paper) url("assets/ren-light-still.jpg") center / cover no-repeat; }
.fallback[hidden] { display: none; }
.fallback-stage { position: relative; height: clamp(148px, 36vh, 440px); max-height: calc(52vw * .96); aspect-ratio: 930 / 893; transform: translate(-3.4%, -2.8vh); }
.fallback-stage::after { content: ""; position: absolute; left: 50%; top: 100%; width: 116%; height: 52%; transform: translate(-46%, -41%); border-radius: 50%; mix-blend-mode: lighten; pointer-events: none; background: radial-gradient(closest-side, rgba(238, 252, 228, .95), rgba(238, 252, 228, 0)); }
.fallback-mark { position: relative; width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(70, 60, 40, .16)); }

.top { position: fixed; left: var(--edge-x); top: var(--edge-y); z-index: 5; display: flex; align-items: center; }
.top::before { content: ""; position: fixed; left: 0; right: 0; top: 0; height: 120px; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .6s ease; background: linear-gradient(to bottom, var(--paper) 0%, var(--paper) 45%, rgba(246, 241, 230, 0) 100%); }
.top.over-page::before { opacity: 1; }
.wm-glyph.pending { opacity: 0; }
.wordmark { display: inline-flex; align-items: center; gap: .42em; color: var(--ink); text-decoration: none; font-family: var(--face); font-weight: 400; letter-spacing: .09em; line-height: 1; font-size: var(--wm-size, 26px); animation: settle 1.3s cubic-bezier(.16, 1, .3, 1) 1.9s both; }
.wm-text { display: block; transform: translateY(.02em); }
.wm-glyph { display: block; height: calc(var(--wordmark-cap) * 1.18); width: auto; fill: var(--jade); margin-left: .02em; }
.wordmark:hover { color: var(--jade-deep); transition: color .5s ease; }

.copy { position: absolute; left: 50%; top: 74vh; transform: translateX(-50%); width: min(92vw, 640px); will-change: opacity, transform; text-align: center; z-index: 2; pointer-events: none; }
.copy > * { pointer-events: auto; }
.line { margin: 0; font-family: var(--face); font-weight: 400; font-size: 40px; line-height: 1.15; letter-spacing: -.004em; color: var(--ink); font-variation-settings: "opsz" 60; animation: settle 1.4s cubic-bezier(.16, 1, .3, 1) 2s both; }
.belief { margin: 14px auto 0; max-width: 34em; font-family: var(--face); font-size: 16px; line-height: 1.5; color: var(--quiet-ink); font-variation-settings: "opsz" 16; animation: settle 1.4s cubic-bezier(.16, 1, .3, 1) 2.25s both; }
.cta { display: inline-block; margin-top: 26px; padding-bottom: 5px; font-family: var(--face); font-size: 15px; letter-spacing: .01em; color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(46, 139, 87, .55); transition: border-color .4s ease, color .4s ease; animation: settle 1.4s cubic-bezier(.16, 1, .3, 1) 2.5s both; }
.cta:hover { color: var(--jade-deep); border-color: var(--jade-deep); }
.motion { position: fixed; right: calc(var(--edge-x) - 14px); bottom: calc(var(--edge-y) - 14px); z-index: 6; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--quiet); display: grid; place-items: center; cursor: pointer; opacity: .55; transition: opacity .4s ease, color .4s ease; animation: settle 1.2s cubic-bezier(.16, 1, .3, 1) 3s both; }
.motion[hidden] { display: none; }
.motion:hover, .motion:focus-visible { opacity: 1; color: var(--jade-deep); }
.motion svg { fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.motion[aria-pressed="true"] svg { fill: currentColor; stroke: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes settle { from { opacity: 0; filter: blur(8px); transform: translateY(6px); } to { opacity: 1; filter: blur(0); transform: none; } }

/* Portraits belong to the hero only. */
.person { position: absolute; left: 0; top: 0; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; overflow: hidden; pointer-events: none; z-index: 3; opacity: 0; transform: scale(.6); transition: opacity .35s cubic-bezier(.16, 1, .3, 1), transform .5s cubic-bezier(.16, 1, .3, 1); filter: drop-shadow(0 4px 6px rgba(46, 64, 56, .10)); }
.person.on { opacity: 1; transform: scale(1); }
.person.card-face { background: var(--ink); -webkit-mask-image: radial-gradient(circle closest-side, #000 76%, transparent 100%); mask-image: radial-gradient(circle closest-side, #000 76%, transparent 100%); }
.person-face { position: absolute; inset: 0; background-repeat: no-repeat; mix-blend-mode: screen; filter: contrast(.42) brightness(1.34); }
.person.card-face::after { content: ""; position: absolute; inset: 0; background: var(--paper); mix-blend-mode: multiply; }
.person.card-text { width: auto; height: auto; margin: -14px 0 0 12px; border-radius: 0; background: transparent; overflow: visible; filter: none; transform: translateY(4px); }
.person.card-text.on { transform: none; }
.person.card-text .person-face, .person.card-face .person-text { display: none; }
.person-text { font-family: var(--face); font-size: 15px; line-height: 1.3; color: var(--ink); white-space: nowrap; letter-spacing: .01em; font-variation-settings: "opsz" 15; }

/* The page: words in the upper middle of the frame, the silk along its foot. The canvas is the ground
   under all of it, so the sections are transparent. */
.page { position: relative; z-index: 3; margin-top: 0; background: transparent; }

.chapter { position: relative; z-index: 2; min-height: 100vh; min-height: 100svh; display: grid; align-content: center; justify-items: center; padding: 0 var(--edge-x) 16vh; text-align: center; }
.chapter-index { margin: 0 0 20px; color: var(--jade-deep); font: 500 11px/1.2 var(--face); letter-spacing: .16em; }
.words { max-width: 30em; margin: 0 auto; }
.words h2 { margin: 0 0 18px; font: 400 30px/1.22 var(--face); font-variation-settings: "opsz" 40; letter-spacing: -.004em; }
.words p { margin: 0 auto; font: 400 17px/1.55 var(--face); color: var(--quiet-ink); max-width: 30em; }
/* With the script running, words are seen only while they stand clear of the silk: they arrive once
   they have risen above it and leave before the next arrive (hero.js, chapters). Without it they simply read. */
html.js .chapter > * { will-change: opacity, transform; }

/* Without WebGL the cloth is a baked still along the foot of each chapter, and the close has the baked mark. */
html.no-gl .chapter:not(.close)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 3vh; height: 41vh; pointer-events: none; z-index: -1;
  background: url("assets/silk-band.jpg") center / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent); }
html.no-gl .chapter#field::after { transform: scaleX(-1); }
html.no-gl .chapter#role::after { background-position: 22% center; }
html.no-gl .close::before { width: 150px; background: url("assets/ren-mark-jade.jpg") center top / auto clamp(92px, 15vh, 150px) no-repeat; mix-blend-mode: multiply; }

/* The close: the mark the silk gathers into, the line it opened with, and the brief. */
.close { min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: 1fr auto auto auto 1.2fr; justify-items: center; padding: 0 var(--edge-x); }
/* Room for the mark the cloth gathers into (hero.js, closeMark: the same height and the same gap). */
.close::before { content: ""; grid-row: 2; height: calc(clamp(92px, 15vh, 150px) + clamp(30px, 5.4vh, 58px)); }
.close-copy { grid-row: 3; text-align: center; }
.close h2 { margin: 0; font: 400 40px/1.15 var(--face); font-variation-settings: "opsz" 60; letter-spacing: -.004em; color: var(--ink); }
.brief { grid-row: 4; width: 100%; max-width: 900px; margin-top: 46px; text-align: center; }
.close .cta { animation: none; }
.brief-line { font-family: var(--face); font-weight: 400; font-size: 30px; line-height: 1.55; letter-spacing: -.004em; color: var(--ink); margin: 0; font-variation-settings: "opsz" 32; }
.blank { position: relative; display: inline-block; vertical-align: baseline; margin: 0; }
.blank input { font: inherit; letter-spacing: inherit; color: var(--jade-deep); background: transparent; border: 0; border-bottom: 1px solid rgba(46, 139, 87, .42); border-radius: 0; padding: 0; margin: 0; min-width: 3ch; max-width: 100%; outline: none; caret-color: var(--jade); box-shadow: none; -webkit-appearance: none; appearance: none; transition: border-color .35s ease; }
.blank input::placeholder { color: var(--quiet-ink); opacity: .58; }
.blank input:focus { border-bottom-color: var(--jade); }
.blank input:focus-visible { border-bottom-width: 2px; margin-bottom: -1px; }
.blank input:not(:placeholder-shown) { border-bottom-color: rgba(46, 139, 87, .8); }
.blank.missing input { border-bottom-color: var(--ink); }
.blank i { position: absolute; left: 0; top: 0; visibility: hidden; white-space: pre; font: inherit; letter-spacing: inherit; padding: 0; pointer-events: none; }
.brief-note { font-family: var(--face); font-size: 15px; line-height: 1.55; color: var(--quiet-ink); margin: 26px auto 0; max-width: 520px; font-variation-settings: "opsz" 15; transition: color .3s ease; }
.brief.missing .brief-note { color: var(--ink); }
.brief-go { border-top: 0; border-left: 0; border-right: 0; background: transparent; cursor: pointer; margin-top: 30px; padding: 0 0 5px; border-radius: 0; }
.brief.complete .brief-go { color: var(--jade-deep); border-bottom-color: var(--jade-deep); }
.brief-go:focus-visible { outline: 2px solid var(--jade); outline-offset: 6px; }

@media (max-width: 640px) {
  :root { --wordmark-cap: 16px; }
  .copy { top: 70vh; }
  .line { font-size: 30px; }
  .belief { font-size: 15px; }
  .chapter { padding: 0 18px 18vh; }
  .words { max-width: none; }
  .words h2 { font-size: 27px; }
  .words p { font-size: 16px; }
  .close { padding: 0 18px; }
  .close h2 { font-size: 30px; }
  .brief { margin-top: 34px; padding: 0 6px; }
  .brief-line { font-size: 22px; line-height: 1.6; }
  .brief-note { margin-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .wordmark, .motion, .line, .belief, .cta { animation: none; }
  #light { transition: none; }
}
html.page-only .top::before { opacity: 1; }
