/*
 * The page shell from core/base.html, as the design system's Header: a band whose 64px top
 * row holds the brand marks and the nav, with a hairline under the row. Under the hairline
 * the band is 32px, half the design system's (96px in all, decided 2026-11-04).
 */

/* Space Grotesk (SIL OFL 1.1, fonts/space-grotesk-OFL.txt), cut to "watsof" at weight 500 */
@font-face {
  font-family: 'Space Grotesk Watsof';
  src: url("../fonts/space-grotesk-watsof.1ae23bda01fe.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@layer layout {
  .page-header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--size-header-band);
    background: var(--band);
  }

  .page-header__row {
    position: relative;
    display: flex;
    align-items: flex-end;
    height: var(--size-header-row);
    padding: 0 var(--space-8) 0 var(--space-6);
  }

  /* The hairline is its own bottom layer, so the current tab's block covers it. */
  .page-header__row::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    z-index: 0;
    height: var(--stroke-hairline);
    background: color-mix(in srgb, var(--rule) 60%, transparent);
    pointer-events: none;
  }

  /* The way back (core/base.html header_back): knowei.nl's arrow, as the scrollbar's, left
     of the logo, level with the wordmark's low letters (its bottom 11px; only the k's stem
     rises above them), not with the whole mark. Set by eye: a little over the letters'
     geometric middle, which reads low. */
  .page-header__back {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin: 0 var(--space-3) 6px calc(-1 * var(--space-2));
    color: var(--color-70);
    transition: color var(--kn-dur) var(--kn-ease);
  }

  .page-header__back:hover {
    color: var(--color-90);
  }

  .page-header__back svg {
    width: 18px;
    height: 18px;
  }

  .page-header__brand,
  .page-header__icon {
    margin-bottom: var(--space-3);
    color: var(--color-70);
  }

  .page-header__nav {
    display: flex;
    flex: 1;
    align-self: stretch;
    min-width: 0; /* lets the tabs shrink (tabs.css) */
    justify-content: center;
    margin: 0 var(--space-8);
  }

  /*
   * The test-version warning, in the 32px under the hairline, starting where the logo does:
   * the row's padding plus the way back's place (its 32px and its margins, as above).
   */
  .page-header__warning {
    display: flex;
    align-items: center;
    height: calc(var(--size-header-band) - var(--size-header-row));
    padding-left: calc(var(--space-6) + 32px - var(--space-2) + var(--space-3));
    font: var(--type-body-sm);
    font-weight: 700;
    color: var(--text);
  }

  /*
   * In the row, so the tabs centre in the space left of it; the negative margin centres it
   * on the hairline, and its band-coloured padding cuts a gap in the line.
   */
  .page-header__xi {
    position: relative;
    z-index: 1;
    margin: 0 var(--space-12) -15px 0;
    padding-inline: var(--space-3);
    color: var(--text-muted);
    background: var(--band);
  }

  /*
   * The page footer (core/includes/footer.html): a thin band of small links in two
   * groups: icons and pages on the left; Uitloggen, the credit and the version on the right. One 34px row at the page's 1240px minimum width; the
   * groups wrap to more rows rather than ever scrolling sideways.
   */
  .page-footer {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-8);
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-8) var(--space-2) var(--space-6);
    font: var(--type-body-sm);
    color: var(--text);
    background: var(--band);
  }

  .page-footer__group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-6);
    align-items: center;
  }

  .page-footer a {
    text-decoration: none;
    transition: color var(--kn-dur-fast) var(--kn-ease);
  }

  .page-footer a:hover,
  .page-footer__logout button:hover {
    color: var(--color-90);
  }

  /* Uitloggen is a form button (a POST) that looks like the footer's links. */
  .page-footer__logout button {
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    background: none;
    border: 0;
    transition: color var(--kn-dur-fast) var(--kn-ease);
  }

  /* The dev switch, very small and dashed as the dev controls are (flow/css/dev.css), so it
     never passes for part of the design; filled while ?dev is on. */
  .page-footer__dev {
    padding: 0 var(--space-2);
    font: 400 10px/14px var(--font-sans);
    color: var(--text-muted);
    text-transform: lowercase;
    outline: 1px dashed currentColor;
    outline-offset: 1px;
  }

  .page-footer__dev--on {
    color: var(--color-10);
    background: var(--color-70);
    outline-color: var(--color-70);
  }

  .page-footer__dev--on:hover {
    color: var(--color-10);
    background: var(--color-90);
  }

  .page-footer__version {
    color: var(--text-muted);
  }

  .page-footer__icon {
    display: block;
  }

  /*
   * The Watsof credit in Watsof's wordmark style (watsof.net's header): Space Grotesk 500,
   * tight tracking, lowercase. The font file holds only the letters of "watsof".
   */
  .page-footer__watsof {
    font-family: 'Space Grotesk Watsof', var(--font-sans);
    font-weight: 500;
    font-size: 15px;
    letter-spacing: -0.025em;
  }

  .page-footer__icon svg {
    width: 16px;
    height: 16px;
  }

  /* The email icon: the envelope, and on a click a clipboard with a check in its place for a
     few seconds (core/js/footer.js), the two crossfading in one grid cell. */
  .page-footer__mail {
    display: grid;
  }

  .page-footer__mail svg {
    grid-area: 1 / 1;
    transition: opacity var(--kn-dur-fast) var(--kn-ease);
  }

  .page-footer__mail-copied,
  .page-footer__mail--copied .page-footer__mail-envelope {
    opacity: 0;
  }

  .page-footer__mail--copied .page-footer__mail-copied {
    opacity: 1;
  }

  /* Says "gekopieerd" to a screen reader only. */
  .page-footer__status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /*
   * Brand marks are single-colour masks (PROJECT.md §7.1): the element paints its text
   * colour through the mask, so a token sets the colour.
   */
  .brand-mark {
    display: block;
    background-color: currentColor;
    mask-position: center;
    mask-size: contain;
    mask-repeat: no-repeat;
  }

  .brand-mark--wordmark {
    width: 120px;
    height: 37px;
    mask-image: url("../img/knowei-wordmark.25f1a2823ff9.svg");
  }

  .brand-mark--xi {
    width: 179px;
    height: 29px;
    mask-image: url("../img/xi-mark.eacc1a55ced7.webp");
  }

  .brand-mark--icon {
    width: 32px;
    height: 38px;
    mask-image: url("../img/knowei-icon.333bfd2c1911.svg");
  }

  /*
   * A small screen, as in narrow-notice.css (the pages that have a small-screen layout set the viewport
   * meta to device-width): the header down to the way back and the wordmark, and no 1240px
   * minimum width.
   */
  @media (width < 1024px), (orientation: portrait), (max-device-width: 1023px) {
    body {
      min-width: 0;
    }

    .page-header__row {
      padding-inline: var(--space-4);
    }

    .page-header__nav,
    .page-header__xi,
    .page-header__icon {
      display: none;
    }

    .page-header__brand {
      margin-right: auto;
    }

    .page-header__warning {
      padding-left: calc(var(--space-4) + 32px - var(--space-2) + var(--space-3));
    }

    .page-footer {
      padding-inline: var(--space-4);
    }
  }
}
