/* ============================================
   zerosumalpha — style.css
   Single CSS file. Dark mode only.
   ============================================ */

/* ---- Design Tokens ---- */
:root {
  --bg-primary: #0C0A09;
  --bg-surface: #1C1917;
  --bg-elevated: #292524;

  --text-primary: #E7E5E4;
  --text-body: #A8A29E;
  --text-dim: #78716C;

  --amber: #F59E0B;

  --green: #22C55E;
  --red: #EF4444;

  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: 'Inter', system-ui, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --border: 0.5px solid #292524;
}

/* ---- Fonts ---- */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-primary);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

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

img {
  max-width: 100%;
  border-radius: var(--radius-md);
  border: var(--border);
}

/* ---- Nav ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: rgba(12, 10, 9, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: var(--border);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav__logo {
  width: 28px;
  height: 28px;
}

.nav__wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav__link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  transition: color 0.2s;
}
.nav__link:hover,
.nav__link--active {
  color: var(--text-primary);
  text-decoration: none;
}
.nav__link--active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--amber);
  animation: nav-underline 0.25s ease forwards;
}

@keyframes nav-underline {
  from { width: 0; }
  to { width: 100%; }
}

/* ---- Main Content ---- */
.main {
  padding-top: 56px;
  min-height: calc(100vh - 56px);
}

/* ---- About Page ---- */
.about {
  max-width: 600px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.about__handle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}

.about__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.about__handle-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.about__body p {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-body);
  line-height: 1.72;
  margin-bottom: 20px;
}

.about__body p:first-child {
  color: var(--text-primary);
  font-weight: 500;
}

.about__closing {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.8;
  margin-top: 40px;
  margin-bottom: 40px;
}

.about__links {
  border-top: var(--border);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about__link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.about__link:hover {
  text-decoration: none;
}
.about__link-arrow {
  display: inline-block;
  transition: transform 0.2s;
}
.about__link:hover .about__link-arrow {
  transform: translateX(3px);
}

/* ---- Article ---- */
.article {
  max-width: 680px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.article__header {
  margin-bottom: 48px;
}

.article__tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.article__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: lowercase;
}

.article__tag + .article__tag::before {
  content: '·';
  margin-right: 8px;
}

.article__title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 30px;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 12px;
}

.article__date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

/* Systems context card */
.article__systems-card {
  background: var(--bg-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-body);
}

.article__systems-card a {
  color: var(--amber);
}

.article__systems-card svg {
  flex-shrink: 0;
}

/* Article body */
.article__body {
  font-family: var(--font-sans);
  font-size: 17px;
  color: var(--text-body);
  line-height: 1.72;
}

.article__body h2 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  margin-top: 52px;
  margin-bottom: 20px;
}

.article__body h3 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin-top: 36px;
  margin-bottom: 16px;
}

.article__body p {
  margin-bottom: 20px;
}

.article__body strong {
  color: var(--text-primary);
  font-weight: 500;
}

.article__body ul,
.article__body ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

.article__body li {
  margin-bottom: 8px;
}

.article__body blockquote {
  border-left: 2px solid var(--amber);
  padding-left: 16px;
  margin: 24px 0;
  color: var(--text-dim);
  font-style: italic;
}

.article__body img {
  width: 100%;
  border-radius: var(--radius-md);
  border: var(--border);
  margin: 24px 0;
}

/* Code blocks — macOS style */
.article__body pre {
  background: var(--bg-surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  margin: 24px 0;
  overflow: hidden;
  position: relative;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: var(--border);
  position: relative;
}

.code-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0.15;
}

.code-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.6;
}
.code-dot--red { background: var(--red); }
.code-dot--amber { background: var(--amber); }
.code-dot--green { background: var(--green); }

/* Inline code */
.article__body code {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

/* Code block content — resets inline code styles */
.article__body pre code {
  display: block;
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  background: none;
  border-radius: 0;
  color: var(--text-body);
}

/* Stat callout */
.stat-callout {
  background: var(--bg-surface);
  border-left: 2px solid var(--amber);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 24px;
  margin: 32px 0;
  position: relative;
  overflow: hidden;
}

.stat-callout::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 120px;
  background: linear-gradient(90deg, var(--amber), transparent);
  opacity: 0.04;
}

.stat-callout__label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-callout__number {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 36px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.stat-callout__desc {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-body);
}

/* Article footer */
.article__footer {
  margin-top: 64px;
}

.article__footer-divider {
  border-top: var(--border);
  margin-bottom: 24px;
}

.article__subscribe {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}

.article__subscribe a {
  color: var(--amber);
}

/* ---- Homepage: Hero ---- */
.hero {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 80px 24px 48px;
  overflow: hidden;
}

.hero__grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--amber) 1px, transparent 1px),
    linear-gradient(90deg, var(--amber) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.02;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
  pointer-events: none;
}

.hero__inner {
  position: relative;
}

.hero__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.hero__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

.hero__label-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hero__title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 30px;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 16px;
}

.hero__title-amber {
  color: var(--amber);
}

.hero__cursor {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  background: var(--amber);
  margin-left: 4px;
  vertical-align: text-bottom;
  animation: blink-cursor 1s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero__excerpt {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-body);
  line-height: 1.72;
  margin-bottom: 20px;
  max-width: 600px;
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero__tags {
  display: flex;
  gap: 8px;
}

.hero__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: lowercase;
}

.hero__tag + .hero__tag::before {
  content: '·';
  margin-right: 8px;
}

.hero__date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.hero__read {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber);
  text-decoration: none;
  transition: opacity 0.2s;
}
.hero__read:hover {
  text-decoration: none;
  opacity: 0.8;
}

.hero__handle {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.hero__tagline {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

/* ---- Homepage: Archive ---- */
.archive {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.archive__divider {
  border-top: var(--border);
  margin-bottom: 32px;
}

.archive__heading {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.archive__list {
  display: flex;
  flex-direction: column;
}

.archive__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 14px 0;
  text-decoration: none;
  position: relative;
  transition: transform 0.2s ease;
  border-bottom: var(--border);
}

.archive__row:hover {
  text-decoration: none;
  transform: translateX(8px);
}

.archive__bar {
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 0;
  background: var(--amber);
  transition: height 0.2s ease;
  border-radius: 1px;
}

.archive__row:hover .archive__bar {
  height: 18px;
}

.archive__title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  color: var(--text-body);
  transition: color 0.2s;
  flex-shrink: 0;
}

.archive__row:hover .archive__title {
  color: var(--text-primary);
}

.archive__tags {
  display: flex;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

.archive__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: lowercase;
  white-space: nowrap;
}

.archive__tag + .archive__tag::before {
  content: '·';
  margin-right: 6px;
}

.archive__badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.archive__row:hover .archive__badge {
  opacity: 0.7;
}

.archive__date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Footer ---- */
.footer {
  border-top: var(--border);
  padding: 24px;
  text-align: center;
}

.footer__text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ---- Systems Page ---- */
.systems {
  max-width: 960px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.systems__header {
  margin-bottom: 48px;
}

.systems__title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 30px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.systems__desc {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-body);
  line-height: 1.72;
  max-width: 640px;
  margin-bottom: 16px;
}

.systems__legend {
  display: flex;
  gap: 20px;
  align-items: center;
}

.systems__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.systems__legend-solid {
  width: 20px;
  height: 2px;
  background: var(--amber);
  border-radius: 1px;
}

.systems__legend-dashed {
  width: 20px;
  height: 0;
  border-top: 2px dashed var(--text-dim);
}

/* Diagram: monospace grid */
.systems__diagram {
  margin-bottom: 64px;
}

.systems__tier {
  margin-bottom: 16px;
}

.systems__tier-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--bg-elevated);
}

.systems__tier:first-child .systems__tier-label {
  border-top: none;
  padding-top: 0;
}

/* AI layer gets extra breathing room */
.systems__tier--ai {
  margin-top: 48px;
}

.systems__tier--ai .systems__tier-label {
  color: var(--amber);
  opacity: 0.5;
}

.systems__grid {
  display: grid;
  gap: 12px;
}

.systems__grid--3col {
  grid-template-columns: repeat(3, 1fr);
}

.systems__grid--1col {
  grid-template-columns: 1fr;
}

/* Component boxes */
.systems__box {
  background: var(--bg-surface);
  border: 1px solid var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: border-color 0.2s, opacity 0.2s;
}

.systems__box--coming {
  border-style: dashed;
  opacity: 0.6;
}

.systems__box--active {
  border-color: var(--amber);
  border-style: solid;
  opacity: 1;
}

.systems__box--ai {
  position: relative;
  background: radial-gradient(ellipse at center, rgba(245, 158, 11, 0.03) 0%, var(--bg-surface) 70%);
}

.systems__box-title {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.systems__box--coming .systems__box-title {
  color: var(--text-body);
}

.systems__box-detail {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.systems__box-detail--dim {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Hover states */
.systems__diagram.has-hover .systems__box {
  opacity: 0.15;
  transition: opacity 0.2s;
}

.systems__diagram.has-hover .systems__box.is-hovered {
  opacity: 1;
  border-color: var(--amber);
}

/* ---- Tablet ---- */
@media (max-width: 768px) {
  .systems__grid--3col {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .nav {
    padding: 0 16px;
  }
  .nav__wordmark {
    display: none;
  }
  .nav__links {
    gap: 16px;
  }
  .nav__link {
    padding: 8px 4px;
  }
  .about {
    padding: 48px 20px 60px;
  }
  .article {
    padding: 48px 20px 60px;
  }
  .article__title {
    font-size: 24px;
  }
  .article__body {
    font-size: 16px;
  }
  .article__body h2 {
    font-size: 17px;
    margin-top: 40px;
  }
  .hero {
    padding: 56px 20px 36px;
  }
  .hero__title {
    font-size: 24px;
  }
  .hero__meta {
    gap: 8px;
  }
  .archive {
    padding: 0 20px 60px;
  }
  .archive__row {
    gap: 8px;
  }
  .archive__title {
    flex-shrink: 1;
    min-width: 0;
  }
  .archive__tags {
    display: none;
  }
  .archive__badge {
    display: none;
  }
  .systems {
    padding: 48px 16px 60px;
  }
  .systems__title {
    font-size: 24px;
  }
  .systems__legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .systems__grid--3col {
    grid-template-columns: 1fr;
  }
  .stat-callout__number {
    font-size: 28px;
  }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .hero__cursor {
    animation: none;
    opacity: 1;
  }
  .hero__dot,
  .about__dot {
    animation: none;
    opacity: 1;
  }
}
