/* ============================================================
   eXMC — www.dataalienist.com
   Pure CSS — zero JavaScript.
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --bg-primary: #000000;
  --bg-secondary: #060609;
  --bg-card: #0c0c14;
  --bg-code: #0e0e18;
  --blue-deep: #1a3a5c;
  --blue-bright: #2563eb;
  --amber: #d4a574;
  --amber-bright: #f59e0b;
  --elixir: #7C6D91;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-body: 'Inter', sans-serif;
  --font-code: 'JetBrains Mono', monospace;
  --font-serif: Georgia, 'Times New Roman', serif;

  --max-width: 1120px;
  --section-pad: 7rem 0;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}

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

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* --- Fade-in via CSS scroll-driven animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeInUp 0.7s ease forwards;
  animation-timeline: view();
  animation-range: entry 0% entry 30%;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fallback: browsers without scroll-driven animations get no animation */
@supports not (animation-timeline: view()) {
  .fade-in {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

.section-header {
  margin-bottom: 1rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-sub {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 680px;
  margin-bottom: 3rem;
  line-height: 1.75;
}

/* ============================================================
   NAVIGATION — always solid, no JS scroll detection needed
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 1rem 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.04em;
}

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

.nav-links a {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
  text-transform: capitalize;
}

.nav-links a:hover {
  color: var(--text-primary);
}

/* --- Mobile nav: checkbox hack (no JS) --- */
#nav-toggle-state { display: none; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 0 2rem;
}

.hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.12) 0%, transparent 70%);
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  max-width: 780px;
  position: relative;
  z-index: 1;
}

.hero p {
  margin-top: 1.5rem;
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 660px;
  line-height: 1.8;
  position: relative;
  z-index: 1;
}

.scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  animation: bob 2s ease-in-out infinite;
  color: var(--text-muted);
  font-size: 1.5rem;
}

@keyframes bob {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.6; }
  50% { transform: translateX(-50%) translateY(10px); opacity: 1; }
}

/* ============================================================
   THE ARGUMENT (CARDS)
   ============================================================ */
.argument { padding: var(--section-pad); background: var(--bg-secondary); }

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 2rem;
  border-left: 3px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  border-left-color: var(--blue-bright);
  box-shadow: -4px 0 20px rgba(37,99,235,0.08);
}

.card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.card p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

/* ============================================================
   CODE BLOCKS
   ============================================================ */
pre {
  background: var(--bg-code);
  border-radius: 6px;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.04);
}

pre code { font-family: inherit; }

/* Syntax classes */
.kw  { color: var(--blue-bright); }
.str { color: var(--amber); }
.cmt { color: var(--text-muted); font-style: italic; }
.fn  { color: #7dd3fc; }
.mod { color: var(--elixir); }
.num { color: #86efac; }
.at  { color: #f472b6; }
.sym { color: var(--amber); }

/* ============================================================
   PERFORMANCE
   ============================================================ */
.performance { padding: var(--section-pad); }

.bench-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  font-size: 0.92rem;
}

.bench-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.bench-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary);
}

.bench-table tr:hover td {
  background: rgba(255,255,255,0.015);
}

.bench-table .model-name { color: var(--text-primary); font-weight: 500; }
.bench-table .winner-exmc { color: var(--amber-bright); font-weight: 600; }
.bench-table .winner-pymc { color: var(--text-muted); }

.bench-summary {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 780px;
}

/* ============================================================
   COMPOSITION TEST
   ============================================================ */
.composition {
  padding: var(--section-pad);
  background: var(--bg-secondary);
}

.composition-text {
  max-width: 720px;
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-secondary);
}

.composition-text p { margin-bottom: 1.5rem; }

.composition-text .highlight {
  color: var(--text-primary);
  font-weight: 500;
}

.composition-text code {
  font-family: var(--font-code);
  font-size: 0.88em;
  background: var(--bg-code);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: var(--amber);
}

/* ============================================================
   GALLERY
   ============================================================ */
.gallery { padding: var(--section-pad); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.gallery-item {
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  transition: transform 0.3s, box-shadow 0.3s;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-item .caption {
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Lightbox via :target (no JS) --- */
.lightbox-target {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox-target:target { display: flex; }

.lightbox-target img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
}

.lightbox-target .lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  color: var(--text-muted);
  font-size: 2rem;
  text-decoration: none;
  line-height: 1;
  transition: color 0.2s;
}

.lightbox-target .lightbox-close:hover { color: var(--text-primary); }

.gallery-item a {
  display: block;
  cursor: zoom-in;
}

/* ============================================================
   AMBER TRACE
   ============================================================ */
.amber-trace {
  padding: var(--section-pad);
  background: linear-gradient(180deg, rgba(212,165,116,0.04) 0%, var(--bg-primary) 100%);
  border-top: 1px solid rgba(212,165,116,0.08);
}

.amber-trace .container {
  max-width: 720px;
}

.amber-trace h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  font-style: italic;
  color: var(--amber);
  line-height: 1.5;
  margin-bottom: 2rem;
}

.amber-trace p {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  color: var(--text-secondary);
  line-height: 2;
  margin-bottom: 1.5rem;
}

.amber-trace .essay-link {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--amber);
  border-bottom: 1px solid rgba(212,165,116,0.3);
  padding-bottom: 2px;
  transition: border-color 0.2s;
}

.amber-trace .essay-link:hover {
  border-bottom-color: var(--amber);
}

/* ============================================================
   ARCHITECTURE
   ============================================================ */
.architecture { padding: var(--section-pad); background: var(--bg-secondary); }

.arch-diagram {
  margin: 2rem 0 3rem;
  text-align: center;
}

.arch-diagram img,
.arch-diagram svg {
  max-width: 100%;
  height: auto;
}

.arch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.arch-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.arch-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary);
}

.arch-table .layer-name {
  color: var(--text-primary);
  font-weight: 600;
}

.arch-table .modules {
  font-family: var(--font-code);
  font-size: 0.82rem;
  color: var(--amber);
}

/* ============================================================
   GETTING STARTED — tabs via hidden radio buttons (no JS)
   ============================================================ */
.getting-started { padding: var(--section-pad); }

/* Hide radio inputs */
.tab-radio { display: none; }

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 0;
}

.tab-label {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  user-select: none;
}

.tab-label:hover { color: var(--text-secondary); }

/* Active tab styling via :checked */
#tab-radio-builder:checked ~ .tabs .tab-label[for="tab-radio-builder"],
#tab-radio-dsl:checked ~ .tabs .tab-label[for="tab-radio-dsl"],
#tab-radio-distributed:checked ~ .tabs .tab-label[for="tab-radio-distributed"] {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

/* Panel visibility via :checked */
.tab-panels .tab-panel { display: none; }

#tab-radio-builder:checked ~ .tab-panels #tab-builder { display: block; }
#tab-radio-dsl:checked ~ .tab-panels #tab-dsl { display: block; }
#tab-radio-distributed:checked ~ .tab-panels #tab-distributed { display: block; }

.tab-panels pre {
  border-radius: 0 0 6px 6px;
  border-top: none;
  margin: 0;
}

.install-line {
  margin-top: 2.5rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.install-line code {
  font-family: var(--font-code);
  background: var(--bg-code);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--amber);
  border: 1px solid rgba(255,255,255,0.04);
}

/* ============================================================
   RESEARCH
   ============================================================ */
.research { padding: var(--section-pad); background: var(--bg-secondary); }

.thesis-list {
  list-style: none;
  counter-reset: chapter;
  margin-top: 2rem;
  max-width: 720px;
}

.thesis-list li {
  counter-increment: chapter;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
}

.thesis-list li::before {
  content: counter(chapter);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--blue-bright);
  min-width: 2rem;
  text-align: right;
}

.thesis-list .ch-title {
  font-weight: 600;
  color: var(--text-primary);
}

.thesis-list .ch-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
}

.thesis-subtitle {
  margin-top: 2.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(255,255,255,0.04);
  text-align: center;
}

.footer p {
  font-size: 0.85rem;
  color: var(--elixir);
  margin-bottom: 0.5rem;
}

.footer-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--elixir);
  transition: color 0.2s;
}

.footer-links a:hover { color: #a99aba; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 960px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 640px) {
  :root { --section-pad: 4.5rem 0; }

  /* Mobile nav: checkbox hack */
  .nav-links { display: none; }
  #nav-toggle-state:checked ~ .nav-inner .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.96);
    backdrop-filter: blur(14px);
    padding: 1rem 2rem 1.5rem;
    gap: 1rem;
  }
  .nav-toggle { display: block; }

  .hero h1 { font-size: 1.75rem; }
  .cards { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }

  .bench-table { font-size: 0.8rem; }
  .bench-table th, .bench-table td { padding: 0.5rem 0.6rem; }

  .tabs { overflow-x: auto; }
}

/* ============================================================
   BLOG PAGES
   ============================================================ */
.blog-header {
  padding: 8rem 0 3rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.blog-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  max-width: 780px;
  margin-bottom: 1rem;
}

.blog-header .blog-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.blog-header .blog-meta .tag {
  color: var(--elixir);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(124,109,145,0.3);
  padding: 0.2em 0.6em;
  border-radius: 3px;
}

.blog-body {
  padding: 3rem 0 5rem;
  max-width: 720px;
}

.blog-body h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  color: var(--text-primary);
}

.blog-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--text-primary);
}

.blog-body p {
  font-size: 1.02rem;
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: 1.25rem;
}

.blog-body ul, .blog-body ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.blog-body li { margin-bottom: 0.5rem; font-size: 1.02rem; }

.blog-body blockquote {
  border-left: 3px solid var(--amber);
  padding: 0.5rem 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-secondary);
}

.blog-body code {
  font-family: var(--font-code);
  font-size: 0.88em;
  background: var(--bg-code);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: var(--amber);
}

.blog-body pre code {
  padding: 0;
  background: none;
}

.blog-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}

.blog-body th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.blog-body td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary);
}

.blog-body .highlight-text {
  color: var(--text-primary);
  font-weight: 500;
}

.blog-body hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 2.5rem 0;
}

.blog-nav {
  padding: 2rem 0 3rem;
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.blog-nav a {
  font-size: 0.9rem;
  color: var(--elixir);
  transition: color 0.2s;
}

.blog-nav a:hover { color: #a99aba; }

/* Blog listing section on index */
.blog-listing { padding: var(--section-pad); }

.blog-list {
  list-style: none;
  max-width: 780px;
  margin-top: 2rem;
}

.blog-list li {
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.blog-list .blog-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.blog-list a {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.2s;
}

.blog-list a:hover { color: var(--amber); }

.blog-list .blog-excerpt {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 0.4rem;
}

/* Amber trace blog styling */
.blog-body.amber-prose p {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 2;
}

.blog-body.amber-prose h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  color: var(--amber);
}
