/* ==========================================================================
   Component library (Phase 2 — P07 §18–30, §43–52, §64, §67, §71, §86–88, §106–120, P10 §84)
   Every value comes from tokens.css.
   ========================================================================== */

/* ---------- Typography helpers ---------- */
h1, h2, h3 { font-stretch: var(--stretch-display); }
.t-display { font-size: var(--text-display); line-height: 1.05; font-weight: 750; font-stretch: var(--stretch-display); letter-spacing: -0.02em; }
.t-h1 { font-size: var(--text-h1); } .t-h2 { font-size: var(--text-h2); } .t-h3 { font-size: var(--text-h3); } .t-h4 { font-size: var(--text-h4); }
.t-lead { font-size: var(--text-body-lg); color: var(--color-text-muted); }
.t-small { font-size: var(--text-body-sm); } .t-caption { font-size: var(--text-caption); color: var(--color-text-muted); }
.t-muted { color: var(--color-text-muted); }
.tabular { font-variant-numeric: tabular-nums; }
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-md); }
.prose h2 { margin-top: var(--space-2xl); font-size: var(--text-h2); }
.prose h3 { margin-top: var(--space-xl); font-size: var(--text-h3); }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose a { text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }

/* ---------- Icons ---------- */
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 1em; height: 1em; } .icon--lg { width: 1.75em; height: 1.75em; }

/* ---------- Layout ---------- */
.section { padding-block: var(--section-y); overflow-x: clip; } /* stray absolute children can never scroll the page (P07 §64) */
.section--surface { background: var(--color-surface); }
.section--dark { background: var(--color-surface-dark); color: var(--color-text-inverse); }
.section--dark .section__intro, .section--dark .t-muted, .section--dark .t-lead { color: var(--color-text-inverse-muted); }
.section--dark a:not(.btn) { color: var(--color-accent-bright); }
.section__head { display: grid; gap: var(--space-sm); margin-bottom: var(--space-2xl); max-width: 46rem; }
.section__eyebrow { margin: 0; font-size: var(--text-label); font-weight: 600; color: var(--color-accent); display: flex; align-items: center; gap: var(--space-sm); min-height: 2rem; }
/* An eyebrow that is a link (a product's category, say) still needs a tappable height. */
.section__eyebrow a { display: inline-flex; align-items: center; min-height: 2rem; color: inherit; }
.section__eyebrow::before { content: ""; width: 28px; height: 2px; background: currentColor; }
.section--dark .section__eyebrow { color: var(--color-accent-bright); }
.section__title { margin: 0; font-size: var(--text-h2); }
.section__intro { margin: 0; color: var(--color-text-muted); font-size: var(--text-body-lg); }
.section__foot { margin-top: var(--space-2xl); display: flex; flex-wrap: wrap; gap: var(--space-sm); }
/* Card grids.
   auto-FILL, not auto-fit: with one published project a card keeps its normal size and sits
   at the left, instead of stretching across the whole page with a billboard-sized photo.
   The track minimums are sized so the intended 2/3/4 columns land inside --container-max. */
.grid { display: grid; gap: var(--space-lg); }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 28rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.stack > * + * { margin-top: var(--space-md); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; }
.cluster--center { justify-content: center; }

/* ---------- Buttons (P07 §20–22, §106, §112–113) ---------- */
.btn { position: relative; }
.btn .icon { transition: transform var(--dur-base) var(--ease-out); }
@media (hover: hover) { .btn:hover .icon--end { transform: translateX(3px); } }
.btn--sm { min-height: 40px; padding: 0.45rem 0.9rem; font-size: var(--text-body-sm); }
.btn--lg { min-height: 56px; padding: 0.9rem 1.6rem; font-size: 1.0625rem; }
.btn--block { width: 100%; }
.btn--secondary { background: var(--color-primary); color: #fff; }
.btn--secondary:hover { background: var(--color-primary-hover); color: #fff; }
/* Ghost and phone buttons inherit for the same reason .btn--outline does — see base.css. */
.btn--ghost { background: transparent; color: inherit; padding-inline: 0.5rem; }
.btn--ghost:hover { background: color-mix(in srgb, currentColor 8%, transparent); color: inherit; }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { background: #8f1c13; color: #fff; }
.btn--whatsapp { background: var(--color-whatsapp); color: #fff; }
.btn--whatsapp:hover { background: #0d7038; color: #fff; }
.btn--phone { background: transparent; color: inherit; border-color: currentColor; opacity: 0.92; }
.btn--phone:hover { opacity: 1; background: color-mix(in srgb, currentColor 8%, transparent); }
/* Buttons on a dark surface.

   .btn--outline, .btn--ghost and .btn--phone need nothing here: they inherit the surrounding
   text colour (see base.css), so they are already legible wherever they land. Only the ones
   with a background of their own have to be told, because a background cannot be inherited.

   The list is the surfaces that paint themselves dark. A new dark block joins it here — and
   if it is forgotten, the worst case is now a blue button that could have been brighter,
   not navy text on navy. */
.on-dark .btn--primary,
:is(.section--dark, .hero, .cta-band, .site-footer, .article__cta) .btn--primary {
    background: var(--color-accent-bright); color: var(--color-surface-dark);
}
.on-dark .btn--primary:hover,
:is(.section--dark, .hero, .cta-band, .site-footer, .article__cta) .btn--primary:hover {
    background: #4fb0e6; color: var(--color-surface-dark);
}
.on-dark .btn--secondary,
:is(.section--dark, .hero, .cta-band, .site-footer, .article__cta) .btn--secondary {
    background: transparent; color: var(--color-text-inverse); border-color: currentColor;
}
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; transform: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-arrow { display: inline-flex; align-items: center; gap: 0.35em; min-height: 44px; font-weight: 600; text-decoration: none; }
.link-arrow .icon { transition: transform var(--dur-base) var(--ease-out); }
@media (hover: hover) { .link-arrow:hover .icon { transform: translateX(3px); } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 0.3em; padding: 0.15rem 0.55rem; border-radius: var(--radius-sm); font-size: var(--text-caption); font-weight: 600; line-height: 1.5; border: 1px solid transparent; }
.badge--neutral { background: #E9EDF3; color: #3B4458; }
.badge--accent { background: #E1F0FA; color: #0B5B8B; }
.badge--success { background: #E2F3EA; color: #16603B; }
.badge--warning { background: #FBF0DC; color: #7F4E09; }
.badge--danger { background: #FBE6E3; color: #8F1C13; }
.badge--dark { background: var(--color-surface-dark); color: var(--color-text-inverse); }
.badge--outline { background: transparent; border-color: var(--color-border-strong); color: var(--color-text); }

/* ---------- Forms (P07 §51–52, §47–48) ---------- */
.field { display: grid; gap: 0.35rem; }
.field__label { font-size: var(--text-label); font-weight: 600; color: var(--color-text); }
.field__req { color: var(--color-danger); margin-left: 2px; }
.field__opt { color: var(--color-text-muted); font-weight: 400; }
.field__help { font-size: var(--text-caption); color: var(--color-text-muted); margin: 0; }
.field__error { font-size: var(--text-body-sm); color: var(--color-danger); margin: 0; display: flex; gap: 0.35rem; align-items: flex-start; }
.field__error:empty { display: none; }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: 0.7rem 0.85rem; font: inherit; font-size: 1rem; color: var(--color-text);
  background: var(--color-surface); border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.textarea { min-height: 130px; resize: vertical; }
.select { appearance: none; padding-right: 2.5rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23545E75' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 18px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--color-primary); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(30, 150, 216, 0.28); }
.field--invalid .input, .field--invalid .select, .field--invalid .textarea { border-color: var(--color-danger); }
.input::placeholder, .textarea::placeholder { color: #8A93A6; }
.input:disabled, .select:disabled, .textarea:disabled { background: #EEF1F5; cursor: not-allowed; }
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
/* Choice cards: radio/checkbox as large touch targets (calculator, capacity, filters — P03 §50, P07 §39, §87) */
.choices { display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr)); border: 0; padding: 0; margin: 0; }
.choices legend { font-weight: 600; margin-bottom: var(--space-sm); padding: 0; }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice__box { display: grid; gap: 0.15rem; min-height: 56px; padding: 0.75rem 0.9rem; border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface); transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.choice__title { font-weight: 600; } .choice__meta { font-size: var(--text-caption); color: var(--color-text-muted); }
.choice input:hover + .choice__box { border-color: var(--color-primary); }
.choice input:focus-visible + .choice__box { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.choice input:checked + .choice__box { border-color: var(--color-accent); background: #E9F4FB; box-shadow: inset 0 0 0 1px var(--color-accent); }
.choice input:checked + .choice__box .choice__title::after { content: ""; display: inline-block; width: 0.5em; height: 0.85em; margin-left: 0.5em; border: solid var(--color-accent); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); }
.choice input:disabled + .choice__box { opacity: 0.5; }

/* ---------- Cards (P07 §24–26) ---------- */
.card { position: relative; display: flex; flex-direction: column; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.card__media { aspect-ratio: var(--ratio-product); background: #E6EBF2; overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.card__body { display: grid; gap: var(--space-sm); padding: var(--space-lg); flex: 1; align-content: start; }
.card__meta { font-size: var(--text-caption); color: var(--color-text-muted); display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; }
.card__title { font-size: var(--text-h4); margin: 0; font-stretch: var(--stretch-body); line-height: var(--leading-snug); }
.card__title a { color: inherit; text-decoration: none; }
.card__title a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable, one link */
.card__text { margin: 0; color: var(--color-text-muted); font-size: var(--text-body-sm); }
.card__foot { padding: 0 var(--space-lg) var(--space-lg); display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; position: relative; }
@media (hover: hover) {
  .card--interactive:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-md); }
  .card--interactive:hover .card__media img { transform: scale(1.03); }
  .card--interactive:hover .link-arrow .icon { transform: translateX(3px); }
}
.card:focus-within { border-color: var(--color-accent); }

/*
 * The whole card is the tap target, not the line of text at the top of it.
 *
 * Found by tools/a11y.mjs: a card title is about 20px tall, so on a phone the only tappable
 * part of a product card was a thin strip of text — under the 24px WCAG 2.5.8 asks for, and
 * well under what a thumb actually hits. Everything around it looked clickable and was not,
 * which reads as the site being broken rather than as the user having missed.
 *
 * The link is stretched over the card with a pseudo-element rather than by wrapping the card
 * in an <a>. Wrapping would put the image, the price and every badge inside the link, so a
 * screen reader would announce the whole card as one long link name. This way the link keeps
 * its short, useful name and the card keeps its structure.
 *
 * It works only while a card has ONE link. Add a second — a category link, a separate
 * button — and it needs `position: relative; z-index: 1` or the overlay will swallow it.
 */
.card--interactive { position: relative; }
.card--interactive .card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
/* The media and the text stay below the overlay; anything that must stay separately
   clickable goes above it. */
.card--interactive .card__badges,
.card--interactive .card__actions { position: relative; z-index: 2; }
.card--article .card__media { aspect-ratio: var(--ratio-cover); }
.card--project .card__media { aspect-ratio: var(--ratio-project); }
.card--feature { padding: var(--space-lg); gap: var(--space-sm); border-radius: var(--radius-sm); border-top: 3px solid var(--color-accent); }
.card--feature .card__icon { width: 44px; height: 44px; display: grid; place-items: center; color: var(--color-accent); background: #E9F4FB; border-radius: var(--radius-sm); }
.card--stat { padding: var(--space-lg); border: 0; border-left: 3px solid var(--color-accent); border-radius: 0; background: transparent; }
.card--stat .stat__value { font-size: var(--text-h1); font-weight: 750; font-stretch: var(--stretch-display); line-height: 1; font-variant-numeric: tabular-nums; margin: 0; }
.card--stat .stat__label { color: var(--color-text-muted); margin: var(--space-sm) 0 0; }
.section--dark .card--stat .stat__label { color: var(--color-text-inverse-muted); }
.section--dark .card { background: var(--color-surface-dark-2); border-color: rgba(185, 195, 217, 0.18); color: var(--color-text-inverse); }
.section--dark .card__text, .section--dark .card__meta { color: var(--color-text-inverse-muted); }

/* Signature notched panel — only for CTA panels and capacity cards */
.panel-notched { clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch))); }

/* ---------- Quote CTA panel (P07 §111) ---------- */
.cta-panel { display: grid; gap: var(--space-lg); align-items: center; padding: clamp(1.5rem, 1rem + 3vw, 3rem); background: var(--color-surface-dark); color: var(--color-text-inverse); border-radius: 0; }
@media (min-width: 900px) { .cta-panel { grid-template-columns: 1.4fr auto; } }
.cta-panel__title { font-size: var(--text-h2); margin: 0 0 var(--space-sm); }
.cta-panel__text { margin: 0; color: var(--color-text-inverse-muted); font-size: var(--text-body-lg); }
.cta-panel__actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.cta-panel .btn--primary { background: var(--color-accent-bright); color: var(--color-surface-dark); }
.cta-panel .btn--primary:hover { background: #4fb0e6; }
.cta-panel .btn--outline { color: var(--color-text-inverse); border-color: rgba(243, 246, 250, 0.35); }

/* ---------- Callouts (P07 §110, P05 §32) ---------- */
.callout { color: var(--color-text); display: grid; grid-template-columns: auto 1fr; gap: var(--space-sm) var(--space-md); padding: var(--space-md) var(--space-lg); border-left: 4px solid; background: var(--color-surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.callout__icon { margin-top: 0.15rem; }
.callout__title { font-weight: 700; margin: 0; }
.callout__body { grid-column: 2; margin: 0; }
.callout--important { border-color: var(--color-primary); } .callout--important .callout__icon { color: var(--color-primary); }
.callout--tip { border-color: var(--color-success); } .callout--tip .callout__icon { color: var(--color-success); }
.callout--warning { border-color: var(--color-warning); background: #FFFAF1; } .callout--warning .callout__icon { color: var(--color-warning); }
.callout--example { border-color: var(--color-accent); } .callout--example .callout__icon { color: var(--color-accent); }
/* A box written inside an article has no icon — the two-column grid would leave an empty
   gutter and push the words across. One column when there is nothing to put in the first. */
.callout:not(:has(.callout__icon)) { grid-template-columns: 1fr; padding: var(--space-md); }
.callout > p:last-child { margin-bottom: 0; }
/* Something went wrong and the person must act — form rejected, sign-in failed. */
.callout--danger { border-color: var(--color-danger); background: #FDF3F2; } .callout--danger .callout__icon { color: var(--color-danger); }

/* ---------- Tables: responsive technical tables (P07 §64, §108–109) ---------- */
/* position: relative makes this the containing block for anything absolutely positioned
   inside it. Without it, a screen-reader-only label or a tooltip in a scrolled-out column is
   laid out against the viewport instead, escapes this wrapper's clipping, and quietly widens
   the whole page on a phone. */
.table-wrap { position: relative; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.table { width: 100%; color: var(--color-text); border-collapse: collapse; font-size: var(--text-body-sm); }
.table caption { text-align: left; padding: var(--space-md); font-weight: 700; }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.table thead th { background: #EEF2F7; font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.spec-table { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr; margin: 0; border-top: 1px solid var(--color-border); }
.spec-table dt, .spec-table dd { margin: 0; padding: 0.65rem 0; border-bottom: 1px solid var(--color-border); }
.spec-table dt { color: var(--color-text-muted); padding-right: var(--space-md); }
.spec-table dd { font-weight: 600; font-variant-numeric: tabular-nums; }
.spec-group + .spec-group { margin-top: var(--space-xl); }
.spec-group__title { font-size: var(--text-h4); margin-bottom: var(--space-sm); }

/* ---------- Accordion (native details — P07 §108, FAQ) ---------- */
.accordion { border-top: 1px solid var(--color-border); }
.accordion__item { border-bottom: 1px solid var(--color-border); }
.accordion__summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: var(--space-md); align-items: center; padding: var(--space-md) 0; font-weight: 600; font-size: 1.0625rem; min-height: 56px; }
.accordion__summary::-webkit-details-marker { display: none; }
.accordion__summary .icon { transition: transform var(--dur-base) var(--ease-out); color: var(--color-accent); }
.accordion__item[open] .accordion__summary .icon { transform: rotate(45deg); }
.accordion__panel { padding: 0 0 var(--space-lg); color: var(--color-text-muted); max-width: var(--measure); }
.section--dark .accordion, .section--dark .accordion__item { border-color: rgba(185, 195, 217, 0.2); }
.section--dark .accordion__panel { color: var(--color-text-inverse-muted); }

/* ---------- Tabs (P07 §87, §108) ---------- */
.tabs__list { display: flex; gap: var(--space-xs); border-bottom: 1px solid var(--color-border); overflow-x: auto; scrollbar-width: thin; }
.tabs__tab { appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; padding: 0.75rem 1rem; font: 600 var(--text-body-sm) var(--font-sans); color: var(--color-text-muted); cursor: pointer; white-space: nowrap; min-height: 48px; }
.tabs__tab:hover { color: var(--color-text); }
.tabs__tab[aria-selected="true"] { color: var(--color-primary); border-bottom-color: var(--color-accent); }
.tabs__panel { padding-top: var(--space-lg); }

/* ---------- Tooltip (CSS, keyboard accessible) ---------- */
.tooltip { position: relative; display: inline-flex; }
.tooltip__bubble { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translate(-50%, 4px); max-width: min(16rem, calc(100vw - 2rem)); background: var(--color-surface-dark); color: var(--color-text-inverse); font-size: var(--text-caption); padding: 0.4rem 0.6rem; border-radius: var(--radius-sm); width: max-content; opacity: 0; pointer-events: none; transition: opacity var(--dur-fast), transform var(--dur-fast); z-index: var(--z-dropdown); }
.tooltip:hover .tooltip__bubble, .tooltip:focus-within .tooltip__bubble { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Breadcrumb (P02 §37) ---------- */
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; font-size: var(--text-body-sm); color: var(--color-text-muted); }
.breadcrumb li { display: inline-flex; align-items: center; gap: 0.25rem; }
.breadcrumb li + li::before { content: "/"; color: var(--color-border-strong); margin-right: 0.25rem; }
/* min-height, not padding alone: padding on an inline element does not grow the hit area. */
.breadcrumb a { color: var(--color-text-muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 2rem; }
.breadcrumb a:hover { color: var(--color-accent); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--color-text); }

/* ---------- Empty / loading / success states (P02 §43, P07 §49–50, §67–69) ---------- */
.empty-state { color: var(--color-text); display: grid; justify-items: start; gap: var(--space-sm); padding: var(--space-2xl); border: 1.5px dashed var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface); }
.empty-state__title { font-size: var(--text-h3); margin: 0; }
.empty-state__text { margin: 0; color: var(--color-text-muted); }
.success-state { color: var(--color-text); display: grid; gap: var(--space-md); justify-items: start; padding: var(--space-2xl); background: var(--color-surface); border: 1px solid var(--color-border); border-top: 4px solid var(--color-success); }
.success-state__icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: #E2F3EA; color: var(--color-success); }
.skeleton { position: relative; overflow: hidden; background: #E3E8EF; border-radius: var(--radius-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton--text { height: 0.9em; margin-bottom: 0.6em; } .skeleton--title { height: 1.4em; width: 70%; margin-bottom: 0.8em; } .skeleton--media { aspect-ratio: var(--ratio-product); }
.img-fallback { display: grid; place-items: center; width: 100%; height: 100%; color: #9AA5B8; background: repeating-linear-gradient(135deg, #E6EBF2 0 12px, #EDF1F6 12px 24px); }

/* ---------- Modal (P07 §116) ---------- */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--space-md); }
.modal__backdrop { position: absolute; inset: 0; background: rgba(12, 15, 38, 0.62); opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.modal__dialog { position: relative; width: min(100%, 36rem); max-height: calc(100dvh - 2rem); overflow: auto; background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); transform: translateY(12px); opacity: 0; transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-base) var(--ease-out); }
.modal.is-open .modal__backdrop { opacity: 1; } .modal.is-open .modal__dialog { transform: none; opacity: 1; }
.modal__head { display: flex; justify-content: space-between; align-items: start; gap: var(--space-md); padding: var(--space-lg) var(--space-lg) 0; }
.modal__title { font-size: var(--text-h3); margin: 0; }
.modal__body { padding: var(--space-lg); }
.modal__foot { padding: 0 var(--space-lg) var(--space-lg); display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: flex-end; }
.icon-btn { appearance: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(42, 48, 108, 0.08); }
@media (max-width: 600px) { .modal { align-items: end; padding: 0; } .modal__dialog { width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; } }
body.has-modal { overflow: hidden; }

/* ---------- Toasts (P07 §118) ---------- */
.toast-region { position: fixed; z-index: var(--z-toast); right: var(--space-md); bottom: var(--space-md); display: grid; gap: var(--space-sm); width: min(calc(100% - 2rem), 22rem); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: var(--space-sm); align-items: flex-start; padding: 0.8rem 1rem; background: var(--color-surface-dark); color: var(--color-text-inverse); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); border-left: 4px solid var(--color-accent-bright); animation: toast-in var(--dur-slow) var(--ease-out); }
.toast--success { border-left-color: #43b97c; } .toast--error { border-left-color: #ff7b6e; } .toast--warning { border-left-color: #f0b04f; }
.toast__msg { flex: 1; margin: 0; font-size: var(--text-body-sm); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--dur-base), transform var(--dur-base); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Lightbox (P07 §71) ---------- */
.lightbox { position: fixed; inset: 0; z-index: var(--z-lightbox); background: rgba(8, 10, 28, 0.94); display: grid; grid-template-rows: auto 1fr auto; color: #fff; }
.lightbox__bar { display: flex; justify-content: space-between; align-items: center; padding: var(--space-sm) var(--space-md); }
.lightbox__stage { display: grid; place-items: center; padding: 0 var(--space-md); min-height: 0; }
.lightbox__img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox__nav { display: flex; justify-content: center; align-items: center; gap: var(--space-md); padding: var(--space-md); }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.lightbox__caption { font-size: var(--text-body-sm); color: #cfd6e6; margin: 0; }
.gallery { display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); }
.gallery__item { appearance: none; border: 0; padding: 0; background: #E6EBF2; aspect-ratio: var(--ratio-product); overflow: hidden; border-radius: var(--radius-sm); cursor: zoom-in; }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
@media (hover: hover) { .gallery__item:hover img { transform: scale(1.03); } }

/* ---------- Scroll-to-top (P07 §103) ---------- */
.to-top { position: fixed; right: var(--space-md); bottom: calc(var(--space-md) + 64px); z-index: var(--z-floating); opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity var(--dur-base), transform var(--dur-base), visibility var(--dur-base); background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-md); }
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }

/* ---------- Copy to clipboard (P07 §119) ---------- */
.copy { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 36px; font: inherit; font-weight: 600; background: #EEF2F7; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 0.2rem 0.55rem; cursor: pointer; color: var(--color-text); }
.copy:hover { border-color: var(--color-border-strong); }

/* ---------- Motion system (P07 §31–40): one observer, transform/opacity only ----------
   The gate is .reveal-ready, which core.js adds only once the observer is actually watching.
   If the script fails to load or throws, the class never appears and every section stays
   visible — content must never depend on JavaScript succeeding (P07 §40). */
.reveal-ready [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out); transition-delay: calc(var(--i, 0) * 50ms); }
.reveal-ready [data-reveal="fade"] { transform: none; }
.reveal-ready [data-reveal="scale"] { transform: scale(0.98); }
.reveal-ready [data-reveal].is-revealed { opacity: 1; transform: none; }
.hero-enter > * { animation: hero-in 700ms var(--ease-out) both; }
.hero-enter > *:nth-child(2) { animation-delay: 90ms; } .hero-enter > *:nth-child(3) { animation-delay: 180ms; } .hero-enter > *:nth-child(4) { animation-delay: 270ms; }
@keyframes hero-in { from { opacity: 0; transform: translateY(18px); } }
@view-transition { navigation: auto; } /* lightweight page transition where supported (P07 §37) */
@media (prefers-reduced-motion: reduce) {
  .reveal-ready [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hero-enter > * { animation: none; }
  @view-transition { navigation: none; }
}

/* ---------- Light panels inside dark sections ----------
   A panel with its own light background must not inherit the dark section's text colour
   (caught by the contrast audit: white heading on a white success panel).

   Cards are deliberately NOT in this list. `.section--dark .card` above gives them a dark
   background of their own, so forcing dark text on them produced the same fault in reverse —
   navy on navy at 1.15:1, which the contrast audit then caught in Phase 8. */
.section--dark :is(.empty-state, .success-state, .callout, .table-wrap) { color: var(--color-text); }
.section--dark :is(.empty-state, .success-state, .callout) :is(.t-muted, .empty-state__text, .success-state__icon + *, p) { color: var(--color-text-muted); }
.section--dark :is(.empty-state, .success-state, .callout) .btn--outline,
.section--dark :is(.empty-state, .success-state, .callout) .btn--phone { color: var(--color-primary); border-color: var(--color-border-strong); }
.section--dark :is(.empty-state, .success-state, .callout) .btn--outline:hover { color: var(--color-primary); border-color: var(--color-primary); }
.section--dark :is(.empty-state, .success-state) .btn--primary { background: var(--color-accent); color: #fff; }
.section--dark :is(.empty-state, .success-state) a:not(.btn) { color: var(--color-accent); }

/* --- chips: a row of links that narrow a list (search, filters) ------------------------- */

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--space-md); }

.chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.35rem 0.85rem; border-radius: 999px;
    border: 1px solid var(--color-border); background: var(--color-surface);
    color: var(--color-text-muted); text-decoration: none;
    font-size: var(--text-body-sm); font-weight: 600;
    min-height: 2.25rem;
}
.chip:hover { border-color: var(--color-border-strong); color: var(--color-text); }
.chip.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* --- site-wide search (P02 §38) -------------------------------------------------------- */

.search-form { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: var(--space-md) 0; }
.search-form .input { flex: 1 1 16rem; min-width: 0; }

.search-count { color: var(--color-text-muted); margin-bottom: var(--space-md); }
.search-group { margin: var(--space-lg) 0 var(--space-sm); font-size: var(--text-h4, 1.15rem); }

.search-results { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-sm); }

.search-result {
    position: relative;   /* the title's stretched link needs something to stretch to */
    display: flex; gap: var(--space-sm); align-items: flex-start;
    padding: var(--space-sm); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); background: var(--color-surface);
}
/* The whole result is the tap target, not the line of text. One link, so a screen reader
   still hears one link — and on a phone the target is the card, not 19 pixels of heading. */
.search-result__title a::after { content: ""; position: absolute; inset: 0; }
.search-result:hover { border-color: var(--color-border-strong); }
.search-result__image { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); flex: none; }
.search-result__body { min-width: 0; }
.search-result__title { margin: 0 0 0.25rem; font-size: 1.05rem; }
.search-result__title a { text-decoration: none; }
.search-result__title a:hover { text-decoration: underline; }
.search-result__summary { margin: 0 0 0.35rem; color: var(--color-text-muted); font-size: var(--text-body-sm); }
.search-result__url { margin: 0; font-size: var(--text-caption); color: var(--color-text-muted); word-break: break-all; }

.search-actions { margin-top: var(--space-md); }

@media (max-width: 30rem) {
    .search-result__image { width: 56px; height: 56px; }
}

.site-header__search {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem; border-radius: var(--radius-sm);
    color: inherit; text-decoration: none;
}
.site-header__search:hover { background: color-mix(in srgb, currentColor 10%, transparent); }

.mobile-nav__search { display: flex; gap: 0.5rem; margin-bottom: var(--space-sm); }
.mobile-nav__search .input { flex: 1 1 auto; min-width: 0; }
