/* RWCWise — a page of the app's library: warm paper by day, a lamp-lit desk
   by night, terracotta for what to act on and amber for what was marked.
   The colors are the app's own tokens (src/index.css). */

/* Each color is light-dark(by day, by night); color-scheme picks one. It
   follows the system, and the switch at the top, #look, turns it to the
   other: no script, so the choice lasts until the page is left. */
:root {
  --desk: light-dark(#f3f0e8, #110f0b);
  --paper: light-dark(#fbfaf7, #16140f);
  --sunk: light-dark(#f3f0e8, #1b1813);
  --surface: light-dark(#ffffff, #201d16);
  --line: light-dark(#e7e1d6, #2e2a21);
  --ink: light-dark(#211e18, #ece7db);
  --ink-2: light-dark(#6b6459, #a49c8c);
  --ink-3: light-dark(#a49c8c, #736b5c);
  --mark: light-dark(#fbebb0, #5a4d20);
  --accent: #c2603d;
  /* the accent as text: the app's terracotta is too dark to read by night */
  --accent-ink: light-dark(#b2552f, #e08a68);
  --button-hover: #ad5333;
  --shade: light-dark(rgba(40, 33, 20, 0.34), rgba(0, 0, 0, 0.72));
  --shadow: 0 1px 2px light-dark(rgba(40, 33, 20, 0.05), rgba(0, 0, 0, 0.3)), 0 40px 80px -48px var(--shade);
  --serif: "Newsreader", "Songti SC", "Noto Serif SC", Georgia, serif;
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, "PingFang SC", monospace;
  --pad: 48px;
  --section: 104px;
  color-scheme: light dark;
}

@media not (prefers-color-scheme: dark) {
  :root:has(#look:checked) { color-scheme: dark; }
}

@media (prefers-color-scheme: dark) {
  :root:has(#look:checked) { color-scheme: light; }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }

body {
  margin: 0;
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  overflow-x: hidden;
  background: var(--desk);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

p { margin: 0; text-wrap: pretty; }

kbd {
  font: 500 0.82em/1 var(--mono);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}

code { font: 0.86em/1 var(--mono); color: var(--ink); }

mark {
  color: inherit;
  background: var(--mark);
  border-radius: 0.12em;
  padding: 0 0.06em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* the page: one column of paper on the desk, ruled across between bands */

.band { border-top: 1px solid var(--line); }
header.band { border-top: 0; }

.frame {
  position: relative;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 0 var(--pad);
  border-inline: 1px solid var(--line);
  background: var(--paper);
}

/* header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  min-height: 68px;
  padding-block: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font: 600 21px/1 var(--serif);
  letter-spacing: -0.01em;
}

.brand img { width: 30px; height: 30px; }

.nav { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; font: 500 14px/1 var(--sans); }
.nav a { color: var(--ink-2); text-decoration: none; }
.nav a:hover { color: var(--ink); }
.nav .lang { color: var(--ink); }
.nav .get {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.nav .get:hover { background: var(--button-hover); color: #fff; }

/* the switch: a checkbox, out of sight but focusable, and its label */
.look { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.look-switch { display: inline-flex; padding: 5px; margin: -5px; border-radius: 8px; color: var(--ink-2); cursor: pointer; }
.look-switch:hover { color: var(--ink); background: var(--sunk); }
.look-switch svg { width: 18px; height: 18px; }
.look:focus-visible + .look-switch { outline: 2px solid var(--accent); outline-offset: 1px; }

/* hero */

.hero .frame { padding-block: 104px 96px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 30px;
  font: 500 13px/1 var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 1px; background: var(--accent); }

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

h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(42px, 6.4vw, 80px);
  line-height: 1.02;
  letter-spacing: -0.025em;
}

h1 em, h2 em { font-style: italic; }

.lede {
  max-width: 34em;
  margin: 30px 0 0;
  font-size: clamp(17px, 2vw, 19.5px);
  color: var(--ink-2);
}

.lede strong { color: var(--ink); font-weight: 600; }

.cta { display: flex; align-items: center; gap: 14px 24px; flex-wrap: wrap; margin: 38px 0 0; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font: 600 16px/1 var(--sans);
  text-decoration: none;
  box-shadow: 0 14px 30px -16px var(--accent);
}

.button:hover { background: var(--button-hover); }
.button svg { width: 18px; height: 18px; flex: none; }

.meta { font: 13px/1.5 var(--mono); color: var(--ink-2); }

/* figures: the app's window, and a caption under it as a book has */

.plate { padding-block: 0 72px; }
.hero + .band { border-top: 0; }

.shot { margin: 0; }

.shot picture img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sunk);
  box-shadow: var(--shadow);
}

.shot figcaption {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 18px 2px 0;
  font: italic 16px/1.5 var(--serif);
  color: var(--ink-2);
}

.shot figcaption span {
  flex: none;
  font: 500 11.5px/1 var(--mono);
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

/* each screenshot twice: as the system looks, and the other way, shown once
   the switch is on; lazy, so it is fetched only then */
.shot .other { display: none; }
:root:has(#look:checked) .shot picture { display: none; }
:root:has(#look:checked) .shot .other { display: block; }

/* the note in the margin */

.note {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 24px;
  padding-block: 36px;
  color: var(--ink-2);
}

.note p:last-child { max-width: 46em; }
.note strong { color: var(--ink); font-weight: 600; }

.label,
.kicker,
.track b,
.needs b {
  font: 500 12.5px/1.65 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.note .label { color: var(--accent-ink); }

/* sections */

section > .frame { padding-block: var(--section); }

.kicker { display: flex; gap: 12px; margin: 0 0 18px; color: var(--ink-2); }
.kicker span { color: var(--accent-ink); }

h2 {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

h3 {
  margin: 0 0 10px;
  font: 600 17px/1.4 var(--sans);
  letter-spacing: -0.005em;
}

.section-lede { max-width: 36em; margin: 20px 0 0; color: var(--ink-2); }

/* ruled grids that run from one side of the frame to the other */

.steps,
.small {
  display: grid;
  gap: 1px;
  margin: 56px calc(-1 * var(--pad)) 0;
  padding: 0;
  list-style: none;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.steps li { padding: 36px var(--pad) 40px; background: var(--paper); }

.steps h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font: 500 28px/1.1 var(--serif);
  letter-spacing: -0.015em;
}

.steps h3 svg { width: 22px; height: 22px; flex: none; color: var(--accent-ink); }

.steps p, .small p { color: var(--ink-2); font-size: 15.5px; }

/* features */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: 64px;
  align-items: center;
  margin: 56px calc(-1 * var(--pad)) 0;
  padding: 64px var(--pad);
  border-top: 1px solid var(--line);
}

.feature + .feature { margin-top: 0; }
.feature:nth-of-type(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); }
.feature:nth-of-type(even) .copy { order: 2; }
.feature .copy p { color: var(--ink-2); }
.feature .copy p + p { margin-top: 12px; }
.feature h3 { margin-bottom: 14px; font: 500 30px/1.12 var(--serif); letter-spacing: -0.015em; }

.small {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 calc(-1 * var(--pad)) calc(-1 * var(--section));
  border-bottom: 0;
}

.small > div { padding: 34px 28px 42px; background: var(--paper); }

/* local-first */

.local {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.track {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sunk);
}

.track li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 16px;
  padding: 20px 22px;
}

.track li + li { border-top: 1px dashed var(--line); }

.track li::before {
  content: "";
  grid-row: 1 / 4;
  width: 16px;
  height: 16px;
  margin-top: 4px;
  border: 1.5px solid var(--ink-3);
  border-radius: 50%;
}

.track li.now::before { border-color: var(--accent); background: radial-gradient(var(--accent) 0 3.5px, transparent 4px); }
.track b { grid-column: 2; color: var(--ink-2); font-size: 11.5px; }
.track span { grid-column: 2; }
.track b + span { font: 500 20px/1.35 var(--serif); }
.track span + span { color: var(--ink-2); font-size: 15px; }

/* requirements */

.spec {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.needs { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }

.needs li {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: baseline;
  gap: 4px 24px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.needs b { color: var(--ink-2); }

/* download */

.download { display: flex; flex-direction: column; align-items: center; text-align: center; }
.download img { width: 104px; height: 104px; margin: 0 0 26px; }
.download .kicker { justify-content: center; }
.download h2 { margin: 0 auto; }
.download .section-lede { margin: 20px auto 0; }
.download .cta { justify-content: center; }

/* footer */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  padding-block: 30px 48px;
  font: 13px/1.6 var(--mono);
  color: var(--ink-2);
}

.foot a { color: var(--ink-2); }

/* Chinese has no capitals or italics, and its lines are broken by hand */

:lang(zh) h1 { max-width: none; letter-spacing: 0; line-height: 1.12; }
:lang(zh) h2, :lang(zh) .steps h3, :lang(zh) .feature h3 { letter-spacing: 0; }
:lang(zh) h1 em, :lang(zh) h2 em, :lang(zh) .shot figcaption { font-style: normal; }
:lang(zh) .label, :lang(zh) .kicker, :lang(zh) .track b, :lang(zh) .needs b, :lang(zh) .shot figcaption span { text-transform: none; letter-spacing: 0.04em; }

@media (max-width: 1000px) {
  .small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .steps { grid-template-columns: minmax(0, 1fr); }
  .feature, .feature:nth-of-type(even) { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-block: 48px; }
  .feature:nth-of-type(even) .copy { order: 0; }
  .local, .spec { grid-template-columns: minmax(0, 1fr); gap: 36px; }
}

@media (max-width: 600px) {
  :root { --pad: 16px; --section: 64px; }
  body { font-size: 16px; }
  .frame { border-inline: 0; }
  .nav { gap: 8px 16px; }
  .nav .hide-small { display: none; }
  .hero .frame { padding-block: 56px 56px; }
  .plate { padding-block: 0 40px; }
  .note { grid-template-columns: minmax(0, 1fr); padding-block: 28px; }
  .small { grid-template-columns: minmax(0, 1fr); }
  .small > div { padding: 28px var(--pad) 32px; }
  .needs li { grid-template-columns: minmax(0, 1fr); }
  .shot picture img { border-radius: 8px; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero .eyebrow, .hero h1, .hero .lede, .hero .cta, .plate .shot { animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero h1 { animation-delay: 0.05s; }
  .hero .lede { animation-delay: 0.12s; }
  .hero .cta { animation-delay: 0.19s; }
  .plate .shot { animation-delay: 0.28s; }
  /* the marker drawn across the word, as a highlight is made */
  .hero mark {
    background: linear-gradient(var(--mark), var(--mark)) no-repeat 0 0 / 100% 100%;
    animation: swipe 0.7s 0.7s cubic-bezier(0.6, 0, 0.25, 1) both;
  }
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes swipe { from { background-size: 0 100%; } }
