/*
 * chrome.css — Sitewide chrome (v0.11.13).
 *
 * INVARIANT (test-enforced): this file MUST NOT contain any
 * `body[data-*]` selectors. Page-specific styles live in
 * countdown.css / legal.css / landing.css. Chrome is identical
 * across every page; only the content between header and footer
 * varies.
 *
 * Loaded by every page in the same order:
 *     tokens.css  →  chrome.css  →  (page-specific).css
 *
 * Contains:
 *   1. Self-hosted Poppins @font-face declarations
 *   2. Universal html + body defaults
 *   3. Sitewide a11y baseline (:focus-visible)
 *   4. Skip-to-content link
 *   5. Top-nav (with cart + mobile menu)
 *   6. Footer
 *   7. sr-only utility
 *   8. Logo customizer overlay (used by both countdown + landingpage)
 *   9. Print stylesheet
 */

/* === Self-hosted Poppins ====================================================
 * Five weights covering every page (300/400/500/600/700). Latin subset only —
 * unicode-range U+0000-00FF + symbols. Covers German umlauts (ä/ö/ü/ß), em-
 * dashes, smart quotes, currency symbols.
 *
 * Removes Google Fonts dependency (LG München I 2022 case-law risk + IP leak).
 */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/fonts/poppins-300-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/poppins-400-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/poppins-500-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/poppins-600-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/poppins-700-latin.woff2') format('woff2');
}

/* === Universal box-sizing reset ============================================
 * v0.11.13: sitewide `box-sizing: border-box`. Previously landingpage had
 * this from its extracted inline `* { box-sizing: border-box }` reset, but
 * other pages defaulted to content-box. The visible effect: a footer anchor
 * with `min-height: 44px` and `padding: 12px 16px` rendered at 44px on
 * landingpage (padding inside) but 68px on countdown + legal (padding added
 * on top). After the v0.11.13 chrome refactor, the only way to make footer
 * heights truly identical is universal box-sizing. Modern best practice
 * regardless — adopting it everywhere is fine. */
*, *::before, *::after {
  box-sizing: border-box;
}

/* === Universal html + body defaults ========================================= */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-sans);
  color: var(--navy);
  background: var(--white);
  margin: 0;
  padding-top: var(--nav-height);
  font-size: 17px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Universal main padding-top — every page using <main> gets identical
 * breathing room between nav and content. Pages without <main> (landingpage
 * uses <section> directly) are unaffected. */
main {
  padding-top: 1.5rem;
}

/* Universal a11y focus baseline (keyboard-only). */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Chrome-friendly focus inside nav + footer: inset outline to avoid the
 * 3px halo leaking above the wordmark or footer links (v0.11.12). */
nav.top-nav a:focus-visible,
nav.top-nav button:focus-visible,
footer.legal-footer a:focus-visible,
footer.legal-footer button:focus-visible {
  outline-offset: 0;
}

/* Alpine x-cloak — hide until hydrated (cart-badge flash protection). */
[x-cloak] { display: none !important; }

/* === Skip-to-content link (a11y) ===========================================
 * First focusable element on every page. Hidden until focused, then visible
 * top-left as a navy pill (white-on-navy ~12:1, well above WCAG AA).
 */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--navy);
  color: var(--white);
  padding: 0.6rem 1rem;
  border-radius: 0 0 4px 0;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 10000;
  transition: top 0.15s;
}
.skip-link:focus-visible {
  top: 0;
  outline: 2px solid var(--white);
  outline-offset: -4px;
}

/* === Top-nav (sitewide canonical) ==========================================
 * Fixed, blurred white background with bottom border. Brand left, links + right
 * group flush right. z-index 100 — below overlays (cart drawer 201, banner
 * 1000) but above content.
 */
nav.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1.25rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}

.nav-brand {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--navy);
  text-decoration: none;
}
.nav-brand span { color: var(--blue); }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  /* v0.11.13: explicit margin reset. Browsers apply default 1em top + bottom
   * margin to <ul>, which would inflate nav height by ~32px on any page that
   * lacks a global `* { margin: 0 }` reset (landingpage had one inline; the
   * other pages didn't, which is why nav was taller on countdown + legal). */
  margin: 0 0 0 auto;
  padding: 0;
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  text-decoration: none;
  transition: color 0.3s;
}
.nav-links a:hover { color: var(--blue); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--navy);
  margin: 4px 0;
  transition: all 0.3s;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
@media (min-width: 641px) {
  .nav-right { margin-left: 2rem; }
}

.nav-cart {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray);
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}
.nav-cart:hover { color: var(--blue); }
.nav-cart:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}
.nav-cart--filled { color: var(--navy); }
.nav-cart-badge {
  position: absolute;
  top: 2px;
  right: 0;
  background: var(--blue);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
  box-shadow: 0 0 0 2px var(--white);
  pointer-events: none;
  animation: badge-pop 0.18s ease-out;
}
@keyframes badge-pop {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* === Mobile nav (≤640px) ==================================================== */
@media (max-width: 640px) {
  .nav-links { display: none; }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    padding: 1rem clamp(1.25rem, 4vw, 3rem);
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open a {
    display: block;
    padding: 0.75rem 0;
    min-height: 44px;
    line-height: 1.8;
  }
}

/* === Footer (sitewide canonical) ===========================================
 * White surface, top border, gray text + blue hover. Legal links in 2 clusters
 * separated by | divider (desktop) or stacked (mobile).
 */
footer.legal-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem clamp(1.25rem, 4vw, 2rem);
  background: var(--white);
  text-align: center;
}

.legal-footer-meta {
  font-size: 0.85rem;
  color: var(--gray);
  /* v0.11.13: explicit margin reset — browsers apply default 1em margin-top
   * to <p>, which would push the footer-meta down by ~16px on pages without
   * a global `* { margin: 0 }` reset. */
  margin: 0 0 1rem;
}
.legal-footer-meta a {
  color: var(--gray);
  text-decoration: none;
  transition: color 0.2s;
}
.legal-footer-meta a:hover { color: var(--blue); }

.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem 1rem;
  font-size: 0.85rem;
}
.legal-footer-links a {
  color: var(--gray);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.2rem;
  cursor: pointer;
  transition: color 0.2s;
}
.legal-footer-links a:hover { color: var(--blue); }

.legal-footer-divider {
  color: var(--gray-dim);
  user-select: none;
}

@media (max-width: 640px) {
  .legal-footer-divider { display: none; }
  .legal-footer-links {
    flex-direction: column;
    gap: 0;
  }
  .legal-footer-links a {
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* === sr-only utility (a11y, sitewide) ====================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* === Logo customizer overlay (EE-1) ========================================
 * Invoked from both countdown (.cd-brand-mark) and landingpage (.brand-mark).
 * Class names are unique to the customizer, no scoping needed.
 */
.logo-customizer-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9000;
  padding: 1rem;
}
.logo-customizer-panel {
  background: var(--white);
  color: var(--navy);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 380px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.logo-customizer-panel h3 {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
}
.logo-customizer-panel .lc-subtitle {
  font-size: 0.85rem;
  color: var(--gray);
  margin: 0 0 1.25rem;
}
.logo-customizer-panel .lc-control-group {
  margin-bottom: 1rem;
}
.logo-customizer-panel label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--navy);
}
.logo-customizer-panel .lc-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
.logo-customizer-panel .lc-preset-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  cursor: pointer;
  text-align: left;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--navy);
  transition: border-color 0.15s;
}
.logo-customizer-panel .lc-preset-btn.active {
  border-color: var(--blue);
  background: var(--blue-light);
}
.logo-customizer-panel .lc-preset-strip {
  height: 16px;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}
.logo-customizer-panel select,
.logo-customizer-panel input[type="range"] {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
}
.logo-customizer-panel .lc-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.logo-customizer-panel .lc-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.logo-customizer-panel .lc-btn-reset,
.logo-customizer-panel .lc-btn-apply {
  flex: 1;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--navy);
  min-height: 44px;
}
.logo-customizer-panel .lc-btn-apply {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

/* === Print stylesheet (sitewide) ===========================================
 * Hide fixed chrome, normalize body for paper. Legal pages get printed
 * (lawyer review, customer dispute). References to .back-link / .toc /
 * .back-to-top are no-ops on non-legal pages.
 */
@media print {
  nav.top-nav, .legal-footer, .skip-link, .back-link, .toc summary, .back-to-top {
    display: none;
  }
  body { color: #000; background: #fff; font-size: 11pt; padding-top: 0; }
  main { max-width: 100%; padding: 0; }
  a { color: #000; text-decoration: underline; }
  section h2 { page-break-after: avoid; }
}
