/* ============================================================
   TRACKUP — MAKER'S NOTES
   Design tokens + layout + Trackup visual language
   ============================================================ */

/* ---------- DESIGN TOKENS ---------- */
:root {
  /* Typography */
  --font-display: "Pangea", "Pangea Variable", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Color — warm near-black + warm off-white + one brick-red accent */
  --ink: hsl(25, 8%, 6%);
  --ink-soft: hsl(25, 6%, 22%);
  --ink-quiet: hsl(25, 5%, 45%);
  --paper: hsl(30, 14%, 96%);
  --paper-pure: hsl(0, 0%, 100%);
  --paper-warm: hsl(28, 18%, 92%);

  --rule: hsla(25, 8%, 6%, 0.12);
  --rule-strong: hsla(25, 8%, 6%, 0.28);
  --shadow-soft: hsla(25, 8%, 6%, 0.08);

  --accent: hsl(14, 72%, 52%);
  --accent-quiet: hsla(14, 72%, 52%, 0.15);

  /* Trackup signature: offset block shadow */
  --shadow-block: 6px 6px 0 var(--ink);
  --shadow-block-sm: 3px 3px 0 var(--ink);

  /* Spacing scale */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 32px;
  --space-lg: 64px;
  --space-xl: 104px;
  --space-2xl: 168px;

  /* Layout */
  --content-max: 620px;
  --label-col: 200px;
  --gutter: 120px;
}

/* ---------- RESET ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "ss01", "ss02";  /* Fraunces stylistic sets for slight quirk */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  transition: color 200ms ease;
}

a:hover {
  color: var(--accent);
}

ul {
  list-style: none;
}

/* ============================================================
   PROGRESS BAR (top of page, fills as you scroll)
   ============================================================ */
.progress-rail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 100;
  pointer-events: none;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 80ms linear;
}

/* ============================================================
   TOP STICKY META BAR
   ============================================================ */
.top-bar {
  position: fixed;
  top: 3px;  /* leave room for progress rail */
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 14px 32px;
  background: hsla(30, 14%, 96%, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.top-bar__brand {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.14em;
}

.top-bar__divider,
.top-bar__kicker {
  color: var(--ink-quiet);
}

.top-bar__spacer {
  flex: 1;
}

.top-bar__date {
  color: var(--ink-quiet);
}

/* 语言切换：EN ⇄ 中文 */
.top-bar__lang {
  color: var(--ink);
  text-decoration: none;
  padding: 2px 8px;
  border: 1.5px solid var(--ink);
  margin-right: var(--space-xs);
  transition: background 180ms ease, color 180ms ease;
}

.top-bar__lang:hover {
  background: var(--ink);
  color: var(--paper-pure);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 80px;
  text-align: center;
  position: relative;
}

.hero__logo-wrap {
  width: min(380px, 70vw);
  margin-bottom: var(--space-lg);
  opacity: 0;
  transform: scale(0.96);
  animation: hero-logo-in 800ms cubic-bezier(0.16, 1, 0.3, 1) 100ms forwards;
}

.hero__logo {
  width: 100%;
  height: auto;
  filter: contrast(1.05);
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(36px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
  max-width: 14ch;
  margin-bottom: var(--space-lg);
  opacity: 0;
  transform: translateY(14px);
  animation: hero-text-in 700ms cubic-bezier(0.16, 1, 0.3, 1) 350ms forwards;
}

.hero__byline {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  opacity: 0;
  animation: hero-text-in 600ms cubic-bezier(0.16, 1, 0.3, 1) 600ms forwards;
}

.hero__byline-label {
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.02em;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-quiet);
}

.hero__byline-dot {
  margin: 0 6px;
  color: var(--rule-strong);
}

.hero__scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--ink-quiet);
  opacity: 0;
  animation:
    hero-text-in 600ms cubic-bezier(0.16, 1, 0.3, 1) 1000ms forwards,
    scroll-hint-bob 2.4s ease-in-out 1600ms infinite;
}

@keyframes hero-logo-in {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes hero-text-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scroll-hint-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(6px); }
}

/* ============================================================
   BODY GRID — 2 columns desktop, 1 column mobile
   ============================================================ */
.body-grid {
  display: grid;
  grid-template-columns: var(--label-col) var(--gutter) minmax(0, var(--content-max)) 1fr;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px var(--space-2xl);
  position: relative;
}

/* ---------- LABEL NAV (sticky left rail, desktop only) ---------- */
.label-nav {
  grid-column: 1 / 2;
  position: sticky;
  top: 80px;
  align-self: start;
  padding-top: var(--space-lg);
  height: fit-content;
}

.label-nav ul {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.label-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  text-decoration: none;
  padding: 4px 0;
  position: relative;
  transition: color 220ms ease, padding-left 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.label-item::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--accent);
  transform: translateY(-50%) scale(0);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.label-item:hover {
  color: var(--ink-soft);
}

.label-item.active {
  color: var(--ink);
  padding-left: 4px;
}

.label-item.active::before {
  transform: translateY(-50%) scale(1);
}

.label-item.active .label-item__name {
  color: var(--accent);
}

.label-item__num {
  font-weight: 500;
}

.label-item__slash {
  color: var(--rule-strong);
}

.label-item__name {
  font-weight: 400;
  transition: color 220ms ease;
}

/* ---------- CONTENT COLUMN ---------- */
.content {
  grid-column: 3 / 4;
  padding-top: var(--space-lg);
}

.chapter {
  padding: var(--space-xl) 0;
  border-bottom: 1px solid var(--rule);
}

.chapter:first-child {
  padding-top: var(--space-lg);
}

.chapter:last-of-type {
  border-bottom: none;
}

.chapter__mobile-label {
  display: none;  /* shown only on mobile */
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  margin-bottom: var(--space-md);
}

.chapter__mobile-label span {
  color: var(--ink);
  font-weight: 500;
}

.chapter__heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 3.5vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: var(--space-md);
  max-width: 18ch;
}

.chapter p {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: var(--space-md);
  font-variation-settings: "opsz" 16, "SOFT" 50;
}

.lede {
  font-size: 22px !important;
  line-height: 1.55 !important;
  color: var(--ink) !important;
  font-variation-settings: "opsz" 20, "SOFT" 30 !important;
  margin-bottom: var(--space-lg) !important;
  font-weight: 400;
}

/* ============================================================
   SCREENSHOTS
   ============================================================ */
.screenshot {
  margin: var(--space-lg) 0;
}

/* Phone screenshots: Trackup's own UI (brutal black borders + offset shadow) */
.screenshot--phone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.screenshot--phone img {
  width: min(360px, 80%);
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow-block);
  background: var(--paper-pure);
}

/* Inline screenshots: Claude conversations — clean, no border, integrated */
.screenshot--inline img {
  width: 100%;
  border-radius: 2px;
  box-shadow: 0 1px 0 var(--rule), 0 0 0 1px var(--rule);
}

.screenshot figcaption {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-quiet);
  text-align: center;
  max-width: 50ch;
  margin: var(--space-sm) auto 0;
  line-height: 1.5;
  text-transform: none;
}

/* ============================================================
   SIGNOFF
   ============================================================ */
.signoff {
  margin-top: var(--space-lg);
  padding: var(--space-md) 0 0;
  border-top: 2.5px solid var(--ink);
}

.signoff__text {
  font-family: var(--font-display) !important;
  font-size: 20px !important;
  line-height: 1.4 !important;
  font-weight: 500 !important;
  color: var(--ink) !important;
  letter-spacing: -0.01em !important;
  margin-bottom: var(--space-md) !important;
  font-variation-settings: normal !important;
}

.signoff__links {
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--ink-quiet) !important;
  font-variation-settings: normal !important;
}

.signoff__links a {
  color: var(--ink);
  margin: 0 4px;
}

.signoff__links span {
  color: var(--rule-strong);
  margin: 0 4px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: var(--space-md) 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-xs);
}

.site-footer__dot {
  color: var(--rule-strong);
}

/* ============================================================
   RESPONSIVE — MOBILE (<768px)
   ============================================================ */
@media (max-width: 900px) {
  :root {
    --gutter: 60px;
    --label-col: 140px;
  }

  .body-grid {
    grid-template-columns: var(--label-col) var(--gutter) minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    font-size: 17px;
  }

  .top-bar {
    padding: 12px 20px;
    font-size: 10px;
  }

  .top-bar__kicker,
  .top-bar__divider {
    display: none;
  }

  .hero {
    padding: 100px 24px 60px;
  }

  .hero__logo-wrap {
    width: min(280px, 75vw);
    margin-bottom: var(--space-md);
  }

  .hero__title {
    font-size: clamp(32px, 9vw, 48px);
    margin-bottom: var(--space-md);
  }

  /* Mobile: collapse to single column, hide sticky label nav, show inline labels */
  .body-grid {
    grid-template-columns: 1fr;
    padding: 0 24px var(--space-xl);
  }

  .label-nav {
    display: none;
  }

  .content {
    grid-column: 1;
    padding-top: var(--space-md);
  }

  .chapter {
    padding: var(--space-lg) 0;
  }

  .chapter__mobile-label {
    display: block;
  }

  .chapter p {
    font-size: 17px;
    line-height: 1.65;
  }

  .lede {
    font-size: 19px !important;
  }

  .chapter__heading {
    font-size: clamp(24px, 6vw, 30px);
    max-width: none;
  }

  .screenshot--phone img {
    width: min(300px, 85%);
    box-shadow: var(--shadow-block-sm);
  }

  .signoff__text {
    font-size: 18px !important;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
