/* Tokens ----------------------------------------------------------------- */
:root {
  --fog: #E8EBEE;      /* page */
  --paper: #F5F6F8;    /* raised surface */
  --ink: #15181D;      /* primary text */
  --graphite: #565D68; /* secondary text */
  --rule: #C7CDD4;     /* hairlines */
  --cobalt: #2E44E6;   /* links, focus */

  --t-bg: #17130F;     /* terminal */
  --t-bar: #221C17;
  --t-text: #ECE8E3;
  --t-dim: #8A8178;
  --t-ember: #FF7A45;
  --t-gold: #FFC857;

  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Schibsted Grotesk", "Helvetica Neue", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Type scale (1.25, major third) */
  --s-1: 0.8rem;
  --s0: 1rem;
  --s1: 1.25rem;
  --s2: 1.563rem;
  --s3: 1.953rem;
  --s4: 2.441rem;

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 76rem;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, ol, ul, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--cobalt); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

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

code { font-family: var(--mono); font-size: 0.88em; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 0.5rem 0.9rem; border-radius: 6px;
}
.skip:focus { top: 1rem; }

/* Top bar ---------------------------------------------------------------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 1.4rem;
}
.mark {
  font-family: var(--display); font-weight: 700; font-size: var(--s1);
  color: var(--ink); text-decoration: none; letter-spacing: -0.04em;
  width: 2.4rem; height: 2.4rem; display: grid; place-items: center;
  border: 1.5px solid var(--ink); border-radius: 50%;
}
.top nav { display: flex; gap: clamp(0.9rem, 2.5vw, 2rem); }
.top nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.top nav a:hover { color: var(--cobalt); }

/* Hero ------------------------------------------------------------------- */
.hero { padding-top: clamp(2rem, 7vw, 5.5rem); padding-bottom: clamp(3rem, 8vw, 6rem); }

.name {
  font-family: var(--display);
  font-variation-settings: "opsz" 96;
  font-weight: 700;
  font-size: clamp(3.4rem, 13.2vw, 11.5rem);
  line-height: 0.86;
  letter-spacing: -0.055em;
  margin-left: -0.04em;
  padding-bottom: clamp(1.25rem, 3vw, 2.25rem);
  border-bottom: 1.5px solid var(--ink);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-top: clamp(1.75rem, 4vw, 3rem);
  align-items: start;
}

.lede {
  font-family: var(--display);
  font-size: clamp(var(--s2), 2.6vw, var(--s3));
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 600;
  max-width: 22ch;
}
.now { color: var(--graphite); margin-top: 1.25rem; max-width: 40ch; }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2rem; }
.btn {
  display: inline-flex; align-items: center;
  padding: 0.7rem 1.15rem; border-radius: 999px;
  border: 1.5px solid var(--ink); color: var(--ink);
  font-weight: 600; font-size: 0.95rem; text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--cobalt); border-color: var(--cobalt); }

/* Terminal --------------------------------------------------------------- */
.term {
  background: var(--t-bg);
  color: var(--t-text);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 30px 60px -30px rgba(21,24,29,0.55), 0 12px 24px -16px rgba(21,24,29,0.4);
  overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.65rem 0.8rem 0.65rem 1rem;
  background: var(--t-bar);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #3A322B; }
.term-title { font-family: var(--mono); font-size: 0.78rem; color: var(--t-dim); flex: 1; }

.copy {
  font: 500 0.78rem var(--body);
  color: var(--t-text); background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 6px;
  padding: 0.35rem 0.65rem; cursor: pointer;
  transition: background-color 0.15s;
}
.copy:hover { background: rgba(255,255,255,0.14); }
.copy[data-done] { color: var(--t-gold); }

.term-body {
  font-family: var(--mono);
  font-size: clamp(0.72rem, 1.05vw, 0.86rem);
  line-height: 1.6;
  padding: 1.1rem 1.25rem 1.25rem;
  height: clamp(20rem, 34vw, 26rem);
  overflow-y: auto;
  cursor: text;
  scrollbar-width: thin;
  scrollbar-color: #3A322B transparent;
}
.term-body:focus-visible { outline-offset: -4px; }
.term-out { white-space: pre-wrap; word-break: break-word; }
.term-out .l { min-height: 1.6em; }
.term-line { display: flex; gap: 0.6ch; align-items: baseline; }
.prompt { white-space: nowrap; }
.term-line input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0; padding: 0;
  font: inherit; color: var(--t-text); caret-color: var(--t-ember);
}

.p-user { color: var(--t-ember); }
.p-dim, .t-dim { color: var(--t-dim); }
.t-em { color: var(--t-ember); }
.t-gold { color: var(--t-gold); }
.t-b { color: var(--t-text); font-weight: 700; }
.t-logo {
  font-weight: 700; line-height: 1.15;
  background: linear-gradient(90deg, var(--t-ember), var(--t-gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-block;
}
.term-out a { color: var(--t-gold); }

.term figcaption {
  background: var(--paper); color: var(--graphite);
  font-size: 0.88rem; padding: 0.8rem 1.1rem;
}
.term figcaption code { color: var(--ink); }

/* Section scaffolding ---------------------------------------------------- */
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 2rem;
  flex-wrap: wrap;
  padding-bottom: 1rem; border-bottom: 1.5px solid var(--ink);
  margin-bottom: 0.5rem;
}
.sec-head h2 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(var(--s3), 4vw, var(--s4));
  letter-spacing: -0.035em; line-height: 1;
}
.sec-note { color: var(--graphite); font-size: 0.95rem; max-width: 46ch; }

.work, .about, .recog { padding-block: clamp(3rem, 7vw, 5.5rem); }

/* Work ledger ------------------------------------------------------------ */
.proj { border-bottom: 1px solid var(--rule); }
.proj summary {
  list-style: none; cursor: pointer;
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr) 1.25rem;
  gap: 0.5rem 1.5rem; align-items: baseline;
  padding-block: 1.25rem;
}
.proj summary::-webkit-details-marker { display: none; }
.proj summary::after {
  content: ""; justify-self: end; align-self: center;
  width: 0.7rem; height: 0.7rem;
  border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
  transform: translateY(-25%) rotate(45deg);
  transition: transform 0.2s;
  grid-column: 3; grid-row: 1;
}
.proj[open] summary::after { transform: translateY(15%) rotate(-135deg); }
.proj summary:hover .p-name { color: var(--cobalt); }

.p-name {
  font-family: var(--display); font-weight: 600;
  font-size: var(--s2); letter-spacing: -0.025em; line-height: 1.1;
  transition: color 0.15s;
}
.p-sum { color: var(--graphite); }
.p-badge {
  grid-column: 2; justify-self: start;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

.p-body {
  display: grid; grid-template-columns: 14rem minmax(0, 1fr) 1.25rem; gap: 0 1.5rem;
  padding-bottom: 1.6rem;
}
.p-body > * { grid-column: 2; }
.p-body p { max-width: 62ch; }
.stack { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.stack li {
  font-size: 0.82rem; color: var(--graphite);
  border: 1px solid var(--rule); border-radius: 6px; padding: 0.15rem 0.55rem;
}
.src { margin-top: 1rem; justify-self: start; font-weight: 500; }

@media (prefers-reduced-motion: no-preference) {
  .proj[open] .p-body { animation: open 0.22s ease-out; }
  @keyframes open { from { opacity: 0; transform: translateY(-4px); } }
}

/* About ------------------------------------------------------------------ */
.about-grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(2rem, 6vw, 5rem); padding-top: 1.75rem;
}
.prose p { font-size: var(--s1); line-height: 1.5; max-width: 34em; }
.prose p + p { margin-top: 1em; }
.prose p:not(:first-child) { color: var(--graphite); font-size: 1.0625rem; }

.facts { border-top: 1px solid var(--rule); }
.facts div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding-block: 0.8rem; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--graphite); font-size: 0.92rem; }
.facts dd { font-weight: 500; }

.skills {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.5rem; margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: 1.5rem; border-top: 1px solid var(--rule);
}
.skill h3 { font-family: var(--display); font-weight: 600; font-size: var(--s0); margin-bottom: 0.4rem; }
.skill p { color: var(--graphite); font-size: 0.95rem; }

/* Recognition ------------------------------------------------------------ */
.timeline li {
  display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 1.5rem;
  padding-block: 1.25rem; border-bottom: 1px solid var(--rule);
}
.timeline time { font-family: var(--display); font-weight: 600; font-size: var(--s1); letter-spacing: -0.02em; line-height: 1.3; }
.timeline li + li time { color: var(--graphite); }
.timeline h3 { font-family: var(--display); font-weight: 600; font-size: var(--s1); letter-spacing: -0.02em; line-height: 1.3; }
.timeline p { color: var(--graphite); margin-top: 0.25rem; max-width: 62ch; }

/* Contact ---------------------------------------------------------------- */
.contact {
  padding-block: clamp(4rem, 10vw, 8rem) clamp(3rem, 6vw, 5rem);
  border-top: 1.5px solid var(--ink);
}
.contact-h {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(var(--s3), 5.5vw, 4.25rem);
  letter-spacing: -0.045em; line-height: 0.98; max-width: 14ch;
}
.contact-note { color: var(--graphite); max-width: 46ch; margin-top: 1.25rem; }
.email {
  display: inline-block; margin-top: clamp(2rem, 5vw, 3.5rem);
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.35rem, 4.6vw, 3.4rem);
  letter-spacing: -0.035em; line-height: 1.1;
  color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.14em;
  word-break: break-word;
}
.email:hover { color: var(--cobalt); text-decoration-thickness: 3px; }
.elsewhere { display: flex; flex-wrap: wrap; gap: 0.6rem 1.75rem; margin-top: 2rem; align-items: center; }
.elsewhere a { color: var(--ink); font-weight: 500; }
.elsewhere a:hover { color: var(--cobalt); }
.copy-inline {
  color: var(--ink); background: transparent; border: 1.5px solid var(--rule);
  font-size: 0.9rem; padding: 0.4rem 0.75rem; border-radius: 8px;
}
.copy-inline:hover { background: var(--paper); border-color: var(--ink); }
.copy-inline[data-done] { color: var(--cobalt); }

.foot { padding-block: 2rem 3rem; color: var(--graphite); font-size: 0.88rem; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
  .hero-grid, .about-grid { grid-template-columns: 1fr; }
  .lede { max-width: 26ch; }
  .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proj summary { grid-template-columns: minmax(0, 1fr) 1.25rem; gap: 0.35rem 1rem; }
  .p-name { grid-column: 1; }
  .p-sum, .p-badge { grid-column: 1; }
  .p-badge { white-space: normal; }
  .proj summary::after { grid-column: 2; grid-row: 1; }
  .p-body { grid-template-columns: 1fr; }
  .p-body > * { grid-column: 1; }
}
@media (max-width: 560px) {
  .top nav a:nth-child(3) { display: none; }
  .timeline li { grid-template-columns: 1fr; gap: 0.25rem; }
  .facts div { grid-template-columns: 5.5rem 1fr; }
  .term-bar .term-title { display: none; }
  .term-bar { justify-content: space-between; }
}
