/* Layout: one 1120px column; each section is a two-column row
   (narrow sticky title on the left, content on the right), separated by rules, not cards.
   The single bold element is the Kaplan–Meier figure in the hero. */
:root {
    --paper: #F3F6F7;
    --surface: #FFFFFF;
    --ink: #15222C;
    --muted: #556472;
    --rule: #D2DBE0;
    --petrol: #0E5468;
    --petrol-soft: #DDEBEE;
    --amber: #B9790F;
    --gain: rgba(201, 138, 26, 0.20);
    --on-petrol: #FFFFFF;

    --display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
    --body: "Source Serif 4", Georgia, "Times New Roman", serif;

    --wrap: 1120px;
    --gutter: clamp(16px, 4vw, 40px);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0F1A20;
        --surface: #15232B;
        --ink: #E4ECEF;
        --muted: #9BADB7;
        --rule: #283841;
        --petrol: #6DBBCB;
        --petrol-soft: #16323B;
        --amber: #E4A947;
        --gain: rgba(228, 169, 71, 0.18);
        --on-petrol: #0F1A20;
        color-scheme: dark;
    }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

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

h1, h2, h3 {
    font-family: var(--display);
    line-height: 1.15;
    margin: 0;
    text-wrap: balance;
}

p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg { max-width: 100%; }

a { color: var(--petrol); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

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

.skip-link {
    position: absolute; left: 8px; top: -48px;
    background: var(--petrol); color: var(--on-petrol);
    padding: 8px 14px; font-family: var(--display); z-index: 100;
}
.skip-link:focus { top: 8px; }

/* ---------- Navigation ---------- */
.nav {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--rule);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 60px; }
.nav-brand {
    font-family: var(--display); font-weight: 700; font-size: 1.05rem;
    color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
}
.nav-menu { display: flex; align-items: center; gap: 4px; }
.nav-menu a {
    font-family: var(--display); font-weight: 500; font-size: 0.95rem;
    color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 6px;
}
.nav-menu a:hover { color: var(--ink); }
.nav-menu a.nav-cta { color: var(--on-petrol); background: var(--petrol); margin-left: 8px; }
.nav-menu a.nav-cta:hover { filter: brightness(1.1); }
.nav-toggle {
    display: none;
    font-family: var(--display); font-weight: 600; font-size: 0.95rem;
    background: none; color: var(--ink);
    border: 1px solid var(--rule); border-radius: 6px; padding: 6px 12px; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(48px, 9vw, 112px) clamp(48px, 7vw, 88px); border-bottom: 1px solid var(--rule); }
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
}
.hero-name {
    font-size: clamp(3rem, 8.2vw, 6.4rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 0.92;
}
.hero-role {
    font-family: var(--display); font-weight: 600;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--petrol);
    margin-top: 20px;
    letter-spacing: -0.01em;
}
.hero-lede { font-size: clamp(1.15rem, 1.7vw, 1.3rem); max-width: 34ch; margin-top: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.btn {
    display: inline-flex; align-items: center;
    font-family: var(--display); font-weight: 600; font-size: 0.98rem;
    padding: 11px 20px; border-radius: 8px; text-decoration: none;
    border: 1px solid transparent;
    transition: background-color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--petrol); color: var(--on-petrol); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-quiet { color: var(--ink); border-color: var(--rule); background: var(--surface); }
.btn-quiet:hover { border-color: var(--petrol); }

.hero-facts {
    display: grid; grid-template-columns: repeat(4, auto); justify-content: start;
    gap: 8px 28px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--rule);
}
.hero-facts dt { font-family: var(--display); font-size: 0.82rem; color: var(--muted); }
.hero-facts dd { font-family: var(--display); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }

/* Kaplan–Meier figure */
.km { margin: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 20px 20px 16px; }
.km svg { display: block; width: 100%; height: auto; overflow: visible; }
.km-grid path { stroke: var(--rule); stroke-width: 1; fill: none; }
.km-axis path { stroke: var(--muted); stroke-width: 1.2; fill: none; }
.km-labels text { font-family: var(--display); font-size: 13px; fill: var(--muted); }
.km-gain { fill: var(--gain); stroke: none; opacity: 0; animation: km-fade .8s ease-out 1.5s forwards; }
.km-line { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: km-draw 1.6s cubic-bezier(.45,.05,.25,1) .2s forwards; }
.km-treatment { stroke: var(--amber); }
.km-comparator { stroke: var(--petrol); stroke-width: 2; animation-delay: .35s; }
.km-censor { stroke: var(--amber); stroke-width: 1.6; fill: none; opacity: 0; animation: km-fade .5s ease-out 1.7s forwards; }
.km-keys text { font-family: var(--display); font-size: 13.5px; font-weight: 600; opacity: 0; animation: km-fade .6s ease-out 1.8s forwards; }
.key-treatment { fill: var(--amber); }
.key-comparator { fill: var(--petrol); }
.key-gain { fill: var(--muted); font-weight: 500 !important; font-style: italic; }
.km figcaption { font-size: 0.98rem; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); }
.km figcaption span { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

@keyframes km-draw { to { stroke-dashoffset: 0; } }
@keyframes km-fade { to { opacity: 1; } }

/* ---------- Section rows ---------- */
.block { padding-block: clamp(56px, 8vw, 96px); border-bottom: 1px solid var(--rule); }
.block-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); }
.block-title {
    font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
    align-self: start; position: sticky; top: 88px;
}
.block-body { min-width: 0; max-width: 760px; }
.block-body > p + p { margin-top: 1em; }
.lead { font-size: 1.28rem; line-height: 1.55; margin-bottom: 1em; }
.lead strong { font-weight: 600; }

.sub-title {
    font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em;
    margin-top: 56px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--rule);
}

/* About pillars */
.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 40px; }
.pillars li { border-top: 3px solid var(--petrol); padding-top: 14px; }
.pillars h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.pillars p { font-size: 0.98rem; color: var(--muted); }

/* Expertise */
.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 40px; }
.skill h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.skill > p { color: var(--muted); font-size: 0.98rem; margin-bottom: 10px; }
.skill ul:not(.tags) li { position: relative; padding-left: 18px; font-size: 0.98rem; }
.skill ul:not(.tags) li + li { margin-top: 3px; }
.skill ul:not(.tags) li::before {
    content: ""; position: absolute; left: 0; top: 0.72em;
    width: 8px; height: 2px; background: var(--amber);
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
    font-family: var(--display); font-size: 0.84rem; font-weight: 500;
    background: var(--petrol-soft); color: var(--ink);
    padding: 3px 10px; border-radius: 999px;
}

.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; }
.services li { padding-block: 12px; border-bottom: 1px solid var(--rule); font-size: 0.98rem; }
.services strong { font-family: var(--display); font-weight: 600; }

.areas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 32px; }
.areas dt { font-family: var(--display); font-weight: 700; }
.areas dd { color: var(--muted); font-size: 0.96rem; }

/* Work */
.case {
    display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px;
    padding-block: 32px; border-top: 1px solid var(--rule);
}
.case:first-child { border-top: 0; padding-top: 0; }
.case-when { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.case-role { font-family: var(--display); font-size: 0.88rem; color: var(--muted); margin-top: 4px; }
.case-body h3 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 8px; }
.case-body > p { margin-bottom: 12px; }
.case-body ul:not(.tags) { margin-bottom: 14px; }
.case-body ul:not(.tags) li { position: relative; padding-left: 18px; font-size: 0.98rem; }
.case-body ul:not(.tags) li + li { margin-top: 4px; }
.case-body ul:not(.tags) li::before {
    content: ""; position: absolute; left: 0; top: 0.72em;
    width: 8px; height: 2px; background: var(--amber);
}
.case-body .tags { margin-bottom: 12px; }
.case-featured {
    background: var(--surface); border: 1px solid var(--rule); border-radius: 14px;
    padding: 28px; margin-bottom: 8px;
}
.case-featured:first-child { padding-top: 28px; }
.case-featured h3 { font-size: 1.7rem; }
.case-featured + .case { border-top: 0; }

.text-link { font-family: var(--display); font-weight: 600; }
.aside { margin-top: 24px; color: var(--muted); }

/* Publications */
.pub + .pub { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--rule); }
.pub-journal { font-family: var(--display); font-size: 0.88rem; color: var(--muted); margin-bottom: 4px; }
.pub h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 6px; }
.pub h3 a { color: var(--ink); text-decoration: none; }
.pub h3 a:hover { color: var(--petrol); text-decoration: underline; }
.pub p:last-child { color: var(--muted); font-size: 0.98rem; }

/* Timeline (a real sequence, so it gets a rail) */
.timeline { position: relative; }
.timeline li {
    display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 24px;
    position: relative; padding-bottom: 32px;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: ""; position: absolute; left: 182px; top: 0.55em; bottom: -0.55em;
    width: 1px; background: var(--rule);
}
.timeline li:last-child::before { display: none; }
.timeline li::after {
    content: ""; position: absolute; left: 178px; top: 0.42em;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--paper); border: 2px solid var(--petrol);
}
.timeline li:first-child::after { background: var(--amber); border-color: var(--amber); }
.timeline li > div { padding-left: 20px; }
.tl-when { font-family: var(--display); font-weight: 600; font-size: 0.95rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.timeline h3 { font-size: 1.12rem; font-weight: 700; }
.tl-where { font-family: var(--display); color: var(--petrol); font-size: 0.95rem; margin: 2px 0 6px; }
.timeline li > div > p:last-child:not(.tl-where) { font-size: 0.98rem; }
.timeline-compact li { padding-bottom: 22px; }

.honour {
    display: inline-block; vertical-align: 0.15em;
    font-size: 0.72rem; font-weight: 700;
    color: var(--amber); border: 1px solid currentColor;
    border-radius: 999px; padding: 1px 9px; margin-left: 6px;
}

/* Languages */
.langs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; }
.langs li {
    display: grid; grid-template-columns: 1fr auto 96px; align-items: center; gap: 14px;
    padding-block: 10px; border-bottom: 1px solid var(--rule);
}
.lang { font-family: var(--display); font-weight: 600; }
.level { font-size: 0.92rem; color: var(--muted); }
.scale { display: inline-flex; gap: 4px; }
.scale i { width: 14px; height: 6px; border-radius: 2px; background: var(--rule); }
.scale[data-level="1"] i:nth-child(-n+1),
.scale[data-level="2"] i:nth-child(-n+2),
.scale[data-level="3"] i:nth-child(-n+3),
.scale[data-level="4"] i:nth-child(-n+4),
.scale[data-level="5"] i:nth-child(-n+5) { background: var(--petrol); }

/* Contact */
.contact { background: var(--petrol-soft); padding-block: clamp(64px, 9vw, 112px); }
.contact-title { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; letter-spacing: -0.035em; max-width: 18ch; }
.contact-lede { font-size: 1.15rem; max-width: 56ch; margin-top: 18px; }
.contact-email {
    display: inline-block; margin-top: 28px;
    font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 3.4vw, 2.2rem);
    letter-spacing: -0.02em; color: var(--petrol); overflow-wrap: anywhere;
}
.contact-list {
    display: grid; grid-template-columns: repeat(5, auto); justify-content: start;
    gap: 16px 40px; margin-top: 40px; padding-top: 24px; border-top: 1px solid color-mix(in srgb, var(--petrol) 30%, transparent);
}
.contact-list dt { font-family: var(--display); font-size: 0.85rem; color: var(--muted); }
.contact-list dd { font-family: var(--display); font-weight: 600; }

/* Footer */
.footer { padding-block: 28px; font-family: var(--display); font-size: 0.9rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer a { color: var(--muted); margin-left: 16px; }
.footer a:first-child { margin-left: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .hero-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-lede { max-width: 48ch; }
    .block-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .block-title { position: static; font-size: 1.8rem; }
    .contact-list { grid-template-columns: repeat(3, auto); }
}

@media (max-width: 760px) {
    .nav-toggle { display: inline-block; margin-left: auto; }
    .nav-menu {
        display: none; position: absolute; left: 0; right: 0; top: 100%;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--paper); border-bottom: 1px solid var(--rule);
        padding: 8px var(--gutter) 16px;
    }
    .nav-menu.open { display: flex; }
    .nav-menu a { display: block; padding: 12px 4px; }
    .nav-menu a.nav-cta { margin: 8px 0 0; text-align: center; }
    .hero-facts { grid-template-columns: repeat(2, auto); }
    .pillars, .skills, .services, .areas, .langs { grid-template-columns: minmax(0, 1fr); }
    .case { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .case-featured { padding: 20px; }
    .case-featured:first-child { padding-top: 20px; }
    .timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; padding-left: 24px; }
    .timeline li::before { left: 4px; top: 0.55em; }
    .timeline li::after { left: 0; }
    .timeline li > div { padding-left: 0; }
    .contact-list { grid-template-columns: minmax(0, 1fr); }
    .km { padding: 12px 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .km-line { animation: none; stroke-dashoffset: 0; }
    .km-gain, .km-censor, .km-keys text { animation: none; opacity: 1; }
}
