@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/schibsted-grotesk-latin.woff2") format("woff2");
}

:root {
  --font: "Schibsted Grotesk", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --text: 36rem;
  --margin: 10.5rem;
  --gap: clamp(2rem, 6vw, 5.5rem);
  --gutter: clamp(1.5rem, 5vw, 4rem);
}
/* dark is the default; theme.js switches before first paint */
:root, [data-theme="dark"] {
  --bg: #0E1322; --raise: #151B2E; --fg: #E8E6E1; --muted: #8F96A8; --rule: #232A3F; --uline: #565E77; --accent: #E3B04B;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F6F6F4; --raise: #FFFFFF; --fg: #161C2C; --muted: #5C6375; --rule: #DADCE0; --uline: #A9AEBA; --accent: #A06B0A;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color: var(--fg); transition: background-color .4s ease, color .4s ease; }
body { font-family: var(--font); font-size: 1.0625rem; line-height: 1.65; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--accent); color: var(--bg); }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .24em; text-decoration-color: var(--uline); transition: text-decoration-color .25s ease, color .25s ease; }
a:hover { text-decoration-color: var(--fg); }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
img { display: block; max-width: 100%; height: auto; }
.sr-only, .palette .status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -4rem; background: var(--fg); color: var(--bg); font-size: .875rem; padding: .5rem .8rem; z-index: 3; }
.skip:focus { top: 1rem; }

.small { font-size: .8125rem; line-height: 1.5; color: var(--muted); }
.page { max-width: calc(var(--margin) + var(--gap) + var(--text) + 8rem); margin: 0 auto; padding: 0 var(--gutter); }

/* header: the mark is the home link */
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 1.75rem 0; }
.mark { display: block; color: var(--fg); }
.mark svg { display: block; height: 1.9rem; width: auto; }
.site-header ul { display: flex; gap: 1.75rem; list-style: none; align-items: center; }
.site-header nav a { text-decoration: none; color: var(--muted); }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--fg); }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--muted); font: inherit; padding: .25rem; display: inline-flex; align-items: center; border-radius: 4px; }
.icon-btn:hover { color: var(--fg); }
.icon-btn svg { width: 15px; height: 15px; }
[data-theme="dark"] .sun, [data-theme="light"] .moon { display: none; }
:root:not([data-theme]) .sun { display: none; }
kbd { font-family: inherit; font-size: .75rem; font-weight: 600; color: var(--fg); background: var(--raise); border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; padding: .05rem .4rem; }

/* the document grid: a narrow margin column for labels, a text column for content */
.row { display: grid; grid-template-columns: var(--margin) minmax(0, var(--text)); column-gap: var(--gap); }

/* home: first screen */
.opening { min-height: calc(100svh - 5.5rem); display: grid; grid-template-rows: 1fr auto; }
.opening .row { align-self: center; padding: 4rem 0; }
.opening .note { padding-top: .9rem; }
.opening h1 { font-size: clamp(2.5rem, 5vw, 3.6rem); font-weight: 600; line-height: 1.05; letter-spacing: -.03em; }
.opening .lede { margin-top: 1.5rem; font-size: clamp(1.2rem, 1.9vw, 1.45rem); line-height: 1.45; letter-spacing: -.01em; max-width: 30rem; }
.opening .sub { margin-top: .9rem; color: var(--muted); max-width: 31rem; }
.opening .start { margin-top: 2.25rem; }
.opening .start button { background: none; border: 0; color: var(--fg); font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; padding: 0; }
.opening .start .go { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .24em; text-decoration-color: var(--uline); }
.opening .start button:hover .go { text-decoration-color: var(--fg); }
.elsewhere { display: flex; flex-wrap: wrap; gap: .5rem 2rem; list-style: none; padding: 0 0 2rem calc(var(--margin) + var(--gap)); }
.elsewhere a { text-decoration: none; color: var(--muted); }
.elsewhere a:hover { color: var(--fg); }

@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: reveal 1s cubic-bezier(.2,.6,.2,1) both; }
  .d1 { animation-delay: .1s; } .d2 { animation-delay: .2s; } .d3 { animation-delay: .3s; } .d4 { animation-delay: .45s; }
  @keyframes reveal { from { opacity: 0; transform: translateY(6px); } }
}

/* home: sections */
.section { border-top: 1px solid var(--rule); padding: 3.25rem 0 4.5rem; scroll-margin-top: 1rem; }
.section > h2, .side > h2 { font-size: .8125rem; font-weight: 500; color: var(--muted); padding-top: .35rem; }
.section p + p { margin-top: 1.1rem; }

.entries { list-style: none; }
.entries.spaced { margin-top: 2.5rem; }
.entries > li + li { margin-top: 2.25rem; }
.entries h3 { font-size: 1.1875rem; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.entries h3 a { text-decoration-color: transparent; }
.entries h3 a:hover { text-decoration-color: var(--fg); }
.entries p { color: var(--muted); margin-top: .3rem; }
.entries .small { margin-top: .45rem; }
.figure { color: var(--fg); font-weight: 600; }

/* a talk that was given gets its picture; proposed ones stay text */
.given { display: grid; grid-template-columns: 11rem 1fr; gap: 1.5rem; align-items: start; }
.given .thumb { display: block; overflow: hidden; border-radius: 4px; background: var(--raise); }
.given img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; filter: grayscale(1) contrast(1.05); transition: filter .4s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.given .thumb:hover img, .given .thumb:focus-visible img { filter: grayscale(0); transform: scale(1.03); }
.kicker { margin-top: 2.75rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }

.history { list-style: none; }
.history li { display: grid; grid-template-columns: 5.5rem 1fr; column-gap: 1.25rem; padding: .85rem 0; border-bottom: 1px solid var(--rule); }
.history li:first-child { padding-top: 0; }
.history li:last-child { border-bottom: 0; }
.history .small { padding-top: .2rem; font-variant-numeric: tabular-nums; }
.history b { font-weight: 600; }
.history .where { display: block; color: var(--muted); }

.side { display: flex; flex-direction: column; gap: 1.25rem; }
.portrait { width: 100%; max-width: var(--margin); aspect-ratio: 4 / 5; object-fit: cover; border-radius: 4px; }

.mail { font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-weight: 500; letter-spacing: -.02em; overflow-wrap: anywhere; }
.contact-note { margin-top: 1rem; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; list-style: none; margin-top: 1.5rem; }

.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0 3rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.site-footer a { color: var(--muted); }

/* case studies and plain pages: the article sits in the text column */
.case { padding: 2.5rem 0 5rem; }
.case .row > .crumb { padding-top: .6rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--fg); }
.case-title { font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 600; line-height: 1.1; letter-spacing: -.025em; }
.case-lede { margin-top: 1.25rem; font-size: clamp(1.15rem, 1.7vw, 1.3rem); line-height: 1.5; letter-spacing: -.005em; }
.case-meta { margin-top: 1rem; color: var(--muted); }
.case article > section { margin-top: 3.25rem; }
.case article h2 { font-size: 1.375rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; margin-bottom: .85rem; }
.case article section p { color: var(--muted); margin-bottom: 1rem; }
.case article section p:last-child { margin-bottom: 0; }
.case code { font-family: var(--mono); font-size: .85em; color: var(--fg); background: var(--raise); border: 1px solid var(--rule); border-radius: 4px; padding: .05em .35em; }
.case strong, .case b { color: var(--fg); }

.shot { margin: 2.25rem 0 0; }
.shot img { width: 100%; border: 1px solid var(--rule); border-radius: 6px; background: var(--raise); }
.shot figcaption { color: var(--muted); font-size: .875rem; margin-top: .7rem; }
.shot-pair { display: grid; gap: 1.5rem; margin: 1.5rem 0 1rem; }
.shot-pair .shot { margin: 0; }

.steps { list-style: none; counter-reset: step; margin-top: 1.5rem; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.25rem 1fr; padding: 1rem 0; border-top: 1px solid var(--rule); }
.steps li::before { content: counter(step); font-weight: 600; color: var(--accent); grid-row: span 2; font-variant-numeric: tabular-nums; }
.steps h3 { font-size: 1.0625rem; font-weight: 600; }
.case .steps p { margin: .2rem 0 0; }

.pairs { list-style: none; margin: .5rem 0 1.25rem; }
.pairs li { display: grid; grid-template-columns: 13rem 1fr; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--rule); }
.pairs li:last-child { border-bottom: 1px solid var(--rule); }
.pairs b { font-weight: 600; }
.pairs span { color: var(--muted); }

.gates { list-style: none; counter-reset: gate; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 1.5rem 0; background: var(--rule); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.gates li { counter-increment: gate; background: var(--bg); padding: .8rem .85rem; }
.gates b { display: block; font-weight: 600; font-size: .9375rem; }
.gates b::before { content: counter(gate) " "; color: var(--accent); font-variant-numeric: tabular-nums; }
.gates span { display: block; color: var(--muted); font-size: .8125rem; line-height: 1.45; margin-top: .25rem; }

.case-links { margin-top: 3.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.case-links ul { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; list-style: none; }

/* 404 */
.lost { min-height: calc(100svh - 12rem); display: grid; align-content: center; }
.lost p { margin-top: 1rem; color: var(--muted); }

/* command menu (main.js) */
.palette { margin: 16vh auto auto; width: min(34rem, calc(100vw - 2rem)); background: var(--raise); color: var(--fg); border: 1px solid var(--rule); border-radius: 10px; padding: 0; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.palette::backdrop { background: rgba(8, 11, 20, .6); backdrop-filter: blur(3px); }
.palette input { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--rule); color: var(--fg); font: inherit; font-size: 1.0625rem; padding: 1rem 1.15rem; }
.palette input:focus { outline: none; }
.palette input::placeholder { color: var(--muted); }
.palette ul { list-style: none; padding: .4rem; max-height: 50vh; overflow-y: auto; }
.palette .group { color: var(--muted); font-size: .75rem; padding: .6rem .7rem .25rem; }
.palette [role="option"] { padding: .55rem .7rem; border-radius: 6px; cursor: pointer; }
.palette [role="option"][aria-selected="true"] { background: var(--rule); }
.palette .empty { color: var(--muted); padding: .7rem; }
@media (prefers-reduced-motion: no-preference) {
  .palette[open] { animation: pop .18s ease-out; }
  @keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.985); } }
}

@media (max-width: 760px) {
  .site-header li.hide-s { display: none; }
  .row { grid-template-columns: 1fr; }
  .opening .note, .section > h2, .side > h2 { padding: 0 0 1.25rem; }
  .elsewhere { padding-left: 0; }
  .side { gap: 0; margin-bottom: 1.75rem; }
  .portrait { width: 8.5rem; margin-top: 1rem; }
  .given { grid-template-columns: 1fr; gap: .9rem; }
  .history li { grid-template-columns: 1fr; }
  .history .small { padding: 0 0 .15rem; }
  .start { display: none; }
  .case .row > .crumb { padding: 0 0 1rem; }
  .gates { grid-template-columns: 1fr 1fr; }
  .pairs li { grid-template-columns: 1fr; gap: .1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html, a, .given img { transition: none; }
  .given .thumb:hover img { transform: none; }
}
