/* Furniture shared by both pages: the header bar, the language menu, the theme
   toggle and the footer — the markup lives in web/template/partials/, so the
   styling cannot live in one page's stylesheet.
   Loaded after tokens.css and before the page's own sheet. Colours come from
   the tokens; nothing here writes one. */

[hidden] { display: none !important; }

/* The partials wrap their contents in .wrap, so the measure belongs here too. */
.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.skip-link {
  position: absolute;
  z-index: 100;
  top: var(--space-2);
  left: var(--space-4);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--fg);
  font-size: 14px;
  text-decoration: none;
  transform: translateY(-250%);
  transition: transform 0.15s ease;
}

.skip-link:focus { transform: translateY(0); }

/* ---------- header ---------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}

.site-head-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 60px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  font-family: var(--font-mono);
  color: var(--accent);
}

.site-nav { display: flex; gap: var(--space-1); }

.nav-link {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg-dim);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover { background: var(--bg-sunken); color: var(--fg); }

.head-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.theme-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--fg-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.theme-btn:hover { background: var(--bg-sunken); color: var(--fg); }

.theme-btn .ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Only the icon for the active mode is shown; the other two stay in the DOM
   so switching never waits on a request. */
.theme-btn .ico { display: none; }
.theme-btn[data-mode='system'] .ico-system,
.theme-btn[data-mode='light'] .ico-light,
.theme-btn[data-mode='dark'] .ico-dark { display: block; }

/* ---------- language menu (markup generated by the build) ---------- */

.langbar { position: relative; }

.langbar-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--fg-dim);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.langbar-btn::after {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.langbar-btn:hover { background: var(--bg-sunken); color: var(--fg); }

.langbar-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  max-height: 60vh;
  overflow-y: auto;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow);
}

.langbar-item {
  display: block;
  padding: 7px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--fg-dim);
  font-size: 14px;
  text-decoration: none;
}

.langbar-item:hover { background: var(--bg-sunken); color: var(--fg); }

.langbar-item.is-current {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- footer ---------- */

.site-foot {
  margin-top: var(--space-6);
  border-top: 1px solid var(--line);
  background: var(--bg-raised);
  padding-block: var(--space-5);
  font-size: 13px;
}

.site-foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}

.foot-privacy { margin: 0; color: var(--fg-faint); }

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-links a { color: var(--fg-dim); text-decoration: none; }

.foot-links a:hover { color: var(--accent); text-decoration: underline; }

/* Keyboard focus on the furniture, in case the page sheet has no global rule. */
.skip-link:focus-visible,
.brand:focus-visible,
.nav-link:focus-visible,
.theme-btn:focus-visible,
.langbar-btn:focus-visible,
.langbar-item:focus-visible,
.foot-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
  .wrap { padding-inline: var(--space-4); }

  .site-head-inner { gap: var(--space-2); min-height: 56px; }

  /* Some language names are long; the button must not push the row apart. */
  .langbar-btn > [data-langbar-current] {
    display: inline-block;
    max-width: 9ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-foot-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link,
  .nav-link,
  .theme-btn,
  .langbar-btn { transition-duration: 0.01ms; }
}
