/* Yuandiandian · yuandiandian.cc */

@font-face {
  font-family: "Gabarito";
  src: url("fonts/gabarito-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  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: "Gabarito";
  src: url("fonts/gabarito-latin-ext.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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;
}
@font-face {
  font-family: "Yuandiandian Han";
  src: url("fonts/noto-sans-sc-yuandiandian.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+5706, U+70B9;
}

:root {
  /* the bath and the five pigments; nothing blends */
  --bath: #DCE8E1;
  --paper: #FFFFFF;
  --ink: #14161A;
  --indigo: #1F3A8A;
  --vermilion: #E0452B;
  --ochre: #E8A917;

  /* text on each field */
  --ink-2: #414751;
  --ink-3: #5C626C;
  --on-indigo-2: #CBD6F5;
  --on-ochre-2: #3F2E05;
  --on-ink-2: #BCC1CB;
  --alert: #BE3018;
  --alert-on-ink: #FF9C8A;
  --rule: rgba(20, 22, 26, .16);

  --sans: "Gabarito", "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  --han: "Yuandiandian Han", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;

  --pad: clamp(1.25rem, 4vw, 3rem);
  --max: 70rem;
  --tray: clamp(.625rem, 1.5vw, 1.375rem);
  --edge: clamp(1rem, 3.3vw, 3rem);
  --r: .375rem;
  --out: cubic-bezier(.16, 1, .3, 1);
  --float: 0 1px 0 rgba(20, 22, 26, .2), 0 1.5rem 3rem rgba(20, 22, 26, .22);
  --float-s: 0 1px 0 rgba(20, 22, 26, .16), 0 .5rem 1.125rem rgba(20, 22, 26, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: var(--indigo) var(--bath); background: var(--ink); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--vermilion);
  overflow-x: clip;
}
h1, h2, p, dl, dd, fieldset { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
::selection { background: var(--indigo); color: var(--paper); }
:focus-visible { outline: .1875rem solid var(--focus, var(--ink)); outline-offset: .1875rem; border-radius: .25rem; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 1rem; }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hp { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.skip {
  position: fixed; left: 1rem; top: -4rem; z-index: 30;
  padding: .625rem 1rem; border-radius: var(--r);
  background: var(--ink); color: var(--paper); font-weight: 700; text-decoration: none;
}
.skip:focus { top: 1rem; }
.han { font-family: var(--han); font-weight: 500; }
.wrap { width: min(100%, var(--max)); margin-inline: auto; padding-inline: var(--pad); }

.when-joined { display: none; }
.is-joined .when-open { display: none; }
.is-joined .when-joined { display: inline; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.25rem; padding: 0 1.375rem;
  border: 0; border-radius: var(--r);
  background: var(--ink); color: var(--paper);
  font-weight: 700; font-size: 1.0625rem; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .2s var(--out), transform .2s var(--out);
}
.btn:hover { background: var(--indigo); }
.btn:active { transform: scale(.97); }
.btn:disabled { background: var(--ink-3); cursor: progress; }
.btn-s { min-height: 2.75rem; padding: 0 1.125rem; border-radius: 2rem; font-size: 1rem; }

/* ---------- the bath ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: max(100svh, 42rem);
  border: var(--tray) solid var(--ink);
  padding: var(--edge);
  background: var(--bath);
}
.bath, .bath-still { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; }
.bath { display: block; cursor: crosshair; touch-action: pan-y; }
.bath-still { object-fit: cover; object-position: 78% 50%; }
.js .bath-still { display: none; }
.sheet {
  position: absolute; inset: 0; z-index: 1;
  background: rgba(255, 255, 255, .94);
  clip-path: inset(0 0 100% 0); visibility: hidden; pointer-events: none;
}

.links { position: absolute; z-index: 2; top: var(--edge); right: var(--edge); display: flex; gap: .625rem; }
.links a {
  padding: .5625rem 1.125rem; border-radius: 2rem;
  background: var(--paper); box-shadow: var(--float-s);
  font-size: 1rem; font-weight: 600; line-height: 1.4; text-decoration: none;
  transition: background-color .2s var(--out), color .2s var(--out);
}
.links a:hover { background: var(--ink); color: var(--paper); }

/* the slip of sized paper lying on the water */
.slip {
  position: relative; z-index: 2;
  width: min(33rem, 100%);
  padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.375rem, 3.2vw, 2.75rem) clamp(1.375rem, 2.8vw, 2.25rem);
  background: var(--paper); border-radius: var(--r); box-shadow: var(--float);
}
.brand { display: flex; align-items: center; gap: .625rem; font-size: 1.25rem; line-height: 1.2; }
.mark { flex: none; width: 1.75rem; height: 1.25rem; fill: var(--vermilion); }
.brand-name { font-weight: 800; letter-spacing: -.01em; }
.brand .han { color: var(--ink-2); font-size: 1.125rem; }
h1 {
  margin-top: clamp(1.25rem, 2.4vw, 1.875rem);
  font-size: clamp(2.125rem, 3.75vw, 3.375rem); line-height: 1.04; font-weight: 800; letter-spacing: -.03em;
  text-wrap: balance;
}
.lede { margin-top: 1.125rem; font-size: clamp(1.0625rem, 1.45vw, 1.25rem); line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.lede .han { color: var(--ink); }

/* ---------- the form ---------- */
.join { margin-top: clamp(1.375rem, 2.4vw, 1.875rem); }
.row { display: flex; gap: .625rem; }
.field {
  flex: 1; min-width: 0; min-height: 3.25rem; padding: 0 1rem;
  border: .125rem solid var(--ink); border-radius: var(--r);
  background: var(--paper); color: var(--ink);
  font-size: 1.0625rem;
  transition: border-color .2s var(--out), box-shadow .2s var(--out);
}
.field::placeholder { color: var(--ink-3); opacity: 1; }
.field:hover { box-shadow: inset 0 0 0 .0625rem var(--ink); }
.field:focus-visible { outline-offset: .125rem; border-radius: var(--r); }
.field[aria-invalid="true"] { border-color: var(--alert); }
.oops { margin-top: .625rem; font-size: 1rem; line-height: 1.4; font-weight: 600; color: var(--alert); }
.oops:empty { display: none; }
.fine { margin-top: .75rem; font-size: .9375rem; line-height: 1.45; color: var(--ink-3); text-wrap: pretty; }
.oops:not(:empty) ~ .fine { display: none; }
.nojs { margin-top: .5rem; font-size: .9375rem; font-weight: 600; color: var(--alert); }
.js .nojs { display: none; }

.receipt {
  display: flex; align-items: center; gap: .875rem;
  min-height: 3.25rem; padding: .5rem .875rem .5rem .5rem;
  border: .125rem solid var(--ink); border-radius: var(--r);
}
.print { flex: none; width: 10.5rem; aspect-ratio: 4 / 3; border-radius: .1875rem; overflow: hidden; background: var(--paper); outline: .0625rem solid var(--rule); outline-offset: -.0625rem; }
.print img { display: block; width: 100%; height: 100%; object-fit: cover; }
.done-line { display: flex; align-items: center; gap: .5rem; padding-left: .375rem; font-size: 1.0625rem; line-height: 1.35; overflow-wrap: anywhere; }
.done-line b { font-weight: 700; }
.done-line:focus { outline: none; }
.tick { flex: none; width: 1.375rem; height: 1.375rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.again {
  margin-block: -.75rem; padding: .75rem .125rem; border: 0; background: none;
  color: var(--ink); font-size: .9375rem; font-weight: 700;
  text-decoration: underline; text-decoration-thickness: .0625rem; text-underline-offset: .2em; cursor: pointer;
}
.again:hover { text-decoration-thickness: .125rem; }

/* ---------- pigment pots ---------- */
.tools { display: none; position: absolute; z-index: 2; right: var(--edge); bottom: var(--edge); justify-items: end; gap: .625rem; }
.js .tools { display: grid; }
.hint { padding: .5rem 1rem; border-radius: 2rem; background: var(--ink); color: var(--paper); font-size: .9375rem; line-height: 1.35; font-weight: 600; }
.if-coarse { display: none; }
.bench { display: flex; align-items: center; gap: .5rem; padding: .3125rem .3125rem .3125rem .5rem; border-radius: 2.25rem; background: var(--paper); box-shadow: var(--float-s); }
.pots { display: flex; border: 0; padding: 0; }
.pot { position: relative; display: grid; place-items: center; width: 2.5rem; height: 2.75rem; cursor: pointer; }
.pot input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.dab { width: 1.375rem; height: 1.375rem; border-radius: 50%; transition: transform .25s var(--out), box-shadow .25s var(--out); }
.dab-vermilion { background: var(--vermilion); }
.dab-ochre { background: var(--ochre); }
.dab-indigo { background: var(--indigo); }
.dab-ink { background: var(--ink); }
.dab-clear { background: var(--bath); box-shadow: inset 0 0 0 .09375rem var(--ink-3); }
.pot:hover .dab { transform: scale(1.12); }
.pot input:checked + .dab { transform: scale(1.12); box-shadow: 0 0 0 .1875rem var(--paper), 0 0 0 .3125rem var(--ink); }
.pot input:checked + .dab-clear { box-shadow: inset 0 0 0 .09375rem var(--ink-3), 0 0 0 .1875rem var(--paper), 0 0 0 .3125rem var(--ink); }
.pot input:focus-visible + .dab { outline: .1875rem solid var(--ink); outline-offset: .4375rem; }

/* ---------- fields of single pigment ---------- */
.band { position: relative; padding-block: clamp(4.5rem, 9vw, 8rem); }
h2 { font-size: clamp(2rem, 3.8vw, 3.125rem); line-height: 1.05; font-weight: 800; letter-spacing: -.03em; text-wrap: balance; }
.band p { text-wrap: pretty; }
.cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 6vw, 5.5rem); align-items: start; }
.side { position: sticky; top: 2rem; }
.side p, .copy p { margin-top: 1.125rem; max-width: 26rem; font-size: 1.125rem; }

.band-indigo { background: var(--indigo); color: var(--paper); --focus: var(--paper); }
.band-indigo .copy p { color: var(--on-indigo-2); }
.band-indigo .copy .han { color: var(--paper); }
.band-paper { background: var(--paper); }
.band-paper .side p { color: var(--ink-2); }
.band-ochre { background: var(--ochre); }
.band-ochre .side p { color: var(--on-ochre-2); }
.band-ink { background: var(--ink); color: var(--paper); --focus: var(--paper); }

/* the name: one round, two dots */
.cols:has(.beats) { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); align-items: center; }
.beats { display: flex; align-items: flex-end; justify-content: center; gap: 1.5rem clamp(.75rem, 2vw, 2rem); }
.beat { display: grid; justify-items: center; }
.seat {
  display: grid; place-items: center;
  width: var(--d); height: var(--d); margin: var(--ring); border-radius: 50%;
  background: var(--paper); color: var(--ink);
}
.seat .han { font-size: calc(var(--d) * .56); line-height: 1; font-weight: 700; }
.beat-a { --d: clamp(6.5rem, 11vw, 10rem); --ring: 2.25rem; }
.beat-b, .beat-c { --d: clamp(4.25rem, 6.6vw, 6rem); --ring: .875rem; }
.beat-a .seat { box-shadow: 0 0 0 .625rem var(--ochre), 0 0 0 1rem var(--bath), 0 0 0 1.75rem var(--vermilion), 0 0 0 2.25rem var(--ink); }
.beat-b .seat { box-shadow: 0 0 0 .4375rem var(--vermilion), 0 0 0 .875rem var(--bath); }
.beat-c .seat { box-shadow: 0 0 0 .4375rem var(--ochre), 0 0 0 .875rem var(--ink); }
.beat p { margin-top: .875rem; text-align: center; font-size: 1.0625rem; line-height: 1.3; color: var(--on-indigo-2); }
.beat b { display: block; font-size: 1.5rem; font-weight: 700; color: var(--paper); }

/* facts: a filled dot is said, a ring is not yet */
.facts { border-top: .125rem solid var(--ink); }
.fact {
  display: grid; grid-template-columns: 1.5rem minmax(0, 11rem) minmax(0, 1fr); gap: 0 .75rem; align-items: baseline;
  padding-block: 1.0625rem; border-bottom: .0625rem solid var(--rule);
}
.fact::before { content: ""; width: .75rem; height: .75rem; border-radius: 50%; align-self: start; margin-top: .5rem; border: .125rem solid var(--ink-3); }
.fact.is-set::before { border-color: var(--dot); background: var(--dot); }
.fact:nth-child(4n + 1) { --dot: var(--vermilion); }
.fact:nth-child(4n + 2) { --dot: var(--indigo); }
.fact:nth-child(4n + 3) { --dot: var(--ochre); }
.fact:nth-child(4n) { --dot: var(--ink); }
.fact dt { font-size: 1.0625rem; color: var(--ink-3); }
.fact dd { font-size: 1.1875rem; font-weight: 600; color: var(--ink-2); }
.fact.is-set dd { color: var(--ink); }

/* questions: the ring fills when it opens */
.qs { border-top: .125rem solid var(--ink); }
.q { border-bottom: .0625rem solid rgba(20, 22, 26, .3); }
.q summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  min-height: 4rem; padding-block: 1rem;
  font-size: 1.25rem; line-height: 1.3; font-weight: 700; letter-spacing: -.01em;
  cursor: pointer; list-style: none;
}
.q summary::-webkit-details-marker { display: none; }
.q summary::after {
  content: ""; flex: none; width: 1.25rem; height: 1.25rem; border-radius: 50%;
  border: .125rem solid var(--ink); background: transparent;
  box-shadow: inset 0 0 0 .5rem transparent;
  transition: box-shadow .35s var(--out), transform .35s var(--out);
}
.q summary:hover::after { transform: scale(1.15); }
.q[open] summary::after { box-shadow: inset 0 0 0 .625rem var(--ink); }
.q p { max-width: 36rem; padding-bottom: 1.5rem; font-size: 1.125rem; color: var(--on-ochre-2); }

/* the close: the bath rinsed to ink, one last drop */
.close { overflow: hidden; padding-block: clamp(5rem, 10vw, 8.5rem); }
.close-in { position: relative; z-index: 1; }
.close-in > * { max-width: 34rem; }
.close .lede { margin-top: 1rem; color: var(--on-ink-2); }
.band-ink .field { background: transparent; border-color: rgba(255, 255, 255, .6); color: var(--paper); }
.band-ink .field::placeholder { color: var(--on-ink-2); }
.band-ink .field:hover { box-shadow: inset 0 0 0 .0625rem var(--paper); }
.band-ink .field[aria-invalid="true"] { border-color: var(--alert-on-ink); }
.band-ink .btn { background: var(--paper); color: var(--ink); }
.band-ink .btn:hover { background: var(--bath); }
.band-ink .btn:disabled { background: var(--on-ink-2); }
.band-ink .fine { color: var(--on-ink-2); }
.band-ink .oops, .band-ink .nojs { color: var(--alert-on-ink); }
.band-ink .receipt { border-color: rgba(255, 255, 255, .6); }
.band-ink .again { color: var(--paper); }
.last-drop {
  position: absolute; right: clamp(-3rem, 4vw, 7rem); top: 50%; translate: 0 -50%;
  width: 6rem; height: 6rem; border-radius: 50%; background: var(--bath);
  box-shadow:
    0 0 0 1.125rem var(--vermilion), 0 0 0 2rem var(--ochre), 0 0 0 2.5rem var(--ink),
    0 0 0 4.25rem var(--indigo), 0 0 0 5rem var(--bath), 0 0 0 7rem var(--vermilion),
    0 0 0 7.5rem var(--ink), 0 0 0 9.5rem var(--ochre);
}

.foot { background: var(--ink); color: var(--on-ink-2); --focus: var(--paper); border-top: .0625rem solid rgba(255, 255, 255, .16); padding-block: 1.5rem 2rem; font-size: .9375rem; }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 2rem; }
.foot .brand-name { font-size: 1.0625rem; color: var(--paper); }
.foot .han { margin-left: .25rem; }
.foot a { margin-left: auto; padding-block: .75rem; color: var(--paper); text-decoration: underline; text-decoration-thickness: .0625rem; text-underline-offset: .2em; }
.foot a:hover { text-decoration-thickness: .125rem; }

/* ---------- motion: the sheet is laid once and lifted once ---------- */
.sheet-art { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.hero.is-laying .sheet, .hero.is-lifting .sheet { visibility: visible; clip-path: inset(0); }
.hero.is-lifting .sheet { background: var(--paper); }
.hero.is-lifting .sheet-art { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .hero.is-laying .sheet { animation: lay .7s cubic-bezier(.3, 0, .15, 1) both; }
  .hero.is-lifting .sheet { animation: liftoff .95s cubic-bezier(.6, 0, .9, .45) both; }
  .is-fresh .print img { animation: settle .9s var(--out) .55s both; }
}
@keyframes lay { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes liftoff { to { transform: translateY(-112%) rotate(-3deg); } }
@keyframes settle { from { opacity: 0; transform: translateY(-.75rem) rotate(-5deg) scale(1.25); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ---------- narrower ---------- */
@media (pointer: coarse) {
  .if-fine { display: none; }
  .if-coarse { display: inline; }
}
@media (max-width: 56rem) {
  .links { display: none; }
  .cols, .cols:has(.beats) { grid-template-columns: minmax(0, 1fr); }
  .beats { justify-content: flex-start; }
  .side { position: static; }
  .last-drop { right: -5rem; top: auto; bottom: -6rem; translate: none; scale: .8; }
  .close { padding-bottom: 14rem; }
}
@media (max-width: 36rem) {
  .hero { min-height: 0; padding-bottom: 21rem; }
  .row { flex-direction: column; }
  .btn { width: 100%; }
  .btn-s { width: auto; }
  .tools { left: var(--edge); justify-items: center; }
  .if-wide { display: none; }
  .beats { flex-wrap: wrap; justify-content: center; }
  .beat-a { flex-basis: 100%; }
  .fact { grid-template-columns: 1.5rem minmax(0, 1fr); }
  .fact dd { grid-column: 2; }
  .foot a { margin-left: 0; }
  .receipt { align-items: flex-start; flex-direction: column; padding: .5rem; }
  .print { width: 100%; }
  .done-line { padding: .25rem .25rem .125rem; }
}
