/* ==========================================================================
   steffenbilger.com — main.css
   Visual system: "The Drawing Sheet" — limestone paper, slate structure,
   a terracotta route line, engineering title blocks and chainage markers.
   ========================================================================== */

:root {
  /* Palette (from the brief) */
  --limestone: #E9E2D5;
  --warm: #F8F6F1;
  --terra: #B85C45;
  --terra-deep: #8F4034;
  --slate: #60788A;
  --slate-ink: #3E5464;      /* darker slate for text on light ground */
  --mist: #D8E0E4;
  --graphite: #292B2D;
  --charcoal: #46494A;
  --clay: #D9C5B8;
  --olive: #8B9388;
  --signal: #D6AA4B;         /* functional accent only */

  --ink: var(--graphite);
  --ink-soft: var(--charcoal);
  --rule: rgba(41, 43, 45, .18);
  --rule-strong: rgba(41, 43, 45, .45);
  --paper: var(--warm);

  --f-display: "DM Serif Display", "Libre Baskerville", Georgia, serif;
  --f-body: "Inter", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "DM Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --wrap: 1240px;
  --wrap-text: 720px;
  --gutter: clamp(16px, 4vw, 48px);
  --header-h: 76px;
  --radius: 2px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px);
  /* NB: never overflow-x:hidden on html/body — it breaks position:sticky. */
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.68;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
img { height: auto; display: block; }

a { color: var(--slate-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--terra-deep); }

:focus-visible { outline: 2px solid var(--terra-deep); outline-offset: 3px; }

h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 400; line-height: 1.08; margin: 0 0 .5em; color: var(--ink); letter-spacing: -.005em; }
h1 { font-size: clamp(2.5rem, 6.2vw, 5.4rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); }
h3 { font-size: clamp(1.35rem, 2.1vw, 1.75rem); }
h4 { font-family: var(--f-body); font-weight: 600; font-size: 1.02rem; letter-spacing: .01em; }
p { margin: 0 0 1.1em; }
strong { font-weight: 600; }
em { font-style: italic; }
small { font-size: .82em; }
abbr[title] { text-decoration: underline dotted; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 300; background: var(--graphite); color: #fff; padding: 10px 16px; font: 500 14px var(--f-body); }
.skip-link:focus { top: 12px; color: #fff; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--text { max-width: calc(var(--wrap-text) + 2 * var(--gutter)); }
.wrap--wide { max-width: 1440px; }

/* Mono metadata */
.meta, .eyebrow {
  font-family: var(--f-mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--slate-ink); font-weight: 500;
}
.eyebrow { display: inline-flex; align-items: center; gap: .7em; margin-bottom: 1.1rem; }
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--terra); }

main { display: block; overflow-x: clip; }

/* ==========================================================================
   HEADER — sticky. The lower edge is a route line that tracks scroll.
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(248, 246, 241, .97);
  border-bottom: 1px solid var(--rule);
}
@supports (backdrop-filter: blur(4px)) {
  .site-header { background: rgba(248, 246, 241, .9); backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px); }
}
.site-header__bar {
  max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter);
  height: var(--header-h); display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand__mark { width: 38px; height: 38px; flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__name { font-family: var(--f-display); font-size: 1.42rem; letter-spacing: .005em; }
.brand__role { font-family: var(--f-mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--slate-ink); margin-top: 4px; }
.brand:hover { color: var(--ink); }

.nav { margin-left: auto; display: flex; align-items: center; height: 100%; }
.nav__list { list-style: none; margin: 0; padding: 0; display: flex; align-items: stretch; height: 100%; }
.nav__item { position: static; display: flex; }
.nav__trigger, .nav__link {
  appearance: none; background: none; border: 0; cursor: pointer;
  display: flex; align-items: center; gap: 7px; height: 100%;
  padding: 0 13px; font: 500 .9rem/1 var(--f-body); color: var(--ink); text-decoration: none;
  position: relative;
}
.nav__num { font-family: var(--f-mono); font-size: .66rem; color: var(--terra-deep); letter-spacing: .05em; }
.nav__trigger::after, .nav__link::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: -1px; height: 3px; background: var(--terra);
  transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.nav__trigger:hover::after, .nav__trigger[aria-expanded="true"]::after, .nav__link:hover::after,
.nav__item.is-current > .nav__trigger::after, .nav__item.is-current > .nav__link::after { transform: scaleX(1); }
.nav__chev { width: 9px; height: 9px; transition: transform .25s var(--ease); }
.nav__trigger[aria-expanded="true"] .nav__chev { transform: rotate(180deg); }
.nav__cta {
  margin-left: 14px; align-self: center; height: auto; padding: 11px 18px; border: 1px solid var(--graphite);
  font: 500 .82rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); text-decoration: none;
  transition: background .2s, color .2s;
}
.nav__cta:hover { background: var(--graphite); color: var(--warm); }

/* Mega panel */
.mega {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--warm); border-bottom: 1px solid var(--rule-strong);
  box-shadow: 0 30px 60px -30px rgba(41, 43, 45, .35);
  display: none;
}
.mega.is-open { display: block; }
.mega__inner { max-width: 1440px; margin: 0 auto; padding: 36px var(--gutter) 40px; display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 48px; }
.mega__intro { border-right: 1px solid var(--rule); padding-right: 36px; }
.mega__intro .meta { display: block; margin-bottom: 14px; }
.mega__title { font-family: var(--f-display); font-size: 2rem; line-height: 1.05; margin-bottom: 12px; }
.mega__lede { font-size: .92rem; color: var(--ink-soft); margin: 0; }
.mega__links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 28px; align-content: start; }
.mega__links a {
  display: grid; grid-template-columns: 44px 1fr; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--rule);
  text-decoration: none; color: var(--ink); font-size: .96rem; transition: color .2s, padding .2s;
}
.mega__links a span { font-family: var(--f-mono); font-size: .7rem; color: var(--slate-ink); }
.mega__links a:hover, .mega__links a[aria-current="page"] { color: var(--terra-deep); }
.mega__links a[aria-current="page"] span { color: var(--terra-deep); }

/* Route-progress line along the header's lower edge */
.route-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none; }
.route-progress__line { position: absolute; left: 0; top: 1px; height: 1px; width: 100%; background: transparent; }
.route-progress__fill { position: absolute; left: 0; top: 0; height: 3px; width: 0; background: var(--terra); }
.route-progress__dot { position: absolute; top: -4px; left: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--warm); border: 3px solid var(--terra); transform: translateX(-5px); }

/* Mobile menu */
.menu-btn {
  display: none; margin-left: auto; appearance: none; background: none; border: 1px solid var(--graphite);
  height: 44px; padding: 0 14px; gap: 10px; align-items: center; cursor: pointer;
  font: 500 .74rem/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
.menu-btn__lines { width: 18px; height: 12px; position: relative; }
.menu-btn__lines::before, .menu-btn__lines::after, .menu-btn__lines span { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--graphite); }
.menu-btn__lines::before { top: 0; } .menu-btn__lines span { top: 5px; } .menu-btn__lines::after { bottom: 0; }

.drawer { position: fixed; inset: 0; z-index: 200; background: var(--warm); display: none; flex-direction: column; }
.drawer.is-open { display: flex; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; height: 68px; padding: 0 var(--gutter); border-bottom: 1px solid var(--rule); flex: none; }
.drawer__close { appearance: none; background: none; border: 1px solid var(--graphite); height: 44px; padding: 0 14px; font: 500 .74rem/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); cursor: pointer; }
.drawer__body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px var(--gutter) 40px; flex: 1; }
.drawer__group { border-bottom: 1px solid var(--rule); }
.drawer__toggle {
  width: 100%; appearance: none; background: none; border: 0; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 14px; padding: 18px 0; color: var(--ink);
  font: 400 1.6rem/1.1 var(--f-display);
}
.drawer__toggle .nav__num { font-size: .72rem; }
.drawer__toggle svg { margin-left: auto; width: 14px; height: 14px; transition: transform .25s; flex: none; }
.drawer__toggle[aria-expanded="true"] svg { transform: rotate(45deg); }
.drawer__links { list-style: none; margin: 0; padding: 0 0 16px 34px; display: none; }
.drawer__links.is-open { display: block; }
.drawer__links a { display: block; padding: 9px 0; color: var(--ink); text-decoration: none; font-size: 1.02rem; border-left: 2px solid var(--rule); padding-left: 16px; }
.drawer__links a[aria-current="page"] { border-left-color: var(--terra); color: var(--terra-deep); }
.drawer__direct { display: block; padding: 18px 0; font: 400 1.6rem/1.1 var(--f-display); color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
body.is-locked { overflow: hidden; }

/* ==========================================================================
   ROUTE BAR (breadcrumb) — rendered as stations on a line
   ========================================================================== */
.routebar { border-bottom: 1px solid var(--rule); background: var(--warm); }
.routebar__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; padding-top: 14px; padding-bottom: 14px; font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.routebar ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; row-gap: 6px; }
.routebar li { display: flex; align-items: center; color: var(--ink-soft); }
.routebar li + li::before { content: ""; width: 28px; height: 1px; background: var(--rule-strong); margin: 0 10px; }
.routebar li::after { content: ""; order: -1; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--slate); margin-right: 8px; }
.routebar li:last-child::after { background: var(--terra); border-color: var(--terra); }
.routebar li + li::before { order: -2; }
.routebar a { color: var(--slate-ink); text-decoration: none; }
.routebar a:hover { color: var(--terra-deep); }
.routebar__sheet { margin-left: auto; color: var(--slate-ink); padding-left: 16px; }

/* ==========================================================================
   FOOTER — mist blue, with a long route line
   ========================================================================== */
.site-footer { background: var(--mist); color: var(--graphite); margin-top: 0; position: relative; }
.footer__route { display: block; width: 100%; height: 56px; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; padding-top: 28px; padding-bottom: 48px; }
.footer__name { font-family: var(--f-display); font-size: 2.1rem; line-height: 1; margin-bottom: 10px; }
.footer__lede { font-size: .92rem; color: var(--charcoal); max-width: 34ch; }
.site-footer h2 { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--slate-ink); margin-bottom: 16px; font-weight: 500; }
.footer__list { list-style: none; margin: 0; padding: 0; font-size: .93rem; }
.footer__list li { margin-bottom: 9px; }
.footer__list a { color: var(--graphite); text-decoration: none; border-bottom: 1px solid transparent; }
.footer__list a:hover { border-bottom-color: var(--terra); color: var(--graphite); }
.footer__contact a { color: var(--graphite); }
.social { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.social a { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--graphite); color: var(--graphite); transition: background .2s, color .2s; }
.social a:hover { background: var(--graphite); color: var(--mist); }
.social svg { width: 18px; height: 18px; fill: currentColor; }
.footer__note { font-size: .8rem; color: var(--charcoal); margin-top: 12px; }
.footer__base { border-top: 1px solid rgba(41, 43, 45, .25); }
.footer__base .wrap { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; justify-content: space-between; padding-top: 18px; padding-bottom: 22px; font-size: .84rem; }
.footer__base a { color: var(--graphite); }
.lock-btn { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: var(--graphite); text-decoration: underline; cursor: pointer; }

/* ==========================================================================
   PAGE HEADS — five compositions, chosen per page
   ========================================================================== */

/* 1. Sheet — engineering drawing frame with a title block */
.ph-sheet { padding: clamp(36px, 6vw, 72px) 0 clamp(36px, 5vw, 64px); background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    repeating-linear-gradient(90deg, rgba(96,120,138,.09) 0 1px, transparent 1px 48px),
    var(--paper); }
.ph-sheet__frame { border: 1px solid var(--rule-strong); position: relative; display: grid; grid-template-columns: 1fr minmax(260px, 340px); }
.ph-sheet__frame::before, .ph-sheet__frame::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--terra); }
.ph-sheet__frame::before { top: -7px; left: -7px; border-right: 0; border-bottom: 0; }
.ph-sheet__frame::after { bottom: -7px; right: -7px; border-left: 0; border-top: 0; }
.ph-sheet__main { padding: clamp(24px, 4vw, 56px); border-right: 1px solid var(--rule-strong); }
.ph-sheet__main h1 { margin-bottom: .35em; }
.ph-sheet__lede { font-size: clamp(1.05rem, 1.5vw, 1.22rem); color: var(--ink-soft); max-width: 60ch; margin: 0; }
.titleblock { display: grid; grid-template-rows: auto; font-family: var(--f-mono); font-size: .74rem; }
.titleblock div { padding: 14px 18px; border-bottom: 1px solid var(--rule-strong); display: flex; flex-direction: column; gap: 4px; }
.titleblock div:last-child { border-bottom: 0; }
.titleblock dt, .titleblock .tb-k { text-transform: uppercase; letter-spacing: .12em; color: var(--slate-ink); font-size: .66rem; }
.titleblock dd, .titleblock .tb-v { margin: 0; font-family: var(--f-body); font-size: .98rem; color: var(--ink); font-weight: 500; letter-spacing: 0; }
dl.titleblock { margin: 0; }

/* 2. Split — portrait/figure beside title (image shown whole) */
.ph-split { padding: clamp(32px, 5vw, 64px) 0; }
.ph-split__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.ph-split__lede { font-size: clamp(1.05rem, 1.5vw, 1.22rem); color: var(--ink-soft); max-width: 56ch; }

/* 3. Statement — very large type with a drawn route line */
.ph-statement { padding: clamp(48px, 9vw, 120px) 0 clamp(40px, 6vw, 80px); position: relative; }
.ph-statement h1 { font-size: clamp(2.8rem, 8.4vw, 7.6rem); line-height: .98; max-width: 14ch; }
.ph-statement__lede { font-size: clamp(1.08rem, 1.6vw, 1.3rem); max-width: 62ch; color: var(--ink-soft); }
.ph-statement__route { position: absolute; right: 0; top: 0; width: min(46vw, 620px); height: 100%; pointer-events: none; opacity: .9; }

/* 4. Index — headline with numbered contents column */
.ph-index { padding: clamp(36px, 6vw, 80px) 0; background: var(--limestone); }
.ph-index__grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(28px, 5vw, 80px); align-items: end; }
.ph-index__toc { list-style: none; margin: 0; padding: 0; counter-reset: toc; border-top: 2px solid var(--graphite); }
.ph-index__toc li { counter-increment: toc; border-bottom: 1px solid var(--rule-strong); }
.ph-index__toc a { display: grid; grid-template-columns: 46px 1fr; padding: 11px 0; text-decoration: none; color: var(--ink); font-size: .96rem; }
.ph-index__toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--f-mono); font-size: .74rem; color: var(--terra-deep); padding-top: 3px; }
.ph-index__toc a:hover { color: var(--terra-deep); }

/* 5. Data — headline plus a rail of key figures */
.ph-data { padding: clamp(36px, 6vw, 80px) 0 0; }
.ph-data__rail { margin-top: clamp(28px, 4vw, 48px); display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border-top: 1px solid var(--graphite); border-bottom: 1px solid var(--graphite); }
.ph-data__rail > div { padding: 22px 22px 22px 0; border-right: 1px solid var(--rule); }
.ph-data__rail > div + div { padding-left: 22px; }
.ph-data__rail > div:last-child { border-right: 0; }
.ph-data__num { font-family: var(--f-display); font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1; color: var(--terra-deep); display: block; margin-bottom: 6px; }
.ph-data__label { font-size: .88rem; color: var(--ink-soft); display: block; }

/* ==========================================================================
   SECTIONS
   ========================================================================== */
.section { padding: clamp(48px, 8vw, 104px) 0; }
.section--tight { padding: clamp(32px, 5vw, 64px) 0; }
.section--limestone { background: var(--limestone); }
.section--mist { background: var(--mist); }
.section--clay { background: #EFE4DC; }
.section--slate { background: var(--slate-ink); color: var(--warm); }
.section--slate h2, .section--slate h3, .section--slate h4 { color: var(--warm); }
.section--slate a { color: #F2D9CF; }
.section--slate .meta, .section--slate .eyebrow { color: #E6EBEE; }
.section--slate .eyebrow::before { background: var(--clay); }
.section__head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: clamp(20px, 4vw, 64px); align-items: end; margin-bottom: clamp(28px, 4vw, 56px); }
.section__head h2 { margin: 0; }
.section__head p { margin: 0; color: var(--ink-soft); }
.section--slate .section__head p { color: #E6EBEE; }

/* Chainage divider: a measured line with kilometre ticks */
.chainage { display: flex; align-items: center; gap: 14px; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .12em; color: var(--slate-ink); text-transform: uppercase; margin: 0 0 22px; }
.chainage::after { content: ""; flex: 1; height: 9px; background:
    linear-gradient(var(--rule-strong), var(--rule-strong)) 0 50% / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--rule-strong) 0 1px, transparent 1px 32px) 0 0 / 100% 9px no-repeat; }
.chainage b { color: var(--terra-deep); font-weight: 500; }
