/* Infinite Script site chrome — the header and footer every Infinite Script
   site shares, pixel for pixel, with the theme switch in the header.

   Source of truth: infinite-services/src/assets/site-chrome.css. Infinite
   Servers, Infinite Gateway and Infinite Visitors keep verbatim copies; edit
   this one and run scripts/sync-shared-css.sh (--check to only compare).
   It needs theme.css (the tokens; their palette applies on .appbar and
   .site-footer even on a page with a palette of its own) and header-top.webp
   next to this file. Load it before the site's own stylesheet, which may then
   style what it puts in the header.

   Markup:
     <header class="appbar">              + appbar-plain: no stripe (white label)
       <a|div|h1 class="brand">
         <span class="logo"><img src="…" alt=""></span>
         <span class="brand-txt">
           <span class="wordmark">Infinite<strong>Name</strong></span>
           <span class="brand-sub">SUBTITLE</span>
         </span>
       </…>
       … the site's own controls …
       <div class="theme-switch" role="group" aria-label="Theme">
         <button type="button" aria-pressed="…" aria-label="Light theme"
                 title="Light theme"><svg aria-hidden="true">sun</svg></button>
         <button type="button" aria-pressed="…" aria-label="Dark theme"
                 title="Dark theme"><svg aria-hidden="true">moon</svg></button>
       </div>
     </header>
     <footer class="site-footer">
       <span class="foot-copy">© YEAR <a class="foot-link"
         href="https://www.infinitescript.com/">Infinite Script</a>. All rights
         reserved.</span>
       <span class="foot-love"><svg aria-hidden="true">code</svg> with
         <a class="foot-heart-link" aria-label="…" title="…"><svg
         class="foot-heart" aria-hidden="true">heart</svg></a></span>
     </footer>
   The pressed theme button is the scheme on screen. Icons: the same 24×24
   paths on every site (see infinite-services' Header.vue and Footer.vue). */

/* ---------- Common ---------- */
/* Set in full here, so nothing the page sets on body (line height, colour,
   box model) shows through. Font settings come from theme.css. */
.appbar,
.site-footer {
  box-sizing: border-box;
  line-height: normal;
  color: var(--text);
}
:is(.appbar, .site-footer) *,
:is(.appbar, .site-footer) *::before,
:is(.appbar, .site-footer) *::after {
  box-sizing: border-box;
}
:is(.appbar, .site-footer) :is(a, button, input, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Header ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  /* 3px more on top for the stripe, so it stays clear of the content. */
  padding: 13px var(--page-gutter) 10px;
  min-height: 64px;
  background: var(--appbar);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border-bottom: 1px solid var(--border-2);
  box-shadow: var(--shadow-sm);
}
/* The 3px, centred stripe from Infinite Script's Citrus Glow header. A layer
   of its own rather than part of the background: --shadow-sm's inset
   highlight paints over the background and would wash out its top row. */
.appbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: url("./header-top.webp") top center / auto 3px repeat-x;
  pointer-events: none;
}
.appbar-plain {
  padding-top: 10px;
}
.appbar-plain::before {
  content: none;
}

/* The brand pushes everything after it to the right edge. */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto 0 0;
  font: inherit;
  color: inherit;
  text-decoration: none;
}
.logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  padding: 6px;
  box-shadow: var(--shadow-sm);
}
.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.brand-txt {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.wordmark {
  font-size: 17px;
  letter-spacing: -0.01em;
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
}
.wordmark strong {
  font-weight: 700;
  margin-left: 1px;
}
.brand-sub {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--faint);
  white-space: nowrap;
}

/* The theme switch: both schemes on show, the one on screen pressed. Built
   like the segmented controls of the Infinite Script apps (Infinite Servers'
   .seg: the inset well, 12px corners, 8px buttons), 38px tall like the
   header's other controls. */
.theme-switch {
  display: flex;
  flex: none;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--inset);
}
.theme-switch button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--r-small);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition:
    color 0.16s,
    background 0.16s;
}
.theme-switch svg {
  width: 17px;
  height: 17px;
}
.theme-switch button:hover {
  color: var(--text);
}
.theme-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow:
    0 0 0 1px var(--border-2),
    var(--shadow-sm);
}

/* ---------- Footer ---------- */
.site-footer {
  margin: 0;
  padding: 24px var(--page-gutter) 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 12.5px;
  color: var(--faint);
}
.foot-love {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
}
.foot-link {
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid
    color-mix(in oklch, var(--accent-text), transparent 65%);
}
.foot-link:hover {
  border-bottom-color: var(--accent-text);
}
.foot-heart {
  color: var(--accent);

  @media (prefers-reduced-motion: no-preference) {
    animation: foot-heart 1.6s ease-in-out infinite;
  }
}
/* The beat is on the icon and the hover on the link, so neither overrides
   the other's transform. */
.foot-heart-link {
  display: inline-flex;
  line-height: 0;

  @media (prefers-reduced-motion: no-preference) {
    transition: transform 0.16s;
  }
}
.foot-heart-link:hover {
  transform: scale(1.18);
}
@keyframes foot-heart {
  0%,
  100% {
    transform: scale(1);
  }
  12% {
    transform: scale(1.22);
  }
  24% {
    transform: scale(1);
  }
  36% {
    transform: scale(1.16);
  }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 720px) {
  .brand-sub {
    display: none;
  }
  .site-footer {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
}
