/* xylems.dev. Tokens first; everything else reads from them. */
:root {
  --paper: #EEF1EE;
  --raised: #F7F9F7;
  --ink: #18201C;
  --ink-2: #4A5650;
  --moss: #2E5A47;
  --moss-ink: #F2F6F3;
  --vessel: #9DB8AA;
  --sap: #A86E14;
  --rule: #D3DCD6;
  --focus: #A86E14;

  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  /* Scale on a 1.25 ratio from a 17px body. */
  --t-small: 0.875rem;
  --t-body: 1.0625rem;
  --t-h4: 1.0625rem;
  --t-h3: 1.3125rem;
  --t-h2: 1.875rem;
  --t-hero: clamp(2.125rem, 1.2rem + 3.6vw, 3.625rem);

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --space: clamp(4rem, 8vw, 7rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1814;
    --raised: #15211C;
    --ink: #E3EAE6;
    --ink-2: #A2B1A9;
    --moss: #86C4A6;
    --moss-ink: #0F1814;
    --vessel: #3D5C4E;
    --sap: #E3AB4E;
    --rule: #24352D;
    --focus: #E3AB4E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1814; --raised: #15211C; --ink: #E3EAE6; --ink-2: #A2B1A9; --moss: #86C4A6;
  --moss-ink: #0F1814; --vessel: #3D5C4E; --sap: #E3AB4E; --rule: #24352D; --focus: #E3AB4E;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-body)/1.55 var(--font);
  font-feature-settings: "ss01";
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--moss); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden, .hp {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--raised); padding: 0.5rem 1rem; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.top-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; font-weight: 700; }
.top nav { display: flex; gap: 1.25rem; margin-left: auto; }
.top nav a { color: var(--ink-2); text-decoration: none; font-size: var(--t-small); font-weight: 500; }
.top nav a:hover { color: var(--ink); }
@media (max-width: 52rem) { .top nav { display: none; } .top .btn-small { margin-left: auto; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.875rem; padding: 0 1.25rem;
  font: 600 var(--t-small)/1 var(--font); letter-spacing: 0.01em;
  color: var(--moss-ink); background: var(--moss);
  border: 1px solid var(--moss); border-radius: 999px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover { border-color: var(--ink-2); filter: none; }
.btn-small { min-height: 2.25rem; padding: 0 1rem; }
.btn[disabled] { opacity: 0.55; cursor: progress; }

/* Hero: the one loud moment */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem); align-items: center;
  padding-block: clamp(3rem, 7vw, 6rem) var(--space);
}
.hero-role { color: var(--moss); font-weight: 600; margin-bottom: 1.25rem; }
.hero h1 {
  font-size: var(--t-hero); font-weight: 700; letter-spacing: -0.025em; line-height: 1.06;
  max-width: 14ch; text-wrap: balance; margin-bottom: 1.5rem;
}
.hero-lede { color: var(--ink-2); max-width: 36rem; font-size: 1.125rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero-graph { margin: 0; }
@media (max-width: 60rem) {
  .hero { grid-template-columns: 1fr; }
  .hero-graph { max-width: 40rem; }
}

.graph { width: 100%; overflow: visible; }
.graph text { font: 500 15px var(--font); fill: var(--ink-2); }
.g-edge { fill: none; stroke: var(--vessel); stroke-width: 1.5; stroke-linecap: round; }
.g-minor { stroke-width: 1; opacity: 0.7; stroke-dasharray: 2 5; }
.g-node circle { fill: var(--paper); stroke: var(--moss); stroke-width: 2; r: 5.5px; }
.g-build circle { fill: var(--moss); }
.g-center circle { fill: var(--moss); }
.g-center text { font: 700 15px var(--font); fill: var(--moss-ink); }
@media (prefers-reduced-motion: no-preference) {
  .g-edge:not(.g-minor) {
    stroke-dasharray: 1; stroke-dashoffset: 1;
    animation: grow 1.1s cubic-bezier(.3, .6, .2, 1) forwards;
    animation-delay: calc(var(--i) * 55ms + 150ms);
  }
  .g-node { opacity: 0; animation: appear .5s ease forwards; animation-delay: .9s; }
  @keyframes grow { to { stroke-dashoffset: 0; } }
  @keyframes appear { to { opacity: 1; } }
}

/* Sections */
main > section { padding-block: 0 var(--space); }
h2 { font-size: var(--t-h2); font-weight: 700; letter-spacing: -0.015em; margin-bottom: 1.5rem; }
h3 { font-size: var(--t-h3); font-weight: 650; }
h4 { font-size: var(--t-h4); font-weight: 650; }
.sub { font-size: var(--t-h4); font-weight: 650; margin: 3rem 0 1rem; color: var(--ink); }
.section-lede { color: var(--ink-2); max-width: 40rem; margin-bottom: 2.5rem; }

.about { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 2rem; }
.prose { max-width: 40rem; }
.prose p:first-child { font-size: 1.1875rem; color: var(--ink); }
.prose p { color: var(--ink-2); }
@media (max-width: 52rem) { .about { grid-template-columns: 1fr; gap: 0; } }

/* Experience: a real sequence, so a dated rail */
.job { border-top: 2px solid var(--ink); padding-top: 1.25rem; margin-bottom: 3rem; }
.job-head { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 2rem; margin-bottom: 1.5rem; }
.job-note { color: var(--ink-2); max-width: 40rem; margin: 0; }
.role, .earlier li {
  display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 2rem;
  padding-block: 1.25rem; border-top: 1px solid var(--rule);
}
.role-dates { color: var(--ink-2); font-size: var(--t-small); font-variant-numeric: tabular-nums; margin: 0.15rem 0 0; }
.role h4 { margin-bottom: 0.75rem; max-width: 40rem; }
.role ul li {
  position: relative; padding-left: 1.1rem; margin-bottom: 0.5rem; max-width: 42rem; color: var(--ink-2);
}
.role ul li::before {
  content: ""; position: absolute; left: 0; top: 0.68em; width: 6px; height: 6px;
  border-radius: 50%; background: var(--moss);
}
.earlier .at { font-weight: 400; color: var(--ink-2); }
.earlier p:last-child { color: var(--ink-2); max-width: 42rem; margin: 0.4rem 0 0; }
@media (max-width: 52rem) {
  .job-head, .role, .earlier li { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* Speaking */
.talks { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 2rem; }
.talks li { border-top: 2px solid var(--sap); padding-top: 1rem; }
.talks h4 { margin-bottom: 0.5rem; }
.talks p { color: var(--ink-2); margin: 0; }

/* Projects: rows, not a card grid */
.project {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 1.5rem;
  padding-block: 2rem; border-top: 1px solid var(--rule);
}
.project:last-child { border-bottom: 1px solid var(--rule); }
.project-logo { width: 56px; height: 56px; border-radius: 14px; }
.project-body { max-width: 46rem; }
.project h3 { margin-bottom: 0.75rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem; }
.status { font-size: var(--t-small); font-weight: 500; color: var(--moss); }
.project p { color: var(--ink-2); }
.project-ai strong { color: var(--ink); font-weight: 650; }
.stack { font-size: var(--t-small); color: var(--ink-2); }

/* Platform */
.pipeline {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem;
  counter-reset: step; margin-bottom: 3rem; position: relative;
}
.pipeline li { counter-increment: step; position: relative; padding-top: 2.75rem; }
.pipeline li::before {
  content: counter(step); position: absolute; top: 0; left: 0;
  width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 var(--t-small)/1 var(--font); font-variant-numeric: tabular-nums;
  background: var(--moss); color: var(--moss-ink);
}
.pipeline li:not(:last-child)::after {
  content: ""; position: absolute; top: 1rem; left: 2.5rem; right: -0.5rem;
  border-top: 1.5px solid var(--vessel);
}
.pipeline h4 { margin-bottom: 0.4rem; }
.pipeline p { font-size: var(--t-small); color: var(--ink-2); margin: 0; }
@media (max-width: 60rem) {
  .pipeline { grid-template-columns: 1fr; gap: 0; }
  .pipeline li { padding: 0 0 1.5rem 3rem; }
  .pipeline li:not(:last-child)::after { top: 2.25rem; bottom: 0.25rem; left: 1rem; right: auto; border-top: 0; border-left: 1.5px solid var(--vessel); }
}
.layers { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 0 2rem; margin: 0 0 2rem; }
.layers div { padding-block: 0.9rem; border-top: 1px solid var(--rule); }
.layers dt { font-weight: 650; margin-bottom: 0.25rem; }
.layers dd { margin: 0; color: var(--ink-2); font-size: var(--t-small); }
.next { color: var(--ink); max-width: 44rem; border-left: 3px solid var(--sap); padding-left: 1rem; }

/* Toolchain */
.tools { width: 100%; border-collapse: collapse; max-width: 56rem; }
.tools th, .tools td { text-align: left; vertical-align: top; padding: 0.95rem 1.5rem 0.95rem 0; border-top: 1px solid var(--rule); }
.tools thead th { font-size: var(--t-small); color: var(--ink-2); font-weight: 500; border-top: 0; padding-top: 0; }
.tools tbody th { font-weight: 650; white-space: nowrap; width: 13rem; }
.tools td { color: var(--ink-2); }
@media (max-width: 40rem) {
  .tools thead { display: none; }
  .tools tr { display: block; border-top: 1px solid var(--rule); padding-block: 0.9rem; }
  .tools th, .tools td { display: block; border: 0; padding: 0; }
  .tools tbody th { width: auto; margin-bottom: 0.25rem; }
}

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 0 2rem; margin: 0; }
.skills div { padding-block: 0.9rem; border-top: 1px solid var(--rule); }
.skills dt { font-weight: 650; margin-bottom: 0.25rem; }
.skills dd { margin: 0; color: var(--ink-2); }
.cred { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 2rem; }
.cred li { color: var(--ink-2); margin-bottom: 0.75rem; }
.cred strong { color: var(--ink); font-weight: 600; }

/* Contact */
.form {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem 1.5rem; max-width: 56rem;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-wide { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: var(--t-small); }
.opt { font-weight: 400; color: var(--ink-2); }
.field input, .field textarea {
  font: inherit; color: var(--ink); background: var(--raised);
  border: 1px solid var(--rule); border-radius: 10px; padding: 0.7rem 0.85rem;
}
.field input:focus, .field textarea:focus { border-color: var(--moss); outline: 2px solid color-mix(in srgb, var(--moss) 35%, transparent); outline-offset: 0; }
.field textarea { resize: vertical; min-height: 9rem; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.form-status, .dl-status { margin: 0; color: var(--ink-2); }
.form-status[data-state="error"], .dl-status[data-state="error"] { color: #B3261E; }
:root[data-theme="dark"] .form-status[data-state="error"] { color: #F2B8B5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) [data-state="error"] { color: #F2B8B5; } }
@media (max-width: 52rem) { .form { grid-template-columns: 1fr; } }

/* Download dialog */
dialog {
  border: 1px solid var(--rule); border-radius: 18px; padding: 0;
  background: var(--raised); color: var(--ink); width: min(26rem, calc(100vw - 2rem));
}
dialog::backdrop { background: rgb(15 24 20 / 0.45); }
.dl { padding: 1.75rem; }
.dl h2 { font-size: var(--t-h3); margin-bottom: 0.75rem; }
.dl p { color: var(--ink-2); }
.dl .ts { min-height: 65px; margin-block: 1rem; }
.dl-actions { display: flex; justify-content: flex-end; }

/* Footer */
.foot { border-top: 1px solid var(--rule); padding-block: 2.5rem; color: var(--ink-2); font-size: var(--t-small); }
.foot-inner { display: grid; gap: 0.5rem; }
.foot p { margin: 0; }
.foot a { margin-right: 1rem; }
.small { font-size: 0.8125rem; }
@media (max-width: 40rem) { .graph text { font-size: 21px; } .g-center text { font-size: 19px; } }
