/* Portfolio design: matches the one-page CV.
   Blue-grey ink on paper, one muted blue accent. Serif headings, sans-serif text, monospace for dates and stack tags.
   Dark is the default theme; data-theme="light" on <html> switches to the CV's white paper.
   Layout: a 1120px column; sections use a narrow label column on the left, like the CV. */
:root {
  --paper: #12171c;
  --wash: #1a2128;        /* quiet fill for notes, code and image tiles */
  --ink: #e6eaee;
  --ink-soft: #b4bec8;
  --ink-muted: #8f9ba7;   /* 6:1 on the paper */
  --rule: #29323b;
  --rule-strong: #3b4651;
  --accent: #8fbad6;      /* links, labels, focus */
  --accent-ink: #b7d4e8;
  --accent-wash: #1a2935;
  --on-accent: #0e1820;   /* text on an accent fill */
  --bar: rgba(18, 23, 28, .94);
  color-scheme: dark;

  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --measure: 68ch;
  --label-col: 11rem;
  --index-bar: 52px;      /* height of the sticky "On this page" bar */
}
:root[data-theme="light"] {
  --paper: #ffffff;
  --wash: #f4f6f8;
  --ink: #1c2229;
  --ink-soft: #444f5b;
  --ink-muted: #5f6975;   /* 5.6:1 on white */
  --rule: #dde2e7;
  --rule-strong: #c4ccd4;
  --accent: #24506b;
  --accent-ink: #1b3e53;
  --accent-wash: #eef3f6;
  --on-accent: #ffffff;
  --bar: rgba(255, 255, 255, .96);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--index-bar) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
code { font-family: var(--font-mono); font-size: .88em; background: var(--wash); padding: .08em .3em; border-radius: 3px; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

.skip-link { position: absolute; left: 16px; top: -100px; background: var(--paper); padding: 8px 12px; border: 1px solid var(--rule-strong); z-index: 10; }
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* Header and footer */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 32px; padding-block: 20px; }
.brand-line { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--accent); text-decoration: none; }
.brand-role { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-muted); }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: .95rem; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; }
.site-nav { align-items: baseline; }
/* Theme switch: shown only when the script that remembers the choice has run */
.theme-toggle { display: none; align-items: center; gap: 6px; font: inherit; font-size: .9rem; color: var(--ink-soft); background: none; border: 1px solid var(--rule-strong); border-radius: 999px; padding: 2px 10px 2px 8px; cursor: pointer; }
.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 14px; height: 14px; flex: none; }

.site-footer { border-top: 1px solid var(--rule); margin-top: 96px; color: var(--ink-muted); font-size: .92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 32px; padding-block: 32px 44px; }
.site-footer p { margin: 0; }
.brand-small { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.footer-nav a { color: var(--ink-soft); }
.footer-note { font-family: var(--font-mono); font-size: .76rem; }

/* Shared type */
.eyebrow { margin: 0 0 10px; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.eyebrow a { text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.lead { font-size: 1.25rem; line-height: 1.5; color: var(--ink-soft); max-width: var(--measure); margin: 0; }
.muted { color: var(--ink-muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tags li { font-family: var(--font-mono); font-size: .76rem; line-height: 1.4; color: var(--ink-soft); border: 1px solid var(--rule); border-radius: 3px; padding: 2px 7px; }
.date { font-family: var(--font-mono); font-size: .8rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.area-num { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--accent); border-radius: 3px; background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; }
.button::after { content: "↓"; font-weight: 400; }
.button:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); text-decoration: none; }

/* Pictures: thumbnails and the typographic tile used when a product has no image */
.card-media, .hero-media { display: block; text-decoration: none; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--rule); border-radius: 4px; background: var(--wash); }
.card-media img, .hero-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.02); }
.card:hover .card-media, .hero-media:hover { border-color: var(--rule-strong); }
.thumb-steps { list-style: none; margin: 0; padding: 22px 24px; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 7px; counter-reset: thumb; }
.thumb-steps li { font-family: var(--font-mono); font-size: .8rem; line-height: 1.3; color: var(--ink-soft); display: flex; gap: 12px; }
.thumb-steps li::before { counter-increment: thumb; content: counter(thumb, decimal-leading-zero); color: var(--accent); }

/* Home */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 40px 64px; align-items: end; padding-block: 72px 56px; border-bottom: 1px solid var(--rule); }
.intro h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.08; letter-spacing: -.01em; margin: 0 0 20px; max-width: 18ch; }
.intro .lead + .lead { margin-top: 12px; }
.intro-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 24px 0 0; font-size: .98rem; }

.area-index-title { margin: 0 0 8px; font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.area-index ol { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.area-index a { display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: baseline; padding: 9px 2px; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.area-index a:hover { color: var(--accent); background: var(--accent-wash); }
.area-index a:hover .area-index-name { text-decoration: underline; }
.area-index .area-count { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-muted); }

.area { display: grid; grid-template-columns: var(--label-col) minmax(0, 1fr); gap: 0 40px; padding-block: 56px; border-bottom: 1px solid var(--rule); scroll-margin-top: 0; }
.area-head { display: grid; gap: 6px; align-content: start; }
.area-head .area-num { margin: 0; }
.area-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; line-height: 1.25; margin: 0; color: var(--ink); }
.area-head .area-count { margin: 0; font-size: .9rem; color: var(--ink-muted); }
.area-body { min-width: 0; display: grid; gap: 32px; }
.area-intro { margin: 0; max-width: var(--measure); color: var(--ink-soft); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 40px 32px; list-style: none; margin: 0; padding: 0; }
.card { display: grid; grid-template-rows: auto 1fr; gap: 18px; }
.card-text { display: grid; grid-template-rows: auto auto 1fr auto auto; gap: 8px; }
.card .date { margin: 0; }
.card h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1.25; margin: 0; }
.card p { margin: 0; color: var(--ink-soft); }
.card .tags { align-self: start; margin-top: 4px; }
.card-link { font-weight: 600; font-size: .98rem; margin-top: 6px; justify-self: start; }
.card-link::after { content: " →"; }
/* An area with one product shows it wide: picture left, text right */
.cards.single .card { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: none; gap: 32px; align-items: start; }

/* Product pages */
.product-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 56px; padding-block: 64px 48px; }
.product-hero.has-media { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; }
.product-hero h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 4.6vw, 3rem); line-height: 1.1; letter-spacing: -.01em; margin: 0 0 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 28px 0 0; }
.facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 16px 32px; margin: 44px 0 0; padding: 20px 0 0; border-top: 1px solid var(--rule); }
.facts div { display: grid; gap: 4px; align-content: start; }
.facts dt { font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.facts dd { margin: 0; }

/* "On this page": sticky bar of section links */
.page-index { position: sticky; top: 0; z-index: 5; background: var(--bar); border-block: 1px solid var(--rule); }
.page-index ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 0 28px; overflow-x: auto; scrollbar-width: none; min-height: var(--index-bar); align-items: center; }
.page-index ol::-webkit-scrollbar { display: none; }
.page-index li { flex: none; }
.page-index a { display: block; padding: 8px 0; font-size: .92rem; color: var(--ink-soft); text-decoration: none; border-bottom: 2px solid transparent; }
.page-index a:hover { color: var(--accent); }
.page-index a[aria-current="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.block { display: grid; grid-template-columns: var(--label-col) minmax(0, 1fr); gap: 0 40px; padding-block: 48px; border-bottom: 1px solid var(--rule); }
.block > h2 { position: sticky; top: calc(var(--index-bar) + 24px); align-self: start; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: .35rem 0 0; line-height: 1.4; }
.block-body { min-width: 0; display: grid; gap: 18px; }
.block-body > p, .block-body > ul, .block-body > ol { margin: 0; max-width: var(--measure); }
.block-body h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; margin: 8px 0 0; }
.block-body ul { padding-left: 1.2em; }
.block-body li + li { margin-top: 6px; }
.block-body li::marker { color: var(--ink-muted); }

/* Simple flow diagram: an ordered list of steps with arrows between them */
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 28px; counter-reset: step; max-width: none !important; }
.flow li { position: relative; border: 1px solid var(--rule-strong); border-top: 3px solid var(--accent); border-radius: 4px; padding: 14px 16px; background: var(--paper); margin: 0 !important; }
.flow li strong { display: block; font-size: .98rem; line-height: 1.3; margin-bottom: 4px; }
.flow li span { display: block; font-size: .9rem; line-height: 1.45; color: var(--ink-soft); }
.flow li::before { counter-increment: step; content: counter(step, decimal-leading-zero); display: block; font-family: var(--font-mono); font-size: .72rem; color: var(--ink-muted); margin-bottom: 6px; }
.flow li + li::after { content: ""; position: absolute; left: -22px; top: 50%; width: 16px; height: 1px; background: var(--ink-muted); }
.flow li + li > :first-child::before { content: ""; position: absolute; left: -10px; top: calc(50% - 4px); border: 4px solid transparent; border-left: 5px solid var(--ink-muted); }
.diagram-caption { font-size: .9rem; color: var(--ink-muted); margin: 0; }

/* Screenshots: click to open full size */
.shots { display: grid; gap: 28px; }
.shot { margin: 0; display: grid; gap: 8px; align-content: start; }
.shot-link { display: block; border-radius: 4px; }
.shot img { border: 1px solid var(--rule); border-radius: 4px; width: 100%; }
.shot-link:hover img { border-color: var(--rule-strong); }
.shot figcaption { font-size: .9rem; color: var(--ink-muted); max-width: var(--measure); }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 28px 24px; }
.shot-phone { max-width: 300px; }
.note { background: var(--wash); border-left: 3px solid var(--rule-strong); border-radius: 0 4px 4px 0; padding: 14px 18px; font-size: .95rem; color: var(--ink-soft); max-width: var(--measure); margin: 0; }

.checklist { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.checklist li { padding-left: 1.4em; position: relative; margin: 0 !important; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .62em; width: .55em; height: .3em; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

.next-links { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; padding-block: 40px 0; }
.next-link { display: grid; gap: 2px; padding: 16px 20px; border: 1px solid var(--rule); border-radius: 4px; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.next-link span { font-family: var(--font-body); font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.next-link span::before { content: "← "; }
.next-link.next { text-align: right; }
.next-link.next span::before { content: none; }
.next-link.next span::after { content: " →"; }
.next-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* Walkthrough (text demo) */
.walkthrough { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: 0; counter-reset: scene; max-width: var(--measure); }
.walkthrough li { border-top: 1px solid var(--rule); padding: 16px 0 16px 3rem; position: relative; margin: 0 !important; }
.walkthrough li:last-child { border-bottom: 1px solid var(--rule); }
.walkthrough li::before { counter-increment: scene; content: counter(scene, decimal-leading-zero); position: absolute; left: 0; top: 18px; font-family: var(--font-mono); font-size: .8rem; color: var(--ink-muted); }
.walkthrough strong { display: block; }
.walkthrough span { color: var(--ink-soft); }

/* Existing recording players (SoherAgent tabs and SoherDocs chapters) */
.demo-switcher { display: grid; gap: 20px; }
.demo-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-tab, .workflow-chapter { font: inherit; text-align: left; cursor: pointer; display: flex; gap: 10px; align-items: baseline; background: var(--paper); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 4px; padding: 8px 12px; text-decoration: none; }
.demo-tab strong, .workflow-chapter strong { display: block; font-size: .95rem; }
.demo-tab span span, .workflow-chapter span span { display: block; font-size: .8rem; color: var(--ink-muted); }
.demo-tab[aria-selected="true"], .workflow-chapter[aria-current] { border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.demo-tab-number, .workflow-chapter-number { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-muted); }
.demo-stage { min-width: 0; }
.demo-panel { display: grid; gap: 14px; min-width: 0; }
.demo-panel[hidden] { display: none; }
.demo-panel video, .workflow-stage video { width: 100%; border: 1px solid var(--rule); border-radius: 4px; background: #11161b; }
.demo-filmstrip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.demo-chapter { flex: 0 0 150px; scroll-snap-align: start; display: grid; gap: 6px; text-decoration: none; color: var(--ink); font-size: .82rem; line-height: 1.3; }
.demo-chapter img { border: 1px solid var(--rule); border-radius: 3px; }
.demo-chapter[aria-current] img { outline: 2px solid var(--accent); outline-offset: 1px; }
.demo-chapter span span { display: block; font-family: var(--font-mono); font-size: .72rem; color: var(--ink-muted); }
.demo-panel-footer, .workflow-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; font-size: .92rem; color: var(--ink-soft); }
.demo-panel-footer p, .workflow-footer p { margin: 0; max-width: var(--measure); }
.demo-panel-footer span { display: flex; gap: 16px; }
.workflow-demo { display: grid; gap: 16px; }
.workflow-chapters { display: flex; flex-wrap: wrap; gap: 8px; }
.workflow-stage { display: grid; gap: 10px; min-width: 0; }
.workflow-truth { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-muted); }
.visualization-note, .evidence-note { font-size: .92rem; color: var(--ink-muted); max-width: var(--measure); margin: 0; }
.evidence-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }

@media (max-width: 960px) {
  .intro { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .area-index { max-width: 32rem; }
}

@media (max-width: 820px) {
  :root { --label-col: 1fr; --index-bar: 46px; }
  .area, .block { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-block: 40px; }
  .block > h2 { position: static; }
  .area-head { grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 12px; }
  .area-head .area-count { grid-column: 2; }
  .cards.single .card { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .product-hero.has-media { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .hero-media { order: -1; }
  .flow { grid-auto-flow: row; grid-auto-columns: auto; gap: 22px; }
  .flow li + li::after { left: 24px; top: -16px; width: 1px; height: 12px; }
  .flow li + li > :first-child::before { left: 20px; top: -9px; border: 4px solid transparent; border-top: 5px solid var(--ink-muted); }
  .intro { padding-block: 48px 40px; }
  .product-hero { padding-block: 32px 36px; }
  .page-index ol { gap: 0 20px; }
  .next-links { grid-template-columns: minmax(0, 1fr); }
  .next-link.next { text-align: left; }
}

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

/* Theme switch icon: a sun offers light mode, a moon offers dark mode */
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
