/* ── Tokens ──────────────────────────────────────────────────────────── */

:root {
  --bg:          #0d0f17;
  --bg-header:   #0a0c13;
  --surface:     #171a25;
  --surface-2:   #1d2130;
  --border:      #252a3a;
  --border-dim:  #1c2030;
  --text:        #b0b9ce;
  --text-dim:    #5a6280;
  --text-head:   #cdd4e8;
  --gold:        #c4a24a;
  --gold-dim:    #8a6c28;
  --gold-bg:     rgba(196, 162, 74, 0.07);
  --teal:        #45a098;
  --teal-dim:    #2a6b64;
  --teal-bg:     rgba(69, 160, 152, 0.08);
  --teal-border: rgba(69, 160, 152, 0.25);
  --code-bg:     #090b11;
  --ph-bg:       #0f1220;
  --ph-line:     rgba(37, 42, 58, 0.9);
  --grid-sz:     28px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:          #edeae0;
    --bg-header:   #e6e2d8;
    --surface:     #e2ded4;
    --surface-2:   #d8d4c8;
    --border:      #c4bfb2;
    --border-dim:  #d0ccc0;
    --text:        #2e2c28;
    --text-dim:    #7a7060;
    --text-head:   #1a1814;
    --gold:        #7a5500;
    --gold-dim:    #a07020;
    --gold-bg:     rgba(122, 85, 0, 0.06);
    --teal:        #1e6b64;
    --teal-dim:    #2a8a80;
    --teal-bg:     rgba(30, 107, 100, 0.07);
    --teal-border: rgba(30, 107, 100, 0.3);
    --code-bg:     #dcd8cc;
    --ph-bg:       #d8d4c8;
    --ph-line:     rgba(180, 175, 165, 0.8);
  }
}

:root[data-theme="dark"] {
  --bg:          #0d0f17;
  --bg-header:   #0a0c13;
  --surface:     #171a25;
  --surface-2:   #1d2130;
  --border:      #252a3a;
  --border-dim:  #1c2030;
  --text:        #b0b9ce;
  --text-dim:    #5a6280;
  --text-head:   #cdd4e8;
  --gold:        #c4a24a;
  --gold-dim:    #8a6c28;
  --gold-bg:     rgba(196, 162, 74, 0.07);
  --teal:        #45a098;
  --teal-dim:    #2a6b64;
  --teal-bg:     rgba(69, 160, 152, 0.08);
  --teal-border: rgba(69, 160, 152, 0.25);
  --code-bg:     #090b11;
  --ph-bg:       #0f1220;
  --ph-line:     rgba(37, 42, 58, 0.9);
}

:root[data-theme="light"] {
  --bg:          #edeae0;
  --bg-header:   #e6e2d8;
  --surface:     #e2ded4;
  --surface-2:   #d8d4c8;
  --border:      #c4bfb2;
  --border-dim:  #d0ccc0;
  --text:        #2e2c28;
  --text-dim:    #7a7060;
  --text-head:   #1a1814;
  --gold:        #7a5500;
  --gold-dim:    #a07020;
  --gold-bg:     rgba(122, 85, 0, 0.06);
  --teal:        #1e6b64;
  --teal-dim:    #2a8a80;
  --teal-bg:     rgba(30, 107, 100, 0.07);
  --teal-border: rgba(30, 107, 100, 0.3);
  --code-bg:     #dcd8cc;
  --ph-bg:       #d8d4c8;
  --ph-line:     rgba(180, 175, 165, 0.8);
}

/* ── Reset ───────────────────────────────────────────────────────────── */

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.78;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── Theme toggle ────────────────────────────────────────────────────── */

.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  border-radius: 2px;
  z-index: 100;
}
.theme-toggle:hover { color: var(--teal); border-color: var(--teal-dim); }
.theme-toggle:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ── Site nav ────────────────────────────────────────────────────────── */

.site-nav {
  border-bottom: 1px solid var(--border);
  background: var(--bg-header);
  padding: 0 1.5rem;
}

.site-nav-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 3rem;
}

.site-nav-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
  flex-shrink: 0;
}

.site-nav-logo svg { display: block; flex-shrink: 0; }
.site-nav-logo:hover { color: var(--gold-dim); }
.site-nav-logo:hover svg path { stroke: var(--gold-dim); }

.site-nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.site-nav-links a {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
}

.site-nav-links a:hover { color: var(--teal); }

/* ── Shared typography ───────────────────────────────────────────────── */

.log-eyebrow {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.log-eyebrow::before {
  content: '';
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--teal);
  border-radius: 50%;
  flex-shrink: 0;
}

.log-eyebrow span { color: var(--text-dim); }

/* ── Post header ─────────────────────────────────────────────────────── */

.post-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 4rem 1.5rem 3rem;
}

.post-header-inner { max-width: 720px; margin: 0 auto; }

.post-title {
  font-family: Georgia, Cambria, 'Times New Roman', serif;
  font-size: clamp(1.875rem, 5vw, 3.125rem);
  font-weight: normal;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--gold);
  text-wrap: balance;
  margin-bottom: 2rem;
}

.post-subtitle {
  font-family: Georgia, Cambria, 'Times New Roman', serif;
  font-size: 1.1875rem;
  font-style: italic;
  color: var(--text-dim);
  font-weight: normal;
  line-height: 1.5;
  text-wrap: balance;
  margin-top: -1.25rem;
  margin-bottom: 2rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.meta-pill {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  border-radius: 2px;
}

.meta-pill.active {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: var(--gold-bg);
}

/* ── Post intro ──────────────────────────────────────────────────────── */

.post-intro {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-intro p {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text);
  max-width: 64ch;
}

.post-intro p + p { margin-top: 1.25rem; }
.post-intro .lead { font-size: 1.25rem; line-height: 1.7; color: var(--text-head); }

/* ── Post body ───────────────────────────────────────────────────────── */

.post-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.post-section {
  padding-top: 3rem;
  border-top: 1px solid var(--border-dim);
  margin-top: 3rem;
}

.post-section:first-child { border-top: none; margin-top: 0; }

.section-eyebrow {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.875rem;
}

.section-heading {
  font-family: Georgia, Cambria, 'Times New Roman', serif;
  font-size: 1.625rem;
  font-weight: normal;
  color: var(--gold);
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-wrap: balance;
  margin-bottom: 1.25rem;
}

.post-section p { color: var(--text); max-width: 64ch; line-height: 1.78; }
.post-section p + p { margin-top: 1rem; }

code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875em;
  background: var(--surface-2);
  color: var(--teal);
  padding: 0.15em 0.4em;
  border-radius: 2px;
}

/* ── Media placeholders ──────────────────────────────────────────────── */

.media-block { margin: 1.75rem 0; }

.media-placeholder {
  position: relative;
  width: 100%;
  min-height: 220px;
  background-color: var(--ph-bg);
  background-image:
    linear-gradient(var(--ph-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ph-line) 1px, transparent 1px);
  background-size: var(--grid-sz) var(--grid-sz);
  border: 1px dashed var(--border);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 2.5rem 2rem;
  overflow: hidden;
}

.media-placeholder.tall { min-height: 340px; }
.media-placeholder.wide { min-height: 260px; }

.media-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 70% at 50% 50%, transparent 30%, var(--ph-bg) 100%);
  pointer-events: none;
}

.ph-icon { font-size: 1.375rem; opacity: 0.35; position: relative; z-index: 1; user-select: none; }

.ph-label {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  position: relative;
  z-index: 1;
  line-height: 1.5;
}

.ph-label strong {
  display: block;
  font-weight: normal;
  color: var(--teal);
  margin-bottom: 0.25rem;
}

.media-caption {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-top: 0.625rem;
  padding-left: 0.25rem;
}

/* ── Real screenshots ────────────────────────────────────────────────── */

.media-image {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--ph-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.media-image img { display: block; max-width: 100%; height: auto; }
.media-image.pixel img { image-rendering: pixelated; width: 220px; max-width: 100%; }

.media-note-title {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.5rem;
}

.media-note-title::before { content: '↓ '; color: var(--text-dim); }

.media-note {
  font-size: 0.9375rem;
  color: var(--text-dim);
  line-height: 1.65;
  max-width: 60ch;
}

/* ── Expandable tech sections ────────────────────────────────────────── */

details {
  background: var(--teal-bg);
  border: 1px solid var(--teal-border);
  border-radius: 3px;
  margin-top: 1.5rem;
}

details > summary {
  padding: 0.875rem 1.125rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
  line-height: 1;
}

details > summary::-webkit-details-marker { display: none; }

details > summary::before {
  content: '▶';
  font-size: 0.5625rem;
  display: inline-block;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

details[open] > summary::before { transform: rotate(90deg); }
details > summary:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }

.details-inner {
  padding: 1.25rem 1.25rem 1.375rem;
  border-top: 1px solid var(--teal-border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.details-inner p { font-size: 0.9375rem; color: var(--text); line-height: 1.72; max-width: 62ch; }

.details-inner pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 1rem 1.125rem;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--text);
  tab-size: 4;
}

.details-inner pre .c { color: var(--text-dim); }
.details-inner pre .k { color: var(--teal); }
.details-inner pre .n { color: var(--gold); }

/* ── Pull quote ──────────────────────────────────────────────────────── */

.pull-quote {
  border-left: 2px solid var(--gold);
  padding: 0.25rem 0 0.25rem 1.375rem;
  margin: 2rem 0;
  font-family: Georgia, Cambria, serif;
  font-size: 1.125rem;
  font-style: italic;
  color: var(--gold-dim);
  line-height: 1.6;
  max-width: 54ch;
}

/* ── What's next box ─────────────────────────────────────────────────── */

.whats-next {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2rem 2rem 2.25rem;
  margin-top: 4rem;
}

.whats-next .section-eyebrow { margin-bottom: 0.75rem; }
.whats-next .section-heading { font-size: 1.375rem; margin-bottom: 1rem; }
.whats-next p { max-width: 60ch; line-height: 1.75; }

/* ── Milestone track ─────────────────────────────────────────────────── */

.milestone-section {
  max-width: 720px;
  margin: 4rem auto 0;
  padding: 0 1.5rem 5rem;
}

.milestone-label {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.75rem;
}

.milestone-track { display: flex; align-items: flex-start; }

.milestone-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.milestone-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 0.5625rem;
  left: calc(50% + 0.625rem);
  right: calc(-50% + 0.625rem);
  height: 1px;
  background: var(--border);
}

.milestone-step.done:not(:last-child)::after { background: var(--gold-dim); }

.milestone-dot {
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  margin-bottom: 0.625rem;
  position: relative;
  z-index: 1;
}

.milestone-step.done .milestone-dot   { background: var(--gold); border-color: var(--gold); }
.milestone-step.current .milestone-dot { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }

.milestone-name {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
}

.milestone-step.done .milestone-name,
.milestone-step.current .milestone-name { color: var(--gold); }
.milestone-step.current .milestone-name::after { content: ' ←'; color: var(--gold-dim); }

/* ── Post footer ─────────────────────────────────────────────────────── */

.post-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  max-width: 720px;
  margin: 0 auto;
}

.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }

.footer-link {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
}

.footer-copyright {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-top: 1.25rem;
}

.footer-link:hover { color: var(--teal); }

/* ── Index page ──────────────────────────────────────────────────────── */

.index-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 4rem 1.5rem 3rem;
}

.index-header-inner { max-width: 720px; margin: 0 auto; }

.index-title {
  font-family: Georgia, Cambria, 'Times New Roman', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: normal;
  color: var(--gold);
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
  margin-bottom: 1rem;
}

.index-description {
  font-size: 1.0625rem;
  color: var(--text-dim);
  max-width: 58ch;
  line-height: 1.65;
}

.index-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.post-list { display: flex; flex-direction: column; gap: 0; }

.post-list-item {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0 1.5rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border-dim);
  text-decoration: none;
  color: inherit;
}

.post-list-item:first-child { border-top: 1px solid var(--border-dim); }
.post-list-item:hover .post-list-title { color: var(--gold); }

.post-list-num {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  padding-top: 0.25rem;
}

.post-list-title {
  font-family: Georgia, Cambria, serif;
  font-size: 1.25rem;
  font-weight: normal;
  color: var(--text-head);
  line-height: 1.3;
  text-wrap: balance;
  margin-bottom: 0.5rem;
  transition: color 0.1s;
}

.post-list-summary {
  font-size: 0.9375rem;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 58ch;
  margin-bottom: 0.75rem;
}

.post-list-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.post-tag {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  border: 1px solid var(--teal-border);
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .post-list-item { grid-template-columns: 1fr; gap: 0.25rem; }
  .post-list-num { padding-top: 0; }
  .site-nav-links { display: none; }
}
