/* Nav tools (language flag + dark mode switch) and the light theme.
   Loaded last on every page, in both languages. */

/* Landing page width (project pages and case studies keep --max) */
:root { --page-max: 1640px; }

/* Nav tools */
.nav-tools { display: inline-flex; align-items: center; gap: 14px; margin-left: 4px; }
.lang-switch {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 4px;
  text-decoration: none; transition: background-color 0.2s;
}
.lang-switch:hover { background: var(--stage-2); }
.lang-switch svg { width: 22px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18); }

.theme-switch {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 0;
  font: inherit; color: var(--fg-2); background: none; border: 0; cursor: pointer;
}
.theme-switch:hover { color: var(--fg); }
.theme-track {
  position: relative; width: 34px; height: 20px; border-radius: 10px;
  background: var(--stage-2); box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 0.25s;
}
.theme-knob {
  position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--fg); transition: transform 0.3s var(--ease-out);
}
.theme-switch[aria-checked="true"] .theme-track { background: var(--idr); box-shadow: none; }
.theme-switch[aria-checked="true"] .theme-knob { transform: translateX(14px); background: var(--idr-ink); }
.theme-switch svg { width: 18px; height: 18px; }
.theme-switch .i-sun { display: none; }
[data-theme="light"] .theme-switch .i-sun { display: block; }
[data-theme="light"] .theme-switch .i-moon { display: none; }

@media (max-width: 560px) {
  .site-head .wrap { gap: 12px; }
  .site-nav { gap: 12px; }
  .nav-tools { gap: 8px; margin-left: 0; }
  .theme-switch svg { display: none !important; }
}
.site-nav a, .site-name { white-space: nowrap; }
@media (max-width: 480px) {
  /* Mono headers are wider: keep name, flag and theme switch; sections are reached by scrolling */
  .site-head .site-nav > a { display: none; }
}
@media (max-width: 400px) {
  .site-name { font-size: var(--step-0); }
  .site-nav { font-size: var(--step-0); }
}

/* Light theme */
:root[data-theme="light"] {
  --bg: #f6f4ef;
  --stage: #ecebe6;
  --stage-2: #e1ded7;
  --fg: #161513;
  --fg-2: #57534c;
  --fg-3: #6b665e;
  --line: #dad6cd;
  --accent: #161513;
  --shadow: 0 24px 48px -16px rgba(40, 32, 20, 0.28), 0 6px 14px -6px rgba(40, 32, 20, 0.16);
  color-scheme: light;
  scrollbar-color: #c9c4ba var(--bg);
}
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c9c4ba; }
[data-theme="light"] .btn:hover { background: #000; }
[data-theme="light"] .btn-red:hover { background: var(--accent-hover, #a92612); }
[data-theme="light"] .btn-quiet:hover { background: #d5d1c9; }

/* Case study report and sheet */
[data-theme="light"] .report { --bg: #fbfaf7; --stage: #f0eee9; --stage-2: #e5e2db; }
[data-theme="light"] .report .criteria .res.miss { color: #b8240f; }
[data-theme="light"] .sheet { border-color: var(--line); box-shadow: 0 -24px 60px -20px rgba(40, 32, 20, 0.35); }
[data-theme="light"] .sheet-backdrop { background: rgba(40, 36, 30, 0.35); }
[data-theme="light"] .sheet-scroll { scrollbar-color: #c9c4ba var(--bg); }
[data-theme="light"] .fig { background: #e9e7e1; }

/* Project page */
[data-theme="light"] .pj { --panel: #e7e4dd; --quiet: #e1ded7; --shot-shadow: 0 16px 32px -8px rgba(40, 32, 20, 0.28); }
[data-theme="light"] .pj .btn-quiet:hover { background: #d5d1c9; }
[data-theme="light"] .pj-outcome-list .k { color: var(--idr); }
