/* Shared styles for the AI pages (ai.html, ai-gpu-postmortem.html).
   Tokens and components are copied from portfolio.html so the pages match;
   portfolio.html stays self-contained and does not load this file. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0e;
  --bg2: #141416;
  --bg3: #1a1a1d;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #e8e6e0;
  --muted: #7a7870;
  --body: #b5b2aa;
  --accent: #e8736a;
  --accent2: #f0b89a;
  --teal: #5ab8a8;
  --gold: #c9a96e;
  --serif: 'Noto Serif JP', serif;
  --mono: 'Space Mono', monospace;
  --sans: 'DM Sans', 'Noto Serif JP', sans-serif;  /* JP fallback: kanji in body text otherwise renders as boxes on machines without a CJK font */
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: var(--accent2); }

/* ── NAV ─────────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 3rem;
  background: rgba(13,13,14,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: var(--serif); font-size: 1.1rem; color: var(--text);
  letter-spacing: 0.08em; text-decoration: none;
}
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  font-family: var(--mono); font-size: 0.72rem; color: var(--muted);
  text-decoration: none; letter-spacing: 0.12em; text-transform: uppercase;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.here { color: var(--accent); }

/* ── PAGE HEAD ───────────────────────────────────── */
.page-head {
  padding: 10rem 3rem 5rem;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 1.5rem;
}
.page-title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.15;
  letter-spacing: -0.01em; max-width: 22ch;
}
.page-title em { font-style: normal; color: var(--accent2); }
.lead {
  margin-top: 2rem; max-width: 62ch;
  font-size: 1.1rem; color: var(--body); line-height: 1.8;
}

/* ── SECTIONS ────────────────────────────────────── */
section { padding: 6rem 3rem; }
section.alt { background: var(--bg2); }
.section-header {
  display: flex; align-items: baseline; gap: 1.5rem;
  margin-bottom: 3rem; padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.section-number {
  font-family: var(--mono); font-size: 0.7rem; color: var(--accent); letter-spacing: 0.12em;
}
.section-title {
  font-family: var(--serif); font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 300; letter-spacing: -0.01em;
}
.section-subtitle {
  margin-left: auto; font-family: var(--mono); font-size: 0.65rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); align-self: center;
}
.prose { max-width: 68ch; color: var(--body); }
.prose p + p { margin-top: 1.1rem; }
.prose h3 {
  font-family: var(--serif); font-weight: 400; font-size: 1.35rem;
  color: var(--text); margin: 2.5rem 0 0.75rem;
}
.prose ul, .prose ol { margin: 0.75rem 0 0 1.25rem; }
.prose li + li { margin-top: 0.5rem; }
.prose strong { color: var(--text); font-weight: 500; }
code {
  font-family: var(--mono); font-size: 0.82em; color: var(--accent2);
  background: rgba(255,255,255,0.04); padding: 0.05rem 0.35rem; border-radius: 2px;
}

/* ── BYLINE (Nagi) ───────────────────────────────── */
.byline {
  display: flex; gap: 1.5rem; align-items: center;
  margin-top: 3rem; max-width: 68ch;
  padding: 1.5rem; border: 1px solid var(--border); background: var(--bg2);
}
.byline img { width: 72px; height: 72px; border-radius: 50%; flex: none; }
.byline p { font-size: 0.9rem; color: var(--muted); line-height: 1.7; }
.byline strong { color: var(--text); font-weight: 500; }

figure.wide { margin: 0 0 3rem; max-width: 1100px; }
figure.wide img { width: 100%; height: auto; display: block; border: 1px solid var(--border); }
figure.wide figcaption { margin-top: 1.25rem; max-width: 72ch; }
figure.wide figcaption p { font-size: 0.92rem; color: var(--body); line-height: 1.8; }
figure.wide figcaption p + p { margin-top: 0.75rem; }
.cap-label {
  display: inline-block; font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--teal); margin-bottom: 0.5rem;
}

/* ── CARDS (from .project-card) ──────────────────── */
.grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1px; background: var(--border); border: 1px solid var(--border);
}
.grid.three { grid-template-columns: repeat(3, 1fr); }
.card { background: var(--bg2); padding: 2.25rem; transition: background 0.25s; }
section.alt .card { background: var(--bg); }
.card:hover { background: var(--bg3); }
.card.wide { grid-column: 1 / -1; }
.badge {
  display: inline-block; font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.2rem 0.7rem; border-radius: 2px; margin-bottom: 1rem;
  background: rgba(201,169,110,0.12); color: var(--gold);
}
.badge.teal { background: rgba(90,184,168,0.12); color: var(--teal); }
.badge.red  { background: rgba(232,115,106,0.12); color: var(--accent); }
.card h3 {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 400;
  margin-bottom: 0.75rem; color: var(--text);
}
.card p { font-size: 0.9rem; color: var(--muted); line-height: 1.8; }
.card p + p { margin-top: 0.75rem; }
.card .note {
  margin-top: 1.25rem; font-family: var(--mono); font-size: 0.72rem;
  color: var(--teal); letter-spacing: 0.04em;
}
a.card { text-decoration: none; display: block; }
a.card .note { color: var(--accent); }

/* ── POSTMORTEM ──────────────────────────────────── */
.meta-line {
  margin-top: 2rem; font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.meta-line span + span::before { content: "·"; margin: 0 0.75rem; color: var(--border2); }
.facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3rem;
  margin-top: 3rem; max-width: 1000px;
}
.facts h2 {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 400;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
  padding-bottom: 0.6rem; border-bottom: 1px solid var(--border2);
}
.facts dl > div {
  display: flex; align-items: baseline; gap: 0.75rem;
  padding: 0.9rem 0; border-bottom: 1px solid var(--border);
}
.facts dt { flex: 1; display: flex; gap: 0.75rem; color: var(--body); font-size: 1.1rem; }
.facts dt::after { content: ""; flex: 1; border-bottom: 1px dotted var(--border2); transform: translateY(-4px); }
.facts dd { font-family: var(--mono); font-size: 1.15rem; color: var(--text); white-space: nowrap; }
table.timeline { border-collapse: collapse; width: 100%; max-width: 1000px; font-size: 0.9rem; }
.timeline th, .timeline td {
  text-align: left; vertical-align: top; padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.timeline th {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); font-weight: 400;
}
.timeline td:first-child {
  font-family: var(--mono); font-size: 0.78rem; color: var(--accent2); white-space: nowrap;
}
.timeline td { color: var(--body); }
.status {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.15rem 0.5rem; border-radius: 2px; white-space: nowrap;
}
.status.done { background: rgba(90,184,168,0.12); color: var(--teal); }
.status.open { background: rgba(201,169,110,0.12); color: var(--gold); }
.status.wontfix { background: rgba(255,255,255,0.06); color: var(--muted); }

/* ── FOOT ────────────────────────────────────────── */
.next {
  display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 3rem;
}
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.8rem 1.75rem; border: 1px solid var(--border2); border-radius: 2px;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; text-decoration: none; color: var(--muted); transition: all 0.2s;
}
.btn:hover { color: var(--text); border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0a08; font-weight: 700; }
.btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
footer {
  padding: 2rem 3rem; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); background: var(--bg);
}
.footer-left { font-family: var(--serif); font-size: 1rem; color: var(--muted); }
.footer-right {
  font-family: var(--mono); font-size: 0.65rem; color: var(--muted);
  letter-spacing: 0.12em; opacity: 0.6;
}

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 900px) {
  nav { padding: 1rem 1.5rem; }
  .nav-links { gap: 1rem; }
  .nav-links li.hide-sm { display: none; }
  .page-head { padding: 7rem 1.5rem 3rem; }
  section { padding: 4rem 1.5rem; }
  .grid, .grid.three { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; gap: 2rem; }
  .section-header { flex-wrap: wrap; }
  .section-subtitle { margin-left: 0; width: 100%; }
  .byline { flex-direction: column; align-items: flex-start; }
  .timeline-wrap { overflow-x: auto; }
  footer { flex-direction: column; gap: 0.5rem; text-align: center; }
}
