@charset "utf-8";

/* Tokens. Dark is the default; light follows the OS unless the toggle says otherwise. */
:root {
  --bg: #111214;
  --surface: #18191c;
  --text: #ebeae6;
  --muted: #9b9b97;
  --rule: #2b2c30;
  --accent: #ff5b1f;
  --accent-ink: #ff5b1f;
  --on-accent: #111214;

  --sans: "Schibsted Grotesk", "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --wrap: 72rem;
  --pad: clamp(1.25rem, 4vw, 3rem);
  --gap: 1.5rem;
  --section: 6.5rem;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f2f0;
    --surface: #ffffff;
    --text: #151619;
    --muted: #5c5d62;
    --rule: #d6d6d2;
    --accent-ink: #b8380a;
    --on-accent: #151619;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f2f2f0;
  --surface: #ffffff;
  --text: #151619;
  --muted: #5c5d62;
  --rule: #d6d6d2;
  --accent-ink: #b8380a;
  --on-accent: #151619;
  color-scheme: light;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  interpolate-size: allow-keywords;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ol, ul, figure, pre { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { font-weight: 600; text-wrap: balance; }
p { text-wrap: pretty; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--rule);
  transition: text-decoration-color 120ms ease, color 120ms ease;
}
a:hover { text-decoration-color: var(--accent); }

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

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

.meta {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
}

.meta code {
  font-family: var(--mono);
  font-size: 1em;
  color: var(--text);
  white-space: nowrap;
}

.muted { color: var(--muted); }

.ext::after {
  content: "\2197";
  display: inline-block;
  margin-left: 0.2em;
  font-size: 0.9em;
  transition: transform 120ms ease;
}
a.ext:hover::after { transform: translate(1px, -1px); }

.skip {
  position: absolute;
  left: var(--pad);
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-decoration: none;
  z-index: 10;
}
.skip:focus { top: 0.75rem; }

/* Layout. One 12-column grid. Columns 1-3 are the label rail; 4-12 hold the content. */
.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--pad));
  margin-inline: auto;
  padding-inline: var(--pad);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
}

/* Header */
.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 2rem;
  padding-block: 1.75rem;
}

.brand {
  margin-right: auto;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  font-size: 0.9375rem;
}

.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover { color: var(--text); }

.theme-toggle {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-family: var(--mono);
  font-size: 0.8125rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }

/* Hero */
.hero {
  padding-top: clamp(2rem, 5vw, 4rem);
  padding-bottom: var(--section);
  align-items: start;
}

.id {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2.75rem;
}

.id img {
  width: 96px;
  height: 96px;
  border-radius: 2px;
  background: var(--surface);
  flex: none;
}

.id h1 {
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.statement {
  grid-column: 1 / span 10;
  font-size: clamp(2.25rem, 1.2rem + 4.2vw, 4.25rem);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -0.03em;
  max-width: 24ch;
  text-wrap: balance;
}

.hero-text {
  grid-column: 1 / span 5;
  margin-top: 2.75rem;
}

.lead {
  font-size: 1.25rem;
  line-height: 1.5;
  max-width: 34rem;
}

.lead + .lead {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 2.25rem;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.15rem;
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transition: filter 120ms ease;
}
.button:hover { filter: brightness(1.08); }

.hero-panel {
  grid-column: 6 / span 7;
  margin-top: 2.75rem;
}

/* Output panels: real command output, never mocked */
.panel { min-width: 0; }

.panel pre {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text);
  tab-size: 2;
}

.panel pre.wrapped { white-space: pre-wrap; overflow-wrap: anywhere; }
.panel pre.wrapped .l { display: inline-block; width: 100%; padding-left: 2ch; text-indent: -2ch; }
.panel .p { color: var(--muted); user-select: none; }
.panel .hl { color: var(--accent-ink); }
.panel .dim { color: var(--muted); }

.panel figcaption {
  margin-top: 0.75rem;
  max-width: 62ch;
}

.results {
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.results caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 0.6rem;
}
.results th, .results td {
  padding: 0.55rem 1.1rem;
  text-align: right;
  border-top: 1px solid var(--rule);
  font-weight: 400;
  white-space: nowrap;
}
.results thead th { border-top: 0; color: var(--muted); }
.results th[scope="row"] { text-align: left; color: var(--muted); padding-right: 2.5rem; }
.results .hl { color: var(--accent-ink); font-weight: 500; }

.shot img {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

/* Sections */
.section { padding-bottom: var(--section); }

.sec-head {
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
  align-items: baseline;
}

.sec-head h2 {
  grid-column: 1 / span 3;
  font-size: 1.75rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.sec-head .intro {
  grid-column: 4 / -1;
  max-width: 40rem;
  color: var(--muted);
}

.sec-head .body { grid-column: 4 / -1; }

.prose p { max-width: 40rem; }
.prose p + p { margin-top: 1rem; }
.prose .stack { margin-top: 1.5rem; max-width: 40rem; }

/* Rows: label in the rail, content to the right. Used by projects, experience, education. */
.rows { margin-top: 2.25rem; }

.row {
  padding-block: 1.75rem;
  border-top: 1px solid var(--rule);
  row-gap: 1rem;
  align-items: start;
}

.row > .label { grid-column: 1 / span 3; }
.row > .body { grid-column: 4 / -1; }

.idx, .when {
  display: block;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
}

.when { padding-top: 0.15rem; }

/* Projects */
.project .label h3 {
  margin-top: 0.35rem;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.project .label h3 a { text-decoration: none; }
.project .label h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent); }

.project .what { grid-column: 4 / span 6; padding-top: 1.55rem; }
.project .what > p:first-child { max-width: 56ch; }
.project .what .meta { margin-top: 0.75rem; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 0.85rem;
  font-size: 0.9375rem;
}

.metric {
  grid-column: 10 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 1.55rem;
}

.metric .num {
  font-size: 2rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.metric .label-text {
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 24ch;
}

.project details { grid-column: 4 / -1; }

.project summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
  list-style: none;
}
.project summary::-webkit-details-marker { display: none; }
.project summary::before {
  content: "+";
  display: inline-block;
  width: 0.75em;
  color: var(--accent-ink);
}
.project details[open] summary::before { content: "\2212"; }
.project summary:hover { color: var(--text); }

.project details .panel { margin-top: 0.9rem; }

@media (prefers-reduced-motion: no-preference) {
  .project details::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 180ms ease, content-visibility 180ms allow-discrete;
  }
  .project details[open]::details-content { block-size: auto; }
}

/* Experience and education */
.roles h3 {
  font-size: 1.0625rem;
  line-height: 1.45;
}
.roles h3 .org { font-weight: 400; color: var(--muted); }
.roles h3 .org::before {
  content: "\00B7";
  margin: 0 0.5em 0 0.15em;
}
.roles .body p { margin-top: 0.3rem; color: var(--muted); max-width: 46rem; }

/* Contact */
.contact-line {
  font-size: clamp(1.5rem, 1rem + 2vw, 2.75rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.contact-line a {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  margin-top: 1.25rem;
}

.contact-note { margin-top: 1.5rem; color: var(--muted); max-width: 40rem; }

.copy {
  appearance: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: none;
  padding: 0.2rem 0.55rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  cursor: pointer;
}
.copy:hover { color: var(--text); border-color: var(--muted); }

/* Footer */
.site-foot > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
}

/* Tablet: the rail moves above the content */
@media (max-width: 64rem) {
  .statement { grid-column: 1 / -1; }
  .hero-text { grid-column: 1 / span 10; }
  .hero-panel { grid-column: 1 / -1; margin-top: 3rem; }

  .sec-head h2, .sec-head .intro, .sec-head .body { grid-column: 1 / -1; }
  .sec-head .intro, .sec-head .body { margin-top: 1rem; }

  .row > .label, .row > .body { grid-column: 1 / -1; }
  .row { row-gap: 0.6rem; }

  .project .label { display: flex; align-items: baseline; gap: 1rem; }
  .project .label h3 { margin-top: 0; }
  .project .what { grid-column: 1 / span 8; padding-top: 0; }
  .metric { grid-column: 9 / -1; padding-top: 0.2rem; }
  .project details { grid-column: 1 / -1; }
}

/* Phone */
@media (max-width: 40rem) {
  :root { --section: 4.5rem; }

  body { font-size: 1rem; }

  .site-head { padding-block: 1.25rem; }
  .site-nav { order: 3; width: 100%; gap: 0.25rem 1.1rem; }

  .id { margin-bottom: 2rem; gap: 1rem; }
  .id img { width: 72px; height: 72px; }

  .lead { font-size: 1.125rem; }
  .hero-text { grid-column: 1 / -1; margin-top: 1.75rem; }
  .hero-panel { margin-top: 2.25rem; }

  .sec-head h2 { font-size: 1.5rem; }
  .rows { margin-top: 1.5rem; }

  .project .what, .metric { grid-column: 1 / -1; }
  .metric {
    flex-direction: row;
    align-items: baseline;
    gap: 0.75rem;
    padding-top: 0.5rem;
  }
  .metric .num { font-size: 1.75rem; }
  .metric .label-text { max-width: none; }

  .panel pre { font-size: 0.75rem; padding: 0.9rem 1rem; }
  .results th, .results td { padding: 0.45rem 0.7rem; }
  .results th[scope="row"] { padding-right: 0.9rem; white-space: normal; }

  .roles h3 .org { display: block; }
  .roles h3 .org::before { content: none; }
}

/* Print: a clean summary with link targets written out */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --text: #000; --muted: #444; --rule: #ccc;
    --accent: #000; --accent-ink: #000;
  }
  .site-nav, .theme-toggle, .copy, .skip, .hero-panel, .project details, .actions .button { display: none !important; }
  body { font-size: 10.5pt; }
  .hero, .section { padding-bottom: 1.5rem; }
  .statement { font-size: 20pt; }
  .row { break-inside: avoid; padding-block: 0.6rem; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-family: var(--mono); font-size: 8pt; color: #444; }
  .ext::after { content: none; }
}
