/* ==========================================================================
   Breezedude — shared foundation
   One stylesheet for tokens, page frame, header/footer and the building
   blocks every page uses. Page-specific sheets add only what is unique.
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-sunk: #eef1f4;
  --text: #11161f;
  --text-soft: #565f6d;
  --border: #dde2e8;
  --border-strong: #c3cad4;
  --primary: #1d4ed8;
  --primary-hover: #1740b8;
  --primary-ink: #ffffff;
  --primary-wash: rgba(29, 78, 216, 0.06);
  --ok: #15803d;
  --ok-wash: rgba(21, 128, 61, 0.09);
  --warn: #9a5b06;
  --warn-wash: rgba(154, 91, 6, 0.09);
  --danger: #c02626;
  --danger-wash: rgba(192, 38, 38, 0.08);
  --measure: 68ch;
  --radius: 5px;
  --ease: cubic-bezier(.22, .8, .3, 1);

  /* Aliases for the stylesheets that still use the previous token names */
  --surface-muted: var(--surface);
  --surface-strong: var(--surface);
  --primary-strong: var(--primary-hover);
  --primary-soft: var(--primary-wash);
  --radius-md: var(--radius);
  --radius-lg: 8px;
  --radius-xl: 10px;
  --transition: 160ms ease;
  --shadow: 0 10px 28px rgba(8, 12, 20, 0.14);
  --bg-accent: transparent;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1319;
  --surface: #161b23;
  --surface-sunk: #0b0e13;
  --text: #e7eaf0;
  --text-soft: #9ba5b4;
  --border: #262d38;
  --border-strong: #38414f;
  --primary: #6aa5ff;
  --primary-hover: #8dbcff;
  --primary-ink: #0b0f15;
  --primary-wash: rgba(106, 165, 255, 0.10);
  --ok: #4ade80;
  --ok-wash: rgba(74, 222, 128, 0.10);
  --warn: #fbbf24;
  --warn-wash: rgba(251, 191, 36, 0.10);
  --danger: #f87171;
  --danger-wash: rgba(248, 113, 113, 0.10);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1319;
    --surface: #161b23;
    --surface-sunk: #0b0e13;
    --text: #e7eaf0;
    --text-soft: #9ba5b4;
    --border: #262d38;
    --border-strong: #38414f;
    --primary: #6aa5ff;
    --primary-hover: #8dbcff;
    --primary-ink: #0b0f15;
    --primary-wash: rgba(106, 165, 255, 0.10);
    --ok: #4ade80;
    --ok-wash: rgba(74, 222, 128, 0.10);
    --warn: #fbbf24;
    --warn-wash: rgba(251, 191, 36, 0.10);
    --danger: #f87171;
    --danger-wash: rgba(248, 113, 113, 0.10);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }

/* Browser surfaces carry the design too */
::selection { background: var(--primary); color: var(--primary-ink); }
* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 120ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Page frame ─────────────────────────────────────────────────────────── */

.wrap { width: min(1320px, 100% - 56px); margin-inline: auto; }
.wrap-narrow { width: min(920px, 100% - 56px); margin-inline: auto; }

.site-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--border);
}

.site-head .mark { width: 34px; height: 34px; display: block; flex: none; }
:root[data-theme="dark"] .site-head .mark { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-head .mark { filter: invert(1); }
}

.wordmark { font-size: 1.02rem; font-weight: 650; letter-spacing: -0.01em; margin-right: auto; text-decoration: none; }
.wordmark span { display: block; font-size: 0.78rem; font-weight: 400; color: var(--text-soft); letter-spacing: 0; }

.site-foot {
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 22px 0 44px;
  color: var(--text-soft);
  font-size: 0.85rem;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.site-foot a { color: var(--text-soft); text-decoration: none; transition: color 140ms ease; }
.site-foot a:hover { color: var(--primary); }

/* ── Header controls ────────────────────────────────────────────────────── */

.ctrl {
  appearance: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.82rem;
  padding: 6px 11px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}
.ctrl:hover { color: var(--text); border-color: var(--border-strong); background: var(--primary-wash); }

.seg { display: inline-flex; }
.seg .ctrl { border-radius: 0; margin-left: -1px; }
.seg .ctrl:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.seg .ctrl:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.seg .ctrl[aria-pressed="true"] { color: var(--primary-ink); background: var(--primary); border-color: var(--primary); }

/* Sun / moon theme switch */
.theme-btn {
  appearance: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
  width: 34px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}
.theme-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--primary-wash); }
.theme-btn svg { grid-area: 1 / 1; width: 17px; height: 17px; transition: opacity 260ms var(--ease), transform 360ms var(--ease); }
.theme-btn .i-sun { opacity: 1; transform: rotate(0) scale(1); }
.theme-btn .i-moon { opacity: 0; transform: rotate(-70deg) scale(0.6); }
:root[data-theme="dark"] .theme-btn .i-sun { opacity: 0; transform: rotate(70deg) scale(0.6); }
:root[data-theme="dark"] .theme-btn .i-moon { opacity: 1; transform: rotate(0) scale(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { opacity: 0; transform: rotate(70deg) scale(0.6); }
  :root:not([data-theme="light"]) .theme-btn .i-moon { opacity: 1; transform: rotate(0) scale(1); }
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary,
.btn-ghost { border-color: var(--border-strong); color: var(--text); background: none; }
.btn-secondary:hover,
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn .arr { transition: transform 180ms var(--ease); }
.btn:hover .arr { transform: translateX(3px); }

/* ── Sections ───────────────────────────────────────────────────────────── */

.block { margin-top: 46px; }
.block > h2 {
  font-size: 1.12rem;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border-strong);
}
.block > h2 span { font-weight: 400; color: var(--text-soft); font-size: 0.88rem; margin-left: 10px; letter-spacing: 0; }

.cols { display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; align-items: start; }
.cols > section + section { border-left: 1px solid var(--border); padding-left: 48px; }
.spread { display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; align-items: start; }

.colhead {
  font-size: 0.71rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-soft); font-weight: 650;
  padding: 16px 0 6px;
}

/* Entry row with preview image */
.e {
  display: grid;
  grid-template-columns: 132px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 12px 12px 12px 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
  overflow: hidden;
  transition: background-color 150ms ease;
}
.e figure, .e > div { transition: transform 180ms var(--ease); }
.e:hover { background: var(--primary-wash); }
.e:hover figure, .e:hover > div { transform: translateX(10px); }
.e figure { margin: 0; overflow: hidden; aspect-ratio: 16 / 10; background: var(--surface); }
.e img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: saturate(0.74) contrast(1.02);
  transition: transform 430ms var(--ease), filter 300ms ease;
}
.e:hover img { transform: scale(1.06); filter: saturate(1) contrast(1.02); }
.e b { font-size: 1.08rem; font-weight: 600; display: block; transition: color 150ms ease; }
.e:hover b { color: var(--primary); }
.e p { color: var(--text-soft); font-size: 0.88rem; margin-top: 2px; }
.e .arrow { color: var(--border-strong); display: inline-flex; transition: color 150ms ease, transform 200ms var(--ease); }
.e:hover .arrow { color: var(--primary); transform: translateX(3px); }
.e .ext { font-size: 0.85rem; color: var(--text-soft); transition: color 150ms ease; }
.e:hover .ext { color: var(--primary); }

/* ── Prose ──────────────────────────────────────────────────────────────── */

.prose { max-width: var(--measure); }
.prose p + p { margin-top: 13px; }
.prose p, .prose li { color: var(--text-soft); }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose ul, .prose ol { margin: 12px 0 0; padding-left: 20px; }
.prose li + li { margin-top: 6px; }
.prose h3 { font-size: 1.1rem; margin-top: 26px; }

.lead { font-size: 1.06rem; color: var(--text-soft); max-width: 56ch; }

/* ── Notes ──────────────────────────────────────────────────────────────── */

.note {
  border-left: 2px solid var(--border-strong);
  padding: 2px 0 2px 16px;
  margin-top: 18px;
  font-size: 0.92rem;
  color: var(--text-soft);
}
.note strong { color: var(--text); }
.note-warn { border-left-color: var(--warn); }
.note-info { border-left-color: var(--primary); }

/* Inline code */
.code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-sunk);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ── Numbered steps ─────────────────────────────────────────────────────── */

@media (max-width: 1040px) {
  .cols, .spread { grid-template-columns: 1fr; column-gap: 0; }
  .cols > section + section { border-left: 0; padding-left: 0; }
  .cols > section + section .colhead { padding-top: 26px; }
}

@media (max-width: 760px) {
  .wrap, .wrap-narrow { width: calc(100% - 32px); }
  .e { grid-template-columns: 100px 1fr auto; gap: 14px; }
  .guide-step { grid-template-columns: 34px 1fr; gap: 16px; padding: 24px 0 26px; }
  .guide-step::before { width: 32px; height: 32px; font-size: 0.95rem; }
  .guide-step::after { left: 16px; top: 60px; }
}

/* ── Language switch (markup contract of translation.js) ────────────────── */

.lang-toggle {
  appearance: none;
  display: inline-flex;
  overflow: hidden;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--text-soft);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 140ms ease;
}
.lang-toggle:hover { border-color: var(--border-strong); }
.lang-toggle[hidden] { display: none; }
.lang-seg {
  padding: 5px 10px;
  font-size: 0.79rem;
  font-weight: 650;
  line-height: 1.5;
  user-select: none;
  transition: background-color 150ms ease, color 150ms ease;
}
.lang-seg.active { background: var(--primary); color: var(--primary-ink); }

/* ── Tool pages ─────────────────────────────────────────────────────────────
   The tool stylesheets (analyzer, configurator, flashers) still address the
   container class names. These are the flat versions: no frame, no radius,
   no shadow. Page sheets keep overriding sizing as they always did.
   ------------------------------------------------------------------------ */

.app-shell { width: min(1320px, 100% - 56px); margin-inline: auto; }
.page-card { background: none; border: 0; border-radius: 0; padding: 0; }
.tool-layout { display: grid; gap: 16px; }

/* Full-height tool pages (USB diagnostics): header stays, body fills the rest */
.app-page { display: flex; flex-direction: column; }
.app-page > main { flex: 1; min-height: 0; }

@media (max-width: 760px) {
  .app-shell { width: calc(100% - 32px); }
}

/* Logo returns home from every page */
.home-link { display: inline-flex; flex: none; border-radius: 4px; }
.home-link .mark { transition: opacity 140ms ease; }
.home-link:hover .mark { opacity: 0.72; }

/* ── Card media (shop and overview cards from the previous layout) ──────── */

.product-placeholder {
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--surface);
  margin-bottom: 12px;
}

.product-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 430ms var(--ease);
}

.card-option { display: block; color: inherit; text-decoration: none; }
.card-option:hover .product-placeholder img { transform: scale(1.04); }
.card-option h2 { font-size: 1.2rem; transition: color 150ms ease; }
.card-option:hover h2 { color: var(--primary); }
.card-option p { color: var(--text-soft); font-size: 0.92rem; margin-top: 4px; }

/* ── Guide steps: a visible thread through the sequence ─────────────────── */

.guide-steps { counter-reset: step; margin-top: 10px; }

.guide-step {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 24px;
  padding: 30px 0 34px;
  border-top: 1px solid var(--border);
}

.guide-step::before {
  counter-increment: step;
  content: counter(step);
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 650;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: var(--bg);
  margin-top: 2px;
}

/* thread connecting the step markers */
.guide-step::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 72px;
  bottom: -1px;
  width: 1px;
  background: var(--border);
}

.guide-step:last-child::after { display: none; }

.guide-step .step-body { color: var(--text-soft); }
.guide-step .step-body > .prose { margin-top: 6px; }
.guide-step figure { margin: 20px 0 0; overflow: hidden; max-width: 440px; }
.guide-step figure img { width: 100%; height: auto; display: block; }

/* Steps run the full column; the page width already limits the measure */
.guide-step .prose { max-width: none; }
.guide-step .step-body { max-width: none; }

/* Compact controls for tool pages */
.controls-row .btn,
.controls .btn {
  padding: 7px 14px;
  font-size: 0.92rem;
}
