/* By JTT — page styles. Mobile-first, minimal, editorial.
 * Warm paper + carbon ink. One signal accent. Hairlines. No ornament.
 *
 * Color roles (tokenized — single source for the palette):
 *   --paper   page canvas       var(--paper)  warm paper
 *   --ink     primary text      var(--ink)  carbon ink
 *   --surface raised panels     var(--surface)  card / inset
 *   --line    hairline borders  var(--line)
 *   --muted   secondary text    var(--muted)
 *   --signal  accent / action   var(--signal)  vermilion (scarce)
 *   --signal-soft  focus tint   var(--signal-soft)
 *   --ok      success           var(--ok)
 * 60-30-10: paper narrates, ink structures, signal acts (≤10%). */

:root {
  --paper: #f5f2eb;
  --ink: #161614;
  --surface: #fdfbf7;
  --line: #e3ddd2;
  --muted: #6b675f;
  --signal: #be3718;
  --signal-soft: #e8834a;
  --ok: #2e7d32;
  --chip: #efe9df;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { margin: 0; }

/* Skip link — visually hidden until focused (keyboard users) */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 200;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: "Geist Mono", monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
}
.skip-link:focus {
  top: 1rem;
}

/* Global visible focus — consistent keyboard path on every control */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* ---- Typography system ----
 * 4-step scale (hook → bridge → detail → meta):
 *   display  clamp(2.8rem, 7vw, 4.5rem)  hero / page titles
 *   section  22px                        section heads, h2
 *   lead     18px                        ledes, body-lead
 *   body     16px                        paragraphs (h3 17px, labels 12px mono)
 * Measure: prose 65ch; lede 44ch. Line-height unitless. */

h1, h2, h3, h4 {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  line-height: 1.15;
  font-weight: 600;
  text-wrap: balance;
}

h1.title { font-size: clamp(2.8rem, 7vw, 4.5rem); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 28px 0 8px; }
h3 { font-size: 17px; margin: 24px 0 6px; }

p { margin: 0 0 14px; color: var(--ink); }
a { color: var(--ink); }
a:hover { color: var(--signal); }

.label {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 6px;
}

.tagline {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

/* ---- Page head ---- */
.page-head { padding: 24px 0 8px; }
.page-head h1 { font-size: clamp(2.5rem, 6vw, 4rem); margin: 0 0 8px; letter-spacing: -0.02em; }

/* ---- Homepage hero ---- */
.hero { padding: 48px 0 24px; }
.hero h1 { font-size: clamp(3rem, 9vw, 5rem); margin: 0 0 12px; letter-spacing: -0.02em; }
.hero .lede { font-size: 18px; color: var(--muted); max-width: 44ch; margin: 0 0 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---- Sections ---- */
.section { margin: 40px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.section-head h2 { margin: 0; font-size: 20px; }
.section-head a { font-family: "Geist Mono", monospace; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); text-decoration: none; }
.section-head a:hover { color: var(--signal); }

/* ---- Work / link list ---- */
.work-list, .link-list, .post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}
.work-item, .link-list li, .post-item { border-bottom: 1px solid var(--line); }
.work-item a, .link-list a {
  display: flex;
  padding: 14px 0;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
}
.work-item a {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.link-list a {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.work-item a:hover, .link-list a:hover { color: var(--signal); }
.work-item .work-name { font-weight: 600; font-size: 18px; }
.work-item .work-kind, .link-note { font-family: "Geist Mono", monospace; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.work-item .work-desc { color: var(--muted); font-size: 14px; line-height: 1.5; max-width: 56ch; }

/* ---- Writing list ---- */
.post-item { padding: 18px 0; }
.post-item a { text-decoration: none; color: var(--ink); }
.post-item a:hover { color: var(--signal); }
.post-item .post-title { font-size: 20px; font-weight: 600; }
.post-item .post-meta { font-family: "Geist Mono", monospace; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 4px; }
.post-item .post-desc { color: var(--muted); font-size: 15px; margin-top: 6px; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 12px 20px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: "Geist Mono", monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 100ms ease;
}
.btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn:active { transform: scale(0.97); }
.btn.btn-primary { background: var(--ink); color: var(--paper); }
.btn.btn-primary:hover { background: var(--signal); border-color: var(--signal); }

/* ---- Cards (projects) ---- */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 16px 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: border-color 150ms ease;
}
.card:hover, .card:focus-visible { border-color: var(--signal); }
.card:focus-visible { outline: 3px solid var(--signal-soft); outline-offset: 2px; }
.card .card-title { font-weight: 600; font-size: 18px; margin: 0 0 4px; }
.card .card-kind { font-family: "Geist Mono", monospace; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.card .card-desc { color: var(--muted); font-size: 14px; margin: 8px 0 0; line-height: 1.55; }

@media (min-width: 641px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
  /* A trailing odd card spans the full row instead of leaving an orphan cell. */
  .card-grid > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---- Article ---- */
.article-head { padding: 24px 0 8px; }
.article-head h1 { font-size: 38px; margin: 0 0 8px; letter-spacing: -0.02em; }
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 24px;
}
.article-meta .author-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); }

/* ---- Prose (blog / about / legal) ---- */
.prose { max-width: 680px; }
.prose h1 { font-size: 36px; }
.prose h2 { font-size: 24px; margin-top: 32px; }
.prose h3 { font-size: 19px; margin-top: 24px; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 16px 22px; padding: 0; }
.prose li { margin-bottom: 6px; }
.prose code { font-family: "Geist Mono", monospace; font-size: 0.9em; background: var(--chip); padding: 2px 5px; border-radius: 4px; }
.prose pre { background: var(--ink); color: var(--paper); padding: 16px; overflow-x: auto; border-radius: 8px; font-family: "Geist Mono", monospace; font-size: 14px; line-height: 1.5; }
.prose pre code { background: transparent; padding: 0; color: inherit; }
.prose blockquote { margin: 0 0 16px; padding: 4px 16px; border-left: 3px solid var(--signal); color: var(--muted); }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 28px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 16px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; font-size: 15px; }
.prose th { background: var(--chip); }

/* ---- Post nav ---- */
.post-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 40px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.post-nav a { font-family: "Geist Mono", monospace; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); text-decoration: none; }
.post-nav a:hover { color: var(--signal); }

/* ---- 404 ---- */
.notfound { text-align: center; padding: 60px 0; }
.notfound h1 { font-size: 80px; margin: 0 0 8px; }
.notfound p { color: var(--muted); }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    transform: none !important;
  }
}

/* ---- Experiments content styles (re-themed to canonical By JTT) ---- */
.heading { margin-bottom: 24px; }
.game-explanation { line-height: 1.65; }
.important { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85em; }

.exp-page { padding-top: 18px; }
.exp-title { font-size: clamp(1.75rem, 4vw, 2rem); margin: 0 0 10px; }
.exp-body { line-height: 1.6; color: var(--ink); }
.exp-body h2 { margin: 22px 0 8px; font-size: 22px; }
.exp-body ul { padding-left: 20px; }
.exp-body li { margin-bottom: 6px; }
.exp-cta { display: inline-block; margin-top: 8px; padding: 10px 18px; background: var(--ink); color: var(--paper); font-weight: 600; text-decoration: none; }
.exp-cta:hover { background: var(--signal); color: var(--paper); }
.exp-video { width: 100%; max-width: 480px; aspect-ratio: 16/9; height: auto; display: block; margin: 0 auto 8px; }
.exp-live { display: inline-block; padding: 0.25rem 0.6rem; border: 1px solid var(--signal); color: var(--signal); font-family: "Geist Mono", monospace; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; }

.brand-statement { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--signal); padding: 14px 16px; margin: 0 0 18px; font-size: 15px; line-height: 1.6; }

.principles { margin: 0 0 20px; padding-left: 22px; }
.principles li { margin-bottom: 6px; }
.principles-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 16px 0; }
.principle { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; }
.principle h3 { margin: 0 0 6px; font-size: 17px; }
.principle p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.pipeline { margin: 0 0 20px; padding-left: 22px; }
.pipeline li { margin-bottom: 6px; line-height: 1.55; }

.timeline { list-style: none; margin: 24px 0 0; padding: 0; }
.timeline-item { position: relative; padding-left: 34px; margin-bottom: 22px; }
.timeline-item::before { content: ''; position: absolute; left: 11px; top: 6px; bottom: -22px; width: 3px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-marker { position: absolute; left: 0; top: 4px; width: 25px; height: 25px; border-radius: 50%; background: var(--signal); border: 3px solid var(--paper); }
.timeline-item-next .timeline-marker { background: var(--line); }
.timeline-card { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; }
.timeline-card-next { border-style: dashed; }
.timeline-date { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--signal); margin-bottom: 6px; }
.timeline-title { margin: 0 0 6px; font-size: 20px; }
.timeline-desc { margin: 0 0 8px; font-size: 14px; line-height: 1.55; }
.timeline-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; }
.timeline-tags li { font-size: 12px; font-weight: 600; color: var(--ink); background: var(--chip); border-radius: 20px; padding: 3px 10px; }

.exp-stats { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 12px 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); }
.exp-stat { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.exp-stat dt { color: var(--muted); font-weight: 600; flex-shrink: 0; }
.exp-stat dd { margin: 0; color: var(--ink); text-align: right; }
@media (min-width: 641px) { .exp-stats { grid-template-columns: 1fr 1fr; } }

.latest { margin: 8px 0 0; }
.latest-title { font-size: 20px; margin: 0 0 10px; }
.latest-card { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line); padding: 16px; }
.latest-card-body { flex: 1; min-width: 0; }
.latest-badge { display: inline-block; background: var(--signal); color: var(--paper); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 10px; margin-bottom: 8px; }
.latest-name { margin: 0 0 6px; font-size: 22px; }
.latest-desc { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.latest-play { display: inline-block; background: var(--ink); color: var(--paper); padding: 9px 16px; font-weight: 600; font-size: 14px; text-decoration: none; }
.latest-play:hover { background: var(--signal); color: var(--paper); }
.latest-thumb { width: 92px; height: 92px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--line); }
.latest-thumb .card-thumb-text { font-size: 40px; font-weight: 700; color: var(--muted); }
.latest-x { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; }
.latest-x-title { margin: 0 0 8px; font-size: 16px; }

.lb-panel { background: var(--surface); border: 1px solid var(--line); padding: 12px 14px; margin: 12px 0; }
.lb-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.lb-title { font-size: 15px; margin: 0; }
.lb-yourscore { font-weight: 700; font-size: 18px; }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lb-empty { color: var(--muted); font-size: 14px; }
.lb-status { color: var(--muted); font-size: 13px; }
.lb-form { display: flex; gap: 8px; margin-top: 10px; }
.lb-form input { flex: 1; padding: 8px 12px; border: 1px solid var(--line); background: var(--paper); font-size: 14px; min-width: 0; }
.lb-submit { padding: 8px 14px; background: var(--ink); color: var(--paper); border: none; font-weight: 600; cursor: pointer; }

.lesson-fixed { color: var(--ok); font-weight: 700; }
.lesson-note { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

.fw-featured { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--signal); padding: 16px; margin-bottom: 18px; }
.fw-version-badge { flex: 0 0 auto; background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px; padding: 6px 10px; align-self: flex-start; }
.fw-version-body { flex: 1; min-width: 0; }
.fw-version-title { font-size: 17px; font-weight: 600; color: var(--ink); margin: 0 0 4px; }
.fw-version-meta { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.fw-timeline { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.fw-version { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; }

.agent-frame-wrap { border: 1px solid var(--line); background: var(--surface); padding: 12px; margin: 12px 0; font-size: 14px; }

.principles-title { font-size: 24px; margin: 0 0 14px; }
.principles-note { margin-top: 14px; font-size: 13px; color: var(--muted); }
.title-accent { color: var(--ink); }
.share-button { display: inline-block; margin-top: 10px; padding: 9px 16px; background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px; text-decoration: none; }
.share-button:hover { background: var(--signal); color: var(--paper); }
.timeline-links { font-size: 14px; }
.timeline-links a { font-weight: 600; }
.lb-name { font-weight: 600; }
.tweet-embed, .tweet-pending { margin: 10px 0; }
.tweet-pending { color: var(--muted); font-size: 14px; }
