/* Progressive, dependency-free appearance layer. Load after style.css. */
:root {
  color-scheme: light;
  --theme-background: #ffffff;
  --theme-surface: #ffffff;
  --theme-surface-raised: #f3f6fa;
  --theme-heading: #0b1f3a;
  --theme-focus: #2563eb;
  --theme-header: #fffffff5;
  --theme-control-hover: #edf3fb;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --theme-background: #081321;
  --theme-surface: #101f32;
  --theme-surface-raised: #14263b;
  --theme-heading: #e6eef8;
  --theme-focus: #f7b53e;
  --theme-header: #081321f5;
  --theme-control-hover: #1c3450;
  --text: #d5e0ee;
  --ink: #e6eef8;
  --muted: #abbcd1;
  --line: #30445e;
  --pale: #101f32;
  --blue: #91b9ff;
  --white: #101f32;
  --shadow: 0 14px 48px #00000040;
}

body { background: var(--theme-background); color: var(--text); font-size: 1rem; }
h1, h2, h3, h4 { color: var(--theme-heading); }
:focus-visible { outline-color: var(--theme-focus); }
.site-header { background: var(--theme-header); border-color: var(--line); }
.brand-logo-light { display: none; }
.brand-logo-dark { display: block; }
[data-theme="dark"] .brand-logo-light { display: block; }
[data-theme="dark"] .brand-logo-dark { display: none; }

.theme-toggle,
.language-switch,
.search-trigger,
.menu-toggle {
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--theme-surface);
  color: var(--theme-heading);
}
.theme-toggle { display: none; padding: 10px; }
.theme-controls-ready .theme-toggle { display: inline-flex; }
.theme-toggle:hover,
.language-switch:hover,
.search-trigger:hover,
.menu-toggle:hover { background: var(--theme-control-hover); }
.theme-toggle svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.theme-toggle .theme-icon-sun { display: none; }
.theme-toggle .theme-icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }
.language-switch { display: inline-flex; width: auto; min-width: 58px; padding: 8px; gap: 3px; white-space: nowrap; font-size: .875rem; font-weight: 550; }
.language-switch .language-current { color: var(--blue); font-weight: 800; }
.language-switch a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border-radius: 7px; }
.topbar .container { min-height: 44px; }
.topbar .language-switch,
.footer-bottom .language-switch { min-width: 0; padding: 0; gap: 6px; border: 0; border-radius: 0; background: transparent; color: #c4cede; font-size: .875rem; }
.topbar .language-switch .language-current,
.footer-bottom .language-switch .language-current { color: #f7b53e; }
.topbar .language-switch a:hover,
.footer-bottom .language-switch a:hover { color: #fff; background: #ffffff12; }
.topbar .language-switch:focus-within,
.footer-bottom .language-switch:focus-within { background: transparent; }
.nav-cta { display: inline-flex; align-items: center; min-height: 44px; }
.nav-wrap { gap: 23px; }
.nav-actions { gap: 9px; }
.desktop-nav { gap: 22px; }
.dialog-close { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
.filter-button { min-height: 44px; }

.hero h1 { font-size: clamp(2.7rem, 4.8vw, 4.5rem); max-width: 700px; }
html[lang="en"] .hero h1 { max-width: 755px; font-size: clamp(2.7rem, 4.7vw, 4.4rem); }
.hero-copy,
.equipment-card p,
.feature-content > p,
.tech-copy p,
.faq-answer,
.section-head p,
.cta-strip p,
.footer-brand p,
.topic-intro p,
.mini-point p,
.note-panel p,
.article-card p,
.editorial-note,
.article-content table,
.source-box ul,
.takeaways ul { font-size: 1rem; }
.library-search input { font-size: 1rem; min-height: 48px; }
.faq-list summary { min-height: 44px; }

/* Replace fixed light colors without changing the navy-and-amber brand blocks. */
[data-theme="dark"] .desktop-nav a { color: #bbcbe0; }
[data-theme="dark"] .desktop-nav a:hover,
[data-theme="dark"] .desktop-nav a[aria-current="page"] { color: var(--blue); }
[data-theme="dark"] .equipment-card,
[data-theme="dark"] .article-card,
[data-theme="dark"] .search-dialog,
[data-theme="dark"] .library-search,
[data-theme="dark"] .filter-button,
[data-theme="dark"] .btn-light,
[data-theme="dark"] .sitemap-list { background: var(--theme-surface); border-color: var(--line); }
[data-theme="dark"] .equipment-card:hover { border-color: #55789f; }
[data-theme="dark"] .equipment-art { background: linear-gradient(180deg, #182d45, #14263b); }
[data-theme="dark"] .equipment-art svg { stroke: #c2d5ee; }
[data-theme="dark"] .equipment-art svg [fill="#dce8fa"] { fill: #2a4667; }
[data-theme="dark"] .equipment-art svg [fill="#fff"] { fill: #101f32; }
[data-theme="dark"] .quick-nav strong,
[data-theme="dark"] .faq-list summary,
[data-theme="dark"] .library-search input,
[data-theme="dark"] .article-author,
[data-theme="dark"] .article-toc .toc-title,
[data-theme="dark"] .article-content strong,
[data-theme="dark"] .article-content th,
[data-theme="dark"] .search-result strong,
[data-theme="dark"] .dialog-close,
[data-theme="dark"] .btn-light { color: var(--theme-heading); }
[data-theme="dark"] .library-search input::placeholder { color: #a7b8cf; opacity: 1; }
[data-theme="dark"] .filter-button { color: #c1cee0; }
[data-theme="dark"] .filter-button:hover { color: #c6dcff; border-color: #8bb5fc; background: #18334e; }
[data-theme="dark"] .filter-button[aria-pressed="true"] { color: #fff; border-color: #3e7be0; background: #235fc8; }
[data-theme="dark"] .btn-navy,
[data-theme="dark"] .nav-cta { color: #fff; background: #235fc8; }
[data-theme="dark"] .btn-navy:hover,
[data-theme="dark"] .nav-cta:hover { background: #2c6bda; }
[data-theme="dark"] .btn-amber { color: #0b1f3a; }
[data-theme="dark"] .btn-light:hover { background: var(--theme-control-hover); }
[data-theme="dark"] .takeaways,
[data-theme="dark"] .no-js-note { background: #142c49; }
[data-theme="dark"] .article-content th { background: #172d46; }
[data-theme="dark"] .article-content td { background: #0d1b2c; }
[data-theme="dark"] .note-panel { background: var(--theme-surface); }
[data-theme="dark"] .editorial-note { background: #0d1b2c; }
[data-theme="dark"] .empty-state { border-color: #55708e; }
[data-theme="dark"] .breadcrumbs li:not(:first-child)::before { color: #91a5c0; }
[data-theme="dark"] .error-page .error-mark { color: #7ea5d9; }
[data-theme="dark"] .search-dialog { box-shadow: 0 25px 100px #0009; }
[data-theme="dark"] .search-dialog::backdrop { background: #020714c4; }
[data-theme="dark"] .search-result:hover { background: #1a314c; }
[data-theme="dark"] .dialog-close { background: #1b314d; }
[data-theme="dark"] .dialog-close:hover { background: #294666; }
[data-theme="dark"] .back-top { background: #173451; border-color: #476282; }
[data-theme="dark"] .back-top:hover { background: #235fc8; }
[data-theme="dark"] ::selection { background: #f9c665; color: #0b1f3a; }

@media (max-width: 1120px) {
  .nav-cta { display: none; }
  .nav-wrap { gap: 19px; }
  .desktop-nav { gap: 17px; }
  .brand img { width: 176px; }
}

@media (max-width: 860px) {
  .nav-actions { gap: 7px; }
  .js .desktop-nav { top: 100%; }
  [data-theme="dark"] .js .desktop-nav { background: var(--theme-surface); }
  html.js[data-theme="dark"] .desktop-nav { background: var(--theme-surface); }
  [data-theme="dark"] .desktop-nav a[aria-current="page"] { background: #193451; }
  .hero h1,
  html[lang="en"] .hero h1 { font-size: clamp(2.7rem, 6.9vw, 3.9rem); max-width: 660px; }
}

@media (max-width: 600px) {
  .site-header .container { width: calc(100% - 24px); }
  .nav-wrap { min-height: 72px; gap: 8px; }
  .brand img { width: clamp(122px, 32vw, 166px); }
  .nav-actions { gap: 6px; }
  .language-switch { min-width: 50px; padding-inline: 4px; gap: 2px; font-size: .8125rem; }
  .topbar .container { justify-content: space-between; gap: 8px; letter-spacing: .04em; }
  .topbar .language-switch,
  .footer-bottom .language-switch { font-size: .875rem; gap: 4px; }
  .footer-bottom { align-items: flex-start; }
  .search-trigger,
  .theme-toggle,
  .menu-toggle { width: 44px; height: 44px; }
  .hero h1,
  html[lang="en"] .hero h1 { font-size: clamp(2.45rem, 9.5vw, 3.55rem); line-height: 1.1; max-width: 450px; }
  .hero-content { padding-top: 42px; }
  .hero { min-height: 650px; }
  .hero-actions .btn { font-size: .875rem; min-height: 48px; }
  .hero-footnote { font-size: .8125rem; }
  .equipment-card p { font-size: 1rem; }
  .equipment-grid { gap: 14px; }
  .equipment-card { padding-inline: 15px; }
  .faq-answer { font-size: 1rem; }
  .search-help { font-size: .875rem; }
  .search-result strong { font-size: 1rem; }
}

@media (max-width: 359px) {
  .equipment-grid { grid-template-columns: 1fr; }
}

@media print {
  :root[data-theme="dark"] {
    color-scheme: light;
    --theme-background: #fff;
    --theme-heading: #111;
    --text: #111;
    --ink: #111;
    --muted: #333;
    --line: #ccc;
    --blue: #111;
  }
  .theme-toggle, .language-switch { display: none !important; }
  [data-theme="dark"] .takeaways,
  [data-theme="dark"] .article-content th,
  [data-theme="dark"] .article-content td,
  [data-theme="dark"] .editorial-note { background: #fff; color: #111; }
}
