/* ==========================================================================
   Robot Clan — "Instrumentation Panel" design system
   Blueprint-grid technical publication. Mono for structure/data,
   serif for reading. Dual accent (amber = primary, cyan = secondary),
   like indicator lights on lab equipment.
   ========================================================================== */

:root {
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --max-width: 720px;
  --wide: 960px;
  --grid-cell: 28px;
}

/* dark = default */
:root,
:root[data-theme="dark"] {
  --bg: #0a0e14;
  --bg-raised: #10151d;
  --bg-inset: #0d1219;
  --fg: #dce3ea;
  --fg-muted: #6b7787;
  --border: #1c2530;
  --border-strong: #2e3a48;
  --accent: #ffab2e;
  --accent-ink: #1a1204;
  --accent-2: #57d9e8;
  --grid-line: rgba(140, 175, 215, 0.055);
  --grid-line-strong: rgba(140, 175, 215, 0.11);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  --bg: #f2f4f6;
  --bg-raised: #ffffff;
  --bg-inset: #eaeef1;
  --fg: #11151b;
  --fg-muted: #576270;
  --border: #dde2e7;
  --border-strong: #c2cad2;
  --accent: #c46c05;
  --accent-ink: #fff6e8;
  --accent-2: #0d7f8f;
  --grid-line: rgba(20, 40, 65, 0.045);
  --grid-line-strong: rgba(20, 40, 65, 0.09);
  --shadow: 0 20px 50px rgba(20, 30, 45, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / var(--grid-cell) var(--grid-cell),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / var(--grid-cell) var(--grid-cell),
    linear-gradient(var(--grid-line-strong) 1px, transparent 1px) 0 0 / calc(var(--grid-cell) * 4) calc(var(--grid-cell) * 4),
    linear-gradient(90deg, var(--grid-line-strong) 1px, transparent 1px) 0 0 / calc(var(--grid-cell) * 4) calc(var(--grid-cell) * 4),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  line-height: 1.65;
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

.wrap { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--fg-muted); }

::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: var(--wide);
  padding-top: 16px;
  padding-bottom: 16px;
}
.site-title {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 14px;
  color: var(--fg);
}
.site-title .bracket { color: var(--accent); }
.site-title:hover { text-decoration: none; color: var(--fg); }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.site-nav a { color: var(--fg-muted); }
.site-nav a:hover, .site-nav a.active { color: var(--accent); text-decoration: none; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, transform .15s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ---------- layout shells ---------- */
main.wrap { max-width: var(--max-width); padding-top: 56px; padding-bottom: 72px; min-height: 55vh; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 84px 24px 40px;
  animation: rc-rise .6s ease both;
}
.hero-readout {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  margin: 0 0 22px;
}
.hero-tagline {
  font-family: var(--font-serif);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(2.1rem, 4.5vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  max-width: 16ch;
}
.hero-desc {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-size: 0.95rem;
  max-width: 58ch;
  margin: 0;
}

/* ---------- section grid (home) ---------- */
.section-grid {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 12px 24px 88px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}
.section-card {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  padding: 24px 22px 26px;
  background: var(--bg-raised);
  color: var(--fg);
  opacity: 0;
  animation: rc-rise .5s ease both;
}
.section-grid .section-card:nth-child(1) { animation-delay: .08s; }
.section-grid .section-card:nth-child(2) { animation-delay: .14s; }
.section-grid .section-card:nth-child(3) { animation-delay: .20s; }
.section-grid .section-card:nth-child(4) { animation-delay: .26s; }
.section-grid .section-card:nth-child(5) { animation-delay: .32s; }

.section-card::before,
.section-card::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--border-strong);
  transition: border-color .2s ease;
}
.section-card::before { top: -1px; left: -1px; border-top: 1px solid; border-left: 1px solid; }
.section-card::after { bottom: -1px; right: -1px; border-bottom: 1px solid; border-right: 1px solid; }
.section-card:hover { text-decoration: none; border-color: var(--border-strong); }
.section-card:hover::before, .section-card:hover::after { border-color: var(--accent); width: 16px; height: 16px; }

.card-index {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}
.section-card h2 {
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}
.section-card p {
  color: var(--fg-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0;
}
.card-arrow {
  position: absolute;
  bottom: 20px;
  right: 20px;
  color: var(--accent-2);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .2s ease, transform .2s ease;
}
.section-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* ---------- archive listing ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  margin: 0 0 10px;
}
.archive h1 { margin: 0 0 10px; font-family: var(--font-serif); }
.archive-desc { color: var(--fg-muted); margin-top: 0; font-family: var(--font-mono); font-size: 0.92rem; }
.empty-note {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin-top: 40px;
}
.archive-list { list-style: none; padding: 0; margin: 36px 0 0; }
.archive-list li { padding: 20px 0; border-bottom: 1px solid var(--border); }
.archive-list li:first-child { border-top: 1px solid var(--border); }
.archive-list a { color: var(--fg); font-size: 1.15rem; font-weight: 600; font-family: var(--font-serif); }
.archive-list a:hover { color: var(--accent); text-decoration: none; }
.archive-list .muted { font-family: var(--font-mono); font-size: 0.8rem; }
.archive-list .excerpt { color: var(--fg-muted); margin: 8px 0 0; font-size: 0.95rem; }

/* ---------- post ---------- */
.post-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
.post-eyebrow a { color: var(--accent-2); }
.post h1 { font-family: var(--font-serif); margin: 0 0 12px; line-height: 1.18; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.post-meta { font-family: var(--font-mono); color: var(--fg-muted); font-size: 0.82rem; margin: 0 0 40px; }
.post-content { font-size: 1.08rem; }
.post-content h2 { font-family: var(--font-mono); font-size: 1.15rem; margin-top: 2.4em; }
.post-content pre {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  padding: 16px;
  overflow-x: auto;
}
.post-content code { font-family: var(--font-mono); font-size: 0.88em; }
.post-content img { max-width: 100%; }
.post-footer {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* ---------- page (about) ---------- */
.page h1 { font-family: var(--font-serif); margin-bottom: 26px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0 56px; }
.site-footer p { margin: 4px 0; font-family: var(--font-mono); font-size: 0.78rem; color: var(--fg-muted); letter-spacing: 0.01em; }
.site-footer a { color: var(--fg-muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- motion ---------- */
@keyframes rc-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  body { font-size: 16.5px; }
  main.wrap { padding-top: 36px; }
  .hero { padding-top: 56px; }
}
