/* Site header (brand, nav, language, theme) and footer. */

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-on);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.nav {
  display: flex;
  gap: var(--sp-1);
  margin-left: auto;
}

.nav a {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-small);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--t-fast), background-color var(--t-fast);
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-hi);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.select,
.icon-btn {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-small);
}

.select {
  padding: 0 var(--sp-2);
}

.icon-btn {
  width: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--border-strong);
}

/* Phones: the nav drops to its own scrollable row under the brand */
@media (max-width: 720px) {
  .site-header .wrap {
    flex-wrap: wrap;
    row-gap: 0;
  }

  .header-tools {
    margin-left: auto;
  }

  .nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    padding-bottom: var(--sp-2);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav a {
    white-space: nowrap;
  }
}

/* Very narrow phones: keep brand mark + tools on one line */
@media (max-width: 380px) {
  .brand-name {
    display: none;
  }

  .nav a {
    padding-inline: var(--sp-2);
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--sp-6);
  color: var(--text-2);
  font-size: var(--fs-small);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-4);
}

.site-footer a {
  color: var(--text-2);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
}

.footer-nav a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
}

.footer-nav a:hover {
  color: var(--text);
}
