/* ============================================================
   ARMAN NADERI — PORTFOLIO v0.2
   "Engineering document" aesthetic. Slate + signal-blue.
   Multi-page: Home / Resume / Projects + project write-ups.
   ============================================================ */

:root {
  color-scheme: light dark;
  --paper:      #f7f6f3;
  --surface:    #ffffff;
  --ink:        #1a1f2b;
  --ink-soft:   #4a5162;
  --ink-faint:  #737b8c;
  --line:       #e2e0da;
  --line-strong:#c9c6bd;
  --accent:     #1f5fdb;
  --accent-ink: #ffffff;
  --sev-high:   #b42318;
  --sev-med:    #b5651d;
  --sev-low:    #3a6a3a;
  --focus:      #1f5fdb;

  --maxw:       820px;
  --wide:       1040px;
  --radius:     4px;
  --nav-h:      60px;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'Courier New', monospace;

  --step--1: clamp(0.8rem, 0.77rem + 0.15vw, 0.88rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2:  clamp(1.55rem, 1.35rem + 1vw, 2.1rem);
  --step-3:  clamp(2.1rem, 1.7rem + 2vw, 3.1rem);
}

[data-theme="dark"] {
  --paper:      #0f1219;
  --surface:    #161a23;
  --ink:        #e8eaf0;
  --ink-soft:   #b0b6c4;
  --ink-faint:  #7c8291;
  --line:       #262b37;
  --line-strong:#39404f;
  --accent:     #6aa2ff;
  --accent-ink: #0f1219;
  --sev-high:   #f0776b;
  --sev-med:    #e0a04a;
  --sev-low:    #7fc07f;
  --focus:      #6aa2ff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
ul { list-style: none; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.skip-link {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.6rem 1rem; border-radius: var(--radius);
  z-index: 200; font-weight: 600; transition: top 150ms ease;
}
.skip-link:focus { top: 1rem; text-decoration: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; width: 100%; }

.eyebrow {
  font-family: var(--font-mono); font-size: var(--step--1);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 1rem; display: flex; align-items: center; gap: 0.6rem;
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: var(--accent); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; color: var(--ink); }
h2 { font-size: var(--step-2); margin-bottom: 1.25rem; }
h3 { font-size: var(--step-1); margin-bottom: 0.6rem; }
p { color: var(--ink-soft); }
p + p { margin-top: 1rem; }
strong { color: var(--ink); font-weight: 600; }

/* ---------- NAV ---------- */
#nav {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { max-width: var(--wide); margin: 0 auto; padding: 0 1.5rem; height: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { font-family: var(--font-mono); font-weight: 600; font-size: 0.9rem; color: var(--ink); letter-spacing: 0.02em; }
.nav-logo:hover { text-decoration: none; color: var(--accent); }
.nav-logo .bracket { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.nav-links { display: flex; gap: 1.25rem; }
.nav-links a { font-size: var(--step--1); font-weight: 500; color: var(--ink-soft); padding: 0.3rem 0.5rem; border-radius: var(--radius); }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-links a.current { color: var(--ink); border: 1px solid var(--line-strong); }

.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; color: var(--ink-soft); transition: border-color 150ms ease, color 150ms ease; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; flex-direction: column; gap: 5px; }
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform 150ms ease, opacity 150ms ease; }
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-mobile { display: none; }

/* ---------- BUTTONS ---------- */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.15rem; border-radius: var(--radius); font-family: var(--font-body); font-size: var(--step--1); font-weight: 600; letter-spacing: 0.01em; cursor: pointer; border: 1px solid transparent; transition: background 150ms ease, border-color 150ms ease, color 150ms ease; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 15px; height: 15px; }

/* ---------- PAGE HEADER ---------- */
.page { padding: 3.5rem 0 4rem; }
.page-lead { max-width: 60ch; margin-top: 0.5rem; }

/* ---------- HOME ---------- */
.home-hero { padding: 4rem 0 3rem; }
.hero-status { font-family: var(--font-mono); font-size: var(--step--1); color: var(--ink-faint); margin-bottom: 1.25rem; display: inline-flex; align-items: center; gap: 0.5rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sev-low); flex-shrink: 0; }
.hero-name { font-size: var(--step-3); margin-bottom: 1.25rem; }
.hero-body { max-width: 60ch; }
.hero-body p { font-size: var(--step-0); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.75rem; }

.hero-meta { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 1.25rem 2.5rem; font-family: var(--font-mono); font-size: var(--step--1); }
.hero-meta div { display: flex; flex-direction: column; gap: 0.15rem; }
.hero-meta .k { color: var(--ink-faint); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }
.hero-meta .v { color: var(--ink); }

/* ---------- WRITING (blog) list ---------- */
.home-section { padding: 3rem 0; border-top: 1px solid var(--line); }
.post-list { display: flex; flex-direction: column; margin-top: 1rem; }
.post-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 1rem; align-items: baseline; padding: 0.9rem 0; border-top: 1px solid var(--line); }
.post-row:first-child { border-top: none; }
.post-row .date { font-family: var(--font-mono); font-size: var(--step--1); color: var(--ink-faint); }
.post-row .title { color: var(--ink); font-weight: 500; }
.post-row:hover .title { color: var(--accent); }
.post-row .arrow { color: var(--ink-faint); }
.empty-note { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 1.25rem 1.5rem; color: var(--ink-faint); font-size: var(--step--1); margin-top: 1rem; }

/* ---------- PROJECTS list ---------- */
.proj-list { display: flex; flex-direction: column; }
.proj-item { padding: 1.75rem 0; border-top: 1px solid var(--line); }
.proj-item:first-child { border-top: none; padding-top: 0.5rem; }
.proj-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.proj-title { font-size: var(--step-1); font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.tag-status { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 3px; }
.tag-live { color: var(--sev-low); border: 1px solid var(--sev-low); }
.tag-progress { color: var(--sev-med); border: 1px solid var(--sev-med); }
.stack-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.chip { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; padding: 0.25rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 3px; color: var(--ink-soft); }
.proj-desc { color: var(--ink-soft); max-width: 65ch; margin-bottom: 1rem; }
.proj-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ---------- metric strip / spec table (shared with write-up) ---------- */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); margin: 1.25rem 0; overflow: hidden; }
.metric { background: var(--surface); padding: 1rem 1.1rem; }
.metric .n { font-family: var(--font-mono); font-size: var(--step-1); color: var(--ink); font-weight: 500; }
.metric .l { font-size: 0.75rem; color: var(--ink-faint); margin-top: 0.15rem; }

.spec { width: 100%; border-collapse: collapse; font-size: var(--step--1); margin: 1rem 0 1.5rem; }
.spec caption { text-align: left; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); padding-bottom: 0.6rem; }
.spec th, .spec td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec thead th { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); font-weight: 500; border-bottom: 1px solid var(--line-strong); }
.spec td.id { font-family: var(--font-mono); color: var(--ink-faint); white-space: nowrap; }
.spec td.rule { color: var(--ink); }
.sev { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.sev-high { color: var(--sev-high); } .sev-med { color: var(--sev-med); } .sev-low { color: var(--sev-low); }

/* ---------- RESUME (single column, sized to real content) ---------- */
.resume-head { text-align: center; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.resume-name { font-size: var(--step-2); margin-bottom: 0.5rem; }
.resume-contact { font-family: var(--font-mono); font-size: var(--step--1); color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: center; }
.resume-dl { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.res-block { padding: 1.75rem 0; border-top: 1px solid var(--line); }
.res-block:first-of-type { border-top: none; }
.res-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 1.25rem; }
.res-entry { margin-bottom: 1.5rem; }
.res-entry:last-child { margin-bottom: 0; }
.res-entry-top { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.res-entry-title { font-family: var(--font-body); font-size: var(--step-0); font-weight: 600; color: var(--ink); }
.res-entry-date { font-family: var(--font-mono); font-size: var(--step--1); color: var(--ink-faint); white-space: nowrap; }
.res-entry-org { font-size: var(--step--1); color: var(--ink-soft); margin-bottom: 0.5rem; }
.res-bullets { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.res-bullets li { position: relative; padding-left: 1.1rem; color: var(--ink-soft); font-size: var(--step--1); }
.res-bullets li::before { content: '—'; position: absolute; left: 0; color: var(--ink-faint); }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2.5rem; }
.res-cert { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.res-cert:first-child { border-top: none; }
.res-cert .name { color: var(--ink); font-size: var(--step--1); font-weight: 500; }
.res-cert .when { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); white-space: nowrap; }
.res-cert .when.pending { color: var(--accent); }
.skill-line { margin-bottom: 0.9rem; }
.skill-line .cat { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); display: block; margin-bottom: 0.2rem; }
.skill-line .items { font-size: var(--step--1); color: var(--ink); }

/* ---------- WRITE-UP page ---------- */
.doc-header { padding: 2.5rem 0 1.5rem; border-bottom: 1px solid var(--line); }
.back-link { font-family: var(--font-mono); font-size: var(--step--1); color: var(--ink-soft); display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: 1.25rem; }
.doc-title { font-size: var(--step-2); margin-bottom: 0.75rem; }
.doc-sub { color: var(--ink-soft); max-width: 62ch; }
.doc-section { padding: 2rem 0; border-top: 1px solid var(--line); }
.doc-section h2 { font-size: var(--step-1); margin-bottom: 1rem; display: flex; align-items: baseline; gap: 0.75rem; }
.doc-section h2 .num { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }
.doc-section p { max-width: 68ch; }
.doc-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; max-width: 68ch; }
.doc-list li { position: relative; padding-left: 1.25rem; color: var(--ink-soft); }
.doc-list li::before { content: '▪'; position: absolute; left: 0; color: var(--accent); font-size: 0.7rem; top: 0.35rem; }
.placeholder { border-left: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); padding: 1rem 1.25rem; border-radius: 0 var(--radius) var(--radius) 0; margin-top: 0.75rem; font-size: var(--step--1); color: var(--ink-soft); }
.placeholder strong { color: var(--accent); font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 0.4rem; }
.arch-flow { display: flex; flex-direction: column; margin-top: 1rem; max-width: 52ch; }
.arch-step { display: grid; grid-template-columns: 40px 1fr; gap: 1rem; padding: 0.85rem 0; border-top: 1px solid var(--line); align-items: start; }
.arch-step:first-child { border-top: none; }
.arch-step .an { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); padding-top: 0.15rem; }
.arch-step .ad strong { display: block; color: var(--ink); font-size: var(--step--1); margin-bottom: 0.15rem; }
.arch-step .ad span { font-size: var(--step--1); color: var(--ink-soft); }
.ascii { font-family: var(--font-mono); font-size: 0.7rem; line-height: 1.5; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; overflow-x: auto; margin-top: 1rem; white-space: pre; }

/* ---------- FOOTER ---------- */
footer { flex-shrink: 0; border-top: 1px solid var(--line); padding: 2rem 0; margin-top: 2rem; }
.footer-inner { max-width: var(--wide); margin: 0 auto; padding: 0 1.5rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-faint); }
.footer-inner a { color: var(--ink-soft); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-mobile.open { display: flex; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0.5rem 1.5rem 1rem; }
  .nav-mobile.open a { padding: 0.75rem 0; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: var(--step-0); }
  .nav-mobile.open a:first-child { border-top: none; }
  .res-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .metrics { grid-template-columns: 1fr; }
  .post-row { grid-template-columns: 90px 1fr auto; }
  .spec .sev-col { display: none; }
}
