/* D2 v2: the page makes a lacquer piece. Every colour explicit; one look whatever the OS theme. */
:root {
  --then: #1C1511;
  --canh-gian: #4A2212;
  --son: #B5271C;
  --cinnabar: #D8452A;
  --gold: #E0A642;
  --eggshell: #F2EEE7;
  --eggshell-2: rgba(242,238,231,.78);
  --wood: #B48C60;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --gutter: clamp(20px, 5vw, 64px);
  --x: 62%;
  --y: 38%;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* No overflow on html or body: either would turn body into the scroll container and unstick the board. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--then);
  color: var(--eggshell);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}
@media (max-width: 480px) { body { font-size: 16px; } }

a { touch-action: manipulation; -webkit-tap-highlight-color: rgba(181,39,28,.25); color: var(--eggshell); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--gold); }
button { touch-action: manipulation; font: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.skip { position: absolute; left: var(--gutter); top: -60px; background: var(--eggshell); color: var(--then); padding: 10px 14px; z-index: 80; }
.skip:focus { top: 12px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left)); }

/* The re-lacquer wipe used by the language switch */
.wipe {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  background: linear-gradient(to right, var(--then) 0 94%, rgba(255,248,235,.28) 100%);
  transform: translateX(-104%);
}
body.relacquer .wipe { transition: transform .58s cubic-bezier(.65, 0, .25, 1); transform: translateX(0); }

/* Fixed header */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  background: rgba(28,21,17,.90);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(255,248,235,.08);
  padding: 8px 0;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 500; min-height: 44px; color: var(--eggshell); }
.brand:hover { color: var(--eggshell); }
.markslot { position: relative; width: 32px; height: 32px; flex: none; display: inline-block; }
.markslot svg, .markslot canvas { position: absolute; inset: 0; width: 32px; height: 32px; display: block; }
.markslot .pool { transform-box: fill-box; transform-origin: center; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.brand:hover .pool, .brand:focus-visible .pool { transform: scale(1.22); }
.markslot canvas { opacity: 0; transition: opacity .3s; border-radius: 3px; }
.brand.done svg { opacity: 0; }
.brand.done canvas { opacity: 1; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { position: relative; color: var(--eggshell); text-decoration: none; padding: 10px 12px; min-height: 44px; display: inline-flex; align-items: center; }
.nav a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 9px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.nav a:hover::after, .nav a:focus-visible::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { font-weight: 600; }
.nav .lang { margin-left: 8px; padding-left: 10px; border-left: 1px solid rgba(242,238,231,.35); display: inline-flex; }
@media (max-width: 640px) {
  .brand .name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
}

/* The stage: a sticky board with the beats scrolling over it */
.stage { position: relative; background: var(--then); }
.stick { position: sticky; top: 0; height: 100svh; overflow: hidden; z-index: 0; user-select: none; }
.frame { position: absolute; inset: 0; transform-origin: 50% 50%; will-change: transform; }
.board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.water {
  position: absolute; inset: -25%; opacity: 0; pointer-events: none; mix-blend-mode: screen;
  /* sanding marks: fine, faint rings from two centres, the way a sanding block turns on the board */
  background:
    repeating-radial-gradient(circle at 66% 38%, rgba(230,238,255,0) 0 5px, rgba(230,238,255,.045) 6px 7px, rgba(230,238,255,0) 8px 9px),
    repeating-radial-gradient(circle at 24% 72%, rgba(230,238,255,0) 0 6px, rgba(230,238,255,.035) 7px 8px, rgba(230,238,255,0) 9px 11px),
    linear-gradient(160deg, rgba(214,232,255,0) 30%, rgba(214,232,255,.10) 50%, rgba(214,232,255,0) 70%);
  animation: ripple 18s ease-in-out infinite alternate;
}
@keyframes ripple { to { transform: translate(-2%, 1.5%) rotate(2deg); } }
.sheen {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: .5;
  background:
    radial-gradient(ellipse 34% 24% at var(--x) var(--y), rgba(255,248,235,.30) 0, rgba(255,248,235,.11) 40%, rgba(255,248,235,0) 100%),
    linear-gradient(115deg, rgba(255,250,240,0) 28%, rgba(255,250,240,.10) 50%, rgba(255,250,240,0) 72%),
    linear-gradient(to bottom, rgba(255,250,240,.06), rgba(255,250,240,0) 35%);
}
.hud {
  position: absolute; right: var(--gutter); bottom: 16px; z-index: 3; margin: 0;
  display: flex; align-items: center; gap: 10px;
  font-size: .8rem; color: rgba(242,238,231,.85); text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.hud-bar { width: 64px; height: 5px; background: rgba(242,238,231,.18); border-radius: 1px; overflow: hidden; }
.hud-fill { display: block; height: 100%; background: var(--son); transform: scaleX(0); transform-origin: left; }
body.sanding .stick { touch-action: none; cursor: crosshair; z-index: 45; }
body.sanding .beats, body.sanding .top { visibility: hidden; }
.stick.sandable { cursor: crosshair; }
.sand-done {
  position: fixed; right: var(--gutter); bottom: 20px; z-index: 50;
  background: var(--eggshell); color: var(--then); border: 0; padding: 12px 18px; min-height: 44px; border-radius: 2px;
}

.beats { position: relative; margin-top: -100svh; z-index: 2; pointer-events: none; }
.beat { min-height: 100svh; display: flex; align-items: center; padding: 88px 0 56px; scroll-margin-top: 68px; overflow: clip; }
/* Phone: a sticky band mirrors the top of the board above the copy, so the material never leaves the screen */
.band { display: none; }
@media (max-width: 759px) {
  .band { display: block; position: sticky; top: 0; height: 36svh; margin-bottom: -36svh; z-index: 3; pointer-events: none; overflow: hidden; isolation: isolate;
    -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent); mask-image: linear-gradient(to bottom, #000 78%, transparent); }
  .band-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  .band .sheen { opacity: .55; }
  .beat { padding-top: 40svh; align-items: flex-start; }
  .b1 { align-items: flex-end; }
}
.beat > .wrap { width: 100%; }
.b1 { align-items: flex-end; }
.b2 { min-height: 130svh; }
.b4 { min-height: 140svh; }
.b5 { min-height: 160svh; }
.copy { pointer-events: auto; position: relative; isolation: isolate; max-width: 560px; padding: 24px 0; }
.copy::before {
  content: ""; position: absolute; z-index: -1; top: -12px; bottom: -12px; left: -100vw; right: -96px;
  background: var(--then); opacity: .96; pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 120px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 120px), transparent);
}
.copy.right { margin-left: auto; }
.copy.right::before {
  left: -96px; right: -100vw;
  -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 120px), transparent);
  mask-image: linear-gradient(to left, #000 calc(100% - 120px), transparent);
}
.wide .copy { max-width: 1000px; }
.cols { display: grid; grid-template-columns: 1fr; gap: 28px 56px; }
@media (min-width: 760px) { .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 759px) {
  .copy, .copy.right { max-width: none; margin-left: 0; padding: 32px 0; }
  .copy::before, .copy.right::before {
    left: -20px; right: -20px; top: 0; bottom: 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  }
}

h1 {
  font-family: var(--sans); font-weight: 500; font-size: 1.1rem; line-height: 1.3; letter-spacing: .01em;
  margin: 0 0 18px; color: var(--eggshell-2);
}
.lead {
  font-family: var(--serif); font-weight: 300;
  font-variation-settings: "opsz" 144, "SOFT" 60;
  font-size: clamp(2.2rem, 1rem + 4.8vw, 4.6rem); line-height: 1.05; letter-spacing: -0.012em;
  margin: 0 0 22px; max-width: 16ch; text-wrap: balance; color: var(--eggshell);
}
.b1 p { margin: 0; max-width: 44ch; }
.b1 p:not(.lead) { font-size: 1.06em; color: var(--eggshell-2); }
.scroll-note { font-size: .8rem; margin-top: 28px !important; color: rgba(242,238,231,.6) !important; }
.rm-note { display: none; font-size: .8rem; margin-top: 20px !important; color: rgba(242,238,231,.6) !important; }
@media (max-width: 640px) { .lead { max-width: none; } }
h2 {
  font-family: var(--serif); font-weight: 400;
  font-variation-settings: "opsz" 48, "SOFT" 30;
  font-size: 1.75rem; line-height: 1.2; margin: 0 0 16px; letter-spacing: -0.005em; text-wrap: balance;
}
.prose { max-width: 60ch; }
.prose p { margin: 0 0 1.1em; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { margin: 0 0 1.1em; padding-left: 1.2em; }
.prose li { margin: 0 0 .35em; }
.prose li::marker { color: var(--cinnabar); }
.caption { font-size: .875em; color: var(--eggshell-2); max-width: 60ch; margin: 1.2em 0 0; }

.fields { display: grid; grid-template-columns: 1fr; gap: 22px 48px; margin: 8px 0 0; }
@media (min-width: 760px) { .fields { grid-template-columns: 1fr 1fr; gap: 28px 56px; } }
.fields > div { position: relative; max-width: 42ch; }
.fields > div::before {
  content: ""; position: absolute; left: -20px; top: 10px; width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, var(--cinnabar), var(--son) 55%, var(--canh-gian) 92%);
  transform: scale(.35); opacity: .55;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s;
}
.fields > div:hover::before, .fields > div:focus-within::before { transform: scale(1); opacity: 1; }
.fields dt {
  font-family: var(--serif); font-weight: 400; font-variation-settings: "opsz" 36, "SOFT" 30;
  font-size: 1.3rem; line-height: 1.25; margin: 0 0 4px;
}
.fields dt a { text-decoration: none; }
.fields dd { margin: 0; color: var(--eggshell-2); }

.play { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 1.2em; }
.play .caption { margin: 0; }
.sand-btn {
  display: none; align-items: center; min-height: 44px; padding: 10px 18px; border-radius: 2px;
  background: transparent; color: var(--eggshell); border: 1px solid rgba(242,238,231,.55); cursor: pointer;
}
.sand-btn:hover { border-color: var(--gold); color: var(--gold); }
@media (pointer: coarse) { .sand-btn { display: inline-flex; } .play-fine { display: none; } }

.email {
  position: relative; overflow: hidden; display: inline-block; margin: 6px 0 14px;
  font-family: var(--serif); font-weight: 400; font-size: 1.35rem; font-variation-settings: "opsz" 36;
  text-decoration: none; padding: 2px 0;
}
.email::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, rgba(255,248,235,0) 38%, rgba(255,248,235,.45) 50%, rgba(255,248,235,0) 62%);
  transform: translateX(-130%);
}
.email:hover::after, .email:focus-visible::after { transition: transform .7s cubic-bezier(.2, .8, .2, 1); transform: translateX(130%); }

/* Footer: the underside of the board */
.under {
  position: relative; z-index: 3;
  background: var(--wood) url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22800%22%20height%3D%22400%22%3E%3Cfilter%20id%3D%22w%22%20x%3D%220%22%20y%3D%220%22%20width%3D%22100%25%22%20height%3D%22100%25%22%3E%3CfeTurbulence%20type%3D%22fractalNoise%22%20baseFrequency%3D%220.0025%200.07%22%20numOctaves%3D%224%22%20seed%3D%227%22%20result%3D%22n%22%2F%3E%3CfeColorMatrix%20in%3D%22n%22%20type%3D%22saturate%22%20values%3D%220%22%20result%3D%22g%22%2F%3E%3CfeComponentTransfer%20in%3D%22g%22%20result%3D%22c%22%3E%3CfeFuncR%20type%3D%22table%22%20tableValues%3D%220.62%201%22%2F%3E%3CfeFuncG%20type%3D%22table%22%20tableValues%3D%220.62%201%22%2F%3E%3CfeFuncB%20type%3D%22table%22%20tableValues%3D%220.62%201%22%2F%3E%3CfeFuncA%20type%3D%22table%22%20tableValues%3D%221%201%22%2F%3E%3C%2FfeComponentTransfer%3E%3CfeBlend%20in%3D%22SourceGraphic%22%20in2%3D%22c%22%20mode%3D%22multiply%22%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D%22800%22%20height%3D%22400%22%20fill%3D%22%23B48C60%22%20filter%3D%22url%28%23w%29%22%2F%3E%3C%2Fsvg%3E") center / 800px 400px;
  color: var(--then);
  padding: 56px 0 40px;
}
.under::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background:
    repeating-linear-gradient(0deg, rgba(60,35,10,.10) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(60,35,10,.08) 0 1px, transparent 1px 5px);
}
.under .wrap { position: relative; }
.under p { margin: 0 0 8px; max-width: 62ch; font-size: .95em; }
.under .foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; align-items: center; }
.foot-nav { display: flex; align-items: center; gap: 4px; }
.foot-nav a { color: var(--then); padding: 10px 10px; min-height: 44px; display: inline-flex; align-items: center; }
.foot-nav a:hover { color: var(--son); }
.foot-nav .lang { margin-left: 6px; padding-left: 8px; border-left: 1px solid rgba(28,21,17,.35); display: inline-flex; }
.under .lang a { color: var(--then); padding: 10px 10px; min-height: 44px; display: inline-flex; align-items: center; }
.under .lang a[aria-current="page"] { font-weight: 600; }
.under .lang a:hover { color: var(--son); }
.under .caption { color: rgba(28,21,17,.72); margin: 0 0 18px; }

@media (prefers-reduced-motion: reduce) {
  .hud, .water, .sand-btn, .play-fine, .sand-done, .scroll-note { display: none !important; }
  .rm-note { display: block; }
  .sheen { --x: 62%; --y: 38%; opacity: 1; }
  .stick { position: relative; }
  .markslot .pool, .nav a::after, .fields > div::before, .markslot canvas, .email::after, .wipe { transition: none !important; }
  .fields > div::before { transform: scale(1); opacity: 1; }
}
