/* LiveForge — main.css. Tokens: see DESIGN.md. No colour, size, spacing,
   or radius outside the token set ships in this file. */

:root {
  --canvas: #0d1117;
  --canvas-hero: #000000;
  --surface: #161b22;
  --surface-raised: #1c2128;
  --border: #30363d;
  --border-subtle: #21262d;
  --text: #f0f6fc;
  --text-strong: #ffffff;
  --text-muted: #7d8590;
  --text-faint: #848d97;
  --accent-green: #3fb950;
  --accent-green-glow: #5fed83;
  --cta-green: #08872b;
  --link-blue: #79c0ff;
  --link-blue-bright: #8dd6ff;
  --focus: #1f6feb;
  --danger: #f85149;
  --warning: #d29922;
  --hover-border: #484f58;
  --lang-python: #3572a5;
  --lang-typescript: #3178c6;
  --lang-javascript: #f1e05a;
  --lang-shell: #89e051;
  --lang-html: #e34c26;
  --lang-css: #563d7c;
  --text-hero: 64px;
  --text-h2: 32px;
  --text-h3: 24px;
  --text-body: 17px;
  --text-small: 15px;
  --text-caption: 12px;
  --font-body: "Mona Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --font-code: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@font-face {
  font-family: "Mona Sans";
  src: url("../fonts/mona-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 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;
  size-adjust: 100%;
  ascent-override: 95%;
  descent-override: 24%;
}

@font-face {
  font-family: "Mona Sans";
  src: url("../fonts/mona-sans-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 200 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+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  size-adjust: 100%;
  ascent-override: 95%;
  descent-override: 24%;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

a { color: var(--link-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 10;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: var(--text-small);
}
.skip-link:focus { top: 8px; text-decoration: none; }

/* Visually hidden but announced by screen readers (A9: posted days). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

section { padding-top: 96px; padding-bottom: 96px; }
section > .wrap > h2 { margin-top: 0; }

h1, h2, h3 { color: var(--text); }
h2 { font-size: var(--text-h2); line-height: 1.25; letter-spacing: -0.8px; font-weight: 460; }
h3 { font-size: var(--text-h3); line-height: 1.3; letter-spacing: -0.4px; font-weight: 500; }

.eyebrow {
  font-size: var(--text-caption);
  line-height: 1.5;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--link-blue-bright);
  margin: 0 0 16px 0;
}

.section-sub {
  color: var(--text-muted);
  font-size: var(--text-body);
  max-width: 640px;
  margin: 0 0 32px 0;
}

.section-head { margin-bottom: 32px; }
.section-head h2 { margin: 0 0 16px 0; }
.section-head .section-sub { margin-bottom: 0; }

.freshness {
  font-size: var(--text-caption);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-faint);
  margin: 0 0 32px 0;
}
.freshness .status-stale { color: var(--warning); }
.freshness .status-live { color: var(--accent-green); }

/* Nav */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
}
.site-nav .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
  font-size: var(--text-body);
  white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand img {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: block;
}
.nav-links {
  display: flex;
  gap: 24px;
  margin-left: auto;
  list-style: none;
  padding: 0;
}
.nav-links a { color: var(--text-muted); font-size: var(--text-small); }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 24px;
  border-radius: 999px;
  font-size: var(--text-small);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--cta-green);
  color: var(--text-strong);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
.btn-primary:hover { background: var(--cta-green); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--hover-border); }

/* Hero */
.hero {
  background: var(--canvas-hero);
  position: relative;
  overflow: hidden;
  padding-top: 96px;
  padding-bottom: 96px;
  text-align: center;
}
.hero .wrap { position: relative; z-index: 2; }
.hero h1 {
  color: var(--text-strong);
  font-size: var(--text-hero);
  line-height: 1.05;
  letter-spacing: -2.24px;
  font-weight: 425;
  max-width: 640px;
  margin: 0 auto 24px auto;
}
.hero .subhead {
  color: var(--text-muted);
  font-size: var(--text-body);
  max-width: 640px;
  margin: 0 auto 32px auto;
}
.hero .supporting {
  color: var(--text-faint);
  font-size: var(--text-small);
  margin: 32px auto 0 auto;
}
.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-canvas {
  position: absolute;
  top: 0;
  left: 50%; /* B1-2: confined to the right half — right-aligned, never
    behind the headline text (design-plan 3.1 / 4.1) */
  width: 50%;
  height: 100%;
  pointer-events: none;
  opacity: 0.5;
  z-index: 1;
}
.scroll-cue {
  display: block;
  margin: 64px auto 0 auto;
  color: var(--text-muted);
  font-size: var(--text-caption);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
}
.scroll-cue span { display: block; margin-top: 4px; }

/* Stats strip */
.stats-strip { background: var(--canvas); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}
.stat { padding: 24px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--border-subtle); }
.stat-number {
  display: block;
  font-size: var(--text-h2);
  line-height: 1.25;
  font-weight: 460;
  color: var(--accent-green);
}
.stat-label {
  display: block;
  margin-top: 8px;
  font-size: var(--text-caption);
  line-height: 1.5;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-muted);
}
.stat-note {
  display: block;
  margin-top: 4px;
  font-size: var(--text-caption);
  color: var(--text-faint);
}

/* Cards */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  min-width: 0; /* F3: 1fr is minmax(auto, 1fr) — without this a wide
    min-content (e.g. a nowrap link) widens the track past the viewport */
}
a.card { color: var(--text); display: block; }
a.card:hover {
  border-color: var(--hover-border);
  background: var(--surface-raised);
  text-decoration: none;
}
.card h3 { margin: 0 0 8px 0; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--link-blue); }
.card .one-line { color: var(--text); margin: 0 0 16px 0; }
.card .intro { color: var(--text-muted); font-size: var(--text-small); margin: 0 0 16px 0; }
.card-meta {
  color: var(--text-muted);
  font-size: var(--text-small);
  margin: 0 0 16px 0;
}
.card-meta .role { color: var(--text); }
.card .result { color: var(--text-muted); font-size: var(--text-small); margin: 0 0 16px 0; }
.card .result strong { color: var(--text); font-weight: 500; }
.card-links { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--text-small); }
.card-links a { overflow-wrap: anywhere; } /* F3/B1-5: links wrap instead of forcing the card track wide */
.card .stale-label { color: var(--warning); }
.stack-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0 0 16px 0;
  padding: 0;
}
.stack-tags li {
  font-size: var(--text-caption);
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
}
.lang-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--border);
  vertical-align: -1px;
  margin-right: 8px;
}
.lang-dot[data-lang="Python"] { background: var(--lang-python); }
.lang-dot[data-lang="TypeScript"] { background: var(--lang-typescript); }
.lang-dot[data-lang="JavaScript"] { background: var(--lang-javascript); }
.lang-dot[data-lang="Shell"] { background: var(--lang-shell); }
.lang-dot[data-lang="HTML"] { background: var(--lang-html); }
.lang-dot[data-lang="CSS"] { background: var(--lang-css); }
.live-proof {
  background: var(--canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 16px 0;
  font-size: var(--text-small);
  color: var(--text-muted);
}
.live-proof dt {
  font-size: var(--text-caption);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-faint);
}
.live-proof dd { margin: 4px 0 16px 0; color: var(--text); }
.live-proof dd:last-child { margin-bottom: 0; }
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-green-glow);
  margin-right: 8px;
  vertical-align: 1px;
}
.all-repos { text-align: center; margin-top: 32px; font-size: var(--text-small); }

/* Automation */
.automation { background: var(--canvas); }
.automation-body { margin-top: 24px; }
.automation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.automation-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  min-width: 0; /* F3: lets the track shrink so the code panel scrolls internally */
}
.automation-panel h3 { margin-top: 0; }
.automation-panel p { color: var(--text-muted); font-size: var(--text-small); }
.automation-panel p:last-child { margin-bottom: 0; }
.proof-list { list-style: none; margin: 0; padding: 0; }
.proof-list div {
  padding-top: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.proof-list div:first-child { padding-top: 0; }
.proof-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.proof-list dt {
  font-size: var(--text-caption);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-faint);
}
.proof-list dd { margin: 4px 0 0 0; color: var(--text); font-size: var(--text-small); }
.proof-list dd a { word-break: break-word; }

/* F6 (design-plan 3.4): the last posted word, rendered as it appears on
   Telegram — a message card, not a metadata table. Tokens only. */
.msg-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 16px 0;
}
.msg-card .msg-meta {
  font-size: var(--text-caption);
  line-height: 1.5;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-faint);
  margin: 0 0 8px 0;
}
.msg-card .msg-word {
  font-size: var(--text-h3);
  line-height: 1.3;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 8px 0;
}
.msg-card .msg-pos {
  font-size: var(--text-caption);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  vertical-align: 4px;
  margin-left: 8px;
}
.msg-card .msg-phonetic {
  font-family: var(--font-code);
  font-size: var(--text-small);
  color: var(--text-muted);
  margin-left: 8px;
}
.msg-card .msg-def { color: var(--text); margin: 0 0 8px 0; }
.msg-card .msg-example { color: var(--text-muted); font-size: var(--text-small); margin: 0; }
.msg-fallback { color: var(--text-muted); font-size: var(--text-small); margin: 0 0 16px 0; }
.quiz-card {
  background: var(--canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 16px 0;
}
.quiz-card .quiz-label {
  font-size: var(--text-caption);
  line-height: 1.5;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-faint);
  margin: 0 0 8px 0;
}
.quiz-card .quiz-question { color: var(--text); font-weight: 500; margin: 0 0 8px 0; }
.quiz-card .quiz-options {
  list-style-type: upper-alpha;
  margin: 0;
  padding-left: 24px;
  color: var(--text-muted);
  font-size: var(--text-small);
}
.quiz-card .quiz-options li { padding-top: 4px; padding-bottom: 4px; }
.timeline { list-style: none; margin: 0 0 24px 0; padding: 0; }
.timeline li {
  display: flex;
  gap: 16px;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: var(--text-small);
  color: var(--text-muted);
}
.timeline time {
  font-family: var(--font-code);
  color: var(--text);
  white-space: nowrap;
}
.code-panel {
  background: var(--canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
}
.code-panel code {
  font-family: var(--font-code);
  font-size: var(--text-small);
  line-height: 1.5;
  color: var(--text);
  white-space: pre;
}
.code-panel .comment { color: var(--text-muted); }
.day-strip {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.day-strip li { text-align: center; flex: 1; }
.day-strip .day-dot {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin: 0 auto 4px auto;
}
.day-strip .day-dot.posted { background: var(--accent-green); border-color: var(--accent-green); }
.day-strip .day-name {
  font-size: var(--text-caption);
  color: var(--text-faint);
  text-transform: uppercase;
}
.ticker-band {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 24px;
  margin-top: 24px;
}
.ticker-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}
.ticker-head h3 {
  font-size: var(--text-caption);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
}
.ticker-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 500;
  padding: 4px 8px;
  cursor: pointer;
  min-height: 24px;
}
.ticker-toggle:hover { color: var(--text); border-color: var(--hover-border); }
.ticker {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  min-height: 24px;
}
.ticker li {
  font-size: var(--text-small);
  color: var(--text-muted);
  padding-top: 4px;
  padding-bottom: 4px;
}
.ticker li a { color: var(--text); }
.ticker-static { overflow: visible; }

/* How I work */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  position: relative;
}
/* B1-3: the 1px connector line that turns three blocks into a process —
   a horizontal line behind the numbers on desktop. */
.steps::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-subtle);
}
.step { position: relative; padding-top: 0; min-width: 0; }
.step-number {
  display: inline-block;
  position: relative;
  z-index: 1;
  background: var(--canvas);
  padding-right: 16px;
  font-size: var(--text-h2);
  line-height: 1.25;
  font-weight: 460;
  color: var(--accent-green);
  margin-bottom: 16px;
}
.step h3 { margin: 0 0 8px 0; }
.step p { color: var(--text-muted); margin: 0; }

/* Contact */
.contact { background: var(--canvas-hero); text-align: center; }
.contact h2 { margin-top: 0; }
.contact p { color: var(--text-muted); max-width: 640px; margin: 0 auto 32px auto; }
.contact .note {
  color: var(--text-faint);
  font-size: var(--text-caption);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
  margin: 32px auto 0 auto;
}

/* Footer */
.site-footer {
  background: var(--canvas);
  border-top: 1px solid var(--border-subtle);
  padding-top: 48px;
  padding-bottom: 48px;
  font-size: var(--text-small);
  color: var(--text-muted);
}
.site-footer .wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.site-footer p { margin: 0; }
.site-footer .updated { color: var(--text-faint); }

/* Reveal (JS enhancement only — default state is visible) */
.js .reveal { opacity: 0; transform: translateY(16px); }
.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 600ms cubic-bezier(0.2, 0.6, 0.2, 1), transform 600ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

/* Tablet */
@media (max-width: 1023px) {
  .hero h1 { font-size: clamp(40px, 6vw, 64px); letter-spacing: -1.2px; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--border-subtle); }
}

/* F8: hide the centre nav links up to 699px. At 640-644px the full nav
   row's min-content was 645px (5px wider than the viewport), failing A7
   (200% zoom = 640 CSS px). Below 700px the nav is avatar + name +
   GitHub button — the same treatment as mobile. */
@media (max-width: 699px) {
  .nav-links { display: none; }
}

/* Mobile */
@media (max-width: 639px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  section { padding-top: 64px; padding-bottom: 64px; }
  .hero { text-align: left; padding-top: 64px; padding-bottom: 64px; }
  .hero h1 { font-size: 40px; line-height: 1.1; letter-spacing: -1.2px; margin-left: 0; margin-right: 0; }
  .hero .subhead { margin-left: 0; margin-right: 0; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .hero-canvas { opacity: 0.25; }
  .scroll-cue { margin-top: 48px; }
  .project-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .card-links { flex-direction: column; gap: 0; }
  .card-links a { display: flex; align-items: center; min-height: 44px; } /* B1-5: full-width 44px tappable rows */
  .automation-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  /* B1-3 mobile: the connector runs vertically on the left, through the
     number centres (step padding 32px + ~6px number half-width). */
  .steps::before { top: 16px; bottom: 16px; left: 38px; right: auto; width: 1px; height: auto; }
  .step { padding-left: 32px; }
  .step-number { display: block; padding-right: 0; }
  .site-footer { text-align: center; } /* B1-4: stacked, centred footer */
  .site-footer .wrap { align-items: center; }
  .stat-number { font-size: var(--text-h3); }
  .step-number { font-size: var(--text-h3); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .ticker li { transition: none; }
}
