/* ─────────────────────────────────────────────────────────────────────────
   Site chrome — header and footer.
   ─────────────────────────────────────────────────────────────────────────
   The markup for these comes from one module (routes/chrome.ts), so their
   styles come from one file. They used to be split across blog.css and
   pages.css, and because the blog only loaded blog.css, every article showed
   an unstyled mega-menu and a footer collapsed into a bullet list.

   Loaded last by every layout, so anything it declares wins.
   ───────────────────────────────────────────────────────────────────────── */

/* ── header ────────────────────────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  /* Matches the page measure. The bar is not full-bleed because the header
     has no inner wrapper to constrain — the footer does, and is. */
  max-width: 1080px;
  margin: 0 auto;
}

.site-header > * {
  flex: 0 0 auto;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.logo__word {
  font-family: var(--font-logo);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
}

/* The gradient pill from v1. Composed in markup rather than shipped as an
   image, so it stays sharp and recolours with the theme. */
.logo__pro {
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: 9.5px;
  line-height: 1;
  background: linear-gradient(90deg, var(--brand), var(--brand-deep));
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  font-weight: 550;
}

.site-nav a {
  text-decoration: none;
  color: var(--text-muted);
}

.site-nav a:hover {
  color: var(--text);
}

.cta {
  display: inline-block;
  background: var(--brand);
  color: var(--on-brand) !important;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 650;
  text-decoration: none;
}

.cta:hover {
  background: #e6c200;
}

/* ── dropdowns ─────────────────────────────────────────────────────────── */
/* CSS-only: :hover for pointers, :focus-within for keyboards. A nav that
   needs JavaScript to open is a nav a crawler cannot follow and a keyboard
   user cannot reach. */

.drop {
  position: relative;
}

.drop__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  color: var(--text-muted);
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
}

.drop:hover .drop__btn,
.drop:focus-within .drop__btn {
  color: var(--text);
}

.drop__chev {
  width: 6px;
  height: 6px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s;
}

.drop:hover .drop__chev,
.drop:focus-within .drop__chev {
  transform: translateY(1px) rotate(-135deg);
}

.drop__panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg, 16px);
  box-shadow: 0 12px 40px rgba(60, 50, 20, 0.14);
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s, transform 0.14s, visibility 0.14s;
  z-index: 40;
}

.drop:hover .drop__panel,
.drop:focus-within .drop__panel {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* A gap between button and panel would close the menu mid-travel. */
.drop__panel::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

.mega {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 26px;
  max-width: min(92vw, 880px);
}

.drop__panel--list {
  width: min(92vw, 320px);
}

.mega__label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.mega__item {
  display: block;
  padding: 8px 10px;
  border-radius: var(--r-sm, 8px);
  text-decoration: none;
  transition: background 0.12s;
}

.mega__item:hover {
  background: var(--surface-alt);
}

.mega__name {
  display: block;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 2px;
}

.mega__badge {
  display: inline-block;
  font-style: normal;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: var(--brand);
  color: var(--on-brand);
  padding: 1px 6px;
  border-radius: 999px;
  vertical-align: 1px;
}

.mega__desc {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── footer ────────────────────────────────────────────────────────────── */

.site-footer {
  display: block;
  margin-top: 88px;
  padding: 56px 24px 32px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
}

/* The bar is full-bleed; its contents keep the page measure. */
.foot,
.foot__legal {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.foot {
  display: grid;
  grid-template-columns: 1.7fr repeat(4, 1fr);
  gap: 40px 32px;
  align-items: start;
}

.foot__brand .logo {
  margin-bottom: 16px;
}

.foot__tagline {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0 0 16px;
  max-width: 40ch;
}

.foot__support {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 18px;
}

.foot__support a {
  color: var(--brand-deep);
  font-weight: 600;
}

/* ── social ── */

.foot__social {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0 0 20px;
}

.foot__social a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background 0.14s, color 0.14s, border-color 0.14s, transform 0.14s;
}

.foot__social a:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  transform: translateY(-2px);
}

.foot__lang {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  background: var(--surface);
  padding: 9px 16px;
  text-decoration: none;
  color: var(--text);
}

.foot__lang:hover {
  border-color: var(--brand);
}

/* ── columns ── */

.foot__head {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 14px;
}

.foot__head--gap {
  margin-top: 28px;
}

.foot__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.foot__col li {
  margin-bottom: 9px;
}

.foot__col a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.45;
  transition: color 0.12s;
}

.foot__col a:hover {
  color: var(--text);
}

.foot__legal {
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ── responsive ────────────────────────────────────────────────────────── */

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

  .foot__brand {
    grid-column: 1 / -1;
    max-width: 560px;
  }
}

@media (max-width: 900px) {
  /* One column: three side by side inside a 320px panel is unreadable. */
  .mega {
    grid-template-columns: 1fr;
    max-width: min(92vw, 320px);
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 12px 16px;
    gap: 10px;
  }

  .site-nav {
    gap: 14px;
    font-size: 13.5px;
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .site-nav .cta {
    padding: 7px 13px;
    font-size: 13.5px;
  }

  /* Dropdowns become plain expandable groups — a hover menu is unusable on
     touch, and an absolutely positioned panel would overflow the viewport. */
  .drop__panel {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border: 0;
    padding: 0;
    display: none;
  }

  .drop:focus-within .drop__panel {
    display: block;
    transform: none;
    padding: 10px 0;
  }

  .site-footer {
    margin-top: 56px;
    padding: 36px 16px 24px;
  }

  .foot {
    grid-template-columns: 1fr 1fr;
    gap: 28px 20px;
  }

  .foot__brand {
    grid-column: 1 / -1;
  }

  /* A 36px target is below the comfortable minimum for touch. */
  .foot__social a {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 380px) {
  .site-nav {
    font-size: 12.5px;
    gap: 10px;
  }

  .foot {
    grid-template-columns: 1fr;
  }
}
