/* ============================================================
   SJ PORTFOLIO — DARK EDITORIAL DATA-JOURNALISM
   Per SITE-ARCHITECTURE.md §5. Rules and whitespace, not cards.
   Type carries hierarchy. One accent, reserved for data.
   Zero dependencies. No JavaScript.
   ============================================================ */

:root {
  /* Ground and ink */
  --black:        #000000;
  --panel:        #0e0e12;
  --ink:          #EAEAEA;
  --muted:        #8A8A9A;
  --dim:          #505060;

  /* The single accent. Marks data and the current page. Nothing else. */
  --accent:       #668fa3;

  /* Hairlines do the work borders used to do */
  --rule:         rgba(234, 234, 234, 0.10);
  --rule-strong:  rgba(234, 234, 234, 0.20);

  /* Type scale */
  --display:      clamp(2.5rem, 7vw, 4.5rem);
  --h1:           clamp(1.9rem, 4vw, 2.7rem);
  --h2:           clamp(1.3rem, 2.4vw, 1.6rem);
  --lede:         clamp(1.05rem, 1.7vw, 1.3rem);
  --small:        0.83rem;

  /* Spacing scale */
  --s1: 4px;  --s2: 8px;   --s3: 16px;  --s4: 24px;
  --s5: 32px; --s6: 48px;  --s7: 72px;  --s8: 112px;

  /* Measure — prose never runs wider than this */
  --measure:      68ch;
  --page:         1120px;
  --masthead-h:   64px;

  --sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--masthead-h) + var(--s4));
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  background: var(--black);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { font-family: var(--sans); font-weight: 700; line-height: 1.15; }

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

/* ---------- Layout ---------- */

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--s4);
}

.section { padding: var(--s7) 0; }
.section + .section { border-top: 1px solid var(--rule); }

.prose { max-width: var(--measure); }
.prose p + p { margin-top: var(--s3); }

/* Kicker: the small uppercase label above a heading. Editorial staple. */
.kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s3);
}

.section-title { font-size: var(--h1); letter-spacing: -0.02em; }
.section-intro {
  max-width: var(--measure);
  margin-top: var(--s3);
  font-size: var(--lede);
  color: var(--muted);
  line-height: 1.5;
}

/* ============================================================
   MASTHEAD (§4.2)
   Visible at rest. No hover dependency. No JavaScript.
   Current page declared in markup via aria-current, never computed.
   ============================================================ */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--masthead-h);
  background: var(--black);
  border-bottom: 1px solid var(--rule);
}

.masthead-inner {
  max-width: var(--page);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--s4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}

.mark {
  font-family: 'Press Start 2P', var(--sans);
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  flex: none;
}
.mark:hover { color: var(--ink); }

.masthead nav {
  display: flex;
  align-items: center;
  gap: var(--s5);
}

.masthead nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  padding: var(--s2) 0;
  border-bottom: 1px solid transparent;
}
.masthead nav a:hover { color: var(--ink); }

/* The current page is marked with a rule, not a filled pill. */
.masthead nav a[aria-current="page"],
.mark[aria-current="page"] { color: var(--ink); }
.masthead nav a[aria-current="page"] { border-bottom-color: var(--accent); }

/* ============================================================
   HERO — index only
   ============================================================ */

.hero { padding: var(--s8) 0 var(--s7); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--s7);
  align-items: start;
}

/* Desaturated so the portrait never competes with the accent (§5.4) */
.portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  filter: grayscale(1) contrast(1.04);
  border: 1px solid var(--rule-strong);
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--s6);
  }
  .portrait { max-width: 200px; order: -1; }
}

.hero-name {
  font-size: var(--display);
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.hero-role {
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule-strong);
  max-width: var(--measure);
  font-size: var(--lede);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
}
.hero-role strong { color: var(--accent); font-weight: 700; }

.hero-lede {
  margin-top: var(--s4);
  max-width: var(--measure);
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-actions {
  margin-top: var(--s6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3) var(--s5);
  align-items: center;
}

/* Links, not buttons. Editorial pages don't need chrome. */
.action {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--accent);
}
.action:hover { color: var(--accent); }
.action-quiet {
  font-size: 0.95rem;
  color: var(--muted);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--rule-strong);
}
.action-quiet:hover { color: var(--ink); border-bottom-color: var(--accent); }

/* ============================================================
   DATA MARKS (§5.3)
   Direct labelling. Honest 0–100 scale. No legends, no chartjunk.
   ============================================================ */

.figure { margin-top: var(--s4); max-width: 460px; }
.figure svg { width: 100%; height: auto; display: block; overflow: visible; }
.figure figcaption {
  margin-top: var(--s2);
  font-size: var(--small);
  color: var(--dim);
  line-height: 1.5;
}

/* SVG primitives */
.bar-track { fill: rgba(234, 234, 234, 0.06); }
.bar-base  { fill: var(--dim); }
.bar-value { fill: var(--accent); }
.bar-label { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.bar-num   { fill: var(--ink); font-size: 11px; font-weight: 700; font-family: var(--sans); }
.bar-num-accent { fill: var(--accent); font-size: 11px; font-weight: 700; font-family: var(--sans); }
.axis-rule { stroke: var(--rule); stroke-width: 1; }

/* The big typographic figure — used where one number IS the story */
.stat { display: block; }
.stat-value {
  display: block;
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  display: block;
  margin-top: var(--s2);
  font-size: var(--small);
  color: var(--muted);
  max-width: 34ch;
  line-height: 1.5;
}

/* Two lead teasers on the home page */
.leads {
  margin-top: var(--s6);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s6);
}
.lead { border-top: 1px solid var(--rule-strong); padding-top: var(--s4); }
.lead h3 { font-size: var(--h2); letter-spacing: -0.015em; }
.lead h3 a:hover { color: var(--accent); }
.lead-meta {
  margin-top: var(--s2);
  font-size: var(--small);
  color: var(--dim);
  letter-spacing: 0.02em;
}
.lead p { margin-top: var(--s3); color: var(--muted); font-size: 0.95rem; }

/* ============================================================
   WORK — numbered editorial entries (§6.2). Ranked, not a grid.
   ============================================================ */

.entry {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: var(--s5);
  padding: var(--s6) 0;
  border-top: 1px solid var(--rule);
}
.entry:first-of-type { border-top: 1px solid var(--rule-strong); }

.entry-index {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  padding-top: 6px;
}

.entry h2 { font-size: var(--h2); letter-spacing: -0.015em; }

.entry-meta {
  margin-top: var(--s2);
  font-size: var(--small);
  color: var(--dim);
}

.entry-problem {
  margin-top: var(--s3);
  max-width: var(--measure);
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.55;
}

.entry-method {
  margin-top: var(--s3);
  max-width: var(--measure);
  color: var(--muted);
  font-size: 0.95rem;
}

.tags {
  margin-top: var(--s4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
}
.tags li {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.tags li::after { content: ''; }
.tags li + li { border-left: 1px solid var(--rule); padding-left: var(--s3); }

/* ============================================================
   BACKGROUND — roles, education, certifications (§6.3)
   ============================================================ */

.role {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: var(--s5);
  padding: var(--s6) 0;
  border-top: 1px solid var(--rule);
}
.role:first-of-type { border-top: 1px solid var(--rule-strong); }

.role-when {
  font-size: var(--small);
  color: var(--dim);
  padding-top: 5px;
  font-variant-numeric: tabular-nums;
}
.role-when .current {
  display: block;
  margin-top: var(--s1);
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.role h3 { font-size: 1.15rem; }
.role-where { margin-top: 2px; font-size: 0.95rem; color: var(--muted); }
.role-note {
  margin-top: var(--s2);
  font-size: var(--small);
  color: var(--accent);
  letter-spacing: 0.02em;
}
.role ul { margin-top: var(--s3); max-width: var(--measure); }
.role ul li {
  position: relative;
  padding-left: var(--s3);
  color: var(--muted);
  font-size: 0.95rem;
}
.role ul li + li { margin-top: var(--s2); }
.role ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 1px;
  background: var(--dim);
}

/* Education */
.degree { border-top: 1px solid var(--rule-strong); padding-top: var(--s4); }
.degree h3 { font-size: var(--h2); letter-spacing: -0.015em; }
.degree-where { margin-top: var(--s2); color: var(--muted); }
.degree-when { margin-top: var(--s1); font-size: var(--small); color: var(--dim); }

.results {
  margin-top: var(--s5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s6);
}

.note {
  margin-top: var(--s5);
  max-width: var(--measure);
  padding-left: var(--s4);
  border-left: 1px solid var(--rule-strong);
  font-size: var(--small);
  color: var(--dim);
  line-height: 1.6;
}

/* Certifications */
.certs { margin-top: var(--s5); }
.cert {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s3);
  padding: var(--s4) 0;
  border-top: 1px solid var(--rule);
}
.cert:first-child { border-top: 1px solid var(--rule-strong); }
.cert-name { font-size: 1.02rem; font-weight: 600; }
.cert-lead .cert-name { color: var(--accent); }
.cert-issuer { font-size: var(--small); color: var(--dim); }

/* Tools — grouped, never rated (§3.6, §8.8) */
.skillset {
  margin-top: var(--s6);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s6) var(--s7);
}
.skillset > div {
  border-top: 1px solid var(--rule);
  padding-top: var(--s4);
}
.skillset .tags { margin-top: var(--s3); }

@media (max-width: 620px) {
  .skillset { grid-template-columns: 1fr; gap: var(--s5); }
}

/* ============================================================
   CONTACT
   ============================================================ */

.contact-grid {
  margin-top: var(--s6);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--s7);
  align-items: start;
}

.channels { border-top: 1px solid var(--rule-strong); }
.channel {
  display: block;
  padding: var(--s4) 0;
  border-bottom: 1px solid var(--rule);
}
.channel-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.channel-value { display: block; margin-top: var(--s1); font-size: 1rem; color: var(--ink); }
a.channel:hover .channel-value { color: var(--accent); }

form { border-top: 1px solid var(--rule-strong); padding-top: var(--s4); }
.field + .field { margin-top: var(--s4); }
.field label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s2);
}
.field input,
.field textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  padding: var(--s3);
  border-radius: 2px;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--dim); }

button[type="submit"] {
  margin-top: var(--s5);
  background: none;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0 0 3px;
  cursor: pointer;
}
button[type="submit"]:hover { color: var(--accent); }

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  border-top: 1px solid var(--rule);
  padding: var(--s6) 0 var(--s7);
  margin-top: var(--s7);
}
.footer-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--s4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4) var(--s5);
  justify-content: space-between;
  align-items: baseline;
}
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s5); }
.footer-links a { font-size: 0.9rem; color: var(--muted); }
.footer-links a:hover { color: var(--accent); }
.footer-note { font-size: var(--small); color: var(--dim); }

/* ============================================================
   RESPONSIVE
   The masthead holds its shape at every breakpoint — two links
   fit at 375px, so there is no disclosure control and no JS.
   ============================================================ */

@media (max-width: 900px) {
  .leads { grid-template-columns: 1fr; gap: var(--s5); }
  .contact-grid { grid-template-columns: 1fr; gap: var(--s6); }
  .role { grid-template-columns: 1fr; gap: var(--s3); }
  .role-when { padding-top: 0; }
  .role-when .current { display: inline; margin-left: var(--s2); }
}

@media (max-width: 620px) {
  :root { --s7: 56px; --s8: 72px; }
  .entry { grid-template-columns: 1fr; gap: var(--s3); }
  .entry-index { padding-top: 0; }
  .masthead nav { gap: var(--s4); }
  .results { gap: var(--s5); }
}

/* ---------- Selection & scrollbar ---------- */
::selection { background: rgba(102, 143, 163, 0.30); color: var(--ink); }
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: #26262e; }
::-webkit-scrollbar-thumb:hover { background: #34343e; }
