/* Site-runtime additions: consent banner + brand-mark logo swap + a11y.
   Loaded AFTER each page's inline <style> block, so these rules win. */

/* === Accessibility (WCAG 2.1 AA) ============================== */

/* Skip-to-content link — visible on keyboard focus only.
   Injected as the first body child by site.js. */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 10000;
  padding: 12px 20px;
  background: var(--ink, #15140f);
  color: var(--paper, #f7f3ea);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: .04em;
  text-decoration: none;
  border-radius: 0 0 6px 0;
  transition: top .12s ease;
}
.skip-to-content:focus,
.skip-to-content:focus-visible {
  top: 0;
  outline: 2px solid var(--accent, #d6552b);
  outline-offset: 2px;
}

/* Stronger visible focus indicator (WCAG 2.4.7 — Focus Visible).
   Many design buttons/links have hover styles but no keyboard focus styles. */
*:focus-visible {
  outline: 2px solid var(--accent, #d6552b);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Remove default fuzzy outline only when :focus-visible is supported */
@supports selector(:focus-visible) {
  *:focus:not(:focus-visible) { outline: none; }
}

/* Screen-reader-only utility — used by site.js for live form announcements */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion — respect users who prefer no animation */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* === End accessibility =============================== */


/* Swap the inline "D" letter glyph in the nav brand for the actual DSE logo. */
.brand .glyph {
  background: url('/logo.png') center / contain no-repeat;
  color: transparent !important;
  font-size: 0 !important;
  text-indent: -9999px;
  overflow: hidden;
}


#dse-consent-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  background: var(--slate, #1a1814);
  color: var(--slate-fg, #f3ecd9);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
#dse-consent-banner .cb-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
}
#dse-consent-banner .cb-text {
  margin: 0;
  color: rgba(243,236,217,.85);
}
#dse-consent-banner .cb-text a {
  color: var(--accent, #d6552b);
  text-decoration: underline;
}
#dse-consent-banner .cb-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
#dse-consent-banner .cb-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.18);
  background: transparent;
  color: var(--slate-fg, #f3ecd9);
  font: inherit;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
#dse-consent-banner .cb-btn:hover { background: rgba(255,255,255,.08); }
#dse-consent-banner .cb-accept {
  background: var(--accent, #d6552b);
  border-color: var(--accent, #d6552b);
  color: #fff;
}
#dse-consent-banner .cb-accept:hover { background: var(--accent-ink, #a8431f); }

@media (min-width: 720px) {
  #dse-consent-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    max-width: 480px;
  }
  #dse-consent-banner .cb-inner {
    flex-direction: column;
  }
}

/* === Mobile navigation (hamburger toggle + slide-in drawer) ===
   Toggle button + drawer are injected by site.js. Toggle is hidden on
   desktop and shown <=1100px (same threshold where .nav-links disappears).
   Drawer is a position:fixed overlay that mirrors .nav-links anchors. */

.nav-toggle {
  display: none;
  position: relative;
  width: 44px; height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--rule, rgba(21,20,15,.12));
  cursor: pointer;
  align-items: center; justify-content: center;
  gap: 5px;
  flex-direction: column;
  font: inherit;
  justify-self: end;
  z-index: 51;
}
.nav-toggle:hover { border-color: var(--ink, #15140f); }
.nav-toggle-bar {
  display: block;
  width: 20px; height: 2px;
  background: var(--ink, #15140f);
  transition: transform .2s ease, opacity .2s ease;
}
body.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-drawer { position: fixed; inset: 0; z-index: 50; }
.nav-drawer[hidden] { display: none; }
.nav-drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(21,20,15,.55);
  animation: dseDrawerFade .2s ease;
}
.nav-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(320px, 86vw);
  background: var(--paper, #f7f3ea);
  border-left: 1px solid var(--ink, #15140f);
  display: flex; flex-direction: column;
  animation: dseDrawerSlide .22s ease;
  overflow-y: auto;
}
.nav-drawer-inner {
  display: flex; flex-direction: column;
  padding: 88px 28px 28px;
  gap: 0;
}
.nav-drawer-inner .nav-link {
  display: block;
  padding: 18px 0;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px;
  color: var(--ink, #15140f);
  text-decoration: none;
  border-bottom: 1px solid var(--rule, rgba(21,20,15,.12));
  min-height: 56px;
}
.nav-drawer-inner .nav-link:last-child { border-bottom: 0; }
.nav-drawer-inner .nav-link::after { display: none; }
.nav-drawer-inner .nav-link .arrow { color: var(--ink-mute, #8a857a); margin-left: 6px; }
.nav-drawer-cta {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--rule, rgba(21,20,15,.12));
}
.nav-drawer-cta .btn {
  display: inline-flex; align-items: center; gap: 10px;
  width: 100%; justify-content: center;
  min-height: 48px;
}

body.nav-open { overflow: hidden; }

@keyframes dseDrawerFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dseDrawerSlide { from { transform: translateX(100%); } to { transform: translateX(0); } }

@media (prefers-reduced-motion: reduce) {
  .nav-drawer-backdrop, .nav-drawer-panel { animation: none; }
}

/* Show toggle at the same breakpoint where .nav-links is hidden.
   Also widen nav-inner grid to accommodate brand | nav-cta | toggle. */
@media (max-width: 1100px) {
  .nav-toggle { display: inline-flex; }
  .nav-inner { grid-template-columns: 1fr auto auto !important; gap: 12px !important; }
}

@media (max-width: 480px) {
  /* On very small screens, hide the nav-cta button to free space — engage
     link still reachable inside drawer + via in-page CTAs. */
  .nav-cta { display: none; }
  .nav-inner { grid-template-columns: 1fr auto !important; }
  .nav-drawer-inner { padding-top: 76px; }
}
/* === End mobile navigation ===================================== */


/* ── mobile (<=640px): consent banner stacked, 44px touch targets ── */
@media (max-width: 640px) {
  #dse-consent-banner { left: 12px; right: 12px; bottom: 12px; font-size: 13px; }
  #dse-consent-banner .cb-inner { padding: 14px 16px; gap: 10px; flex-direction: column; align-items: stretch; }
  #dse-consent-banner .cb-text { font-size: 12px; line-height: 1.5; }
  #dse-consent-banner .cb-buttons { display: flex; gap: 8px; justify-content: stretch; }
  #dse-consent-banner .cb-btn { padding: 12px 16px; font-size: 13px; min-height: 44px; flex: 1; }
}
