/* learn lean — design system
   one ground, one accent, three faces: Inter (UI), JetBrains Mono (code), Newsreader (one display moment) */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2212, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/inter-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2212, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2212, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/inter-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2212, U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/newsreader-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/jbmono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/jbmono-500.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/jbmono-700.woff2') format('woff2');
}

:root {
  --bg: #0a0c0b;
  --surface: #101413;
  --surface-2: #151a18;
  --surface-3: #1b211f;
  --line: rgba(237, 234, 227, 0.1);
  --line-2: rgba(237, 234, 227, 0.18);
  --ink: #edeae3;
  --ink-dim: #b9bdb4;
  --muted: #868e87;
  --accent: #e9a64e;
  --accent-soft: rgba(233, 166, 78, 0.14);
  --accent-line: rgba(233, 166, 78, 0.38);
  --pass: #6fcb8e;
  --fail: #e8796a;
  --ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans CJK SC', 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', ui-monospace, 'Noto Sans Mono CJK SC', monospace;
  --display: 'Newsreader', 'Songti SC', 'Noto Serif CJK SC', serif;

  --wrap: 1180px;
  --gut: 32px;
  --r: 6px;
  --r-lg: 10px;

  --t-hero: clamp(2.5rem, 5.6vw, 4.6rem);
  --t-h2: clamp(1.85rem, 3.3vw, 2.9rem);
  --t-h3: 1.25rem;
  --t-body: 1.03rem;
  --t-sm: 0.845rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: var(--t-body);
  line-height: 1.65;
  font-feature-settings: 'cv05' 1, 'ss01' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--accent-soft); color: var(--ink); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gut);
}

/* ---------- skip link ---------- */
.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: #14100a;
  border-radius: var(--r);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}
.skip:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

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

/* ---------- header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
}
.site-head__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-right: auto;
}
.brand__mark {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  padding: 5px 6px 4px;
  border-radius: 4px;
  background: var(--accent);
  color: #14100a;
  letter-spacing: 0;
}
.brand__text { font-size: 0.98rem; }
.brand:hover .brand__text { color: var(--accent); }

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.9rem;
  color: var(--ink-dim);
}
.nav a {
  position: relative;
  padding-block: 4px;
}
.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transition: right 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { right: 0; }

.nav-toggle { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  min-height: 44px;
  border-radius: var(--r);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease,
    box-shadow 0.16s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--accent);
  color: #16110a;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 8px 24px -14px rgba(233, 166, 78, 0.8);
}
.btn--primary:hover {
  background: #f2b463;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.24) inset, 0 10px 28px -12px rgba(233, 166, 78, 0.9);
}
.btn--ghost {
  border-color: var(--line-2);
  color: var(--ink);
}
.btn--ghost:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.btn--sm { padding: 7px 14px; min-height: 36px; font-size: 0.86rem; }

/* ---------- sections ---------- */
.section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(80px, 11vh, 132px);
  border-top: 1px solid var(--line);
}
/* Only the opening spread claims a full screen; later sections size to their
   content so a short one never leaves a dead half-screen of black. */
.section--first {
  min-height: calc(100vh - 60px);
  border-top: 0;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--accent-line);
}

h2.section__title {
  font-size: var(--t-h2);
  font-weight: 600;
  letter-spacing: -0.032em;
  line-height: 1.08;
  max-width: 20ch;
  text-wrap: balance;
}
.section__lede {
  margin-top: 20px;
  max-width: 56ch;
  color: var(--ink-dim);
  font-size: 1.05rem;
}

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 44px;
  align-items: center;
}
@media (min-width: 1000px) {
  .hero {
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
    gap: 60px;
  }
}
.hero__title {
  font-size: var(--t-hero);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.96;
  text-wrap: balance;
}
/* one display moment: latin serif italic. Newsreader has no CJK, so this line
   is deliberately the English one — the Chinese headline stays in Inter. */
.hero__display {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.5rem, 3.1vw, 2.35rem);
  line-height: 1.16;
  letter-spacing: -0.018em;
  color: var(--accent);
  margin-top: 16px;
  max-width: 24ch;
}
.hero__sub {
  margin-top: 24px;
  max-width: 42ch;
  color: var(--ink-dim);
  font-size: 1.08rem;
}
.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.hero__facts b { color: var(--ink); font-weight: 500; }
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* ---------- live demo ---------- */
.demo {
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 40px 90px -60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.demo__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.demo__dots { display: flex; gap: 5px; }
.demo__dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-2);
}
.demo__file {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  margin-left: 4px;
}
.demo__spacer { margin-left: auto; }
.demo__pause {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 7px;
  min-height: 24px;
  transition: color 0.15s, border-color 0.15s;
}
.demo__pause:hover { color: var(--ink); border-color: var(--line-2); }

.demo__code {
  margin: 0;
  padding: 18px 20px;
  font-family: var(--mono);
  font-size: 0.845rem;
  line-height: 1.72;
  color: var(--ink);
  min-height: 168px;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}
.demo__code .k { color: #c792ea; }
.demo__code .tac { color: #82d2c8; }
.demo__code .num { color: #e9a64e; }
.demo__code .ty { color: #9fc7e8; }
.demo__code .cm { color: #5c6763; font-style: italic; }
.demo__caret {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  vertical-align: -0.16em;
  background: var(--accent);
  animation: blink 1.05s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.demo__goal {
  border-top: 1px solid var(--line);
  padding: 14px 20px 16px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--muted);
  min-height: 96px;
}
.demo__goal .lbl {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.demo__goal #demo-goal {
  color: var(--accent);
  white-space: pre-wrap;
  line-height: 1.62;
}
.demo__goal #demo-goal .hyp { color: var(--ink-dim); }
.demo__goal .hyp { color: var(--ink-dim); }
.demo__verdict {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--pass);
}
.demo__verdict--wait { color: var(--muted); }

/* ---------- workbench frame ---------- */
.frame {
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 50px 120px -70px rgba(0, 0, 0, 1);
}
.frame img { width: 100%; }

/* ---------- loop steps ---------- */
.loop {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 48px;
}
@media (min-width: 820px) {
  .loop { grid-template-columns: repeat(3, 1fr); }
}
.loop__item {
  background: var(--bg);
  padding: 28px 26px 30px;
}
.loop__n {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.loop__h {
  margin-top: 14px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.loop__p {
  margin-top: 10px;
  color: var(--ink-dim);
  font-size: 0.95rem;
}
.loop__p code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
}

/* ---------- chapters ---------- */
.chapters {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 48px;
}
@media (min-width: 700px) { .chapters { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .chapters { grid-template-columns: repeat(3, 1fr); } }
/* The 1px gap is the rule colour, so a trailing empty grid cell would show as a
   grey block. This filler keeps the last row flush with the page background. */
.chapters::after {
  content: '';
  background: var(--bg);
}
.chapter {
  background: var(--bg);
  padding: 26px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background 0.2s ease;
}
.chapter:hover { background: var(--surface); }
.chapter__n {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.chapter__t {
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: -0.022em;
}
.chapter__d { color: var(--ink-dim); font-size: 0.92rem; }
.chapter__meta {
  margin-top: auto;
  padding-top: 12px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.chapter__meta .done { color: var(--pass); }

/* ---------- facts ---------- */
.facts {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 48px;
}
@media (min-width: 760px) { .facts { grid-template-columns: repeat(2, 1fr); } }
.fact { background: var(--bg); padding: 26px 24px; }
.fact__k {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.fact__v {
  margin-top: 10px;
  font-size: 1.02rem;
  color: var(--ink);
}
.fact__v code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--accent);
}
.fact__note { margin-top: 8px; color: var(--muted); font-size: 0.88rem; }

/* ---------- cta ---------- */
.cta {
  text-align: left;
  display: grid;
  gap: 28px;
  align-items: end;
}
@media (min-width: 860px) {
  .cta { grid-template-columns: 1fr auto; }
}

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 34px 44px;
  font-size: var(--t-sm);
  color: var(--muted);
}
.site-foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 26px;
  align-items: baseline;
}
.site-foot a { color: var(--ink-dim); border-bottom: 1px solid var(--line-2); }
.site-foot a:hover { color: var(--accent); border-color: var(--accent-line); }

/* ---------- reveal (entrance only, never on scroll) ---------- */
.enter {
  opacity: 0;
  transform: translateY(10px);
  animation: enter 0.62s cubic-bezier(0.22, 0.9, 0.25, 1) forwards;
}
.enter--1 { animation-delay: 0.05s; }
.enter--2 { animation-delay: 0.13s; }
.enter--3 { animation-delay: 0.2s; }
.enter--4 { animation-delay: 0.27s; }
@keyframes enter {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .enter { opacity: 1; transform: none; }
  .demo__caret { animation: none; }
}

/* ---------- mobile nav ---------- */
@media (max-width: 760px) {
  :root { --gut: 20px; }
  .nav { display: none; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 6px 10px;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    font-size: 0.86rem;
  }
  .nav-open .nav {
    display: flex;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gut) 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .nav-open .nav a { padding-block: 13px; border-bottom: 1px solid var(--line); }
  .nav-open .nav a::after { display: none; }
  .hero__actions .btn { flex: 1 1 auto; }
}
