/* =========================================================
   site.css — fresh start, close to Pico v2 defaults.
   Load AFTER pico.min.css. Override only what must change.

   Page structure this expects (Pico's intended landmarks):

     <body>
       <header class="site-header">      full-bleed colored band
         <nav class="container">         aligns with main content
       </header>
       <main class="container">          equal side margins
       <footer>
         TODO
       </footer>

   Why header is a SIBLING of main, not inside it: a child's
   background can't escape its parent's padding box, so a
   header inside <main class="container"> can never go edge to
   edge without negative-margin/100vw hacks. As a direct child
   of body it's full-bleed naturally, and Pico's own
   `body>header` rule treats it as a page landmark.
   ========================================================= */

:root {
  /* Tokens — edit here */
  --header-bg: #1B4353;
  /*--header-bg: #2892D7;*/            /* dark blue, edge to edge */
  --header-link: #CDE6F4;          /* off-white — readable on dark */
  --header-link-hover: #ffffff;
  --header-color: #faffe3;          /* off-white — readable on dark */
  --brand-height: 2.25rem;         /* banner grows with the image */
  --brand-gap: 0.5rem;             /* extra space right of the brand li */
}

/* Pico gives body-level <header> padding-block (1rem). Zero it:
   the nav's own li spacing (--pico-nav-element-spacing-vertical,
   Pico default 1rem) provides the vertical rhythm inside the
   band, so we don't want a second layer of padding stacking. */
header.site-header {
  --pico-color: var(--header-color);
  padding-block: 0;
  background-color: var(--header-bg);
  color: var(--header-color);
}

/* Link colors on the dark band. Pico paints links through
   internal vars (--pico-color / --pico-text-decoration) and
   its :hover flips them to primary blue + underline — unreadable
   on dark blue, and the underline snaps on instantly (flash).
   Own the vars and the concrete properties in both states,
   transition color only. */
header.site-header nav a {
  --pico-color: var(--header-link);
  --pico-text-decoration: none;
  --pico-underline: transparent;
  color: var(--header-link);
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

header.site-header nav a:hover,
header.site-header nav a:focus-visible {
  --pico-color: var(--header-link-hover);
  --pico-text-decoration: none;
  color: var(--header-link-hover);
  text-decoration: none;
}

/* Brand image: fixed height, auto width, no radius.
   Pico has no nav-img rule, so without this it renders at
   natural size. */
header.site-header nav img.brand {
  height: var(--brand-height);
  width: auto;
  display: block;
  border-radius: 0;
}

/* Pico lays li contents out inline; an inline-block <a> around
   the image baseline-aligns and leaves a descent strut below
   (image sits above center, dead space under). Flex centers
   everything on the cross axis. */
header.site-header nav li {
  display: flex;
  align-items: center;
}

/* Current-page link: Pico's default indicator is underline +
   primary color; primary is unreadable on the dark band, so
   keep the underline in the link color (closest to defaults). */
header.site-header nav a[aria-current="page"] {
  --pico-text-decoration: underline;
  --pico-underline: currentColor;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: 4px;
}

/* Extra breathing room after the brand item: class on the li +
   margin-inline-end. Not an empty <li> (phantom list item for
   screen readers) and not li padding (Pico's li padding feeds
   its hover-box alignment math; margin stays clear of it).
   inline-end = "right of brand" in LTR and in RTL. */
header.site-header nav li.brand-item {
  margin-inline-end: var(--brand-gap);
}

/* =========================================================
   Footer: full-bleed band, sticky to viewport bottom when
   content is short, flows after content when it's long.

   Mechanism: body becomes a flex column with min-height of
   the viewport; main grows to absorb leftover space. The
   footer is NEVER fixed/absolute — it's the last flow item,
   so long content simply pushes it down (no overlap).
   ========================================================= */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;   /* mobile-correct viewport, where supported */
}

body > header,
body > footer {
  flex: none;           /* bands keep their natural height */
}

body > main {
  flex: 1 0 auto;       /* absorb leftover space → footer pinned down */
}

:root {
  /* Footer tokens — mirror the header's values by default but
     are independent knobs so they can diverge later. */
  --footer-bg: #1B4353;            /* dark blue, edge to edge */
  --footer-link: #CDE6F4;          /* off-white — readable on dark */
  --footer-color: #a9abcd;        /* muted text (copyright etc.) */
  --footer-link-hover: #ffffff;
}

footer.site-footer {
  --pico-color: var(--footer-color);
  background-color: var(--footer-bg);
  color: var(--footer-color);
  /* Keeps Pico's default body>footer padding-block (1rem) —
     unlike the header, the footer has no nav li spacing of its
     own, so the default band padding is exactly right. */
}

/* Three zones: left / center / right.
   1fr auto 1fr keeps the middle truly centered no matter how
   wide the side columns get; sides align outward. */
footer.site-footer .footer-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: start;
}

footer.site-footer .zone-center { text-align: center; }
footer.site-footer .zone-right  { text-align: end; }

/* Stack to one column on narrow screens (Pico's first breakpoint) */
@media (max-width: 576px) {
  footer.site-footer .footer-grid {
    grid-template-columns: 1fr;
  }
  footer.site-footer .zone-center,
  footer.site-footer .zone-right {
    text-align: start;
  }
}

/* Link columns: plain stacked lists, no bullets/indent.
   The reset must hit the LI's too: Pico sets `ul li {
   list-style: square }` directly on items, which beats
   inheriting `none` from the ul. With padding 0 and outside
   marker position, a surviving bullet renders just outside the
   li's start edge — in the right-aligned zone that's a stray
   square jammed against the middle column. */
footer.site-footer ul,
footer.site-footer ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

footer.site-footer li {
  list-style: none;
}

footer.site-footer ul.links li {
  margin-block: 0.25rem;
}

/* Link colors on the dark band — same own-the-vars pattern as
   the header (Pico's primary blue is unreadable on indigo, and
   its hover underline snaps on instantly). */
footer.site-footer a {
  --pico-color: var(--footer-link);
  --pico-text-decoration: none;
  --pico-underline: transparent;
  color: var(--footer-link);
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

footer.site-footer a:hover,
footer.site-footer a:focus-visible {
  --pico-color: var(--footer-link-hover);
  --pico-text-decoration: none;
  color: var(--footer-link-hover);
  text-decoration: none;
}

/* Small print (copyright/author) stays muted but readable */
footer.site-footer small {
  color: var(--footer-color);
}
