/* base.css — tokens, reset, typography, layout, header and footer. */

:root {
  --bg: #f7f4ee;            /* warm neutral page background */
  --surface: #ffffff;
  --surface-2: #fbf9f5;
  --text: #1e293b;          /* dark slate */
  --muted: #4a5568;
  --border: #d9d2c4;
  --border-strong: #b9b0a0;
  --accent: #0b6b4f;        /* deep green, 6.6:1 on white */
  --accent-dark: #085540;
  --accent-soft: #e2f1ea;
  --focus: #1d4ed8;
  --warn-bg: #fff4dc;
  --warn-text: #7a4300;
  --warn-border: #e2b259;
  --error: #b42318;
  --error-bg: #fdecea;
  --changed-bg: #fff8e1;
  --changed-border: #b7791f;
  --radius: 12px;
  --radius-small: 8px;
  --shadow: 0 1px 2px rgba(30, 41, 59, .06), 0 4px 16px rgba(30, 41, 59, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --max: 1160px;
  --gutter: 16px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 3.2vw, 1.85rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-dark); text-underline-offset: 3px; }
a:hover { color: var(--text); }
ul, ol { padding-left: 1.3em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: var(--radius-small);
}
.skip-link:focus { top: 8px; color: #fff; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 44px; padding: 10px 18px;
  border: 2px solid var(--accent); border-radius: 999px;
  background: var(--accent); color: #fff;
  font-weight: 650; text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn--secondary { background: var(--surface); color: var(--accent-dark); }
.btn--secondary:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn--ghost { background: transparent; color: var(--accent-dark); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.btn--small { min-height: 44px; padding: 6px 14px; font-size: .92rem; }
.btn--danger { color: var(--error); }
.btn--danger:hover { color: var(--error); border-color: var(--error); background: var(--error-bg); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 20; }
.header-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--text); text-decoration: none; margin-right: auto; min-height: 44px; }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand:hover { color: var(--accent-dark); }

.unit-toggle { display: inline-flex; border: 2px solid var(--accent); border-radius: 999px; padding: 2px; background: var(--surface); }
.unit-toggle button {
  min-height: 44px; min-width: 44px; padding: 6px 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--accent-dark); font-weight: 650; font-size: .95rem; cursor: pointer;
}
.unit-toggle button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.menu-toggle {
  display: none; min-height: 44px; min-width: 44px; padding: 8px 12px;
  border: 2px solid var(--border-strong); border-radius: var(--radius-small); background: var(--surface);
  font-weight: 650; cursor: pointer; align-items: center; gap: 6px;
}
.menu-toggle .bars { display: inline-block; width: 18px; height: 2px; background: currentColor; position: relative; }
.menu-toggle .bars::before, .menu-toggle .bars::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor; }
.menu-toggle .bars::before { top: -6px; }
.menu-toggle .bars::after { top: 6px; }

.site-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-list { display: flex; align-items: center; gap: 4px; }
.nav-list > li > a, .nav-sub-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 12px;
  border-radius: var(--radius-small); color: var(--text); text-decoration: none; font-weight: 600;
  background: none; border: 0; cursor: pointer;
}
.nav-list > li > a:hover, .nav-sub-toggle:hover { background: var(--surface-2); color: var(--accent-dark); }
.nav-list a[aria-current="page"] { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 2px; }
.nav-sub-toggle .caret { width: 10px; height: 10px; transition: transform .15s; }
.nav-sub-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }
.has-sub { position: relative; }
.sub-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 270px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.js .sub-menu:not(.is-open) { display: none; }
.sub-menu a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-small); color: var(--text); text-decoration: none; }
.sub-menu a:hover { background: var(--accent-soft); color: var(--accent-dark); }

@media (max-width: 859px) {
  .header-inner { gap: 8px; }
  .menu-toggle { display: inline-flex; order: 3; }
  .unit-toggle { order: 2; }
  .site-nav { order: 4; flex-basis: 100%; }
  .js .site-nav:not(.is-open) { display: none; }
  .nav-list { flex-direction: column; align-items: stretch; padding: 4px 0 8px; border-top: 1px solid var(--border); }
  .nav-list > li > a, .nav-sub-toggle { width: 100%; justify-content: space-between; }
  .sub-menu { position: static; box-shadow: none; border: 0; padding: 0 0 0 12px; min-width: 0; }
}
@media (max-width: 400px) {
  .header-inner { gap: 6px; }
  .brand { font-size: .98rem; gap: 6px; }
  .brand svg { display: none; }
  .unit-toggle button { padding: 6px 9px; font-size: .86rem; }
  .menu-toggle .menu-word { display: none; }
}

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: .92rem; margin: 18px 0 6px; }
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumb li + li::before { content: "/"; margin-right: 4px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb [aria-current] { color: var(--text); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; padding: 32px 0 40px; background: var(--surface); border-top: 1px solid var(--border); font-size: .95rem; }
.footer-nav ul { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.footer-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; color: var(--text); }
.footer-note { color: var(--muted); }
.footer-brand { font-weight: 700; margin-bottom: 8px; }

main { display: block; }
.section { padding: 40px 0; }
.section--tight { padding: 24px 0; }

/* Narrow phones: let the brand name wrap onto two lines so the unit toggle and menu stay on one row. */
@media (max-width: 600px) {
  .brand span { display: block; max-width: 8.6em; line-height: 1.15; font-size: .95rem; }
  .unit-toggle button { padding: 6px 7px; font-size: .84rem; }
  .menu-toggle .menu-word { display: none; }
}
