/* ============================================
   Andrew Munoz — Portfolio
   Quiet Professional
   Near-white, one deep blue, ledger rows.
   Zero JavaScript. Restraint as the signal.
   ============================================ */
:root {
  --bg: #FCFCFA;
  --bg-elevated: #F4F3EE;   /* wells, callouts, diagram ground */
  --bg-card: #FFFFFF;       /* raised surfaces, diagram boxes */
  --border: #E8E6DF;        /* hairlines */
  --border-hover: #D9D7CE;
  --text: #1A1A17;
  --text-body: #3D3C36;
  --text-muted: #6E6D64;
  --text-dim: #97958A;
  --accent: #1D4ED8;
  --accent-2: #1D4ED8;
  --radius: 8px;
  --maxw: 1020px;
  --font: 'Schibsted Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --display: 'Schibsted Grotesk', -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.62;
}
h1, h2, h3, h4 { font-family: var(--display); color: var(--text); }

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

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(252, 252, 250, 0.95);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 58px;
}
.nav-logo {
  display: inline-flex; align-items: center;
  color: var(--text); text-decoration: none; line-height: 0;
  transition: color 0.15s;
}
.nav-logo:hover { color: var(--accent); }
.nav-logo svg { display: block; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a {
  font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  text-decoration: none; transition: color 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-cta {
  border: 1px solid var(--border-hover); border-radius: 6px; padding: 6px 12px;
  color: var(--text) !important; white-space: nowrap; transition: border-color 0.15s;
}
.nav-cta:hover { border-color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding: 68px 0 44px; text-align: left; }
.eyebrow {
  display: block; font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(34px, 5vw, 52px); font-weight: 700;
  letter-spacing: -0.028em; line-height: 1.1; margin-bottom: 18px;
}
.hero h1 .grad { color: var(--text); }
.hero p.lede { font-size: 17px; color: var(--text-muted); max-width: 540px; margin: 0 0 32px; }
.btn-row { display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 6px;
  font-size: 14px; font-weight: 550; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--text); color: var(--bg); border: 1px solid var(--text); }
.btn-primary:hover { background: #000; }
.btn-ghost { border: 1px solid var(--border-hover); color: var(--text); }
.btn-ghost:hover { border-color: var(--text); }

/* ---------- Stats: one quiet ledger line ---------- */
.stats {
  display: flex; flex-wrap: wrap;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin: 36px 0 0;
}
.stat { display: flex; align-items: baseline; gap: 8px; padding: 13px 26px 13px 0; }
.stat + .stat { border-left: 1px solid var(--border); padding-left: 26px; }
.stat .num { font-size: 15px; font-weight: 650; color: var(--text); font-family: var(--font); }
.stat .lbl { font-size: 13.5px; color: var(--text-muted); }

/* ---------- Sections ---------- */
.section { padding: 24px 0 48px; }
.section-head { margin-bottom: 28px; }
.section-head h2 { font-size: 21px; font-weight: 650; letter-spacing: -0.015em; }
.section-head p { font-size: 15px; color: var(--text-muted); margin-top: 6px; max-width: 560px; }

/* ---------- Projects: ledger rows ---------- */
.grid { display: grid; grid-template-columns: 1fr; counter-reset: proj; border-bottom: 1px solid var(--border); }
.card {
  display: grid; grid-template-columns: 44px 1fr 264px; column-gap: 28px;
  grid-template-areas: "num title thumb" "num desc thumb" "num tags thumb" "num link thumb";
  align-items: start; align-content: start;
  padding: 28px 0; border-top: 1px solid var(--border);
  text-decoration: none; color: var(--text-body);
}
.card::before {
  counter-increment: proj; content: counter(proj, decimal-leading-zero);
  grid-area: num; font-family: var(--mono); font-size: 13px; color: var(--text-dim); padding-top: 3px;
}
.card-icon { display: none; }
.card-thumb {
  grid-area: thumb; width: 264px; aspect-ratio: 16/10;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.card h3 { grid-area: title; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; transition: color 0.15s; }
.card:hover h3 { color: var(--accent); }
.card p { grid-area: desc; font-size: 14.5px; color: var(--text-muted); margin-top: 6px; max-width: 58ch; }
.card .tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px; }
.tag { font-family: var(--mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.card .link-hint { grid-area: link; font-size: 13.5px; font-weight: 550; color: var(--accent); margin-top: 14px; }
.card .link-hint svg { transition: transform 0.18s ease; }
.card:hover .link-hint svg { transform: translateX(3px); }

/* ---------- Project page ---------- */
.proj-hero { padding: 44px 0 24px; border-bottom: 1px solid var(--border); }
.breadcrumb { font-family: var(--mono); font-size: 12px; color: var(--text-dim); margin-bottom: 22px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.breadcrumb a:hover { color: var(--accent); }
.proj-hero h1 {
  font-size: clamp(30px, 4.4vw, 42px); font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.14; margin-bottom: 14px; text-wrap: balance;
}
.proj-hero .sub { font-size: 16.5px; color: var(--text-muted); max-width: 680px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 24px; }

/* ---------- Prose ---------- */
.prose { max-width: 720px; counter-reset: fig; }
.prose h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; margin: 36px 0 10px; }
.prose h2:first-child { margin-top: 12px; }
.prose h3 { font-size: 16.5px; font-weight: 650; margin: 28px 0 8px; }
.prose p { color: var(--text-body); margin-bottom: 14px; }
.prose strong { color: var(--text); font-weight: 650; }
.prose ul { color: var(--text-body); margin: 0 0 14px 20px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--text-dim); }
.prose code {
  font-family: var(--mono); font-size: 13px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; color: var(--text);
}
.prose a { color: var(--accent); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin: 24px 0; }
.feature {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
}
.feature h4 { font-size: 15px; font-weight: 650; margin-bottom: 5px; }
.feature h4 .dot { color: var(--accent); margin-right: 6px; }
.feature h4 svg.dot-ico {
  width: 13px; height: 13px; margin-right: 7px; vertical-align: -1px;
  fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round;
}
.feature p { font-size: 13.5px; color: var(--text-muted); }

.link-hint svg, .demo-banner .txt h4 svg {
  width: 14px; height: 14px; vertical-align: -2.5px; margin-left: 3px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.contact-line { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; }
.contact-line svg {
  width: 15px; height: 15px; flex: 0 0 auto;
  fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.contact-line a { text-decoration: none; }
.contact-line a:hover { text-decoration: underline; text-underline-offset: 3px; }
.about-grid h3 { font-family: var(--mono); letter-spacing: 0.08em; }

.callout {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; margin: 24px 0;
}
.callout p { color: var(--text-body); font-size: 14.5px; margin: 0; }
.callout strong { color: var(--text); }

/* ---------- Architecture diagrams ----------
   The inline SVGs read CSS variables; re-scope them here so
   diagrams render in the light, quiet palette. */
.arch {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5; color: var(--text-muted);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; overflow-x: auto; white-space: pre; margin: 26px 0;
}
.arch-svg {
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin: 26px 0;
  --bg-card: #FAFAF7;
  --bg-elevated: #F4F3EE;
  --border: #C9C7BC;
  --border-hover: #84827A;
  --text-dim: #97958A;
}
.arch-svg svg { display: block; width: 100%; height: auto; }

/* ---------- Media ---------- */
.media-frame {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--bg-card); margin: 18px 0;
  transition: border-color 0.2s;
}
.media-frame img, .media-frame video { display: block; width: 100%; height: auto; }
a:hover > .media-frame, a:hover .media-frame { border-color: var(--border-hover); }
.media-frame figcaption {
  font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--text-muted);
  padding: 10px 14px; border-top: 1px solid var(--border);
}
.media-frame figcaption::before {
  counter-increment: fig;
  content: "Fig. " counter(fig, decimal-leading-zero) " — ";
  color: var(--text-dim);
}
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 26px 0; }
.gallery .media-frame { margin: 0; }
.gallery a { display: block; text-decoration: none; }

/* Phone-portrait gallery — player companion screenshots */
.gallery-phones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 26px 0; }
.gallery-phones .media-frame { margin: 0; }
.gallery-phones a { display: block; text-decoration: none; }
.gallery-phones img { aspect-ratio: 390 / 844; object-fit: cover; object-position: top; }
.gallery-phones.duo { grid-template-columns: repeat(2, 1fr); max-width: 460px; }

.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elevated); padding: 20px 24px; margin: 26px 0;
}
.demo-banner .txt h4 { font-size: 15.5px; font-weight: 650; margin-bottom: 3px; }
.demo-banner .txt p { font-size: 13.5px; color: var(--text-muted); margin: 0; }
@media (max-width: 720px) { .gallery { grid-template-columns: 1fr; } .gallery-phones { grid-template-columns: 1fr 1fr; } }

/* ---------- Pager ---------- */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 64px; }
.pager a {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px;
  text-decoration: none; color: var(--text); transition: border-color 0.15s;
}
.pager a:hover { border-color: var(--text); }
.pager .dir {
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.pager .name { font-weight: 650; font-size: 14.5px; margin-top: 4px; }
.pager .next { text-align: right; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 48px; align-items: start; }
.skill-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.skill-list .tag { font-size: 12.5px; color: var(--text-muted); }
.skill-list .tag:not(:last-child)::after {
  content: "·"; color: var(--text-dim); margin-left: 10px;
}

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); margin-top: 40px; }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 24px 24px 48px;
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 24px;
}
footer p, footer a { font-size: 13px; color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--text); }
footer .stamp {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim);
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .card { grid-template-columns: 32px 1fr; grid-template-areas: "num title" "num thumb" "num desc" "num tags" "num link"; }
  .card-thumb { width: 100%; margin-top: 12px; }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-links { gap: 18px; }
  .nav-links a:not(.nav-cta) { display: none; }
  .pager { flex-direction: column; }
  .pager .next { text-align: left; }
  .hero { padding: 64px 0 48px; }
  .section { padding: 56px 0; }
  .proj-hero { padding: 52px 0 36px; }
}
