/* ==========================================================================
   _shared/base.css
   規定：僅包含 CSS Reset、雙語顯示切換與基礎 RWD 殼。
   禁止：任何顏色、字型、圓角、陰影！全部樣式由各風格 theme.css 定義。
   ========================================================================== */

/* 1. Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  line-height: 1.6;
}

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

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* 2. Bilingual Toggle (無值屬性切換核心) */
body.lang-zh [lang-en] {
  display: none !important;
}

body.lang-en [lang-zh] {
  display: none !important;
}

/* 3. Base RWD Container Utilities (純排版，無視覺樣式) */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   ELITRE — Heritage 1997 theme
   Archival parchment, serif display, forged-red accents at rest and a
   gas-blue → hearth-red flame gradient on hover. Editorial trade-almanac
   layout: masthead, running heads in the margin, ruled section openers,
   rounded photo frames. Light (default) and dark.

   Sections: tokens · base · buttons · masthead · section scaffolding · hero ·
   advantages · products · global map · about · FAQ · contact · footer ·
   catalog page · motion · responsive
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --paper: #FAF7F2;
  --surface: #FFFFFF;
  --surface-warm: #F3EDE3;
  --ink: #1C1816;
  --ink-2: #4F4741;
  --ink-3: #675D55;
  --rule: #DCD3C6;
  --rule-strong: #1C1816;

  --flame-red: #B91C1C;
  --flame-red-dark: #8F1515;
  --flame-red-tint: #FBEDEC;
  --flame-blue: #1D4ED8;
  --flame-blue-dark: #1E3A9E;

  --photo-plate: #FFFFFF;

  --font-head: 'Source Serif 4', 'Noto Serif TC', Georgia, serif;
  --font-body: 'Inter', 'Noto Sans TC', system-ui, sans-serif;

  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --section: clamp(72px, 9vw, 128px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --r-frame: 12px;
  --r-img: 8px;

  color-scheme: light;
}

body.dark {
  --paper: #131012;
  --surface: #1B1719;
  --surface-warm: #211C1E;
  --ink: #F3EDE7;
  --ink-2: #BDB3AA;
  --ink-3: #998F86;
  --rule: #352D30;
  --rule-strong: #F3EDE7;

  --flame-red: #F0625C;
  --flame-red-dark: #F48B86;
  --flame-red-tint: rgba(240, 98, 92, 0.12);
  --flame-blue: #7FA8F5;
  --flame-blue-dark: #A6C2F8;

  color-scheme: dark;
}

/* Accent tokens resolve on <body> so body.dark's red/blue flow into them. */
body {
  --rest-red: var(--flame-red);
  --flame: linear-gradient(90deg in oklch, var(--flame-blue), var(--flame-red));
  --flame-hover: linear-gradient(90deg, var(--flame-blue), var(--flame-red));
  --flame-hover: linear-gradient(90deg in oklch, var(--flame-blue), var(--flame-red));
}

/* ---------- Base ---------- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-feature-settings: "lnum" 1;
  -webkit-font-smoothing: antialiased;
  transition: background-color 240ms ease, color 240ms ease;
}
body.lang-zh { font-family: 'Noto Sans TC', 'Inter', system-ui, sans-serif; line-height: 1.85; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}
body.lang-zh h1, body.lang-zh h2, body.lang-zh h3 {
  font-family: 'Noto Serif TC', var(--font-head);
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

::selection { background: var(--flame-red); color: #fff; }
:focus-visible { outline: 2px solid var(--flame-red); outline-offset: 3px; }

/* Anchors clear the sticky chrome; --mast-h is measured in script.js */
html { scrollbar-color: var(--ink-3) var(--paper); scroll-padding-top: calc(var(--mast-h, 117px) + 20px); }
html:has(.chapter-bar) { scroll-padding-top: calc(var(--mast-h, 117px) + 72px); }

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

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 300;
  background: var(--ink); color: var(--paper); padding: 8px 16px;
}
.skip-link:focus { top: 12px; }

.text-link {
  color: var(--flame-red);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.text-link:hover { text-decoration-thickness: 2px; }

.link-btn {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--flame-red); text-decoration: underline; text-underline-offset: 3px;
}

/* Images: no drag ghost, no iOS long-press save sheet, no selection highlight */
img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* ---------- Buttons ----------
   Red at rest; on hover a blue→red flame overlay fades in (opacity only,
   so nothing slides and nothing flashes). Deep colours in both themes keep
   white text legible. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 26px;
  font-family: var(--font-body); font-size: 0.9375rem; font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  transition: background-color 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}
.btn svg { width: 16px; height: 16px; flex: none; transition: transform 220ms var(--ease); }
.btn:hover svg.nudge { transform: translateX(3px); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 0.875rem; }

.btn-primary, .btn-ghost { position: relative; isolation: isolate; overflow: hidden; }
.btn-primary { color: #fff; border: 0; background: #B91C1C; transition: none; }
.btn-primary:hover, .btn-primary:focus-visible { background: #B91C1C; }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--ink);
  transition: color 220ms ease, border-color 220ms ease;
}
.btn-ghost:hover, .btn-ghost:focus-visible { background: transparent; color: #fff; border-color: transparent; }
.btn-primary::before, .btn-ghost::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: linear-gradient(90deg, #1D4ED8, #B91C1C);
  background: linear-gradient(90deg in oklch, #1D4ED8, #B91C1C);
  opacity: 0; transition: opacity 220ms ease;
}
.btn-primary:hover::before, .btn-primary:focus-visible::before,
.btn-ghost:hover::before, .btn-ghost:focus-visible::before { opacity: 1; }

.cookie-banner .btn { min-height: 44px; }

/* ---------- Masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  transition: background-color 240ms ease;
}
.masthead::before { content: ""; display: block; height: 3px; background: var(--rest-red); transition: none; }
.masthead:hover::before { background: var(--flame-hover); }

.masthead-strip { border-bottom: 1px solid var(--rule); font-size: 0.8125rem; color: var(--ink-3); }
.masthead-strip .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 40px; }
.masthead-strip .dateline { letter-spacing: 0.02em; }
.strip-tools { display: flex; align-items: center; gap: 4px; }

.tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 10px;
  background: none; border: 0; border-radius: 8px; cursor: pointer;
  color: var(--ink-2); font-size: 0.8125rem; font-weight: 500;
}
.tool-btn svg { width: 15px; height: 15px; }
.tool-btn .icon-moon { display: none; }
body.dark .tool-btn .icon-sun { display: none; }
body.dark .tool-btn .icon-moon { display: block; }
/* The theme button names the mode it switches to */
.lbl-to-light { display: none; }
body.dark .lbl-to-dark { display: none; }
body.dark .lbl-to-light { display: inline; }

.masthead-main .wrap { display: flex; align-items: center; gap: 32px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
/* Logo keeps its original colours; in dark mode it sits on a small light disc */
body.dark .brand img { background: #F4F1EC; border-radius: 50%; padding: 3px; }
.brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.brand-word { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; letter-spacing: 0.06em; }
.brand-sub { font-size: 0.75rem; color: var(--ink-3); letter-spacing: 0.04em; }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { position: relative; padding: 8px 12px; font-size: 0.9375rem; font-weight: 500; color: var(--ink-2); }
.nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 1px;
  background: var(--flame-hover); transform: none; transform-origin: left;
  opacity: 0; transition: opacity 160ms ease;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after { opacity: 1; transform: none; }
.nav-tools { display: none; }

.masthead-cta { white-space: nowrap; }

.menu-btn {
  display: none; width: 44px; height: 44px; margin-left: auto;
  background: none; border: 1px solid var(--rule); border-radius: 8px; cursor: pointer; color: var(--ink);
  align-items: center; justify-content: center;
}
.menu-btn svg { width: 20px; height: 20px; }

.nav-scrim {
  position: fixed; left: 0; right: 0; bottom: 0; top: var(--mast-h, 76px); z-index: 98;
  background: rgba(28, 24, 22, 0.38);
  opacity: 0; visibility: hidden; transition: opacity 200ms var(--ease), visibility 200ms;
}
body.menu-open .nav-scrim { opacity: 1; visibility: visible; }

/* ---------- Section scaffolding ---------- */
.section { padding: var(--section) 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section-warm { background: var(--surface-warm); }

/* Ruled openers: a 2px red rule at rest, the flame gradient when the block is hovered */
.section-head, .chapter-head, .pull-quote, .colophon, .faq-list, .adv-grid, .global-stats div, .entry.datasheet {
  border-top: 0;
  background: linear-gradient(var(--rest-red), var(--rest-red)) 0 0 / 100% 2px no-repeat;
  transition: none;
}
.section:hover .section-head, .chapter:hover .chapter-head, .pull-quote:hover, .hero:hover .colophon,
.faq-list:hover, .adv-grid:hover, .global-stats:hover div, .entry.datasheet:hover {
  background: var(--flame-hover) 0 0 / 100% 2px no-repeat;
}

.section-head {
  display: grid; grid-template-columns: 3fr 9fr; gap: 24px 48px;
  padding-top: 20px;
  margin-bottom: clamp(40px, 5vw, 64px);
}

/* Running head: the section's name in the margin; red lettering, flame on hover */
.running-head {
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  padding-top: 10px; width: fit-content;
  background: linear-gradient(var(--rest-red), var(--rest-red));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  transition: none;
}
body.lang-zh .running-head { letter-spacing: 0.12em; }
.section:hover .running-head, .chapter:hover .running-head, .faq-grid:hover .running-head, .contact-card:hover .running-head {
  background: var(--flame-hover);
  -webkit-background-clip: text; background-clip: text;
}

.section-title { font-size: clamp(2rem, 1.3rem + 2.4vw, 3.25rem); max-width: 22ch; }
body.lang-zh .section-title { max-width: 18em; }

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 6vw, 88px) 0 0; }
.hero-grid { display: grid; grid-template-columns: 7fr 5fr; gap: clamp(32px, 5vw, 72px); align-items: end; }
.hero-grid:has(.hero-composite) { grid-template-columns: 6fr 6fr; align-items: center; }

/* Headline sized from its column so English and Chinese both set in exactly two lines */
.hero-grid > div:first-child { container-type: inline-size; }
.hero-title { font-size: min(9.4cqi, 4rem); line-height: 1.08; letter-spacing: -0.02em; font-weight: 600; }
.hero-title .line-2 {
  display: block; width: fit-content; padding-bottom: 0.06em;
  font-style: italic; font-weight: 500; white-space: nowrap;
  background: linear-gradient(var(--rest-red), var(--rest-red));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  transition: none;
}
.hero-title:hover .line-2 { background: var(--flame-hover); -webkit-background-clip: text; background-clip: text; }
body.lang-zh .hero-title { font-size: min(10.8cqi, 4rem); line-height: 1.28; letter-spacing: 0; }
body.lang-zh .hero-title .line-2 { font-style: normal; font-weight: 600; }
.hero-desc { margin-top: 28px; font-size: 1.1875rem; color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

/* Hero composite: the complete grill, with Elitre's own parts laid over it */
.frame { border-radius: var(--r-frame); }
.frame img { border-radius: var(--r-img); }
.hero-figure { margin: 0; }
.hero-figure .frame { border: 1px solid var(--rule); background: var(--surface); padding: 10px; }
.hero-figure img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-img); }
.hero-composite { position: relative; }
.hero-composite .main img { aspect-ratio: 5 / 4; object-fit: cover; object-position: 55% center; }

figcaption { margin-top: 12px; font-family: var(--font-head); font-style: italic; font-size: 0.9375rem; color: var(--ink-3); }
body.lang-zh figcaption { font-style: normal; font-family: 'Noto Serif TC', var(--font-head); }

/* Drawing board: drafting paper and plotted drawings fill the hero behind
   the copy and photos; a paper wash keeps the copy legible. */
.hero-board { position: relative; isolation: isolate; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--rule) 70%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--rule) 70%, transparent) 1px, transparent 1px);
  background-size: 24px 24px; background-position: -1px -1px;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
.hero-bg .drawing {
  position: absolute; left: 56%; top: 44%; transform: translate(-50%, -50%);
  height: 96%; width: auto; max-width: 100vw; overflow: visible; opacity: 0.55;
}
.hero-board .hero-grid > div:first-child { position: relative; }
.hero-board .hero-grid > div:first-child::before {
  content: ""; position: absolute; inset: -48px -64px; z-index: -1;
  background: radial-gradient(closest-side, var(--paper) 62%, transparent);
}
.hero-board .colophon { position: relative; background: color-mix(in srgb, var(--paper) 88%, transparent); }
.drawing .ln  { fill: none; stroke: var(--ink); stroke-width: 0.6; stroke-linecap: round; stroke-linejoin: round; }
.drawing .cl  { fill: none; stroke: var(--ink-3); stroke-width: 0.35; stroke-dasharray: 8 2.5 1.5 2.5; }
.drawing .hid { fill: none; stroke: var(--ink-3); stroke-width: 0.45; stroke-dasharray: 4 2.5; }
.drawing .dim { fill: none; stroke: var(--flame-red); stroke-width: 0.45; stroke-linejoin: round; }
.drawing .lbl { fill: var(--flame-red); font: 600 7px var(--font-body); letter-spacing: 0.04em; }
.drawing .tb  { fill: var(--paper); stroke: var(--ink); stroke-width: 0.45; }
.drawing .tbt { fill: var(--ink); font: 600 5.5px var(--font-body); letter-spacing: 0.12em; }
.drawing .port { fill: none; stroke: var(--ink); stroke-width: 0.45; }
/* Without script the first sheet stands complete */
.drawing .sheet { opacity: 0; }
.drawing .sheet:first-of-type { opacity: 1; }
@media (max-width: 960px) {
  .hero-bg .drawing { height: auto; width: 150vw; max-width: none; left: 50%; top: 30%; opacity: 0.4; }
}

/* Colophon: the plate of facts closing the hero */
.colophon {
  margin-top: clamp(48px, 6vw, 80px);
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--rule);
}
.colophon > div { padding: 18px 20px 20px 0; }
.colophon > div + div { padding-left: 20px; border-left: 1px solid var(--rule); }
.colophon dt { font-size: 0.8125rem; color: var(--ink-3); }
.colophon dd {
  margin-top: 4px; font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; line-height: 1.3;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
body.lang-zh .colophon dd { font-family: 'Noto Serif TC', var(--font-head); }

/* ---------- Advantages: six ruled blocks ---------- */
.adv-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.adv-cell { padding: 28px 28px 32px 0; border-bottom: 1px solid var(--rule); }
.adv-cell:not(:nth-child(3n+1)) { padding-left: 28px; border-left: 1px solid var(--rule); }
.adv-cell h3 { margin-top: 10px; font-size: 1.5rem; }
.adv-cell p { margin-top: 10px; color: var(--ink-2); font-size: 1rem; max-width: 36ch; }

/* ---------- Products: catalogue spread ---------- */
.spread { display: grid; grid-template-columns: repeat(12, 1fr); gap: 48px 32px; }
.entry { grid-column: span 4; display: flex; flex-direction: column; position: relative; }
.entry.wide { grid-column: span 7; }
.entry.half { grid-column: span 5; }
.entry .frame { border: 1px solid var(--rule); background: var(--surface); padding: 8px; overflow: hidden; }
.entry img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-img);
  transition: transform 600ms var(--ease);
}
.entry.wide img { aspect-ratio: 16 / 10; }
.entry:hover img { transform: scale(1.04); }
.entry h3 { margin-top: 20px; font-size: 1.625rem; }
.entry.wide h3 { font-size: 2rem; }
.entry p { margin-top: 10px; color: var(--ink-2); font-size: 1rem; max-width: 58ch; }
.tags { margin-top: 14px; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; color: var(--flame-red); }
.tags > span + span::before { content: " · "; color: var(--ink-3); }

/* Regulator datasheet entry */
.entry.datasheet {
  grid-column: span 8;
  display: grid; grid-template-columns: 5fr 7fr; gap: 28px; align-items: start;
  padding-top: 28px;
}
.entry.datasheet img { aspect-ratio: 1 / 1; }
.entry.datasheet h3 { margin-top: 0; }
.facts { margin-top: 18px; border-top: 1px solid var(--ink); }
.facts > div { display: grid; grid-template-columns: 40% 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 0.9375rem; }
.facts dt { color: var(--ink-3); font-weight: 500; }
.facts dd { font-weight: 600; font-feature-settings: "lnum" 1; }

/* "More — Full Product Catalog" card */
.entry.more {
  grid-column: span 4; padding: 28px; border-radius: var(--r-frame);
  background: var(--ink); color: var(--paper);
  justify-content: space-between; gap: 28px;
}
.entry.more h3 { margin-top: 0; color: var(--paper); }
.entry.more p { color: color-mix(in srgb, var(--paper) 78%, var(--ink)); }
.entry.more ul { border-top: 1px solid color-mix(in srgb, var(--paper) 25%, var(--ink)); }
.entry.more li a {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--paper) 25%, var(--ink));
  font-size: 0.9375rem;
}
.entry.more .btn-primary { align-self: flex-start; }
/* Dark mode: the card no longer becomes the brightest object on the page */
body.dark .entry.more { background: #241E21; color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
body.dark .entry.more h3 { color: var(--ink); }
body.dark .entry.more p { color: var(--ink-2); }
body.dark .entry.more ul, body.dark .entry.more li a { border-color: var(--rule); }

/* Spec table (catalog regulator) */
.spec { margin-top: 18px; border-top: 1px solid var(--ink); font-size: 0.9375rem; }
.spec tr { border-bottom: 1px solid var(--rule); }
.spec th { width: 40%; padding: 9px 12px 9px 0; text-align: left; font-weight: 500; color: var(--ink-3); vertical-align: top; }
.spec td { padding: 9px 0; font-weight: 600; font-feature-settings: "lnum" 1; }

/* ---------- Global market: export map ---------- */
.global-grid { display: grid; gap: clamp(32px, 5vw, 64px); align-items: center; grid-template-columns: 4fr 8fr; }
.global-text { font-size: clamp(1.25rem, 1rem + 0.7vw, 1.5rem); }
.global-stats { margin-top: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.global-stats div { padding-top: 10px; }
.global-stats dt { font-size: 0.8125rem; color: var(--ink-3); }
.global-stats dd {
  font-family: var(--font-head); font-size: 1.75rem; font-weight: 600; line-height: 1.2;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.map-figure { margin: 0; }
.map-frame { border: 1px solid var(--rule); border-radius: var(--r-frame); background: var(--surface); padding: 12px; }
.world-map { display: block; width: 100%; height: auto; }
.world-map .land { fill: var(--surface-warm); stroke: var(--ink-3); stroke-width: 0.6; stroke-linejoin: round; }
body.dark .world-map .land { fill: #2A2427; }
.world-map .grat { fill: none; stroke: var(--rule); stroke-width: 0.5; }
.world-map .arc { fill: none; stroke: var(--flame-blue); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.55; }
.world-map .pin { transform-box: fill-box; transform-origin: 50% 100%; transition: transform 220ms var(--ease); }
.world-map .pin:hover { transform: scale(1.25); }
.world-map .pin path { fill: var(--flame-red); stroke: var(--surface); stroke-width: 1.2; }
.world-map .pin:hover path { fill: url(#pin-flame); }
.world-map .pin circle { fill: var(--surface); }
.world-map .pin text, .world-map .origin text {
  font-family: var(--font-body); font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round;
}
.world-map .origin .star { fill: var(--flame-blue); stroke: var(--surface); stroke-width: 1.2; }
.world-map .origin .ring { fill: none; stroke: var(--flame-blue); stroke-width: 1.2; }
.world-map .origin text { fill: var(--flame-blue); font-size: 12px; }
/* Packets travel from Taiwan (script.js); the pin pings on arrival */
.world-map .packet { fill: var(--flame-blue); }
.world-map .packet-glow { fill: var(--flame-blue); opacity: 0.25; }
.world-map .pin.arrive { animation: arrive 620ms var(--ease); }
.world-map .ping {
  fill: none; stroke: var(--flame-red); stroke-width: 1.5;
  transform-box: fill-box; transform-origin: center; animation: ping 900ms var(--ease) forwards;
}
.map-legend { margin-top: 14px; display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; gap: 8px 20px; font-size: 0.875rem; }
.map-legend dt { font-weight: 600; color: var(--ink); }
.map-legend dd { color: var(--ink-3); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(32px, 5vw, 72px); align-items: start; }
.about-figure .frame { border: 1px solid var(--rule); background: var(--surface); padding: 10px; }
.about-figure img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-img); }
.about-text p { color: var(--ink-2); max-width: 64ch; }
.about-text p + p { margin-top: 1.1em; }
.about-text p:first-child { color: var(--ink); font-size: 1.1875rem; }
body.lang-en .about-text p:first-child::first-letter {
  float: left; font-family: var(--font-head); font-size: 4.4em; line-height: 0.82;
  padding: 6px 12px 0 0; color: var(--flame-red); font-weight: 600;
}
.pull-quote {
  margin-top: clamp(56px, 7vw, 96px); padding-top: 28px;
  display: grid; grid-template-columns: 3fr 9fr; gap: 24px 48px;
}
.pull-quote blockquote p {
  font-family: var(--font-head); font-size: clamp(1.625rem, 1rem + 2vw, 2.625rem);
  line-height: 1.3; font-style: italic; color: var(--ink); max-width: 30ch; text-wrap: balance;
}
body.lang-zh .pull-quote blockquote p { font-family: 'Noto Serif TC', var(--font-head); font-style: normal; line-height: 1.6; max-width: 22em; }
.pull-quote blockquote p::before { content: "“"; color: var(--flame-red); margin-left: -0.45em; padding-right: 0.05em; }
body.lang-zh .pull-quote blockquote p::before { content: none; }
.pull-quote cite { display: block; margin-top: 18px; font-style: normal; font-weight: 600; color: var(--ink-2); }

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: 4fr 8fr; gap: clamp(32px, 5vw, 72px); }
.faq-grid .section-title { font-size: clamp(2rem, 1.3rem + 2vw, 3rem); }
.faq-list details { border-bottom: 1px solid var(--rule); }
.faq-list summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 1fr 24px; gap: 16px; align-items: center;
  padding: 22px 0; font-family: var(--font-head); font-size: 1.3125rem; font-weight: 600; line-height: 1.35;
}
body.lang-zh .faq-list summary { font-family: 'Noto Serif TC', var(--font-head); }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary svg { width: 20px; height: 20px; transition: transform 260ms var(--ease); color: var(--ink-3); }
.faq-list details[open] summary svg { transform: rotate(45deg); color: var(--flame-red); }
.faq-answer { padding: 0 48px 26px 0; color: var(--ink-2); max-width: 68ch; }
.faq-images { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.faq-images img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--rule); border-radius: 10px; }

/* Certification seals: a compact row inside the "certifications" answer */
.seals-faq {
  display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 16px 28px; margin-top: 18px;
  grid-template-columns: repeat(4, auto); justify-items: center;
}
.seal { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.seal-ring {
  width: 64px; aspect-ratio: 1; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--ink-3);
  transition: box-shadow 260ms var(--ease);
}
.seal:hover .seal-ring { box-shadow: 0 0 0 3px var(--paper); }
.seal-ring img { width: 68%; height: 68%; object-fit: contain; }
.seal-name { font-family: var(--font-head); font-size: 0.8125rem; font-weight: 600; }

/* ---------- Contact ---------- */
.contact-card {
  position: relative; overflow: hidden;
  border: 0; border-radius: var(--r-frame); box-shadow: 0 0 0 1px var(--ink);
  background: var(--surface);
}
.contact-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--rest-red); transition: none; }
.contact-card:hover::before { background: var(--flame-hover); }
.contact-card-head { display: block; padding: clamp(28px, 4vw, 48px); border-bottom: 1px solid var(--rule); }
.contact-card-head .running-head { grid-column: 1 / -1; }
.contact-card-head .section-title { max-width: none; }
.contact-body { display: grid; grid-template-columns: 7fr 5fr; }
.contact-details { padding: clamp(28px, 4vw, 48px); }
.contact-details dl > div { display: grid; grid-template-columns: 9.5em 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.contact-details dl > div:first-child { border-top: 1px solid var(--rule); }
.contact-details dt { color: var(--ink-3); font-size: 0.9375rem; }
.contact-details dd { font-weight: 600; }
.contact-details dd a {
  display: inline-block; padding: 10px 0; margin: -10px 0;
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule);
  text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.contact-details dd a:hover { text-decoration-color: currentColor; }
.contact-action {
  padding: clamp(28px, 4vw, 48px); border-left: 1px solid var(--rule); background: var(--surface-warm);
  display: flex; flex-direction: column; gap: 16px; justify-content: center;
}
.contact-action p { color: var(--ink-2); }
.contact-action .btn { width: 100%; }
.contact-hint { font-size: 0.875rem; color: var(--ink-3); }
.copy-btn .copy-done { color: inherit; }
.form-panel { border-top: 1px solid var(--rule); display: none; }
.form-panel.is-open { display: block; }
.form-panel-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px clamp(20px, 4vw, 48px); font-weight: 600; border-bottom: 1px solid var(--rule); }
.form-panel iframe { display: block; width: 100%; height: 760px; border: 0; border-radius: 0 0 var(--r-frame) var(--r-frame); background: #fff; }

/* ---------- Footer ---------- */
.footer { position: relative; background: var(--surface-warm); border-top: 0; padding: 64px 0 32px; font-size: 0.9375rem; }
.footer::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--rest-red); transition: none; }
.footer:hover::before { background: var(--flame-hover); }
.footer-grid { display: grid; grid-template-columns: 6fr 3fr 3fr; gap: 40px; }
.footer .brand-word { font-size: 1.75rem; }
.footer-tagline { margin-top: 12px; color: var(--ink-2); max-width: 46ch; }
.footer .foot-h { font-family: var(--font-body); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
body.lang-zh .footer .foot-h { font-family: 'Noto Sans TC', sans-serif; letter-spacing: 0.12em; }
.footer li + li { margin-top: 6px; }
.footer li a, .footer address a { display: inline-block; padding: 10px 0; }
.footer address { font-style: normal; color: var(--ink-2); }
.footer-base { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 0.8125rem; color: var(--ink-3); }

/* ==========================================================================
   Catalog page
   ========================================================================== */
.catalog-hero { padding: clamp(40px, 5vw, 72px) 0 clamp(40px, 5vw, 64px); }
.catalog-hero .hero-title { font-size: clamp(2.5rem, 1.2rem + 4.4vw, 4.75rem); }
.catalog-hero-grid { display: grid; grid-template-columns: 1fr; gap: 16px clamp(32px, 5vw, 72px); align-items: end; }
.catalog-hero-grid > div { display: grid; grid-template-columns: 7fr 5fr; gap: 16px clamp(32px, 5vw, 72px); align-items: end; }
.catalog-hero .hero-desc { margin-top: 0; padding-bottom: 10px; max-width: 40ch; }

/* Chapter doors: photo, name, types */
.doors {
  margin-top: clamp(28px, 3.5vw, 44px);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  padding-top: 24px;
  background: linear-gradient(var(--rest-red), var(--rest-red)) 0 0 / 100% 2px no-repeat;
}
.door {
  display: flex; flex-direction: column;
  border: 1px solid var(--rule); border-radius: var(--r-frame); background: var(--surface);
  overflow: hidden; transition: border-color 200ms var(--ease), transform 260ms var(--ease);
}
.door:hover { transform: translateY(-3px); }
.door-ph { display: block; aspect-ratio: 4 / 3; background: var(--photo-plate); overflow: hidden; }
.door-ph img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
.door:hover .door-ph img { transform: scale(1.04); }
.door-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.door-name { font-family: var(--font-head); font-size: 1.3125rem; font-weight: 600; line-height: 1.25; color: var(--ink); }
body.lang-zh .door-name { font-family: 'Noto Serif TC', var(--font-head); }
.door-types { font-size: 0.875rem; color: var(--ink-2); line-height: 1.5; }
.door-count { margin-top: auto; padding-top: 8px; font-size: 0.8125rem; font-weight: 600; color: var(--flame-red); font-feature-settings: "tnum" 1, "lnum" 1; }

/* Sticky chapter bar under the masthead */
.chapter-bar {
  position: sticky; top: var(--mast-h, 117px); z-index: 50;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule); border-top: 1px solid var(--rule);
}
.chapter-bar .wrap { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.chapter-bar a {
  position: relative; flex: none; padding: 12px 14px; font-size: 0.9375rem; font-weight: 500; color: var(--ink-2);
  border-bottom: 2px solid transparent;
}
/* The rule sits on ::after so the link's own background can carry the flame text */
.chapter-bar a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.chapter-bar a.is-active { color: var(--ink); }
.chapter-bar a.is-active::after { background: var(--rest-red); }
.chapter-bar a:hover { color: var(--ink); }
.chapter-bar a:hover::after { background: var(--flame-hover); }

.chapter { padding: clamp(56px, 7vw, 96px) 0; }
.chapter + .chapter { border-top: 1px solid var(--rule); }
.chapter-head { display: grid; grid-template-columns: 3fr 9fr; gap: 24px 48px; padding-top: 20px; }
.chapter-head .section-title { font-size: clamp(2.25rem, 1.4rem + 2.8vw, 3.5rem); }

/* Type cards: main photo, facts, and a reference-shape strip that swaps the photo */
.types { margin-top: clamp(32px, 4vw, 48px); display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; align-items: start; }
.types > *, .type-body, .type details { min-width: 0; }
.type { border: 1px solid var(--rule); border-radius: var(--r-frame); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; }
.type .ph {
  position: relative; overflow: hidden;
  background: var(--photo-plate); aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; border-bottom: 1px solid var(--rule);
}
.type .ph img { position: absolute; inset: 20px; width: calc(100% - 40px); height: calc(100% - 40px); object-fit: contain; }
.type-main { transition: opacity 220ms var(--ease), filter 220ms var(--ease), transform 220ms var(--ease); }
.type-main.is-swapping { opacity: 0.25; filter: blur(3px); transform: scale(0.98); }
.type .ph.photo { padding: 0; }
.type .ph.photo img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.types.solo { grid-template-columns: 1fr; }
.types.solo .type { flex-direction: row; }
.types.solo .type .ph { flex: 0 0 50%; aspect-ratio: 4 / 3; border-bottom: 0; border-right: 1px solid var(--rule); }
.type-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 0.9375rem; }
.type-facts > div { display: contents; }
.type-facts dt { color: var(--ink-3); font-weight: 500; }
.type-facts dd { margin: 0; color: var(--ink); }
.type-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.type-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.type-head h3 { font-size: 1.625rem; }
.count, .type-head .count { font-size: 0.875rem; color: var(--ink-3); white-space: nowrap; font-feature-settings: "tnum" 1, "lnum" 1; }
.type-note { color: var(--ink-2); font-size: 0.9375rem; }
.type details { margin-top: auto; border-top: 1px solid var(--rule); padding-top: 12px; }
.type summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  font-size: 0.9375rem; font-weight: 600; color: var(--flame-red);
}
.type summary::-webkit-details-marker { display: none; }
.type summary svg { width: 14px; height: 14px; transition: transform 220ms var(--ease); }
.type details[open] summary svg { transform: rotate(45deg); }
.type summary:hover { text-decoration: underline; text-underline-offset: 3px; }

.strip {
  margin-top: 12px; display: flex; gap: 10px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}
.strip.at-end { -webkit-mask-image: none; mask-image: none; }
.strip-item {
  flex: 0 0 116px; scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 4px;
  padding: 0; border: 0; background: none; cursor: pointer; text-align: left; color: inherit;
}
.strip-item .t {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--photo-plate); border: 1px solid var(--rule); border-radius: 8px;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}
.strip-item .t img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; }
.strip-item[aria-pressed="true"] .t { border-color: transparent; box-shadow: 0 0 0 2px var(--flame-red); }
.strip-note { margin-top: 4px; font-size: 0.8125rem; color: var(--ink-3); }
.strip.photos .strip-item .t img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* horizontal swipes go to the gallery script; vertical still scrolls the page */
.type .ph:has(.slide-nav), .gov-main .ph { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.type-peek { position: absolute; pointer-events: none; }
.type-peek[hidden] { display: none; } /* the global img { display: block } would otherwise override [hidden] */
.type .ph .slide-nav, .gov-main .ph .slide-nav { z-index: 2; }
.type .ph .slide-nav.prev, .gov-main .ph .slide-nav.prev { left: 12px; }
.type .ph .slide-nav.next, .gov-main .ph .slide-nav.next { right: 12px; }
.type .ph:hover .slide-nav, .gov-main .ph:hover .slide-nav { opacity: 1; }
.strip-item:focus-visible { outline: none; }
.strip-item:focus-visible .t { box-shadow: 0 0 0 2px var(--flame-red); }

/* Governor EL-125 datasheet */
.gov { margin-top: 24px; display: grid; grid-template-columns: 6fr 6fr; gap: clamp(28px, 4vw, 56px); align-items: start; }
.gov-main .ph { position: relative; overflow: hidden; background: var(--photo-plate); border: 1px solid var(--rule); border-radius: var(--r-frame); padding: 12px; }
.gov-main .ph img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: var(--r-img); }
.gov > * { min-width: 0; }
.gov-main .strip { margin-top: 12px; }
.gov-sheet .lead { font-family: var(--font-head); font-size: 1.375rem; line-height: 1.45; }
body.lang-zh .gov-sheet .lead { font-family: 'Noto Serif TC', var(--font-head); }
.gov-sheet .spec { margin-top: 20px; }
.gov-sheet .actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; }

/* Closing band */
.closing { padding: clamp(64px, 8vw, 112px) 0; background: var(--ink); color: var(--paper); }
.closing-grid { display: grid; grid-template-columns: 7fr 5fr; gap: 32px; align-items: end; }
.closing h2 { color: var(--paper); font-size: clamp(2rem, 1.3rem + 2.4vw, 3.25rem); max-width: 20ch; }
.closing p { margin-top: 16px; color: color-mix(in srgb, var(--paper) 78%, var(--ink)); max-width: 56ch; }
.closing .closing-tip { margin-top: 12px; font-size: 0.9375rem; color: color-mix(in srgb, var(--paper) 70%, var(--ink)); }
.closing .actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.closing .btn-ghost { color: var(--paper); border-color: var(--paper); }
.closing .btn-ghost:hover { background: transparent; color: #fff; border-color: transparent; }

/* ---------- Hover: one flame for every control ----------
   Whatever reacts to the pointer fills with the same blue→red flame the
   buttons, rules and running heads use, instead of turning flat red. The
   gradient is clipped to the glyphs; at rest the fill is the element's own
   colour, on hover it fades to transparent and the flame shows through.
   Underlines and icons keep `color`, so they stay solid. Wide blocks (FAQ
   rows, card titles, catalogue links) put the gradient on their inner text
   span so it spans the words, not the whole row. */
.text-link, .link-btn, .tool-btn, .type summary,
.contact-details dd a, .footer a, .nav a, .chapter-bar a, .brand-word,
.adv-cell h3 > span, .entry h3 > span, .faq-list summary > span, .door-name > span, .entry.more li a > span {
  background-image: linear-gradient(90deg, var(--hf-a, var(--flame-blue)), var(--hf-b, var(--flame-red)));
  background-image: linear-gradient(90deg in oklch, var(--hf-a, var(--flame-blue)), var(--hf-b, var(--flame-red)));
  -webkit-background-clip: text; background-clip: text;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  -webkit-text-fill-color: currentColor;
  transition: -webkit-text-fill-color 200ms var(--ease), text-decoration-color 200ms var(--ease);
}
.text-link:hover, .text-link:focus-visible, .link-btn:hover, .link-btn:focus-visible,
.tool-btn:hover, .tool-btn:focus-visible,
.nav a:hover, .nav a:focus-visible, .chapter-bar a:hover, .chapter-bar a:focus-visible,
.brand:hover .brand-word, .brand:focus-visible .brand-word,
.type summary:hover, .type summary:focus-visible,
.contact-details dd a:hover, .contact-details dd a:focus-visible, .footer a:hover, .footer a:focus-visible,
.adv-cell:hover h3 > span, .entry:not(.more):hover h3 > span, .faq-list summary:hover > span, .faq-list summary:focus-visible > span,
.door:hover .door-name > span, .door:focus-visible .door-name > span,
.entry.more li a:hover > span, .entry.more li a:focus-visible > span {
  -webkit-text-fill-color: transparent;
}
/* The light-theme "More" card is dark ink, so its flame uses the bright (dark-theme) pair */
body:not(.dark) .entry.more { --hf-a: #7FA8F5; --hf-b: #F0625C; }

/* Certification seals: the hover ring is the flame too (a masked ring, faded in) */
.seal-ring { position: relative; }
.seal-ring::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; padding: 2px;
  background: var(--flame-hover); pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 260ms var(--ease);
}
.seal:hover .seal-ring::after { opacity: 1; }

/* Outlined controls: on hover the 1px border becomes the flame. The fill is
   painted on the padding box and the gradient on the border box, so the
   rounded corners and the element's own background are kept. */
.door:hover, .door:focus-visible {
  border-color: transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--flame-hover) border-box;
}
.strip-item:not([aria-pressed="true"]):hover .t {
  border-color: transparent;
  background: linear-gradient(var(--photo-plate), var(--photo-plate)) padding-box, var(--flame-hover) border-box;
}
.menu-btn:hover, .menu-btn:focus-visible {
  border-color: transparent;
  background: linear-gradient(var(--paper), var(--paper)) padding-box, var(--flame-hover) border-box;
}
/* Borderless or text-filled controls get a masked flame ring instead */
.nav-tools .tool-btn, .slide-nav { position: relative; }
.nav-tools .tool-btn::after, .slide-nav::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: var(--flame-hover); pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 200ms var(--ease);
}
.slide-nav::after { inset: 0; padding: 2px; }
.nav-tools .tool-btn:hover::after, .nav-tools .tool-btn:focus-visible::after,
.slide-nav:hover::after, .slide-nav:focus-visible::after { opacity: 1; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* One authored moment: the hero settles in */
  .hero-title, .hero-desc, .hero-actions, .hero-figure { animation: settle 900ms var(--ease) both; }
  .hero-desc { animation-delay: 80ms; }
  .hero-actions { animation-delay: 140ms; }
  .hero-figure { animation-delay: 60ms; animation-name: develop; }
  .world-map .arc { animation: dash 30s linear infinite; }
  .world-map .origin .ring { animation: ring 2.8s var(--ease) infinite; transform-box: fill-box; transform-origin: center; }
}
@keyframes settle { from { opacity: 0; transform: translateY(14px); } }
@keyframes develop { from { opacity: 0; filter: sepia(0.6) blur(4px); } }
@keyframes dash { to { stroke-dashoffset: -140; } }
@keyframes ring { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(2.4); opacity: 0; } }
@keyframes arrive { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes ping { from { transform: scale(0.4); opacity: 0.9; } to { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (min-width: 961px) {
  .nav-scrim { display: none; }
}

@media (max-width: 1100px) {
  .nav a { padding: 8px 8px; font-size: 0.875rem; }
  .nav a::after { left: 8px; right: 8px; }
  .entry.datasheet, .entry.more { grid-column: span 12; }
  .doors { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  /* Masthead becomes brand + CTA + menu; the nav drops down as a sheet */
  .menu-btn { display: inline-flex; margin-left: 0; }
  .masthead-cta { margin-left: auto; }
  .nav {
    position: fixed; left: 0; right: 0; top: var(--mast-h, 76px); z-index: 99;
    flex-direction: column; gap: 0; margin: 0;
    background: var(--paper); border-bottom: 2px solid var(--rule-strong);
    padding: 8px var(--gutter) 20px;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 200ms var(--ease), transform 200ms var(--ease), visibility 200ms;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav a { padding: 14px 0; font-size: 1.125rem; border-bottom: 1px solid var(--rule); }
  .nav a::after { display: none; }

  .hero-grid, .hero-grid:has(.hero-composite), .catalog-hero-grid, .catalog-hero-grid > div,
  .global-grid, .about-grid, .faq-grid, .closing-grid, .gov { grid-template-columns: 1fr; }
  .section-head, .pull-quote, .chapter-head { grid-template-columns: 1fr; }
  .running-head { padding-top: 0; }

  .hero-figure img { aspect-ratio: 16 / 10; }
  .about-figure img { aspect-ratio: 16 / 10; }
  .colophon { grid-template-columns: 1fr 1fr; }
  .colophon > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .colophon > div:nth-child(n+3) { border-top: 1px solid var(--rule); }

  .adv-grid { grid-template-columns: 1fr 1fr; }
  .adv-cell, .adv-cell:not(:nth-child(3n+1)) { padding: 24px 24px 28px 0; border-left: 0; }
  .adv-cell:nth-child(even) { padding-left: 24px; border-left: 1px solid var(--rule); }

  .spread { grid-template-columns: 1fr 1fr; gap: 40px 20px; }
  .entry, .entry.wide, .entry.half { grid-column: span 1; }
  .entry.wide, .entry.datasheet, .entry.more { grid-column: 1 / -1; }

  .map-legend { grid-template-columns: repeat(3, auto); justify-content: start; }
  .contact-body { grid-template-columns: 1fr; }
  .contact-action { border-left: 0; border-top: 1px solid var(--rule); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .types { grid-template-columns: 1fr; }
  .types.solo .type { flex-direction: column; }
  .types.solo .type .ph { flex: none; aspect-ratio: 16 / 9; border-right: 0; border-bottom: 1px solid var(--rule); }
  .closing .actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
  /* Masthead strip hides; theme and language move into the menu sheet */
  .masthead-strip { display: none; }
  .masthead-strip .dateline { display: none; }
  .masthead-strip .wrap { justify-content: flex-end; }
  .nav-tools { display: flex; gap: 8px; padding-top: 12px; }
  .nav-tools .tool-btn { flex: 1; justify-content: center; border: 1px solid var(--rule); border-radius: 8px; }
  .masthead-cta { padding: 0 14px; min-height: 44px; }
  .brand { min-height: 44px; }

  .adv-grid { grid-template-columns: 1fr; }
  .adv-cell, .adv-cell:not(:nth-child(3n+1)), .adv-cell:nth-child(even) { padding: 22px 0 24px; border-left: 0; }
  .spread { grid-template-columns: 1fr; }
  .entry.datasheet { grid-template-columns: 1fr; }
  .entry h3, .entry.wide h3 { font-size: 1.5rem; }
  .map-legend { grid-template-columns: 1fr 1fr; }
  .faq-answer { padding-right: 0; }
  .contact-details dl > div { grid-template-columns: 1fr; gap: 2px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }

  /* Catalog: chapter doors become compact text rows so products start sooner */
  .doors { grid-template-columns: 1fr; gap: 8px; padding-top: 16px; }
  .door { flex-direction: row; align-items: center; }
  .door-ph, .door-types { display: none; }
  .door-body { flex-direction: row; justify-content: space-between; align-items: baseline; padding: 14px 16px; gap: 12px; }
  .door-name { font-size: 1.0625rem; }
  .door-count { margin-top: 0; padding-top: 0; white-space: nowrap; }
  .type-body { padding: 18px; }
  .strip-item { flex-basis: 96px; }
}

@media (max-width: 420px) {
  .brand-sub { display: none; }
  .hero-actions .btn { width: 100%; }
}


/* ---------- Footer contact block ---------- */
.foot-contact dl > div { display: grid; grid-template-columns: 6.5em 1fr; gap: 10px; padding: 4px 0; }
.foot-contact dt { color: var(--ink-3); font-size: 0.8125rem; padding-top: 2px; }
.foot-contact dd { color: var(--ink); }
.footer .foot-contact a { padding: 0; display: inline; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.footer .foot-contact a:hover { text-decoration-color: currentColor; }
.footer-grid { grid-template-columns: 5fr 3fr 4fr; }
@media (max-width: 960px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr; }
  .foot-contact dl > div { padding: 6px 0; }
  .footer .foot-contact a { display: inline-block; padding: 10px 0; margin: -10px 0; }
}

/* Footer link list: tap-safe but compact (min 32px rows on desktop) */
.footer li + li { margin-top: 0; }
.footer li a { padding: 6px 0; }
@media (max-width: 640px) { .footer li a { padding: 10px 0; } }

@media (max-width: 640px) { .door { min-width: 0; } .door-body { min-width: 0; flex: 1; } .door-name { min-width: 0; } }

/* ---------- Hero slider: five photos, crossfade ---------- */
.hero-slider .main { position: relative; }
.slides { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-img); overflow: hidden; background: var(--surface-warm); }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity 700ms var(--ease); }
.slide.is-active { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.slide-label {
  position: absolute; left: 14px; bottom: 14px;
  padding: 5px 12px; border-radius: 6px;
  background: rgba(28, 24, 22, 0.72); color: #fff;
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}
.slide-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(250, 247, 242, 0.88); color: #1C1816;
  box-shadow: 0 2px 10px rgba(28, 24, 22, 0.18);
  opacity: 0; transition: opacity 200ms var(--ease), background-color 200ms;
}
.slide-nav svg { width: 20px; height: 20px; }
.slide-nav.prev { left: 22px; }
.slide-nav.next { right: 22px; }
.hero-slider:hover .slide-nav, .slide-nav:focus-visible { opacity: 1; }
.slide-nav:hover { background: #fff; }
.dots { display: flex; justify-content: center; gap: 4px; margin-top: 10px; }
.dot { width: 44px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.dot::before { content: ""; width: 24px; height: 3px; border-radius: 2px; background: var(--rule); transition: background-color 200ms, width 300ms var(--ease); }
.dot:hover::before { background: var(--flame-hover); }
.dot.is-active::before { width: 36px; background: var(--flame-red); }
@media (hover: none) { .slide-nav { opacity: 1; width: 40px; height: 40px; } }
@media (prefers-reduced-motion: reduce) { .slide { transition: none; } }

/* ---------- Cookie consent banner (GA4 Consent Mode v2) ---------- */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 400;
  max-width: 720px; margin: 0 auto;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(28, 24, 22, 0.18);
}
.cookie-banner[hidden] { display: none; }
.cookie-banner__inner { display: flex; align-items: center; gap: 16px 24px; padding: 18px 20px; flex-wrap: wrap; }
.cookie-banner__text { flex: 1 1 320px; font-size: 0.9375rem; color: var(--ink-2); }
.cookie-banner__actions { display: flex; gap: 10px; }
