/* Schibsted Grotesk, self-hosted (SIL Open Font License, see fonts/OFL-LICENSE.txt) */
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/schibsted-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/schibsted-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/schibsted-grotesk-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/schibsted-grotesk-latin-800-normal.woff2") format("woff2"); }

:root {
  --paper: #0e1a24;
  --paper-raised: #142430;
  --ink: #d9e2df;
  --ink-strong: #eef3f1;
  --ink-soft: #9db0b7;
  --contour: #23394a;
  --contour-strong: #31516a;
  --brass: #d3a04a;
  --error: #f0907f;
  --ok: #86d3a3;

  --font: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.85rem, 3.2vw, 2.5rem);
  --step-4: clamp(2.1rem, 4.4vw, 3.5rem);

  --gutter: clamp(16px, 5vw, 64px);
  --max: 1160px;
  color-scheme: dark;
}

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

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

html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.1; font-weight: 800; letter-spacing: -0.015em; color: var(--ink-strong); }
p { margin: 0; }

a { color: inherit; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: var(--gutter); top: -100px;
  background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 10;
}
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  max-width: var(--max); margin: 0 auto;
  padding: 22px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: relative; z-index: 2;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; font-weight: 800; font-size: var(--step-1); letter-spacing: -0.01em;
}
.mark { width: 34px; height: 34px; flex: none; }
.mark .trace { fill: none; stroke: var(--ink-soft); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.mark .node { fill: var(--paper); stroke: var(--ink-strong); stroke-width: 2.4; }
.mark .me { fill: var(--brass); }
.wordmark .lan { font-weight: 500; }
.wordmark .tech { font-weight: 500; color: var(--ink-soft); }

.site-header nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); font-weight: 500; }
.site-header nav a { text-decoration: none; padding: 6px 0; }
.site-header nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.site-header nav .nav-cta {
  border: 2px solid var(--ink-soft); padding: 6px 14px; border-radius: 999px;
}
.site-header nav .nav-cta:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  max-width: var(--max); margin: 0 auto;
  padding: clamp(48px, 9vw, 120px) var(--gutter) clamp(72px, 11vw, 150px);
  min-height: min(78vh, 720px);
  display: flex; align-items: center;
  isolation: isolate;
}
.topo {
  position: absolute; inset: -80px -2vw 0 26%;
  width: auto; height: calc(100% + 80px);
  z-index: -1;
}
.topo path { fill: none; stroke: var(--contour); stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.topo path.index { stroke: var(--contour-strong); stroke-width: 1.8; }
.topo .benchmark .halo { fill: none; stroke: var(--brass); stroke-width: 1.5; opacity: .45; }
.topo .benchmark .me { fill: var(--brass); }

.hero-copy { max-width: 46rem; }
.hello { font-size: var(--step-1); font-weight: 600; color: var(--brass); margin-bottom: 1rem; }
.hero h1 { font-size: var(--step-4); line-height: 1.04; letter-spacing: -0.025em; max-width: 22ch; }
.lede { margin-top: 1.5rem; font-size: var(--step-1); color: var(--ink-soft); max-width: 36rem; }
.hello, .lede, .hero h1 { text-shadow: 0 0 18px var(--paper), 0 0 6px var(--paper); }

.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 2.25rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; font-size: var(--step-0);
  padding: 13px 24px; border-radius: 999px; text-decoration: none; cursor: pointer;
  border: 2px solid var(--ink);
}
.button.primary { background: var(--brass); border-color: var(--brass); color: var(--paper); }
.button.primary:hover { background: transparent; color: var(--brass); }
.button.quiet { background: var(--paper); color: var(--ink); border-color: var(--ink-soft); }
.button.quiet:hover { background: var(--paper-raised); }
.button[disabled] { opacity: 0.6; cursor: progress; }

/* Contour draw-in: the page's single load moment */
@media (prefers-reduced-motion: no-preference) {
  .topo path { stroke-dasharray: 3200; stroke-dashoffset: 3200; animation: draw 2.4s cubic-bezier(.45,.05,.2,1) forwards; }
  .topo path:nth-child(2)  { animation-delay: .08s; }
  .topo path:nth-child(3)  { animation-delay: .16s; }
  .topo path:nth-child(4)  { animation-delay: .24s; }
  .topo path:nth-child(5)  { animation-delay: .32s; }
  .topo path:nth-child(6)  { animation-delay: .40s; }
  .topo path:nth-child(7)  { animation-delay: .48s; }
  .topo path:nth-child(8)  { animation-delay: .56s; }
  .topo path:nth-child(9)  { animation-delay: .64s; }
  .topo path:nth-child(10) { animation-delay: .72s; }
  .topo path:nth-child(11) { animation-delay: .80s; }
  .topo .benchmark { opacity: 0; animation: settle .5s ease-out 1.6s forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes settle { to { opacity: 1; } }

/* ---------- Shared section frame ---------- */
main > section:not(.hero) {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(56px, 8vw, 104px) var(--gutter);
}
main > section h2 { font-size: var(--step-3); max-width: 22ch; }

/* ---------- Services ---------- */
.services, .experience, .contact {
  background: linear-gradient(var(--contour-strong), var(--contour-strong)) no-repeat center top / calc(100% - 2 * var(--gutter)) 2px;
}
.service-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 48px) clamp(32px, 6vw, 80px);
  margin-top: clamp(32px, 5vw, 56px);
}
.service-grid article { border-left: 2px solid var(--brass); padding-left: 20px; }
.service-grid h3 { font-size: var(--step-1); }
.service-grid p { margin-top: .5rem; color: var(--ink-soft); max-width: 46ch; }


/* ---------- Experience ---------- */
.experience {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px clamp(32px, 6vw, 88px);
}
.experience-intro p { margin-top: 1rem; color: var(--ink-soft); max-width: 36ch; }
.highlights { list-style: none; margin: 0; padding: 0; }
.highlights li {
  position: relative; padding: 1rem 0 1rem 28px; border-top: 1px solid var(--contour-strong); max-width: 60ch;
}
.highlights li:last-child { border-bottom: 1px solid var(--contour-strong); }
.highlights li::before {
  content: ""; position: absolute; left: 2px; top: 1.45rem;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid var(--brass);
}
.experience .stack-list, .education { grid-column: 2; }
.education { color: var(--ink-soft); font-size: var(--step--1); margin-top: .25rem; }
.stack-list { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.stack-list li { border: 1px solid var(--contour-strong); border-radius: 999px; padding: 5px 14px; font-weight: 500; font-size: var(--step--1); }

/* ---------- Contact ---------- */
.contact {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 88px);
}
.contact-intro p { margin-top: 1rem; color: var(--ink-soft); max-width: 32ch; font-size: var(--step-1); }

.contact-form { display: grid; gap: 20px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; }
.optional { font-weight: 400; color: var(--ink-soft); }
.field input, .field textarea {
  font: inherit; color: var(--ink); background: var(--paper-raised);
  border: 1.5px solid var(--ink-soft); border-radius: 6px; padding: 12px 14px; width: 100%;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus-visible, .field textarea:focus-visible { outline-offset: 1px; border-color: var(--brass); }
.field [aria-invalid="true"] { border-color: var(--error); }
.field-error { color: var(--error); font-size: var(--step--1); font-weight: 500; }
.contact-form .button { justify-self: start; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-status { min-height: 1.5em; font-weight: 600; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--error); }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--max); margin: 0 auto; padding: 28px var(--gutter) 40px;
  background: linear-gradient(var(--contour), var(--contour)) no-repeat center top / calc(100% - 2 * var(--gutter)) 1px;
  color: var(--ink-soft); font-size: var(--step--1);
}

/* ---------- Narrow screens ---------- */
@media (max-width: 860px) {
  .contact, .experience { grid-template-columns: 1fr; }
  .experience .stack-list, .education { grid-column: 1; }
}
@media (max-width: 640px) {
  .site-header nav a:not(.nav-cta) { display: none; }
  .wordmark .name { font-size: 1.05rem; }
  .wordmark .tech { display: none; }
  .topo { inset: auto -40% 0 -10%; height: 70%; opacity: .7; }
  .hero { align-items: flex-start; min-height: 0; }
  .service-grid { grid-template-columns: 1fr; }
}

/* ---------- Error page ---------- */
.error-page { max-width: var(--max); margin: 0 auto; padding: clamp(64px, 12vw, 160px) var(--gutter); }
.error-page h1 { font-size: var(--step-3); }
.error-page p { margin-top: 1rem; color: var(--ink-soft); }
.error-page a { color: var(--brass); }
.request-id { font-size: var(--step--1); }
