/* ------------------------------------------------------------------
   Constraint sheet (see README for the reasoning)
   Accent: signal orange — used ONLY for "live/now" signals + link hover
   Type: Schibsted Grotesk (structure) + JetBrains Mono (metadata)
   Scale: 1.25 ratio · Spacing: 4px base · Radius: 0 / 4 / 8
   No gradients, no glow, no emoji, no uniform card grid.
------------------------------------------------------------------- */

:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --ink: #101214;
  --ink-2: #4a4f57;
  --ink-3: #6b717a;
  --line: #dcdfe3;
  --accent: #b8400f;
  --accent-soft: #f6e3da;
  --code-bg: #111315;
  --code-ink: #d9dde2;

  --font: "Schibsted Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;

  --r1: 4px; --r2: 8px;
  --maxw: 1180px;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f11;
    --surface: #15181b;
    --ink: #e8eaed;
    --ink-2: #a9afb7;
    --ink-3: #8a919a;
    --line: #262a2f;
    --accent: #ff8a5c;
    --accent-soft: #2a1a12;
    --code-bg: #08090a;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f11;
  --surface: #15181b;
  --ink: #e8eaed;
  --ink-2: #a9afb7;
  --ink-3: #8a919a;
  --line: #262a2f;
  --accent: #ff8a5c;
  --accent-soft: #2a1a12;
  --code-bg: #08090a;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
p { margin: 0; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--s5); }
@media (max-width: 600px) { .wrap { padding-inline: var(--s4); } }

.skip { position: absolute; left: -999px; top: var(--s2); background: var(--ink); color: var(--bg); padding: var(--s2) var(--s3); z-index: 10; }
.skip:focus { left: var(--s2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: var(--s5); height: 56px; }
.mark { font-weight: 800; text-decoration: none; letter-spacing: -0.01em; margin-right: auto; }
.site-header ul { display: flex; gap: var(--s5); list-style: none; margin: 0; padding: 0; }
.site-header nav a { font-family: var(--mono); font-size: .8125rem; text-decoration: none; color: var(--ink-2); }
.site-header nav a:hover { color: var(--ink); }
.theme-toggle {
  display: grid; place-items: center; width: 32px; height: 32px;
  background: none; border: 1px solid var(--line); border-radius: var(--r1);
  color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
@media (max-width: 640px) { .site-header nav { display: none; } }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--s8);
  align-items: end;
  padding-top: var(--s9);
  padding-bottom: var(--s9);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-family: var(--mono); font-size: .8125rem; color: var(--ink-2);
  margin-bottom: var(--s5);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.hero h1 {
  font-size: clamp(2.4rem, 5.6vw, 4.75rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
  max-width: 14ch;
}
.lede { margin-top: var(--s5); font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); margin-top: var(--s6); }
.btn {
  display: inline-flex; align-items: center; height: 44px; padding-inline: var(--s5);
  background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 500;
  border-radius: var(--r1);
  transition: transform .15s var(--ease-out);
}
.btn:hover { color: var(--bg); transform: translateY(-1px); }
.email-copy {
  display: inline-flex; align-items: center; gap: var(--s3); height: 44px; padding-inline: var(--s4);
  background: none; border: 1px solid var(--line); border-radius: var(--r1);
  font: 400 .875rem var(--mono); color: var(--ink); cursor: pointer;
}
.email-copy:hover { border-color: var(--ink-3); }
.email-hint { font-size: .75rem; color: var(--ink-3); }
.email-copy.copied .email-hint { color: var(--accent); }

/* career log — the hero's one "peak" */
.log {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--r2);
  font-family: var(--mono);
  font-size: .8125rem;
  overflow: hidden;
}
.log-bar {
  display: flex; justify-content: space-between;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid #23272c;
  color: #7d848d; font-size: .75rem;
}
.log-lines { list-style: none; margin: 0; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.log-lines li { display: grid; grid-template-columns: 7.5ch minmax(0, 1fr); gap: var(--s3); line-height: 1.5; }
.log-lines time { color: #7d848d; }
.log-lines .now time { color: #ff8a5c; }
.log-lines .now span { color: #fff; }
.cursor {
  display: inline-block; width: .55em; height: 1.1em; margin-left: 3px;
  vertical-align: text-bottom; background: #ff8a5c;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.js .log-lines li { opacity: 0; transform: translateY(4px); }
.js .log-lines li.in { opacity: 1; transform: none; transition: opacity .35s var(--ease-out), transform .35s var(--ease-out); }
.js .log-lines li.now.in { transition-duration: .7s; }

.hero > *, .case > *, .now-section > * { min-width: 0; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: var(--s7); padding-top: var(--s8); padding-bottom: var(--s8); }
}

/* ---------- sections ---------- */
.section-head { display: grid; grid-template-columns: 5fr 7fr; gap: var(--s6); align-items: baseline; margin-bottom: var(--s7); }
.section-head h2, .how h2, .now-section h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); }
.section-head p { color: var(--ink-2); max-width: 56ch; }
@media (max-width: 760px) { .section-head { grid-template-columns: 1fr; gap: var(--s3); } }

.work { background: var(--surface); border-block: 1px solid var(--line); padding-block: var(--s9); }

.case {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: var(--s7);
  padding-block: var(--s7);
  border-top: 1px solid var(--line);
  align-items: start;
}
.case--feature { grid-template-columns: 4fr 8fr; border-top: 0; padding-top: 0; }
.case-index { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); margin-bottom: var(--s3); }
.case h3 { font-size: clamp(1.4rem, 2.2vw, 1.95rem); margin-bottom: var(--s4); }
.case--feature h3 { font-size: clamp(2rem, 3.4vw, 3rem); }
.case-sum { color: var(--ink-2); }
.facts { margin: var(--s5) 0 0; display: grid; gap: var(--s3); }
.facts div { display: grid; grid-template-columns: 7ch 1fr; gap: var(--s3); font-size: .9rem; }
.facts dt { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); padding-top: 2px; }
.facts dd { margin: 0; }
.links { display: flex; gap: var(--s5); margin-top: var(--s5); font-weight: 500; }
.note { margin-top: var(--s4); font-family: var(--mono); font-size: .75rem; color: var(--ink-3); }

.shot {
  display: block; border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden;
  box-shadow: 0 1px 0 var(--line), 0 24px 48px -24px rgb(16 18 20 / .28);
  transition: transform .4s var(--ease-out);
}
.shot:hover { transform: translateY(-3px); }

@media (max-width: 900px) {
  .case, .case--feature { grid-template-columns: 1fr; gap: var(--s5); }
}

/* architecture diagram */
.diagram {
  border: 1px solid var(--line); border-radius: var(--r2);
  padding: var(--s6) var(--s5);
  font-family: var(--mono); font-size: .8125rem;
  display: grid; justify-items: center; gap: 0;
  background: var(--bg);
}
.d-node { display: inline-block; padding: var(--s2) var(--s4); border: 1px solid var(--ink-3); border-radius: var(--r1); background: var(--surface); }
.d-core { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.d-in { border-style: dashed; color: var(--ink-2); }
.d-arrow { width: 1px; height: var(--s5); background: var(--ink-3); position: relative; }
.d-arrow::after { content: ""; position: absolute; bottom: -1px; left: -4px; border: 4px solid transparent; border-top-color: var(--ink-3); border-bottom: 0; }
.d-agents { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); max-width: 520px; }
.d-agents li { padding: var(--s1) var(--s3); border: 1px solid var(--line); border-radius: var(--r1); background: var(--surface); }
.d-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s4); color: var(--ink-2); }
.d-tools span::before { content: "▪ "; color: var(--ink-3); }

/* SQL transcript */
.transcript {
  background: var(--code-bg); color: var(--code-ink);
  border-radius: var(--r2); padding: var(--s5);
  font-family: var(--mono); font-size: .8125rem; line-height: 1.6;
  display: grid; gap: var(--s3);
}
.transcript span { display: inline-block; width: 8ch; color: #7d848d; }
.t-label { color: #7d848d; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.t-q { color: #fff; }
.t-sql { margin: 0; padding: var(--s4); background: #1a1d21; border-radius: var(--r1); overflow-x: auto; color: #b9c4cf; }
.t-a { color: #fff; }

/* how I work */
.how { padding-block: var(--s9); }
.steps { list-style: none; counter-reset: s; margin: var(--s7) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--ink); }
.steps li { counter-increment: s; padding: var(--s5) var(--s5) 0 0; }
.steps li + li { padding-left: var(--s5); border-left: 1px solid var(--line); }
.steps li::before { content: "0" counter(s); display: block; font-family: var(--mono); font-size: .75rem; color: var(--ink-3); margin-bottom: var(--s4); }
.steps h3 { font-size: 1.15rem; margin-bottom: var(--s2); }
.steps p { color: var(--ink-2); font-size: .95rem; }
@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr 1fr; row-gap: var(--s6); }
  .steps li:nth-child(3) { padding-left: 0; border-left: 0; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .steps li, .steps li + li { padding-left: 0; border-left: 0; }
}

/* archive */
.archive { padding-bottom: var(--s9); }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
th { text-align: left; font: 400 .75rem var(--mono); color: var(--ink-3); padding: var(--s3) var(--s3) var(--s3) 0; border-bottom: 1px solid var(--line); }
td { padding: var(--s3) var(--s3) var(--s3) 0; border-bottom: 1px solid var(--line); vertical-align: top; }
td:first-child { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); width: 6ch; }
td:nth-child(2) { font-weight: 500; white-space: nowrap; }
td:nth-child(3) { color: var(--ink-2); }
td:nth-child(4) { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); white-space: nowrap; }
td:last-child { white-space: nowrap; font-family: var(--mono); font-size: .75rem; text-align: right; }
tbody tr:hover td { background: var(--surface); }
.table-scroll { position: relative; }

/* phones: each row becomes a compact stacked entry instead of a sideways-scrolling table */
@media (max-width: 640px) {
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody tr {
    display: grid; grid-template-columns: auto 1fr auto; column-gap: var(--s3);
    padding-block: var(--s3); border-bottom: 1px solid var(--line);
  }
  td { border: 0; padding: 0; width: auto !important; white-space: normal !important; text-align: left !important; }
  td:nth-child(1) { grid-column: 1; grid-row: 1; padding-top: 2px; }
  td:nth-child(2) { grid-column: 2; grid-row: 1; }
  td:nth-child(5) { grid-column: 3; grid-row: 1; }
  td:nth-child(3) { grid-column: 2 / 4; }
  td:nth-child(4) { grid-column: 2 / 4; margin-top: var(--s1); }
  tbody tr:hover td { background: none; }
}

/* proof strip */
.proof { border-top: 1px solid var(--line); }
.proof-grid { display: grid; grid-template-columns: 6fr 3fr 3fr; gap: var(--s6); margin-block: 0; padding-block: var(--s6); align-items: end; }
.proof-grid dt { font-size: clamp(1.9rem, 3vw, 2.5rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.proof-grid dd { margin: var(--s1) 0 0; color: var(--ink-2); font-size: .95rem; }
.proof-lead dt { font-size: clamp(3rem, 7vw, 5.5rem); line-height: 1; }
.proof-lead a { text-decoration: none; }
.proof-lead span { font-size: .42em; font-weight: 500; letter-spacing: -.02em; color: var(--ink-2); }
@media (max-width: 760px) { .proof-grid { grid-template-columns: 1fr 1fr; gap: var(--s5); } .proof-lead { grid-column: 1 / -1; } }

.d-loop { font-size: .75rem; color: var(--ink-2); margin-top: var(--s2); }

/* personal builds */
.builds { padding-top: var(--s9); }
.build-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.build-list li { display: grid; grid-template-columns: 3fr 6fr 3fr; gap: var(--s5); padding-block: var(--s5); border-bottom: 1px solid var(--line); }
.build-list li > * { min-width: 0; }
.build-list h3 { font-size: 1.25rem; }
.build-status { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); margin-top: var(--s1); }
.build-list p { color: var(--ink-2); }
.build-list .build-stack { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); padding-top: 3px; }
@media (max-width: 760px) { .build-list li { grid-template-columns: 1fr; gap: var(--s2); } }

/* project explorer */
.explorer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); margin-bottom: var(--s5); }
.search input {
  width: 240px; max-width: 100%; height: 40px; padding-inline: var(--s3);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r1);
  font: 400 .875rem var(--mono);
}
.search input::placeholder { color: var(--ink-3); opacity: 1; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); }
.filters button {
  min-height: 40px; padding-inline: var(--s3); background: none; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--r1); font: 400 .8125rem var(--mono); cursor: pointer;
}
.filters button:hover { color: var(--ink); border-color: var(--ink-3); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.count { margin-left: auto; font-family: var(--mono); font-size: .75rem; color: var(--ink-3); }
#project-rows tr[hidden] { display: none; }
.no-match { padding-block: var(--s5); color: var(--ink-2); }
#project-rows td:first-child { width: 11ch; }
#project-rows td:nth-child(2) { white-space: normal; }
#project-rows td:nth-child(4) { white-space: normal; }
@media (max-width: 640px) { .count { margin-left: 0; width: 100%; } .search, .search input { width: 100%; } #project-rows td:first-child { grid-column: 2 / 4; grid-row: 3; } #project-rows td:nth-child(2) { grid-column: 1 / 3; } #project-rows td:nth-child(3), #project-rows td:nth-child(4) { grid-column: 1 / 4; } }

/* now */
.now-section { padding-bottom: var(--s9); display: grid; grid-template-columns: 5fr 7fr; gap: var(--s6); }
.now-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.now-list li { display: grid; grid-template-columns: 10ch 1fr; gap: var(--s3); padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.now-list span { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); padding-top: 4px; }
@media (max-width: 760px) { .now-section { grid-template-columns: 1fr; } .now-list li { grid-template-columns: 1fr; gap: var(--s1); } }

/* contact — the closing beat */
.contact { padding-block: var(--s9); border-top: 1px solid var(--ink); }
.contact h2 { font-size: clamp(1.5rem, 2.6vw, 2.2rem); max-width: 22ch; font-weight: 700; }
.big-mail {
  display: inline-block; margin-top: var(--s6);
  font-size: clamp(1.3rem, 4.4vw, 3.6rem); font-weight: 800; letter-spacing: -0.03em;
  text-decoration: none; border-bottom: 3px solid var(--accent);
  overflow-wrap: anywhere;
}
.elsewhere { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s5); padding: 0; margin: var(--s6) 0 0; font-family: var(--mono); font-size: .875rem; }

.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s3); padding-block: var(--s5) var(--s6); font-family: var(--mono); font-size: .75rem; color: var(--ink-3); border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .log-lines li { opacity: 1; transform: none; }
}
