/*
 * Desta's website. Every color is a variable below, copied from constants/tokens.ts: change it
 * there first, then here. Color only ever means one of the five elements; emphasis is brightness.
 * Cinnabar is for the seal alone.
 */

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/cormorant-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/cormorant-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
/* The handful of Chinese characters the site shows (docs/design/website.md, Fonts) */
@font-face {
  font-family: 'Desta Hanzi';
  src: url('/fonts/hanzi.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Desta Brush';
  src: url('/fonts/brush.woff2') format('woff2');
  font-display: swap;
}

:root {
  --bg: #07080b;
  --surface-1: #0e1015;
  --surface-2: #15181f;
  --surface-3: #1e222b;
  --border: #272b36;
  --border-subtle: #181b22;
  --text: #f4f0e8;
  --text-2: #a7adb8;
  --text-3: #757d8e;
  --text-rgb: 244, 240, 232;
  --silver-rgb: 226, 228, 234;
  --starlight: #f2dfb8;
  --starlight-rgb: 242, 223, 184;
  --cinnabar: #d4533b;
  --cinnabar-deep: #8e2f22;
  --pill-bg: #f4f0e8;
  --pill-text: #07080b;
  --wood: #5a9a6e;
  --fire: #d4605c;
  --earth: #d4a832;
  --metal: #b8c0cc;
  --water: #4a72a0;

  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --hanzi: 'Desta Hanzi', 'Songti SC', 'Noto Serif SC', serif;
  --brush: 'Desta Brush', 'Desta Hanzi', 'Songti SC', serif;

  --page: 1080px;
  --gutter: 24px;
  --slow: 900ms;
  --ease: cubic-bezier(0.45, 0, 0.25, 1);
}

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

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  font-family: var(--serif);
  font-weight: 600;
  text-wrap: balance;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(var(--text-rgb), 0.35);
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-color: var(--text);
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

.wrap {
  width: 100%;
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--pill-bg);
  color: var(--pill-text);
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 10;
}
.skip:focus {
  left: 8px;
}

/* A glossary label, as the app shows a concept: the characters, then the English term in caps */
.label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.label span[lang] {
  font-family: var(--hanzi);
  font-size: 17px;
  letter-spacing: 0;
  color: var(--text-2);
}

/* ---------------------------------------------------------------- Header */

.site-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: 0.5px;
  text-decoration: none;
}
.brand img {
  width: 26px;
  height: 26px;
}
.site-header nav a {
  color: var(--text-2);
  font-size: 15px;
  text-decoration: none;
}
.site-header nav a:hover {
  color: var(--text);
}

/* ---------------------------------------------------------------- The sky (hero) */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
/* The Silver River. Without JS it's this still wash; sky.js draws the moving one over it */
.sky {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    120% 46% at 50% 30%,
    rgba(var(--silver-rgb), 0.1),
    rgba(var(--silver-rgb), 0.03) 55%,
    transparent 75%
  );
}
.sky canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1600ms var(--ease);
}
.sky.live {
  background: none;
}
.sky.live canvas {
  opacity: 1;
}
/* The sky sinks into the page: the stream never ends on a hard edge */
.sky::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 45%;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.hero .wrap {
  position: relative;
  z-index: 2;
  padding-top: 120px;
  padding-bottom: clamp(56px, 11vh, 120px);
}
.hero h1 {
  font-size: clamp(42px, 8.4vw, 76px);
  line-height: 1.04;
  letter-spacing: -0.5px;
  max-width: 12ch;
}
.hero .lede {
  margin-top: 20px;
  max-width: 34ch;
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--text-2);
}
.cta {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
}
/* The call to action: the app's warm white pill. Not a link until the app is on the App Store */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-text);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}
.cta small {
  font-size: 14px;
  color: var(--text-3);
}

/* ---------------------------------------------------------------- Sections */

section {
  padding: clamp(72px, 12vw, 136px) 0;
}

.idea .wrap {
  max-width: 820px;
}
.idea h2 {
  margin-top: 18px;
  font-size: clamp(28px, 4.6vw, 44px);
  font-weight: 500;
  line-height: 1.16;
}
.elements {
  margin-top: 40px;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--border-subtle);
}
.elements li {
  padding: 20px 4px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.elements span[lang] {
  display: block;
  font-family: var(--hanzi);
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.2;
  letter-spacing: 0;
}
.wood {
  color: var(--wood);
}
.fire {
  color: var(--fire);
}
.earth {
  color: var(--earth);
}
.metal {
  color: var(--metal);
}
.water {
  color: var(--water);
}
.idea .after {
  margin-top: 36px;
  max-width: 46ch;
}

/* A feature: its words beside a piece of the app */
.feature .wrap {
  display: grid;
  gap: 40px;
  align-items: center;
}
.feature h2 {
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.1;
}
.feature .words p {
  margin-top: 16px;
  max-width: 40ch;
}
.feature .eyebrow {
  margin-bottom: 14px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.piece {
  width: 100%;
  max-width: 400px;
  justify-self: center;
}
.piece figcaption {
  margin-top: 14px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}
@media (min-width: 860px) {
  .feature .wrap {
    grid-template-columns: 1fr 1fr;
    gap: 72px;
  }
  .feature.flip .words {
    order: 2;
  }
  .feature.wide .wrap {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .feature.wide .words p {
    margin-left: auto;
    margin-right: auto;
  }
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
}

/* The chat: a question, then Desta's answer beside the mark */
.chat {
  display: grid;
  gap: 18px;
}
.chat .asked {
  justify-self: end;
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 20px 20px 6px 20px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}
.chat .answer {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}
.chat .answer img {
  width: 22px;
  height: 22px;
  margin-top: 3px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin-top: 4px;
  list-style: none;
}
.chips li {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.35;
}

/* Home's Today card */
.today .kicker,
.daycard .kicker,
.match .kicker {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.today .headline {
  margin-top: 12px;
  color: var(--text);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 27px;
  line-height: 1.18;
}
.today .more {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-2);
  font-size: 15px;
}

/* A sign's papercut, tinted by its element (currentColor) */
.sign {
  display: inline-block;
  width: 38px;
  height: 38px;
  background: currentColor;
  -webkit-mask: var(--art) center / contain no-repeat;
  mask: var(--art) center / contain no-repeat;
}

/* Compatibility: the overall percentage, then four sections, each a bar */
.match .pair {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.match .who {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
}
.match .who small {
  display: block;
  color: var(--text-3);
  font-size: 13px;
}
.match .overall {
  color: var(--text);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 46px;
  line-height: 1;
}
.bars {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}
.bars div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  color: var(--text);
  font-size: 14px;
}
.bars dd {
  color: var(--text-2);
}
.bars .bar {
  grid-column: 1 / -1;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.bars .bar i {
  display: block;
  height: 100%;
  width: var(--v);
  background: var(--text);
  transform-origin: left;
}

/* A day the engine picked */
.daycard .date {
  margin-top: 12px;
  color: var(--text);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.12;
}
.daycard .pillar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}
.daycard .pillar .sign {
  width: 30px;
  height: 30px;
}
.daycard ul {
  margin-top: 16px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border-subtle);
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.45;
}

/* ---------------------------------------------------------------- The hall: scrolls over tablets */

.hall {
  width: 100%;
  max-width: 440px;
  margin-top: 8px;
  text-align: center;
}
.hall .row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.hscroll .cord {
  width: 100%;
  height: 11px;
  margin-bottom: 2px;
}
.hscroll .cord line {
  stroke: rgba(var(--text-rgb), 0.15);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.hscroll .rod {
  height: 2px;
  border-radius: 1px;
  background: rgba(var(--text-rgb), 0.3);
}
/* The silk unrolls: its row grows from nothing, and the rolled foot rides down under it */
.hscroll .unroll {
  display: grid;
  grid-template-rows: 1fr;
}
.hscroll .silk {
  overflow: hidden;
  min-height: 0;
  background: linear-gradient(
    to bottom,
    rgba(var(--text-rgb), 0.055),
    rgba(var(--text-rgb), 0.015) 70%,
    rgba(var(--text-rgb), 0.04)
  );
}
.hscroll .foot {
  position: relative;
  height: 9px;
  margin: 0 -3px;
  border-radius: 4.5px;
  background: linear-gradient(to bottom, rgba(var(--text-rgb), 0.2), rgba(var(--text-rgb), 0.04));
}
.hscroll.lit .silk {
  background: linear-gradient(
    to bottom,
    rgba(var(--text-rgb), 0.1),
    rgba(var(--text-rgb), 0.04) 70%,
    rgba(var(--text-rgb), 0.07)
  );
  box-shadow:
    inset 1px 0 0 rgba(var(--starlight-rgb), 0.35),
    inset -1px 0 0 rgba(var(--starlight-rgb), 0.35);
}
.hscroll.lit .rod {
  background: rgba(var(--starlight-rgb), 0.7);
}
.hscroll.lit .foot {
  background: linear-gradient(
    to bottom,
    rgba(var(--starlight-rgb), 0.5),
    rgba(var(--starlight-rgb), 0.2)
  );
}

/* One pillar's writing, the same on silk and on stone: where, the stem, the sign */
.zone {
  display: grid;
  justify-items: center;
  padding: 10px 2px 2px;
}
.zone:last-child {
  padding-bottom: 14px;
}
.zone .zh {
  font-family: var(--hanzi);
  font-size: 15px;
  line-height: 1.3;
  color: var(--text-3);
}
.zone .word {
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.4;
}
.zone .stem {
  font-family: var(--hanzi);
  font-size: 28px;
  line-height: 1.25;
}
.zone .gloss {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.6px;
  line-height: 1.5;
  text-transform: uppercase;
}
.zone .name {
  margin-top: 4px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
}
.lit .zone .zh,
.lit .zone .word {
  color: var(--starlight);
}

/* The one thread from the read scroll to the pillar of yours it touches */
.thread {
  position: relative;
  height: 64px;
}
.thread svg {
  width: 100%;
  height: 100%;
}
.thread line {
  stroke: rgba(var(--starlight-rgb), 0.7);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.thread span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 2px 10px;
  background: var(--bg);
  color: var(--starlight);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.tablet {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
}
.tablet.lit {
  border-color: rgba(var(--starlight-rgb), 0.45);
}
.hall .yours {
  margin: 12px 0 0;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* On a wide screen the hall is the page's centerpiece, so it hangs larger */
@media (min-width: 860px) {
  .hall {
    max-width: 580px;
  }
  .hall .row {
    gap: 12px;
  }
  .hall .zone {
    padding-top: 14px;
  }
  .hall .zone:last-child {
    padding-bottom: 18px;
  }
  .hall .zone .zh {
    font-size: 18px;
  }
  .hall .zone .word {
    font-size: 12px;
  }
  .hall .zone .stem {
    font-size: 36px;
  }
  .hall .zone .gloss {
    font-size: 10.5px;
  }
  .hall .zone .name {
    font-size: 14px;
  }
  .hall .sign {
    width: 48px;
    height: 48px;
  }
  .hall .thread {
    height: 80px;
  }
}

/* ---------------------------------------------------------------- The letter */

.letter .wrap {
  max-width: 640px;
}
.letter .mark {
  width: 30px;
  height: 30px;
  margin-bottom: 28px;
}
.letter h2 {
  font-size: clamp(30px, 4.6vw, 40px);
}
.letter .body p {
  margin-top: 18px;
  color: var(--text);
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(21px, 2.8vw, 25px);
  line-height: 1.36;
}
.signature {
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
}
/* The 命 seal: the site's only cinnabar */
.seal {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 6px;
  background: var(--cinnabar);
  color: var(--text);
  font-family: var(--brush);
  font-size: 32px;
  line-height: 1;
}

/* ---------------------------------------------------------------- Questions */

.faq .wrap {
  max-width: 760px;
}
.faq h2 {
  font-size: clamp(30px, 4.4vw, 42px);
  margin-bottom: 20px;
}
.faq details {
  border-top: 1px solid var(--border-subtle);
}
.faq details:last-of-type {
  border-bottom: 1px solid var(--border-subtle);
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '';
  flex: none;
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 300ms var(--ease);
}
.faq details[open] summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
}
.faq details p {
  padding: 0 0 22px;
  max-width: 60ch;
}
.faq .privacy-note {
  margin-top: 28px;
  font-size: 15px;
  color: var(--text-3);
}

/* ---------------------------------------------------------------- Footer */

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 40px 0 56px;
  font-size: 15px;
}
.site-footer .wrap {
  display: grid;
  gap: 24px;
}
.site-footer ul {
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
}
.site-footer a {
  color: var(--text-2);
  text-decoration: none;
}
.site-footer a:hover,
.site-footer a.brand {
  color: var(--text);
}
.site-footer .fine {
  color: var(--text-3);
  font-size: 13px;
}
@media (min-width: 760px) {
  .site-footer .wrap {
    grid-template-columns: auto 1fr;
    align-items: center;
  }
  .site-footer ul {
    justify-content: flex-end;
  }
  .site-footer .fine {
    grid-column: 1 / -1;
  }
}

/* ---------------------------------------------------------------- Documents (privacy, terms, support) */

.doc {
  padding: 132px 0 96px;
}
.doc .wrap {
  max-width: 760px;
}
.doc h1 {
  font-size: clamp(38px, 6vw, 54px);
  line-height: 1.08;
  margin-bottom: 28px;
}
.doc h2 {
  font-size: 28px;
  line-height: 1.2;
  margin: 48px 0 14px;
}
.doc h3 {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 10px;
}
.doc p,
.doc ul {
  margin-bottom: 16px;
}
.doc ul {
  padding-left: 22px;
}
.doc li {
  margin-bottom: 8px;
}
.doc b,
.doc strong {
  color: var(--text);
  font-weight: 600;
}
.doc .table {
  overflow-x: auto;
  margin-bottom: 16px;
}
.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.doc th,
.doc td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}
.doc th {
  color: var(--text);
  font-weight: 600;
}
.doc .lost {
  min-height: 40vh;
}

/* ---------------------------------------------------------------- Motion */

/*
 * Slow and ceremonial, never a bounce. Things are hidden before they arrive only when JS is
 * running (html.js), so the page reads whole without it.
 */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity var(--slow) var(--ease),
    transform var(--slow) var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .reveal.in {
  opacity: 1;
  transform: none;
}

.js .hall .hscroll .unroll {
  grid-template-rows: 0fr;
  transition: grid-template-rows 1200ms var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .hall.in .hscroll .unroll {
  grid-template-rows: 1fr;
}
.js .hall .tablet,
.js .hall .yours,
.js .hall .thread span {
  opacity: 0;
  transition: opacity var(--slow) var(--ease);
  transition-delay: var(--d, 1500ms);
}
.js .hall.in .tablet,
.js .hall.in .yours,
.js .hall.in .thread span {
  opacity: 1;
}
.js .hall .thread line {
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1100ms var(--ease) 2100ms;
}
.js .hall.in .thread line {
  stroke-dashoffset: 0;
}
.js .hall .thread span {
  --d: 2900ms;
}

.js .bars .bar i {
  transform: scaleX(0);
  transition: transform 1100ms var(--ease);
  transition-delay: var(--d, 300ms);
}
.js .in .bars .bar i {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js .reveal {
    transform: none;
  }
  .js .hall .hscroll .unroll {
    grid-template-rows: 1fr;
    transition: none;
  }
  .js .hall .thread line {
    stroke-dashoffset: 0;
    transition: none;
  }
  .js .bars .bar i {
    transform: none;
    transition: none;
  }
  .sky canvas,
  .faq summary::after {
    transition: none;
  }
}
