/* The public header and footer. Markup: scripts/lib/site-chrome.mjs and, by hand, the header in
   site/generator/index.html. Boards: SiteHeader*, SiteFooter* (docs/design/redesign-2026-10/).
   No script: the phone menu and the phone "QR code types" list are <details>.
   >= 721px: brand, links, Sign in and Start free on one row, the offline status last.
   <= 720px: brand, Sign in, Start free and a round menu button; the links are in the sheet it opens, and below
   375px Sign in moves into the sheet too (the bar cannot hold it);
   the offline status takes its own row. Sticky and translucent (DESIGN.md R14), except on the
   generator, whose own sticky tabs start at the top of the window. */

:root {
  /* Bar plus its 1px rule: the sticky header's height, and the scroll offset below it. */
  --site-header-h: 65px;
}

html {
  scroll-padding-block-start: calc(var(--site-header-h) + var(--space-4));
}

html:has(#inspector) {
  scroll-padding-block-start: 0;
}

.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--color-bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-block-end: 1px solid var(--color-line);
}

body:has(#inspector) .site-header {
  position: relative;
}

.site-header__inner {
  box-sizing: content-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  max-inline-size: var(--container);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 40px);
  min-block-size: calc(var(--site-header-h) - 1px);
}

/* brand-mark sets its gap and tracking inline, so the board values need !important. */
.site-header__brand,
.site-footer__mark {
  display: flex;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: normal;
  color: var(--color-text);
  text-decoration: none;
}

.site-header__brand {
  flex: none;
  align-items: center;
}

.site-header__brand:hover,
.site-footer__mark:hover {
  text-decoration: none;
}

.site-header__brand brand-mark,
.site-footer__mark brand-mark {
  gap: 10px !important;
  letter-spacing: -0.02em !important;
}

.site-header__brand brand-mark svg,
.site-footer__mark brand-mark svg {
  flex: none;
  inline-size: 26px;
  block-size: 26px;
}

.site-nav {
  flex: none;
  min-inline-size: 0;
}

.site-nav__list,
.site-menu__list,
.site-footer__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav__list a,
.site-menu__list a {
  line-height: normal;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--dur-hover) var(--ease-in-out);
}

/* 20px of text with a 44px hit area around it. */
.site-nav__list a {
  position: relative;
  display: block;
  font-size: 15px;
  font-weight: var(--weight-medium);
}

.site-nav__list a::before {
  content: "";
  position: absolute;
  inset: -12px -8px;
}

.site-nav__list a:hover,
.site-nav__list a[aria-current],
.site-menu__list a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.site-header__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
}

.site-header__actions .btn {
  min-block-size: 0;
  gap: 0;
  border: 0;
  line-height: normal;
  text-decoration: none;
  white-space: nowrap;
}

/* Sign in is a quiet link, not a button: no fill, no lift. */
.site-header__actions .site-nav__signin {
  padding: 10px 12px;
  font-size: 15px;
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
}

.site-header__actions .site-nav__signin:hover {
  color: var(--color-text);
  background: transparent;
  transform: none;
}

.site-header__actions .site-nav__start {
  min-block-size: 42px;
  padding: 0 var(--space-4);
  font-size: 14.5px;
}

/* The generator's offline status. A margin, not a gap, so an empty slot takes no room. */
.site-header__inner > .gen-pwa {
  margin-inline-start: var(--space-4);
}

.site-header__inner > .gen-pwa:empty {
  display: none;
}

.site-menu {
  display: none;
}

.site-menu__panel {
  display: none;
}

.site-menu__summary {
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: var(--touch-min);
  block-size: var(--touch-min);
  padding: 0;
  color: var(--color-text);
  list-style: none;
  cursor: pointer;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  user-select: none;
}

.site-menu__summary::-webkit-details-marker {
  display: none;
}

/* The menu icon while closed, the close icon while open. */
.site-menu__summary svg {
  display: block;
}

.site-menu__summary .site-menu__close,
.site-menu[open] .site-menu__summary .site-menu__open {
  display: none;
}

.site-menu[open] .site-menu__summary .site-menu__close {
  display: block;
}

.site-menu__list a {
  display: flex;
  align-items: center;
  min-block-size: 50px;
  font-size: 17px;
  font-weight: var(--weight-semibold);
}

/* A 1px rule above every row but the first. */
.site-menu__list li + li a {
  min-block-size: 51px;
  border-block-start: 1px solid var(--color-line);
}

/* The current page: ink, with the highlighter underline. */
.site-menu__list a[aria-current] {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-highlight);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

@media (max-width: 720px) {
  .site-nav {
    display: none;
  }
  /* Sign in stays in the bar at phone widths, tightened so brand, Sign in, Start free and the menu button fit one row from
     375px up. Below that (the 374px block at the end of this rule set) it moves back into the sheet, where it is also
     written, so it is never missing. The sheet's copy is hidden while the bar's shows, so it is not said twice. */
  .site-header__inner {
    gap: var(--space-2);
  }
  .site-header__actions {
    gap: 0;
  }
  .site-header__actions .site-nav__signin {
    padding: 10px 4px;
    font-size: 14.5px;
  }
  .site-header__actions .site-nav__start {
    padding-inline: var(--space-3);
  }
  .site-menu__list li:has(> .site-menu__signin) {
    display: none;
  }
  .site-menu {
    display: block;
  }
  .site-header:has(.site-menu[open]) .site-menu__panel {
    display: block;
    padding: var(--space-1) clamp(16px, 4vw, 40px) var(--space-4);
    background: var(--color-surface);
    border-block-start: 1px solid var(--color-line);
  }
  /* The offline status wraps to its own row; the first row keeps the bar's height. */
  .site-header__inner {
    flex-wrap: wrap;
    row-gap: 0;
  }
  .site-header__inner > .gen-pwa {
    flex-basis: 100%;
    margin: 0;
    padding-block-end: var(--space-1);
  }
}

/* Narrower than any common phone: the bar cannot hold four things in one row, so Sign in is the sheet's again. */
@media (max-width: 374px) {
  .site-header__actions .site-nav__signin {
    display: none;
  }
  .site-menu__list li:has(> .site-menu__signin) {
    display: list-item;
  }
}

/* Footer: brand and nav.json columns, the QR code types, a base row; width and gutter of .container.
   No margin of its own: the generator and SEO pages end with no bottom padding, so they add it. */
body:has(#inspector) .site-footer {
  margin-block-start: var(--space-12);
}

.site-footer {
  --site-gutter: clamp(16px, 4vw, 40px);
  background: var(--color-surface);
  border-block-start: 1px solid var(--color-line);
  font-size: 15px;
}

.site-footer a {
  color: var(--color-text-muted);
  transition: color var(--dur-hover) var(--ease-in-out);
}

.site-footer a:hover,
.site-footer a.site-footer__mark {
  color: var(--color-text);
}

.site-footer__top,
.site-footer__types,
.site-footer__base {
  box-sizing: content-box;
  max-inline-size: var(--container);
  margin-inline: auto;
  padding-inline: var(--site-gutter);
}

.site-footer__top {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-10);
  padding-block: 56px var(--space-10);
}

.site-footer__brand {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.site-footer__mark {
  align-self: flex-start;
}

.site-footer__tagline {
  margin: 0;
  line-height: normal;
  color: var(--color-text-muted);
}

.site-footer__status {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: 24px;
  margin-block: var(--space-2) -2px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: normal;
}

/* Grey, always: the page cannot know the live state (OBS-16). */
.site-footer__status-dot {
  flex: none;
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

.site-footer__cols {
  grid-column: span 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-10);
  align-items: start;
}

.site-footer__col,
.site-footer__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer__heading {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
  line-height: normal;
  color: var(--color-text);
}

.site-footer__list li {
  display: flex;
  flex-direction: column;
}

/* 24px hit area around 20px of text; the negative margin keeps the board's rhythm. */
.site-footer__list a,
.site-footer__types a {
  display: inline-flex;
  align-items: center;
  min-block-size: 24px;
  margin-block: -2px;
  line-height: normal;
}

.site-footer__types--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding-block-end: var(--space-10);
}

.site-footer__types--fold {
  display: none;
}

.site-footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-5) var(--space-8);
  border-block-start: 1px solid var(--color-line);
  font-size: 13px;
  line-height: normal;
  color: var(--color-text-muted);
}

@media (max-width: 1023px) {
  .site-footer__brand,
  .site-footer__cols {
    grid-column: 1 / -1;
  }
}

@media (min-width: 721px) and (max-width: 1023px) {
  .site-footer__top {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-8) var(--space-6);
  }
  .site-footer__cols {
    gap: var(--space-8) var(--space-6);
  }
}

@media (max-width: 720px) {
  .site-footer__top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px var(--space-5);
    padding-block: var(--space-10) 28px;
  }
  .site-footer__cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px var(--space-5);
  }
  .site-footer__types--row {
    display: none;
  }
  .site-footer__types--fold {
    display: block;
    padding-block-end: var(--space-6);
  }
  .site-footer__more summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-block-size: 48px;
    font-size: 15px;
    font-weight: var(--weight-semibold);
    line-height: normal;
    color: var(--color-text);
    list-style: none;
    cursor: pointer;
    border-block: 1px solid var(--color-line);
  }
  .site-footer__more summary::-webkit-details-marker {
    display: none;
  }
  .site-footer__count {
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: var(--weight-medium);
    line-height: normal;
    color: var(--color-text-muted);
  }
  .site-footer__chev {
    flex: none;
    transition: transform var(--dur-ui) var(--ease-in-out);
  }
  .site-footer__more[open] .site-footer__chev {
    transform: rotate(180deg);
  }
  .site-footer__more nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-1) var(--space-5);
    padding: var(--space-3) 0 var(--space-1);
  }
}
