/* ==========================================================================
   Chesi Supply Chain Explorer - base styles
   Design tokens, layout, components. Animations: animations.css.
   Breakpoints: responsive.css.
   ========================================================================== */

:root {
  --ink: #0b1f33;
  --navy: #1e3a5f;
  --steel: #3c5a7a;
  --muted: #55667a;
  --line: #dbe2ea;
  --line-strong: #c3cfdb;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --amber: #f5a524;
  --amber-ink: #8a5600;
  --amber-soft: #fff4dd;
  --teal: #0e9f8e;
  --teal-ink: #07695e;
  --teal-soft: #e2f5f2;
  --red: #c8352f;
  --focus: #1a73e8;

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 51, 0.06), 0 1px 1px rgba(11, 31, 51, 0.04);
  --shadow: 0 8px 24px rgba(11, 31, 51, 0.08), 0 2px 6px rgba(11, 31, 51, 0.05);
  --shadow-lg: 0 24px 60px rgba(11, 31, 51, 0.18);
  --header-h: 68px;
  --gutter: clamp(16px, 3vw, 32px);
  --maxw: 1320px;
}

*,
*::before,
*::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

html, body { overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--navy); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.2vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 650; }
h3 { font-size: 1.15rem; font-weight: 650; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
button, input, select, textarea { font: inherit; color: inherit; }

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

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 1000; background: var(--ink); color: #fff;
  padding: 10px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; color: #fff; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--steel); margin: 0 0 0.75rem; display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--amber); display: inline-block; }
.lead { font-size: 1.125rem; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; font-size: 0.95rem; text-decoration: none; cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, transform .2s, box-shadow .2s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { background: #ffb83f; color: var(--ink); box-shadow: 0 6px 16px rgba(245, 165, 36, .35); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.btn-light { background: rgba(255,255,255,.9); border-color: var(--line); color: var(--ink); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.85rem; }
.btn[aria-pressed="true"] { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--navy); text-decoration: underline; cursor: pointer; font-weight: 600; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink);
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand-sub { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.main-nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.main-nav a {
  padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: 0.93rem; white-space: nowrap;
}
.main-nav a:hover { background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--amber); border-radius: 0; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; }

/* ---------- Search ---------- */
.search { position: relative; }
.search-input-wrap { position: relative; display: flex; align-items: center; }
.search-input-wrap svg { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input, .search input[type="search"] {
  width: 240px; height: 42px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  padding: 0 14px 0 38px; transition: width .25s, border-color .2s;
}
.search input:focus, .search input[type="search"]:focus { width: 260px; border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(26,115,232,.18); }
.search-results {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(440px, calc(100vw - 32px)); max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 200;
}
.search-results[hidden] { display: none; }
.search-group-label { font-family: var(--mono); font-size: 0.68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.search-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink);
}
.search-item:hover, .search-item[aria-selected="true"] { background: var(--surface-2); }
.search-item-title { font-weight: 600; font-size: 0.93rem; }
.search-item-meta { font-size: 0.8rem; color: var(--muted); }
.search-type {
  flex: none; font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: .08em;
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 2px 5px; margin-top: 2px; color: var(--steel); min-width: 74px; text-align: center;
}
.search-empty { padding: 14px 10px; color: var(--muted); font-size: 0.9rem; }
.search-all { display: block; padding: 10px; text-align: center; font-weight: 600; border-top: 1px solid var(--line); margin-top: 4px; }

/* ---------- Views ---------- */
main { min-height: calc(100vh - var(--header-h)); }
.view[hidden] { display: none !important; }
.view-header { padding-top: 28px; padding-bottom: 18px; }
.view-header h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }

.breadcrumbs { font-size: 0.85rem; margin: 0 0 12px; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; color: var(--line-strong); margin-right: 2px; }
.breadcrumbs a { color: var(--steel); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--ink); font-weight: 600; }

.section { padding: clamp(48px, 7vw, 96px) 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head p { margin: 0; }

/* ---------- Hero / world ---------- */
.hero { position: relative; background: radial-gradient(1200px 600px at 70% 10%, #ffffff 0%, #eef3f7 55%, #e6edf3 100%); overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-grid { position: relative; max-width: 1600px; margin: 0 auto; }
.hero-copy {
  position: absolute; left: var(--gutter); top: clamp(20px, 4vw, 48px); z-index: 5; max-width: 430px;
}
.hero-copy h1 { margin-bottom: 0.35em; font-size: clamp(2rem, 3.6vw, 3rem); }
.hero-copy .lead { font-size: 1.1rem; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-legend {
  position: absolute; right: var(--gutter); top: clamp(20px, 4vw, 48px); z-index: 5; width: 260px;
  background: rgba(255,255,255,.82); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; backdrop-filter: blur(6px);
  font-size: 0.85rem;
}
.hero-legend h2 { font-size: 0.95rem; margin-bottom: 6px; }
.hero-legend ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.hero-legend li { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.legend-swatch { width: 22px; height: 0; border-top: 3px dotted var(--teal); flex: none; }
.legend-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid var(--amber); flex: none; }

/* scene stage shared by home and sectors */
.scene-stage { position: relative; width: 100%; aspect-ratio: 1600 / 1000; }
.scene-stage .scene-svg { width: 100%; height: 100%; }
.scene-stage .scene-loading {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-family: var(--mono); font-size: .85rem;
}
.scene-fallback {
  position: absolute; inset: 8%; display: grid; place-items: center; text-align: center; border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg); color: var(--muted); padding: 20px; background: repeating-linear-gradient(135deg, #fff 0 12px, #f4f7fa 12px 24px);
}
.hotspot-layer { position: absolute; inset: 0; pointer-events: none; }
.hotspot {
  position: absolute; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; min-height: 36px;
  border-radius: 999px; border: 0; background: var(--ink); color: #fff; font-weight: 600; font-size: 0.85rem;
  box-shadow: 0 6px 18px rgba(11,31,51,.28); white-space: nowrap; transition: transform .2s, background-color .2s, box-shadow .2s;
}
.hotspot::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink); border-bottom: 0; transition: border-color .2s;
}
.hotspot-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--amber); color: var(--ink); display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.75rem; font-weight: 700; flex: none; position: relative;
}
.hotspot:hover, .hotspot:focus-visible, .hotspot.is-hover { transform: translate(-50%, -100%) scale(1.06); background: var(--navy); }
.hotspot:hover::after, .hotspot:focus-visible::after, .hotspot.is-hover::after { border-top-color: var(--navy); }
.hotspot[aria-pressed="true"], .hotspot.is-selected { background: var(--amber); color: var(--ink); }
.hotspot[aria-pressed="true"]::after, .hotspot.is-selected::after { border-top-color: var(--amber); }
.hotspot[aria-pressed="true"] .hotspot-num, .hotspot.is-selected .hotspot-num { background: var(--ink); color: #fff; }
.hotspot:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.scene-tooltip {
  position: fixed; z-index: 20; width: 260px; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px 14px; font-size: 0.85rem;
  transform: translate(-50%, 12px); opacity: 0; transition: opacity .15s;
}
.scene-tooltip.is-visible { opacity: 1; }
.scene-tooltip strong { display: block; font-size: 0.95rem; margin-bottom: 2px; }
.scene-tooltip .tip-meta { font-family: var(--mono); font-size: .7rem; color: var(--steel); letter-spacing: .06em; text-transform: uppercase; margin-top: 6px; }

/* SVG zone states (classes applied to inline SVG) */
.scene-svg .zone-pad { transition: fill .25s, stroke .25s; }
.scene-svg .zone-pad.is-hover, .scene-svg .zone-pad.is-selected { fill: rgba(245,165,36,.22); stroke: var(--amber); stroke-dasharray: none; stroke-width: 2.5; }
.scene-svg [data-zone] { transition: opacity .3s; }
.scene-stage.has-focus .scene-svg #objects g[data-zone]:not(.zone-on) { opacity: .45; }
.scene-svg .flow-path { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 10; }
.scene-svg .flow-path.flow-road { stroke: #fff; opacity: .55; }
.scene-svg .flow-path.flow-alt { stroke: var(--amber); }

/* sector rail under home scene */
.sector-rail { padding: 16px 0 22px; border-top: 1px solid var(--line); background: rgba(255,255,255,.6); }
.sector-rail ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.9rem; cursor: pointer;
}
.chip:hover, .chip.is-hover { border-color: var(--ink); }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--steel)); flex: none; }
.chip-sm { min-height: 30px; padding: 3px 10px; font-size: 0.8rem; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px; font-size: 0.78rem; font-weight: 500;
  background: var(--surface-2); color: var(--steel); border: 1px solid var(--line); text-decoration: none;
}
a.tag:hover { border-color: var(--steel); color: var(--ink); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; position: relative;
  transition: border-color .2s, box-shadow .25s, transform .25s;
}
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover .card, .card.is-interactive:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin-bottom: 6px; }
.card p { color: var(--muted); font-size: 0.93rem; margin-bottom: 0.75em; }
.card-meta { font-family: var(--mono); font-size: 0.72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--steel); }

.industry-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: 100%; }
.industry-thumb { aspect-ratio: 16 / 10; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow: hidden; position: relative; }
.industry-thumb img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.35); transition: transform .5s; }
.card-link:hover .industry-thumb img { transform: scale(1.45); }
.industry-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.industry-body h3::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 8px; vertical-align: 1px; }
.industry-body .card-meta { margin-top: auto; }

.theme-card { display: flex; flex-direction: column; gap: 10px; }
.theme-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.theme-card li a { display: flex; justify-content: space-between; gap: 10px; text-decoration: none; padding: 6px 8px; border-radius: 6px; font-size: .9rem; color: var(--ink); }
.theme-card li a:hover { background: var(--surface-2); }
.theme-card li a span:last-child { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.cat-card { display: flex; gap: 14px; align-items: flex-start; }
.cat-card img { width: 72px; height: 54px; flex: none; background: var(--surface-2); border-radius: 8px; }
.cat-card h3 { font-size: 1rem; }

/* ---------- Flow diagram (operator -> record) ---------- */
.flow-diagram { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; align-items: stretch; margin: 10px 0 8px; }
.flow-step { position: relative; padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-right: 28px; }
.flow-step:last-child { margin-right: 0; }
.flow-step:not(:last-child)::after {
  content: ""; position: absolute; right: -28px; top: 50%; width: 28px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--teal) 0 4px, transparent 4px 9px); background-size: 9px 2px;
}
.flow-step .flow-kind { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--steel); }
.flow-step h3 { font-size: 1rem; margin: 6px 0 4px; }
.flow-step p { font-size: .85rem; color: var(--muted); margin: 0; }
.flow-step svg { width: 30px; height: 30px; color: var(--navy); }
.kind-hardware { border-top: 3px solid var(--amber); }
.kind-network { border-top: 3px solid var(--steel); }
.kind-software { border-top: 3px solid var(--teal); }
.kind-people { border-top: 3px solid var(--ink); }

.cta-band { background: var(--ink); color: #fff; border-radius: var(--radius-lg); padding: clamp(28px, 5vw, 56px); display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: center; position: relative; overflow: hidden; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #c9d5e2; }
.cta-band .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.cta-band .btn-ghost:hover { background: rgba(255,255,255,.08); border-color: #fff; color: #fff; }
.cta-band-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.cta-band::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border: 2px dashed rgba(245,165,36,.35); border-radius: 50%; }

/* ---------- Sector view ---------- */
.sector-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; padding-bottom: 48px; }
.scene-card { background: linear-gradient(180deg, #fbfcfd, #eef3f7); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; position: relative; }
.scene-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.7); font-size: .85rem; flex-wrap: wrap; }
.scene-toolbar .hint { color: var(--muted); display: flex; gap: 8px; align-items: center; }
.sector-panel { position: sticky; top: calc(var(--header-h) + 16px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; max-height: calc(100vh - var(--header-h) - 32px); overflow: auto; }
.sector-panel h2 { font-size: 1.05rem; }
.dept-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.dept-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; min-height: 48px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-weight: 600; transition: border-color .2s, background-color .2s;
}
.dept-btn:hover, .dept-btn.is-hover { border-color: var(--line-strong); background: var(--surface-2); }
.dept-btn[aria-expanded="true"] { border-color: var(--amber); background: var(--amber-soft); }
.dept-btn .hotspot-num { background: var(--ink); color: #fff; }
.dept-btn[aria-expanded="true"] .hotspot-num { background: var(--amber); color: var(--ink); }
.dept-btn .count { margin-left: auto; font-family: var(--mono); font-size: .72rem; color: var(--muted); font-weight: 500; }
.dept-btn .chev { width: 16px; height: 16px; transition: transform .2s; flex: none; }
.dept-btn[aria-expanded="true"] .chev { transform: rotate(90deg); }
.dept-body { padding: 8px 4px 10px 12px; }
.dept-body p { font-size: .88rem; color: var(--muted); margin: 0 0 8px; }
.activity-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.activity-links a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink);
  border: 1px solid transparent; font-size: .93rem;
}
.activity-links a:hover { background: var(--surface-2); border-color: var(--line); }
.activity-links a[aria-current="true"] { background: var(--ink); color: #fff; }
.activity-links svg { width: 16px; height: 16px; flex: none; }
.sector-switch { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.sector-switch label { font-size: .8rem; color: var(--muted); display: block; margin-bottom: 6px; }

select, input[type="text"], input[type="email"], input[type="tel"], input[type="search"], textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 12px; background: var(--surface);
}
select:focus, input:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(26,115,232,.18); }

/* ---------- Activity drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(11, 31, 51, 0.35); z-index: 300; opacity: 0; transition: opacity .25s; }
.drawer-backdrop.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); z-index: 310; background: var(--bg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(102%); transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.drawer.is-open { transform: none; }
.drawer[hidden], .drawer-backdrop[hidden] { display: none; }
.drawer-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 20px 14px; display: flex; gap: 12px; align-items: flex-start; }
.drawer-head h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); margin: 4px 0 6px; }
.drawer-head .tag-list { margin-top: 2px; }
.drawer-head-actions { margin-left: auto; display: flex; gap: 6px; flex: none; }
.drawer-body { overflow: auto; padding: 20px; flex: 1; overscroll-behavior: contain; }
.drawer-foot { background: var(--surface); border-top: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.drawer-foot .spacer { flex: 1; }
.d-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 14px; }
.d-section > h3 { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; margin-bottom: 10px; }
.d-num { font-family: var(--mono); font-size: .7rem; color: var(--steel); border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px; }
.challenge-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.challenge-list li { display: flex; gap: 8px; font-size: .92rem; align-items: flex-start; }
.challenge-list svg { width: 18px; height: 18px; color: var(--red); flex: none; margin-top: 2px; }
.workflow { list-style: none; padding: 0; margin: 0; counter-reset: wf; display: grid; gap: 0; }
.workflow li { counter-increment: wf; position: relative; padding: 0 0 14px 40px; font-size: .94rem; }
.workflow li::before {
  content: counter(wf); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-family: var(--mono); font-size: .75rem;
}
.workflow li:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 26px; bottom: 2px; width: 2px; background: var(--line); }
.req-list .tag { background: var(--surface); }
.note-callout { display: flex; gap: 10px; background: var(--amber-soft); border: 1px solid #f3d79c; border-radius: var(--radius); padding: 12px 14px; font-size: .9rem; margin-bottom: 14px; }
.note-callout svg { width: 20px; height: 20px; color: var(--amber-ink); flex: none; margin-top: 2px; }

.profile-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: #fbfcfd; }
.profile-block h4 { margin: 0 0 4px; font-size: .98rem; }
.profile-block > p { font-size: .88rem; color: var(--muted); margin-bottom: 10px; }
.reco { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; padding: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); margin-top: 8px; }
.reco img { width: 76px; height: 57px; border-radius: 8px; background: var(--surface-2); }
.reco-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.reco-name { font-weight: 650; }
.reco-mfr { color: var(--muted); font-size: .85rem; }
.reco dl { margin: 6px 0 8px; display: grid; gap: 6px; font-size: .88rem; }
.reco dt { font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--steel); }
.reco dd { margin: 0; }
.reco-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; border: 1.5px solid; }
.badge svg { width: 13px; height: 13px; }
.badge-best { background: var(--teal-soft); color: var(--teal-ink); border-color: var(--teal); }
.badge-alternative { background: #eef3fa; color: var(--navy); border-color: #9db3cc; }
.badge-specialised { background: var(--amber-soft); color: var(--amber-ink); border-color: var(--amber); }
.badge-lifecycle { background: #fdecea; color: #8c231e; border-color: #e7a19c; }

.cap-group { margin-bottom: 10px; }
.cap-group h4 { font-size: .8rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--steel); margin: 8px 0 6px; display: flex; gap: 8px; align-items: center; }
.cap-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.cap-list li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: .9rem; }
.cap-list li::before { content: ""; width: 10px; height: 10px; margin-top: 6px; border-radius: 2px; background: var(--c); }
.cap-list strong { display: block; }
.cap-list span { color: var(--muted); font-size: .85rem; }
.kind-key { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.related-grid a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--surface); font-weight: 600; font-size: .9rem; }
.related-grid a:hover { border-color: var(--ink); }
.related-grid small { display: block; color: var(--muted); font-weight: 400; }

/* ---------- Catalogue ---------- */
.catalogue-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; padding-bottom: 120px; }
.filters { position: sticky; top: calc(var(--header-h) + 16px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; max-height: calc(100vh - var(--header-h) - 32px); overflow: auto; }
.filters h2 { font-size: 1rem; display: flex; justify-content: space-between; align-items: center; }
.filter-group { margin-bottom: 14px; }
.filter-group label, .filter-group legend { font-size: .8rem; font-weight: 600; color: var(--steel); display: block; margin-bottom: 4px; }
.filter-group fieldset { border: 0; padding: 0; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; padding: 3px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.filters-toggle { display: none; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.active-filters button { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: .8rem; cursor: pointer; }
.active-filters button:hover { border-color: var(--ink); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.product-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: 100%; }
.product-card .p-img { background: linear-gradient(180deg, #f6f8fa, #e9eef3); aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 10px; position: relative; }
.product-card .p-img img { width: 78%; }
.img-note { position: absolute; left: 10px; bottom: 8px; font-family: var(--mono); font-size: .6rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.product-card .p-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; gap: 8px; }
.product-card h3 { font-size: 1.05rem; margin: 0; }
.product-card h3 a { text-decoration: none; color: var(--ink); }
.product-card h3 a:hover { text-decoration: underline; }
.p-mfr { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--steel); }
.p-desc { font-size: .9rem; color: var(--muted); margin: 0; }
.p-specs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .84rem; }
.p-specs li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 3px; }
.p-specs li span:first-child { color: var(--muted); }
.p-specs li span:last-child { text-align: right; font-weight: 500; }
.p-why { font-size: .86rem; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 0; }
.p-why strong { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--steel); }
.p-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.tbc { display: inline-block; font-size: .72rem; font-weight: 600; color: var(--amber-ink); background: var(--amber-soft); border: 1px solid #f0d08f; border-radius: 4px; padding: 0 5px; }
.empty-state { text-align: center; padding: 48px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); }

.compare-tray {
  position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 140%); z-index: 250; width: min(760px, calc(100% - 24px));
  background: var(--ink); color: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 10px 12px; display: flex; align-items: center; gap: 10px; transition: transform .35s cubic-bezier(.2,.8,.2,1), visibility 0s .35s; visibility: hidden;
}
.compare-tray.is-visible { transform: translate(-50%, 0); visibility: visible; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.compare-tray ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex: 1; min-width: 0; overflow: hidden; flex-wrap: wrap; }
.compare-tray li { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: .82rem; max-width: 100%; }
.compare-tray li button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; cursor: pointer; display: grid; place-items: center; }
.compare-tray li button svg { width: 14px; height: 14px; }
.compare-tray .tray-label { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #9fb2c6; flex: none; }

/* ---------- Product detail ---------- */
.product-detail { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 32px; padding-bottom: 60px; align-items: start; }
.pd-media { background: linear-gradient(180deg, #f8fafb, #e7edf2); border: 1px solid var(--line); border-radius: var(--radius-lg); aspect-ratio: 4/3; display: grid; place-items: center; position: sticky; top: calc(var(--header-h) + 16px); }
.pd-media img { width: 70%; }
.spec-table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.spec-table th, .spec-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec-table th { width: 38%; color: var(--muted); font-weight: 500; background: #fafbfc; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }
.pd-section { margin-top: 26px; }
.pd-section h2 { font-size: 1.15rem; }
.lifecycle-callout { background: #fdecea; border: 1px solid #f0b8b4; color: #6e1b17; border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 10px; margin: 14px 0; font-size: .92rem; }
.lifecycle-callout svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.activity-index { columns: 2; column-gap: 24px; list-style: none; padding: 0; margin: 0; }
.activity-index li { break-inside: avoid; margin-bottom: 6px; font-size: .92rem; }
.activity-index .badge { margin-left: 6px; transform: scale(.88); transform-origin: left center; }

/* ---------- Compare ---------- */
.compare-wrap { padding-bottom: 60px; }
.cmp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.cmp-row { display: grid; grid-template-columns: 200px repeat(var(--n), minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row > div { padding: 10px 14px; font-size: .9rem; border-left: 1px solid var(--line); word-break: break-word; }
.cmp-row > div:first-child { border-left: 0; color: var(--muted); font-weight: 500; background: #fafbfc; }
.cmp-row.is-diff > div:first-child { box-shadow: inset 3px 0 0 var(--amber); color: var(--ink); }
.cmp-row.is-diff > div:first-child::after { content: " (differs)"; font-size: .72rem; color: var(--amber-ink); font-weight: 600; }
.cmp-head > div { background: var(--surface); }
.cmp-head img { width: 110px; margin: 0 auto 8px; }
.cmp-head .cmp-title { font-weight: 650; }
.cmp-section > div { background: var(--surface-2) !important; font-family: var(--mono); font-size: .7rem !important; letter-spacing: .1em; text-transform: uppercase; color: var(--steel) !important; grid-column: 1 / -1; }
.compare-picker { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.compare-picker > div { flex: 1 1 240px; }

/* ---------- Finder ---------- */
.finder-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding-bottom: 60px; align-items: start; }
.finder-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 12px; background: var(--surface); }
.finder-form legend { font-weight: 650; padding: 0 6px; }
.finder-form .hint { font-size: .82rem; color: var(--muted); margin: 0 0 8px; }
.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.opt span { display: block; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: .88rem; cursor: pointer; transition: all .15s; min-height: 42px; }
.opt input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.finder-results { position: sticky; top: calc(var(--header-h) + 16px); }
.finder-result { margin-bottom: 12px; }
.match-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 3px; font-size: .85rem; }
.match-list li { display: flex; gap: 6px; align-items: flex-start; }
.match-list svg { width: 15px; height: 15px; flex: none; margin-top: 3px; }
.match-yes svg { color: var(--teal); }
.match-no svg { color: var(--amber-ink); }

/* ---------- Software ---------- */
.stack-list { display: grid; gap: 12px; }
.stack { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stack-part { font-size: .88rem; }
.stack-part small { display: block; font-family: var(--mono); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--steel); }
.cap-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .9rem; }
.cap-table th, .cap-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cap-table thead th { background: #fafbfc; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--steel); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label, .form-field legend { font-weight: 600; font-size: .9rem; }
.form-field .req { color: var(--red); }
.form-field fieldset { border: 0; padding: 0; margin: 0; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { font-weight: 400; display: inline-flex; gap: 8px; align-items: center; }
.radio-row input { width: 18px; height: 18px; accent-color: var(--ink); }
.field-error { color: var(--red); font-size: .82rem; min-height: 1em; }
[aria-invalid="true"] { border-color: var(--red) !important; }
.form-context { background: var(--teal-soft); border: 1px solid #b7e2db; border-radius: var(--radius); padding: 10px 12px; font-size: .9rem; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.form-status { border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; font-size: .95rem; }
.form-status.is-warning { background: var(--amber-soft); border: 1px solid #f0d08f; }
.form-status.is-success { background: var(--teal-soft); border: 1px solid #9fd8cf; }
.form-status.is-error { background: #fdecea; border: 1px solid #f0b8b4; }
.form-status pre { white-space: pre-wrap; font-family: var(--mono); font-size: .8rem; background: rgba(255,255,255,.7); padding: 10px; border-radius: 8px; margin: 10px 0; max-height: 220px; overflow: auto; }
.contact-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: 28px; padding-bottom: 60px; align-items: start; }
.contact-layout .card form { margin: 0; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 28px; align-items: start; }
.solution-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.solution-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .92rem; display: flex; gap: 8px; }
.solution-list li::before { content: ""; width: 8px; height: 8px; margin-top: 8px; background: var(--amber); border-radius: 2px; flex: none; }
.process { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: pr; }
.process li { counter-increment: pr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px 56px; position: relative; }
.process li::before { content: "0" counter(pr); position: absolute; left: 16px; top: 14px; font-family: var(--mono); font-weight: 700; color: var(--amber-ink); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #b8c6d6; padding: 40px 0 28px; margin-top: 0; font-size: .9rem; }
.site-footer a { color: #e3eaf2; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 24px; }
.footer-grid h2 { color: #fff; font-size: .9rem; font-family: var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-legal { border-top: 1px solid rgba(255,255,255,.12); margin-top: 28px; padding-top: 16px; font-size: .78rem; color: #8ea2b8; }
.site-footer .brand { color: #fff; }
.site-footer .brand-sub { color: #8ea2b8; }

/* ---------- Boot / error ---------- */
.boot-error { max-width: 720px; margin: 60px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; }
.boot-error code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-size: .9em; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 400; font-size: .9rem; box-shadow: var(--shadow-lg); }
.toast[hidden] { display: none; }

/* ---------- Refinements ---------- */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }

/* Sector scenes: numbered markers, label revealed on hover / focus / selection to avoid overlap */
.scene-stage.labels-on-demand .hotspot { padding: 5px; gap: 0; }
.scene-stage.labels-on-demand .hotspot-label {
  max-width: 0; overflow: hidden; opacity: 0; transition: max-width .25s ease, opacity .2s, margin .25s;
}
.scene-stage.labels-on-demand .hotspot:hover .hotspot-label,
.scene-stage.labels-on-demand .hotspot:focus-visible .hotspot-label,
.scene-stage.labels-on-demand .hotspot.is-hover .hotspot-label,
.scene-stage.labels-on-demand .hotspot.is-selected .hotspot-label { max-width: 240px; opacity: 1; margin: 0 6px 0 8px; }
.scene-stage.labels-on-demand .hotspot.is-hover,
.scene-stage.labels-on-demand .hotspot.is-selected,
.scene-stage.labels-on-demand .hotspot:focus-visible { z-index: 5; }
.scene-stage.labels-on-demand .hotspot-num { width: 28px; height: 28px; font-size: .82rem; }

@media (max-width: 1399px) {
  .hero-copy { position: relative; left: auto; top: auto; max-width: 720px; padding: 28px var(--gutter) 0; }
  .hero-grid { display: flex; flex-direction: column; }
  .hero .scene-stage { width: min(100%, 1180px); margin: -40px auto 0; }
}
@media (max-width: 1320px) {
  .header-tools > .btn-primary { display: none; }
}
@media (min-width: 1400px) {
  .hero .scene-stage { width: 80%; margin: 24px 0 0 auto; }
  .hero-copy { pointer-events: none; }
  .hero-copy a, .hero-copy button { pointer-events: auto; }
}
@media (min-width: 1600px) {
  .hero .scene-stage { width: 86%; }
}

body.has-tray main { padding-bottom: 96px; }

/* Official Chesi logo */
.brand-logo { height: 40px; width: auto; display: block; }
.site-header .brand { gap: 12px; }
.site-header .brand-sub { margin: 0; padding-left: 12px; border-left: 1px solid var(--line); line-height: 1.3; max-width: 72px; }
.site-footer .brand-logo { height: 46px; }
@media (max-width: 480px) { .brand-logo { height: 32px; } }
