/* ==========================================================================
   Sami Khaddam — design system, direction A "Drawing sheet"
   Construction-drawing language: navy ink on cool paper, dimension lines,
   title blocks, and a redline red reserved for markups and focus.
   ========================================================================== */

/* Archivo variable font (width 62–125%, weight 100–900), self-hosted: no requests to Google. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin-wdth.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin-ext-wdth.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Colour */
  --paper: #F6F7F9;      /* page background */
  --sheet: #FFFFFF;      /* raised surfaces: title blocks, tool sheets, fields */
  --ink: #14223A;        /* text, rules, buttons — Sami's navy */
  --muted: #586377;      /* secondary text (5.9:1 on paper) */
  --line: #C9D1DC;       /* rules and borders */
  --line-soft: #E1E6ED;  /* hairlines inside tables */
  --tint: #E9EDF3;       /* quiet fills, hover */
  --red: #B3261E;        /* redline: markups, stamps, focus, errors (6.2:1 on paper) */

  /* Type */
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wide: 115%;          /* font-stretch for headings */
  --t-xs: .8125rem;      /* 13px  labels in title blocks */
  --t-sm: .875rem;       /* 14px  meta, footers */
  --t-md: 1.0625rem;     /* 17px  body */
  --t-lg: 1.25rem;       /* 20px  lead, readouts */
  --t-xl: 1.625rem;      /* 26px  section headings */
  --t-2xl: clamp(2.125rem, 1.4rem + 3vw, 3.25rem);   /* 34–52px page titles */
  --t-display: clamp(3.25rem, 1.5rem + 8vw, 7rem);   /* 52–112px name */

  /* Space & layout */
  --gutter: clamp(16px, 5vw, 56px);
  --maxw: 1200px;
  --label-col: 240px;
  --radius: 2px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-md)/1.6 var(--font);
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-weight: 600; font-stretch: var(--wide); line-height: 1.15; }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
img, svg { max-width: 100%; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: 8px; background: var(--sheet); padding: 8px 12px; z-index: 10; }
.muted { color: var(--muted); }

/* ---------- Header ---------- */
.site-head { border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 12px 32px; min-height: 68px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-stretch: 112%; text-decoration: none; font-size: 1.0625rem; }
.brand img { width: 28px; height: 28px; flex: none; }
.site-nav { display: flex; gap: 28px; margin-left: auto; }
.site-nav a { text-decoration: none; color: var(--muted); padding: 6px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.lang { color: var(--muted); font-size: var(--t-sm); }
.lang a { text-decoration: none; padding: 4px 2px; }
.lang [aria-current] { color: var(--ink); font-weight: 600; }
.menu-btn { display: none; margin-left: auto; font: inherit; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; color: var(--ink); cursor: pointer; }

@media (max-width: 760px) {
  .site-head .wrap { gap: 8px 14px; }
  .menu-btn { display: inline-block; order: 2; margin-left: 0; padding: 6px 10px; }
  .site-head .lang { order: 1; margin-left: auto; }
  .site-nav { display: none; order: 3; width: 100%; flex-direction: column; gap: 0; margin: 0 0 12px; }
  .site-nav a { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
  .site-nav a[aria-current] { border-bottom-color: var(--line-soft); font-weight: 600; }
  .site-head.open .site-nav { display: flex; }
}

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 1rem/1 var(--font); text-decoration: none;
  padding: 14px 20px; border-radius: var(--radius);
  background: var(--ink); color: var(--sheet); border: 1.5px solid var(--ink);
}
.btn:hover { background: #22365A; border-color: #22365A; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }

/* ---------- Dimension line: the signature element ----------
   Dimensions the width of its parent, with oblique ticks in redline. */
.dimensioned { display: inline-block; max-width: 100%; }
.dim {
  position: relative; margin-top: 18px; padding-top: 8px;
  border-top: 1px solid var(--ink);
  text-align: center; font-size: var(--t-sm); color: var(--muted);
}
.dim::before, .dim::after {
  content: ""; position: absolute; top: -8px; width: 1.5px; height: 16px;
  background: var(--red); transform: rotate(45deg);
}
.dim::before { left: 0; }
.dim::after { right: 0; }

/* ---------- Title block ---------- */
.titleblock { width: 100%; border-collapse: collapse; border: 1.5px solid var(--ink); background: var(--sheet); font-size: .9375rem; }
.titleblock th, .titleblock td { border: 1px solid var(--line-soft); padding: 10px 14px; text-align: left; vertical-align: top; }
.titleblock th { width: 36%; font-weight: 400; font-size: var(--t-xs); color: var(--muted); padding-top: 12px; }
/* The caption is the title block's heading row: a real <caption>, so screen readers name the table */
.titleblock caption { caption-side: top; text-align: left; padding: 10px 14px; background: var(--sheet); color: var(--ink);
  font-weight: 600; font-stretch: 110%; border: 1.5px solid var(--ink); border-bottom: 0; }

/* ---------- Hero ---------- */
.hero { border-bottom: 1px solid var(--line); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 48px 64px; align-items: end; padding-top: clamp(48px, 9vw, 112px); padding-bottom: clamp(48px, 8vw, 96px); }
.hero h1 { font-size: var(--t-display); line-height: .94; font-stretch: 118%; letter-spacing: -.015em; }
.lead { font-size: var(--t-lg); line-height: 1.55; max-width: 36ch; margin: 32px 0 32px; }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Page heading (inner pages) ---------- */
.page-head { border-bottom: 1px solid var(--line); }
.page-head .wrap { padding-top: clamp(40px, 7vw, 80px); padding-bottom: clamp(36px, 5vw, 56px); }
.page-head h1 { font-size: var(--t-2xl); }
.page-head .lead { margin-bottom: 0; max-width: 52ch; }
.crumb { font-size: var(--t-sm); color: var(--muted); margin-bottom: 14px; }

/* ---------- Sections: label column + content ---------- */
.sec { border-bottom: 1px solid var(--line); }
.sec .wrap { display: grid; grid-template-columns: var(--label-col) minmax(0, 1fr); gap: 24px 48px; padding-top: clamp(40px, 6vw, 72px); padding-bottom: clamp(40px, 6vw, 72px); }
.sec h2 { font-size: var(--t-xl); }
.sec-note { color: var(--muted); font-size: .9375rem; margin-top: 10px; max-width: 28ch; }
.prose p + p { margin-top: 1em; }
.prose { max-width: 64ch; }
@media (max-width: 760px) { .sec .wrap { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Row lists (experience, tools) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 24px; padding: 22px 0; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; padding-top: 0; }
.rows .when { color: var(--muted); }
.rows h3 { font-size: 1.125rem; font-stretch: 108%; }
.rows .org { color: var(--muted); }
.rows p { margin-top: 8px; max-width: 62ch; }
@media (max-width: 560px) { .rows > li { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Stamp ---------- */
.stamp {
  display: inline-block; border: 2px solid var(--red); color: var(--red);
  padding: 3px 10px; font-weight: 700; font-stretch: 112%; font-size: .9375rem;
  transform: rotate(-2deg);
}

/* ---------- Tool sheet ---------- */
.sheet { display: grid; grid-template-columns: 300px minmax(0, 1fr); background: var(--sheet); border: 1.5px solid var(--ink); margin: clamp(28px, 4vw, 48px) 0 clamp(48px, 7vw, 88px); }
.sheet h2 { font-size: 1rem; font-stretch: 110%; margin-bottom: 18px; }
.sheet-tb { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 2fr; border-top: 1.5px solid var(--ink); font-size: var(--t-sm); }
.sheet-tb > div { padding: 12px 16px; border-left: 1px solid var(--line-soft); }
.sheet-tb > div:first-child { border-left: 0; }
.sheet-tb small { display: block; color: var(--muted); font-size: var(--t-xs); }
.sheet-tb p { color: var(--muted); font-size: var(--t-xs); line-height: 1.5; margin-top: 8px; max-width: 60ch; }
@media (max-width: 820px) {
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .sheet-tb { grid-template-columns: 1fr 1fr; }
  .sheet-tb > div:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line-soft); }
}

/* ---------- Footer ---------- */
/* Footer: a drawing title block with identity, pages, contact and legal cells */
.site-foot { font-size: var(--t-sm); color: var(--ink); background: var(--sheet); border-top: 1.5px solid var(--ink); }
.site-foot .wrap { padding-top: 40px; padding-bottom: 28px; }
/* 1px gaps over a line-coloured background draw the cell dividers at any column count */
.foot-block { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line-soft); border: 1.5px solid var(--ink); }
.foot-block > * { padding: 18px 20px; background: var(--sheet); min-width: 0; }
.foot-id { display: flex; align-items: center; gap: 14px; }
.foot-id img { flex: none; }
.foot-id strong { display: block; font-size: 1.0625rem; font-weight: 600; font-stretch: 112%; }
.foot-id span { color: var(--muted); }
.foot-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.foot-cell small { font-size: var(--t-xs); color: var(--muted); margin-bottom: 2px; }
.foot-cell a { text-decoration: none; }
.foot-cell a:hover { text-decoration: underline; }
.foot-cell .lang { margin-top: 4px; }
.foot-base { margin-top: 16px; color: var(--muted); font-size: var(--t-xs); }
/* Narrow screens: identity and contact (long email) take full rows, pages and legal share one */
@media (max-width: 860px) {
  .foot-block { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "id id" "contact contact" "pages legal"; }
  .foot-id { grid-area: id; } .foot-contact { grid-area: contact; } .foot-pages { grid-area: pages; } .foot-legal { grid-area: legal; }
}
@media (max-width: 340px) { .foot-block { grid-template-columns: minmax(0, 1fr); grid-template-areas: "id" "contact" "pages" "legal"; } }

/* ---------- Small helpers ---------- */
.small { font-size: .9375rem; }
.tools-stamp { margin-top: 28px; }
.tools-disclaimer { margin-top: 12px; max-width: 68ch; }
.tool-groups { padding-top: 48px; padding-bottom: 88px; }

/* ---------- Legal text ---------- */
.legal { max-width: 70ch; }
.legal h2 { font-size: var(--t-xl); margin: 48px 0 16px; }
.legal h2:first-child { margin-top: 0; }
.legal h3 { font-size: 1.125rem; font-stretch: 108%; margin: 28px 0 8px; }
.legal p, .legal ul { margin: 0 0 12px; }
.legal ul { padding-left: 1.2em; }
.legal li + li { margin-top: 8px; }

/* ---------- Not found ---------- */
.notfound .wrap { padding-top: clamp(56px, 10vw, 120px); padding-bottom: clamp(56px, 10vw, 120px); }
.notfound h1 { font-size: var(--t-display); line-height: 1; font-stretch: 118%; }
.notfound p { margin-top: 20px; }

/* ==========================================================================
   Visual layer: line drawings, motion and richer section layouts
   ========================================================================== */

:root { --blue: #2E5E99; --ease: cubic-bezier(.65, .05, .25, 1); }
html { scroll-behavior: smooth; }

/* ---------- Sticky header ---------- */
.site-head { position: sticky; top: 0; z-index: 30; background: rgba(246, 247, 249, .86); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom-color: transparent; transition: border-color .3s, box-shadow .3s; }
.site-head.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 24px -18px rgba(20, 34, 58, .45); }
.site-nav a { transition: color .2s, border-color .2s; }

/* ---------- Line drawings ---------- */
.drawing { display: block; width: 100%; height: auto; overflow: visible; }
.drawing .ln { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.drawing .ln.heavy { stroke-width: 2.5; }
.drawing .ln.thin { stroke-width: 1; stroke: #3A4A66; }
.drawing .ln.red { stroke: var(--red); stroke-width: 1.5; }
.drawing .ln.blue { stroke: var(--blue); }
.drawing .ln.area { fill: rgba(46, 94, 153, .12); stroke: var(--blue); }
.drawing .ln.fill-soft { fill: rgba(88, 99, 119, .10); }
.drawing .ln.fill-blue { fill: rgba(46, 94, 153, .22); }
.drawing .ln.fill-ink { fill: var(--ink); stroke: var(--ink); }
.drawing .ln.swatch { stroke: var(--sheet); stroke-width: 1; }
.drawing .axis { stroke: var(--line); stroke-width: 1; stroke-dasharray: 10 4 2 4; vector-effect: non-scaling-stroke; }
.drawing .axis.red-axis { stroke: var(--red); opacity: .7; }
.drawing text { font: 500 13px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.drawing text.red { fill: var(--red); font-weight: 700; }
.drawing.icon { max-width: 120px; }

/* Draw-on animation: strokes are hidden until the drawing scrolls into view */
@media (prefers-reduced-motion: no-preference) {
  .js .drawing .ln { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset var(--dur, 1.1s) var(--ease) var(--d, 0s); }
  .js .drawing .ln.area, .js .drawing .ln.fill-soft, .js .drawing .ln.fill-blue, .js .drawing .ln.fill-ink, .js .drawing .ln.swatch { fill-opacity: 0; transition: stroke-dashoffset var(--dur, 1.1s) var(--ease) var(--d, 0s), fill-opacity .6s ease calc(var(--d, 0s) + .5s); }
  .js .drawing .fade { opacity: 0; transition: opacity .6s ease var(--d, 0s); }
  .js .drawing.is-in .ln { stroke-dashoffset: 0; }
  .js .drawing.is-in .ln { fill-opacity: 1; }
  .js .drawing.is-in .fade { opacity: 1; }
  .js .drawing .axis.fade { opacity: 0; }
  .js .drawing.is-in .axis.fade { opacity: 1; }
  .js .drawing.is-in .axis.red-axis { opacity: .7; }
}

/* Reveal on scroll */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s var(--ease); transition-delay: var(--d, 0s); }
  .js .reveal.is-in { opacity: 1; transform: none; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 0; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 75% 85% at 72% 40%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 75% 85% at 72% 40%, #000 25%, transparent 75%);
  opacity: .8;
}
.hero .wrap { position: relative; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; padding-top: clamp(40px, 6vw, 80px); padding-bottom: clamp(32px, 5vw, 56px); }
.hero-drawing { max-width: 600px; margin-left: auto; }
@media (prefers-reduced-motion: no-preference) {
  .js .hero-copy > * { opacity: 0; transform: translateY(14px); animation: rise .9s var(--ease) forwards; }
  .js .hero-copy > :nth-child(2) { animation-delay: .12s; }
  .js .hero-copy > :nth-child(3) { animation-delay: .3s; }
  .js .hero-copy > :nth-child(4) { animation-delay: .42s; }
  .js .hero .dim { clip-path: inset(-12px 100% -2px 0); animation: dimline 1.1s var(--ease) .55s forwards; }
}
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes dimline { to { clip-path: inset(-12px 0 -2px 0); } }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); } .hero-drawing { margin: 8px auto 0; max-width: 520px; } }

/* Title block strip: the facts, set along the bottom of the hero like a drawing's title block */
.title-strip { position: relative; border-bottom: 1px solid var(--line); }
.title-strip .wrap { padding-bottom: clamp(40px, 6vw, 72px); }
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1.5px solid var(--ink); background: var(--sheet); }
.strip > div { padding: 16px 18px; border-left: 1px solid var(--line-soft); min-width: 0; hyphens: auto; overflow-wrap: break-word; }
.strip > div:first-child { border-left: 0; background: var(--ink); color: var(--sheet); }
.strip small { display: block; font-size: var(--t-xs); color: var(--muted); margin-bottom: 4px; }
.strip > div:first-child small { color: #AEB8C8; }
.strip strong { font-weight: 600; font-stretch: 108%; font-size: 1.0625rem; }
.strip .big { font-size: 1.75rem; line-height: 1.1; font-stretch: 112%; }
@media (max-width: 520px) { .strip { grid-template-columns: minmax(0, 1fr) !important; } .strip > div { border-left: 0 !important; } .strip .big { font-size: 1.5rem; } }
@media (max-width: 900px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .strip > div { border-top: 1px solid var(--line-soft); } .strip > div:first-child { grid-column: 1 / -1; border-top: 0; } .strip > div:nth-child(2n) { border-left: 0; } }

/* ---------- Expertise cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--line); padding: 22px 22px 24px;
  text-decoration: none; color: inherit; transition: border-color .25s, transform .35s var(--ease), box-shadow .35s var(--ease);
}
/* Every element with class "card" gets the same hover: lift, shadow and ink border. It lives on
   the base class, so any card added later inherits it; don't override it per page.
   Cards that do something (a link card, or a card with a .stretch button) also show the pointer,
   and their whole surface is clickable. Hover applies only on devices that can hover, so taps
   on phones don't stick; keyboard focus on a clickable card looks the same. */
@media (hover: hover) {
  .card:hover { border-color: var(--ink); transform: translateY(-3px); box-shadow: 0 18px 36px -24px rgba(20, 34, 58, .45); }
}
a.card, .card:has(.stretch) { cursor: pointer; }
a.card:focus-visible, .card:has(.stretch:focus-visible) { border-color: var(--ink); transform: translateY(-3px); box-shadow: 0 18px 36px -24px rgba(20, 34, 58, .45); outline: 2px solid var(--red); outline-offset: 3px; }
/* A button inside a card that makes the whole card its click area */
.card .stretch { font: inherit; color: inherit; background: none; border: 0; padding-left: 0; padding-right: 0; padding-bottom: 0; text-align: left; cursor: pointer; align-self: flex-start; }
.card .stretch::before { content: ""; position: absolute; inset: 0; }
.card .stretch:focus-visible { outline: none; }
html:not(.js) .card .stretch { display: none; }
/* "Open" / "Details" with a line that extends on hover */
.card .open { margin-top: auto; padding-top: 16px; font-size: var(--t-sm); font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.card .open::after { content: ""; width: 18px; height: 1.5px; background: currentColor; transition: width .3s var(--ease); }
@media (hover: hover) { .card:hover .open::after { width: 30px; } }
.card:focus-visible .open::after { width: 30px; }
.card .drawing { margin-bottom: 18px; height: 80px; width: auto; max-width: 100%; }
.card > .drawing { align-self: flex-start; }
.card h3 { font-size: 1.125rem; font-stretch: 108%; }
.card p { color: var(--muted); margin-top: 6px; font-size: .9375rem; }
.sec-wide .wrap { grid-template-columns: minmax(0, 1fr); }
.sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px 32px; margin-bottom: 28px; }
.sec-head h2 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); }
.sec-head p { color: var(--muted); max-width: 46ch; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .cards { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 36px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1.5px; background: var(--ink); transform-origin: top; }
.js .timeline::before { transform: scaleY(var(--progress, 0)); transition: transform .15s linear; }
.timeline > li { position: relative; padding: 0 0 40px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before { content: ""; position: absolute; left: -36px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }
.timeline > li:first-child::before { background: var(--ink); box-shadow: 0 0 0 4px rgba(20, 34, 58, .12); }
.js .timeline > li::before { transition: background .3s, box-shadow .3s; }
.js .timeline > li:first-child:not(.is-reached)::before { background: var(--paper); box-shadow: none; }
.js .timeline > li.is-reached::before { background: var(--ink); box-shadow: 0 0 0 4px rgba(20, 34, 58, .12); }
.timeline .when { font-size: var(--t-sm); color: var(--muted); }
.timeline h3 { font-size: 1.25rem; font-stretch: 108%; margin-top: 2px; }
.timeline .org { color: var(--muted); }
.timeline p { margin-top: 10px; max-width: 62ch; }
.timeline .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; list-style: none; padding: 0; }
.tags li { font-size: var(--t-xs); border: 1px solid var(--line); padding: 4px 10px; background: var(--sheet); }

/* ---------- Tool cards ---------- */
.tool-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tool-card { display: flex; flex-direction: column; }
.tool-card .thumb { background: var(--paper); border: 1px solid var(--line-soft); margin: -8px -8px 18px; padding: 10px 8px; }
.tool-card .thumb .drawing { height: 90px; margin: 0 auto; }
.tool-card .basis { font-size: var(--t-xs); color: var(--muted); margin-top: 10px; }
@media (hover: hover) { .tool-card:hover .thumb { border-color: var(--line); } }
@media (max-width: 1000px) { .tool-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .tool-cards { grid-template-columns: minmax(0, 1fr); } }
.tool-group + .tool-group { margin-top: 56px; }
.tool-group h2 { font-size: 1.25rem; margin-bottom: 16px; display: flex; align-items: baseline; gap: 12px; }
.tool-group h2 small { font-size: var(--t-sm); color: var(--muted); font-weight: 400; font-stretch: 100%; }

/* ---------- Navy contact band with skyline ---------- */
.band-dark { position: relative; overflow: hidden; background: var(--ink); color: var(--sheet); border: 0; }
.band-dark .wrap { position: relative; z-index: 1; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: end; padding-top: clamp(56px, 8vw, 96px); padding-bottom: clamp(140px, 16vw, 200px); }
.band-dark h2 { font-size: clamp(2rem, 1.3rem + 2.4vw, 3.25rem); line-height: 1.05; }
.band-dark p { color: #C9D1DC; font-size: var(--t-lg); max-width: 40ch; }
.band-dark .actions { margin-top: 24px; }
.band-dark .btn { background: var(--sheet); color: var(--ink); border-color: var(--sheet); }
.band-dark .btn:hover { background: #E9EDF3; border-color: #E9EDF3; }
.band-dark a:not(.btn) { color: var(--sheet); }
.band-dark :focus-visible { outline-color: #F0675D; }
.band-dark .skyline { position: absolute; left: 0; right: 0; bottom: 0; height: auto; min-width: 900px; width: 100%; opacity: .9; }
.band-dark .skyline .ln { stroke: #8FA0BA; }
.band-dark .skyline .ln.thin { stroke: #5D6F8C; }
.band-dark .skyline .ln.red { stroke: #F0675D; }
@media (max-width: 760px) { .band-dark .wrap { grid-template-columns: minmax(0, 1fr); } .band-dark .skyline { left: 50%; transform: translateX(-50%); } }
.band-dark .titleblock { color: var(--ink); }
.band-dark .titleblock a { color: var(--ink); }
.contact-hero .wrap { align-items: center; padding-top: clamp(56px, 9vw, 112px); padding-bottom: clamp(170px, 20vw, 240px); }
.contact-hero h1 { font-size: var(--t-display); line-height: .95; font-stretch: 118%; letter-spacing: -.015em; }
.contact-hero p { margin-top: 20px; }

/* ---------- Inner page heads with drawings ---------- */
.page-head.with-drawing .wrap { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px 64px; align-items: center; }
.page-head.with-drawing .drawing { max-width: 360px; margin-left: auto; }
@media (max-width: 760px) { .page-head.with-drawing .wrap { grid-template-columns: minmax(0, 1fr); } .page-head.with-drawing .drawing { max-width: 260px; margin: 0; } }

/* Skill rows with drawings */
.skill-rows { display: grid; gap: 16px; }
.skill-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px; align-items: center; }
.skill-row .drawing { height: 72px; }
@media (max-width: 520px) { .skill-row { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; } }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- CV details ---------- */
.timeline .bullets { margin: 12px 0 0; padding-left: 1.1em; max-width: 66ch; }
.timeline .bullets li + li { margin-top: 6px; }
.timeline .bullets li::marker { color: var(--muted); }
.facts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 760px) { .facts-grid { grid-template-columns: minmax(0, 1fr); } }
.band-dark .actions a:not(.btn) { text-underline-offset: 4px; }

/* Anchored sections stop below the sticky header */
[id] { scroll-margin-top: 88px; }

/* Keep the footer at the bottom of short pages */
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

/* ---------- Tool page heads with the tool's drawing ---------- */
.tool-head .drawing { max-width: 300px; }
@media (max-width: 760px) { .tool-head .drawing { display: none; } }

/* ---------- Legal page: "On this page" menu ---------- */
.toc { position: sticky; top: 96px; align-self: start; font-size: var(--t-sm); }
.toc p { font-size: var(--t-xs); color: var(--muted); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 1.5px solid var(--ink); }
.toc li + li { margin-top: 6px; }
.toc a { text-decoration: none; color: var(--ink); }
.toc a:hover { text-decoration: underline; }
.toc .toc-h3 a { color: var(--muted); padding-left: 12px; }
.toc .toc-h2 { font-weight: 600; margin-top: 14px; }
.toc .toc-h2:first-child { margin-top: 0; }
@media (max-width: 760px) { .toc { position: static; } }

/* ---------- Not found ---------- */
.notfound .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 64px; align-items: center; }
.notfound-drawing { max-width: 440px; margin-left: auto; }
@media (max-width: 760px) { .notfound .wrap { grid-template-columns: minmax(0, 1fr); } .notfound-drawing { margin: 0; max-width: 340px; } }

/* ---------- Detail pop-up (expertise) ---------- */
html:has(dialog[open]) { overflow: hidden; scrollbar-gutter: stable; }
.xp { padding: 0; border: 0; background: transparent; color: var(--ink); width: min(900px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 48px); margin: auto; overflow: visible; }
.xp::backdrop { background: rgba(20, 34, 58, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.xp-sheet { position: relative; display: flex; flex-direction: column; max-height: calc(100dvh - 48px); background: var(--sheet); border: 1.5px solid var(--ink); box-shadow: 0 40px 80px -40px rgba(20, 34, 58, .65); }
.xp-sheet::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--line-soft); pointer-events: none; }
.xp-scroll { overflow: auto; overscroll-behavior: contain; padding: clamp(28px, 4vw, 48px) clamp(22px, 4vw, 48px) clamp(24px, 3vw, 36px); }
.xp-head { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 28px; align-items: center; padding: 0 48px 26px 0; border-bottom: 1px solid var(--line); }
.xp-head .drawing { height: 104px; width: auto; max-width: 100%; }
.xp-kicker { font-size: var(--t-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.xp h2 { font-size: var(--t-xl); font-stretch: 108%; line-height: 1.2; margin-top: 6px; }
.xp-lead { color: var(--muted); margin-top: 10px; max-width: 54ch; }
.xp-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 28px 48px; padding-top: 26px; }
.xp h3 { font-size: var(--t-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.xp h3:not(:first-child) { margin-top: 26px; }
.xp .bullets { margin: 0; padding-left: 1.1em; }
.xp .bullets li + li { margin-top: 8px; }
.xp .bullets li::marker { color: var(--red); }
.xp .tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.xp-roles { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-soft); font-size: var(--t-sm); }
.xp-roles li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.xp-roles .when { display: block; font-size: var(--t-xs); color: var(--muted); }
.xp-roles strong { font-weight: 600; }
.xp-roles .org { color: var(--muted); }
.xp-note { margin-top: 18px; font-size: var(--t-sm); color: var(--muted); }
.xp-foot { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px clamp(22px, 4vw, 48px); border-top: 1.5px solid var(--ink); font-size: var(--t-sm); }
.xp-foot a { color: var(--ink); }
.xp-step { font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 6px 0; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.xp-step::before, .xp-step::after { content: ""; height: 1.5px; background: currentColor; transition: width .3s var(--ease); }
.xp-step.prev::before { width: 18px; }
.xp-step.next::after { width: 18px; }
@media (hover: hover) { .xp-step.prev:hover::before, .xp-step.next:hover::after { width: 30px; } }
.xp-close { position: absolute; z-index: 1; top: 16px; right: 16px; width: 40px; height: 40px; background: var(--sheet); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, transform .3s var(--ease); }
.xp-close::before, .xp-close::after { content: ""; position: absolute; left: 11px; right: 11px; top: 50%; height: 1.5px; background: var(--ink); transform: rotate(45deg); }
.xp-close::after { transform: rotate(-45deg); }
@media (hover: hover) { .xp-close:hover { border-color: var(--ink); transform: rotate(90deg); } }
@media (prefers-reduced-motion: no-preference) {
  .xp[open] .xp-sheet { animation: xp-in .5s var(--ease) both; }
  .xp[open]::backdrop { animation: xp-fade .35s ease both; }
  .xp.is-closing .xp-sheet { animation: xp-out .22s ease both; }
  .xp.is-closing::backdrop { animation: xp-fade .22s ease reverse both; }
  .xp-item:not([hidden]) .xp-head > div, .xp-item:not([hidden]) .xp-body { animation: xp-swap .55s var(--ease) both; }
  .xp-item:not([hidden]) .xp-body { animation-delay: .08s; }
}
@keyframes xp-in { from { opacity: 0; transform: translateY(28px) scale(.98); } }
@keyframes xp-out { to { opacity: 0; transform: translateY(16px) scale(.985); } }
@keyframes xp-fade { from { opacity: 0; } }
@keyframes xp-swap { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 680px) {
  .xp { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  .xp-sheet { max-height: calc(100dvh - 16px); }
  .xp-head { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-right: 0; }
  .xp-head .drawing { height: 72px; }
  .xp-body { grid-template-columns: minmax(0, 1fr); }
  .xp-close { top: 12px; right: 12px; }
  .xp-foot a { display: none; }
}

/* Draft tools: only on local and preview builds, marked so they can't be mistaken for live ones */
.draft-flag { display: inline-block; margin: 6px 0 4px; padding: 2px 8px; border: 1.5px solid var(--red); color: var(--red); font-size: var(--t-xs); font-weight: 600; }
