/* tokens.css */
/* Code 3 Workshop · Design tokens (EMS blue · gold) */
:root {
  --bg: #f3f6fb;
  --bg-elevated: #ffffff;
  --bg-panel: rgba(255, 255, 255, 0.92);
  --bg-card: #ffffff;
  --bg-card-hover: #eef3fa;
  --border: rgba(0, 63, 135, 0.12);
  --border-strong: rgba(0, 63, 135, 0.22);
  --text: #0b1f3a;
  --text-muted: #4a5f78;
  --text-dim: #6b7f96;
  --accent: #c9a227;
  --accent-soft: #e8d48b;
  --accent-dim: rgba(201, 162, 39, 0.14);
  --accent-glow: rgba(201, 162, 39, 0.32);
  --cyan: #0057b8;
  --cyan-dim: rgba(0, 87, 184, 0.1);
  --success: #1a8f5c;
  --ems: #003f87;
  --ems-mid: #0057b8;
  --ems-light: #2b7fd4;
  --gold: #c9a227;
  --gold-bright: #d4af37;
  --gold-soft: #f5e9c0;
  --surface: rgba(0, 63, 135, 0.04);
  --surface-hover: rgba(0, 63, 135, 0.07);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --shadow: 0 12px 40px rgba(0, 63, 135, 0.1);
  --shadow-soft: 0 6px 20px rgba(0, 63, 135, 0.08);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --content-max: 1120px;
  --prose-max: 42rem;
  --header-shadow: 0 1px 0 rgba(201, 162, 39, 0.42), 0 10px 28px rgba(0, 63, 135, 0.06);
}
/* base.css */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
  height: 100%;
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior-y: auto;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  min-height: 100dvh;
  min-height: 100svh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  overflow-y: visible;
  max-width: 100%;
}

::selection {
  background: rgba(201, 162, 39, 0.35);
  color: #0b1f3a;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Prefer keyboard-visible focus without fighting mouse clicks */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--ems-mid);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.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;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-xs);
  background: var(--ems);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}

.skip-link:focus {
  top: 1rem;
}

/* Ambient background — static only (blur/noise/orb animation caused scroll jank) */
.bg-fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  contain: strict;
  background:
    radial-gradient(720px 420px at 8% -8%, rgba(0, 87, 184, 0.1), transparent 62%),
    radial-gradient(640px 380px at 100% 0%, rgba(201, 162, 39, 0.1), transparent 58%);
}

.bg-orb,
.bg-noise {
  display: none;
}

.bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.7;
  background-image:
    linear-gradient(rgba(0, 63, 135, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 63, 135, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
}

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

@media (max-width: 900px) {
  .bg-grid {
    display: none;
  }
}
/* layout.css */
.app {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: visible;
}

/* Header */
.header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1.5rem;
  min-height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--header-shadow);
}

.header::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ems) 0%, var(--gold-bright) 50%, var(--ems) 100%);
  pointer-events: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  justify-self: start;
  grid-column: 1;
}

.header .site-nav {
  justify-self: center;
  grid-column: 2;
  justify-content: center;
}

.header .header-search {
  grid-column: 3;
  justify-self: end;
}

.header .nav-toggle {
  justify-self: end;
  grid-column: 3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 12px var(--accent-glow));
  transition: transform 0.3s var(--ease);
}

.brand:hover .brand-mark {
  transform: scale(1.04) rotate(-2deg);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text .site-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--ems) 0%, var(--ems-mid) 55%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text p:not(.site-title) {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  touch-action: manipulation;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ems);
}

.nav-toggle:hover {
  background: var(--surface-hover);
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.site-nav > a,
.nav-dropdown-toggle {
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: normal;
  color: var(--text-muted);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
  touch-action: manipulation;
}

.site-nav > a:hover,
.nav-dropdown-toggle:hover {
  color: var(--text);
  background: var(--surface);
}

.site-nav > a[aria-current="page"],
.nav-dropdown.is-active > .nav-dropdown-toggle,
.nav-dropdown-panel a[aria-current="page"] {
  color: var(--ems);
  background: var(--cyan-dim);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  border: none;
  background: transparent;
  /* Keep same type style as .site-nav > a (do not use font: inherit — it resets size/weight) */
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: normal;
  color: var(--text-muted);
}

.nav-dropdown-toggle .chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.2s var(--ease);
  opacity: 0.75;
}

.nav-dropdown.is-open > .nav-dropdown-toggle .chevron,
.nav-dropdown:hover > .nav-dropdown-toggle .chevron {
  transform: rotate(180deg);
}

.nav-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 12.5rem;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 60;
}

.nav-dropdown.is-open > .nav-dropdown-panel {
  display: block;
}

/* Desktop: open on hover when not touch-primary */
@media (hover: hover) and (pointer: fine) {
  .nav-dropdown:hover > .nav-dropdown-panel,
  .nav-dropdown:focus-within > .nav-dropdown-panel {
    display: block;
  }
}

.nav-dropdown-panel a {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.nav-dropdown-panel a:hover {
  color: var(--text);
  background: var(--surface);
}

.site-nav > a:focus-visible,
.nav-dropdown-toggle:focus-visible,
.nav-dropdown-panel a:focus-visible,
.nav-toggle:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--ems-mid);
  outline-offset: 2px;
}

/* Main */
.main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.main-narrow {
  max-width: 760px;
}

/* Footer — standard multi-column site footer */
.site-footer {
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 40%);
  color: var(--text);
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 2rem 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.footer-brand {
  max-width: 280px;
}

.footer-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.footer-brand-link img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.footer-brand-link span {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--ems) 0%, var(--ems-mid) 55%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.footer-brand p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.9rem;
}

.footer-back-top {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ems-mid);
  padding: 0.35rem 0;
  transition: color 0.15s, gap 0.15s;
}

.footer-back-top:hover {
  color: var(--ems);
  gap: 0.5rem;
}

.footer-col h2 {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.85rem;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-col a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s;
}

.footer-col a:hover {
  color: var(--ems);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem 1.5rem;
  padding: 1.15rem 0 calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.footer-notice {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.45;
  max-width: 42rem;
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem 1.5rem;
  }

  .footer-brand {
    grid-column: 1 / -1;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .footer-inner {
    padding: 2rem 1.1rem 1.25rem;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 1.25rem;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Mobile nav */
@media (max-width: 900px) {
  .header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand toggle"
      "search search"
      "nav nav";
    padding: 0.75rem 1rem;
  }

  .header-left {
    grid-area: brand;
    justify-self: start;
  }

  .nav-toggle {
    display: grid;
    grid-area: toggle;
    justify-self: end;
  }

  .header-search {
    grid-area: search;
    justify-self: stretch;
    max-width: none;
    width: 100%;
  }

  .site-nav {
    display: none;
    grid-area: nav;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.25rem;
    padding: 0.5rem 0 0.25rem;
    border-top: 1px solid var(--border);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav > a,
  .nav-dropdown-toggle {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-xs);
    width: 100%;
    justify-content: space-between;
  }

  .nav-dropdown {
    width: 100%;
  }

  .nav-dropdown-panel {
    position: static;
    display: none;
    min-width: 0;
    margin: 0.15rem 0 0.35rem;
    box-shadow: none;
    border: 1px solid var(--border);
    background: var(--surface);
  }

  .nav-dropdown.is-open > .nav-dropdown-panel {
    display: block;
  }

  .nav-dropdown-panel a {
    padding: 0.6rem 0.9rem 0.6rem 1.15rem;
  }

  .main {
    padding: 1.5rem 1.1rem 2.5rem;
    gap: 2rem;
  }
}
/* components.css */
/* Kickers & type */
.kicker {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.45rem;
}

.section-head {
  margin-bottom: 1.15rem;
}

.section-head h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.section-head p {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 48ch;
  line-height: 1.6;
}

/* Glass panel */
.glass-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.25), transparent);
  pointer-events: none;
  z-index: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1.2rem;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.12s var(--ease), box-shadow 0.12s var(--ease), transform 0.1s;
  white-space: nowrap;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #2b7fd4, #0057b8 55%, #003f87);
  color: #ffffff !important;
  border: 1px solid rgba(0, 87, 184, 0.35);
  box-shadow: 0 4px 18px rgba(0, 63, 135, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-decoration: none !important;
}

.btn-primary:hover {
  color: #ffffff !important;
  filter: brightness(1.05);
  box-shadow: 0 8px 26px rgba(0, 63, 135, 0.35);
}

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface-hover);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

/* Status chips */
.status-chip {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.status-live {
  color: var(--success);
  background: rgba(26, 143, 92, 0.1);
  border-color: rgba(26, 143, 92, 0.28);
}

.status-soon {
  color: var(--text-dim);
  background: var(--surface);
}

.status-lesson {
  color: var(--ems-mid);
  background: var(--cyan-dim);
  border-color: rgba(0, 87, 184, 0.2);
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}

.card-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 801px) {
  .card-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.resource-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem 1.35rem;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
  height: 100%;
  transition: border-color 0.12s var(--ease), background 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.resource-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0;
  transition: opacity 0.25s;
  background: linear-gradient(90deg, var(--ems-mid), var(--gold));
}

a.resource-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow);
}

@supports (content-visibility: auto) {
  .card-grid > .resource-card {
    content-visibility: auto;
    contain-intrinsic-size: auto 190px;
  }

  .category-tile {
    content-visibility: auto;
    contain-intrinsic-size: auto 160px;
  }
}

a.resource-card:hover::after {
  opacity: 1;
}

a.resource-card:focus-visible,
a.category-tile:focus-visible,
.btn:focus-visible,
.footer-col a:focus-visible,
.footer-back-top:focus-visible,
.footer-brand-link:focus-visible {
  outline: 2px solid var(--ems-mid);
  outline-offset: 3px;
}

.resource-card-soon {
  opacity: 0.9;
  cursor: default;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.card-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.card-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.resource-card h3 {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.card-subtitle {
  font-size: 0.84rem;
  color: var(--cyan);
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.card-meta li {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ems-mid);
}

a.resource-card:hover .card-cta {
  gap: 0.6rem;
  color: var(--ems);
}

/* Category tiles */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.category-list .category-tile {
  width: 100%;
  max-width: none;
}

.category-tile {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.35rem 1.3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s var(--ease), border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.category-tile-media {
  padding: 0;
  gap: 0;
}

.category-tile-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  max-height: 220px;
  overflow: hidden;
  background: var(--surface);
}

.category-tile-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: none;
}

.category-tile-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(11, 31, 58, 0.22) 100%);
  pointer-events: none;
}

.category-tile-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.15rem 1.3rem 1.25rem;
}

.category-tile::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--ems-mid), var(--gold));
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 1;
}

.category-tile:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.category-tile:hover::after {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  a.resource-card:hover {
    transform: translateY(-2px);
  }

  .category-tile-media:hover .category-tile-img img {
    transform: scale(1.04);
    transition: transform 0.22s var(--ease);
  }
}

@media (min-width: 720px) {
  .category-tile-media {
    display: grid;
    grid-template-columns: 240px 1fr;
    align-items: stretch;
    min-height: 152px;
  }

  .category-tile-img {
    aspect-ratio: auto;
    max-height: none;
    height: 100%;
    min-height: 152px;
  }

  .category-tile-body {
    justify-content: center;
    padding: 1.15rem 1.35rem;
  }

  .category-tile-media p {
    flex: none;
  }

  .category-tile-media .tile-count {
    margin-top: 0.2rem;
  }
}

.category-tile h3 {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.category-tile p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

@media (max-width: 560px) {
  .category-tile-img {
    aspect-ratio: 16 / 9;
    max-height: 180px;
  }
}

.tile-count {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

/* Value props */
.value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.value-card {
  padding: 1.25rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.value-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
}

.value-card h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
}

.value-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Featured */
.featured-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.5rem;
  padding: 1.5rem 1.6rem;
  align-items: center;
}

.featured-card .kicker {
  margin-bottom: 0.5rem;
}

.featured-card h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.55rem;
}

.featured-card p {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 42ch;
}

.featured-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(0, 63, 135, 0.06), transparent),
    #0b1f3a;
  border: 1px solid rgba(0, 63, 135, 0.2);
  padding: 1.25rem;
}

.featured-visual svg {
  width: 100%;
  max-width: 320px;
  height: auto;
}

/* Prose */
.prose {
  max-width: var(--prose-max);
}

.prose h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 1.75rem 0 0.65rem;
}

.prose h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.35rem 0 0.5rem;
}

.prose p,
.prose li {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 0.85rem;
}

.prose ul,
.prose ol {
  padding-left: 1.2rem;
  margin-bottom: 1rem;
}

.prose ul {
  list-style: disc;
}

.prose ol {
  list-style: decimal;
}

.prose a {
  color: var(--ems-mid);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(201, 162, 39, 0.45);
  text-underline-offset: 0.15em;
}

.prose a:hover {
  color: var(--ems);
  text-decoration-color: var(--gold);
}

.sources-note {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

/* Buttons inside prose must not inherit blue link styling */
.prose a.btn,
.prose a.btn:hover {
  text-decoration: none;
  font-weight: 600;
}

.prose a.btn-primary,
.prose a.btn-primary:hover {
  color: #ffffff;
}

.prose a.btn-ghost,
.prose a.btn-ghost:hover {
  color: var(--text);
}

.prose strong {
  color: var(--text);
  font-weight: 700;
}

.callout {
  margin: 1.25rem 0;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(201, 162, 39, 0.28);
  background: var(--accent-dim);
}

.callout p {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
}

.decision-box {
  margin: 1.25rem 0;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.decision-box h3 {
  margin-top: 0;
  color: var(--ems);
  font-size: 0.95rem;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.lesson-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.lesson-nav a.btn-primary,
.lesson-nav a.btn-primary:hover {
  color: #ffffff;
  text-decoration: none;
}

.lesson-nav a.btn-ghost,
.lesson-nav a.btn-ghost:hover {
  color: var(--text);
  text-decoration: none;
}

/* Lesson self-check quiz */
.lesson-quiz {
  margin-top: 2rem;
  padding: 1.35rem 1.4rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
}

.lesson-quiz > h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
  color: var(--text);
}

.quiz-intro {
  margin: 0 0 1.15rem !important;
  font-size: 0.92rem !important;
  color: var(--text-muted) !important;
}

.quiz-q {
  margin: 0 0 1rem;
  padding: 0.95rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.quiz-q legend {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  padding: 0 0.25rem;
  margin-bottom: 0.55rem;
}

.quiz-option {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0.4rem 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.45;
  cursor: pointer;
}

.quiz-option input {
  margin-top: 0.25rem;
  flex-shrink: 0;
  accent-color: var(--ems-mid);
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.quiz-actions .btn {
  text-decoration: none !important;
}

.quiz-q.is-correct {
  border-color: rgba(26, 143, 92, 0.45);
  background: rgba(26, 143, 92, 0.08);
}

.quiz-q.is-wrong {
  border-color: rgba(185, 60, 60, 0.4);
  background: rgba(185, 60, 60, 0.06);
}

.quiz-q.is-unanswered {
  border-color: rgba(201, 162, 39, 0.45);
}

.quiz-option.is-picked {
  color: var(--text);
}

.quiz-q.is-wrong .quiz-option.is-key,
.quiz-q.is-correct .quiz-option.is-key {
  color: var(--text);
  font-weight: 600;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  margin-left: -0.5rem;
  background: rgba(26, 143, 92, 0.1);
  box-shadow: inset 3px 0 0 var(--success);
}

.quiz-result {
  margin-top: 1rem;
  padding: 0.95rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

.quiz-result p {
  margin: 0 0 0.35rem !important;
}

.quiz-result p:last-child {
  margin-bottom: 0 !important;
}

.quiz-result-note {
  font-size: 0.82rem !important;
  color: var(--text-dim) !important;
}

.quiz-result-pass {
  border-color: rgba(26, 143, 92, 0.4);
  background: rgba(26, 143, 92, 0.1);
}

.quiz-result-review,
.quiz-result-warn {
  border-color: rgba(201, 162, 39, 0.4);
  background: var(--accent-dim);
}

.prose .lesson-quiz a.btn-primary,
.prose .lesson-quiz a.btn-primary:hover {
  color: #fff !important;
}

.prose .lesson-quiz button.btn {
  font: inherit;
  cursor: pointer;
  border: none;
}

.prose .lesson-quiz button.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.path-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.path-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.path-list .step {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--cyan-dim);
  color: var(--ems-mid);
}

.path-list strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}

.path-list span {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 0;
  list-style: none;
}

.stat-strip li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 63, 135, 0.045);
  border: 1px solid var(--border);
  text-align: left;
}

.stat-strip strong {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ems);
  line-height: 1.15;
}

.stat-strip span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.section-cta {
  margin-top: 1.25rem;
}

.trust-banner {
  text-align: center;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.trust-banner p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.trust-banner a {
  color: var(--ems-mid);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(201, 162, 39, 0.4);
  text-underline-offset: 0.15em;
}

@media (max-width: 800px) {
  .card-grid,
  .value-grid {
    grid-template-columns: 1fr;
  }

  .card-grid-3 {
    grid-template-columns: 1fr;
  }

  .featured-card {
    grid-template-columns: 1fr;
  }

  .stat-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  a.resource-card,
  .category-tile-img img {
    transition: none;
  }

  a.resource-card:hover {
    transform: none;
  }

  .category-tile-media:hover .category-tile-img img {
    transform: none;
  }
}
/* pages.css */
/* Home hero */
.hero-home {
  display: grid;
  grid-template-columns: 1.25fr 0.7fr;
  gap: 2rem;
  align-items: center;
  padding: 2.15rem 2.1rem 2.2rem;
  background:
    radial-gradient(900px 280px at 100% -10%, rgba(201, 162, 39, 0.16), transparent 58%),
    radial-gradient(700px 240px at -8% 120%, rgba(0, 87, 184, 0.1), transparent 55%),
    var(--bg-elevated);
}

.hero-home .hero-logo {
  display: flex;
  justify-content: center;
  max-width: 240px;
  margin: 0 auto;
}

.hero-home .hero-logo img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 28px rgba(0, 63, 135, 0.14));
}

.hero-copy-block h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.18;
  color: var(--text);
  margin-bottom: 0.85rem;
  max-width: 18ch;
}

.hero-copy-block .lead {
  font-size: 1.08rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 54ch;
  font-weight: 500;
}

.page-hero {
  padding: 1.75rem 1.65rem;
  background:
    radial-gradient(720px 180px at 100% 0%, rgba(201, 162, 39, 0.1), transparent 55%),
    var(--bg-elevated);
}

.page-hero h1 {
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.55rem;
}

.page-hero .lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 52ch;
  line-height: 1.6;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 0.85rem;
}

.breadcrumb a {
  color: var(--ems-mid);
  font-weight: 600;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  opacity: 0.6;
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.hero-home .stat-strip {
  max-width: 36rem;
}

@media (max-width: 800px) {
  .hero-home {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1.5rem 1.2rem 1.65rem;
  }

  .hero-home .stat-strip {
    margin-left: auto;
    margin-right: auto;
    text-align: left;
  }

  .hero-copy-block h1 {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-copy-block .lead {
    margin-left: auto;
    margin-right: auto;
  }

  .btn-row {
    justify-content: center;
  }

  .hero-home .hero-logo {
    max-width: 180px;
    order: -1;
  }
}

/* ── EMS Toolkit apps ── */
.toolkit-app {
  display: grid;
  gap: 1.25rem;
}

.toolkit-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.5rem;
  box-shadow: var(--shadow-soft);
}

.toolkit-panel h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.toolkit-panel > .panel-lead {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1.15rem;
}

.toolkit-form {
  display: grid;
  gap: 1rem;
}

.toolkit-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.toolkit-field input[type="number"],
.toolkit-field select {
  width: 100%;
  max-width: 22rem;
  font-size: 1rem; /* prevent iOS zoom */
  font-family: var(--font);
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(0, 63, 135, 0.04);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.toolkit-field input[type="number"]:focus,
.toolkit-field select:focus {
  outline: none;
  border-color: var(--ems-mid);
  box-shadow: 0 0 0 3px rgba(0, 87, 184, 0.15);
}

.toolkit-field .hint {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.toolkit-result {
  margin-top: 0.25rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(0, 87, 184, 0.08), rgba(201, 162, 39, 0.1));
  border: 1px solid rgba(0, 87, 184, 0.16);
}

.toolkit-result[data-empty="true"] {
  opacity: 0.72;
}

.toolkit-result .result-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.35rem;
}

.toolkit-result .result-value {
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.toolkit-result .result-sub {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.toolkit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.toolkit-edu-list {
  margin: 0.75rem 0 0;
  padding-left: 1.15rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.78));
  font-size: 0.95rem;
  line-height: 1.55;
}

.toolkit-edu-list li {
  margin: 0.4rem 0;
}

.toolkit-edu-list strong {
  color: var(--text, #f4f7fb);
}

.toolkit-street-math {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.toolkit-street-math strong {
  color: var(--text);
  font-weight: 600;
}

.toolkit-dose-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.toolkit-dose-table th,
.toolkit-dose-table td {
  text-align: left;
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.toolkit-dose-table th {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface);
}

.toolkit-dose-table tr:last-child td {
  border-bottom: none;
}

.toolkit-dose-table .dose-name {
  font-weight: 600;
  color: var(--text);
}

.toolkit-dose-table .dose-formula {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.toolkit-dose-table .dose-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ems);
  white-space: nowrap;
}

.toolkit-dose-note {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 400;
}

.toolkit-weight-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.toolkit-weight-chips button {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.toolkit-weight-chips button:hover,
.toolkit-weight-chips button:focus-visible {
  border-color: var(--ems-mid);
  color: var(--ems);
  background: var(--cyan-dim);
  outline: none;
}

.toolkit-related {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.toolkit-related a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ems-mid);
}

.toolkit-related a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .toolkit-dose-table th:nth-child(2),
  .toolkit-dose-table td:nth-child(2) {
    display: none;
  }

  .toolkit-field input[type="number"],
  .toolkit-field select {
    max-width: none;
  }
}

/* Weight converter layout */
.weight-convert-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.85rem 1rem;
  align-items: end;
  margin-bottom: 1.15rem;
}

.weight-convert-grid .toolkit-field input {
  max-width: none;
}

.weight-convert-swap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 0.65rem;
  color: var(--ems-mid);
  font-size: 1.35rem;
  font-weight: 600;
  user-select: none;
}

.weight-convert-swap-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 87, 184, 0.18);
}

@media (max-width: 560px) {
  .weight-convert-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .weight-convert-swap {
    padding: 0;
    order: 0;
  }

  .weight-convert-swap-icon {
    transform: rotate(90deg);
  }
}

/* Lesson ECG strip examples (CardioStrip exports) */
.lesson-strip {
  margin: 1rem 0 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #faf7f0;
  box-shadow: var(--shadow-soft);
}

.lesson-strip img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.lesson-strip figcaption {
  padding: 0.55rem 0.85rem 0.65rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.lesson-strip figcaption strong {
  color: var(--text-muted);
  font-weight: 600;
}

.look-for {
  margin: 0.35rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 87, 184, 0.14);
}

.look-for > strong {
  display: block;
  font-size: 0.78rem;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.4rem;
}

.look-for ul {
  margin: 0;
}

.path-steps {
  counter-reset: pathstep;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.path-steps > li {
  counter-increment: pathstep;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.path-steps > li::before {
  content: counter(pathstep);
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2b7fd4, #003f87);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.path-steps > li strong {
  display: block;
  margin-bottom: 0.2rem;
}

.path-steps > li span {
  display: block;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}
/* search.css */
/* Site search */

.header-search {
  position: relative;
  flex: 0 1 220px;
  min-width: 140px;
  max-width: 260px;
}

.header-search-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.header-search-input {
  width: 100%;
  font-family: var(--font);
  /* 16px minimum prevents iOS Safari zoom-on-focus */
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.48rem 0.9rem 0.48rem 2.15rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7f96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem 50%;
  background-size: 14px;
  /* Prevent iOS from auto-zooming the page on focus */
  touch-action: manipulation;
}

.header-search-input::placeholder {
  color: var(--text-dim);
}

.header-search-input:focus {
  border-color: rgba(0, 87, 184, 0.45);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(0, 87, 184, 0.12);
}

.search-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  left: 0;
  min-width: min(340px, 92vw);
  max-height: min(70vh, 420px);
  overflow: auto;
  z-index: 70;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.search-result-list {
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
  gap: 0.2rem;
}

.search-result-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  row-gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  text-decoration: none !important;
  color: inherit;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.search-result-item:hover,
.search-result-item:focus-visible,
.search-result-item.is-active {
  background: var(--surface);
  border-color: var(--border);
  outline: none;
}

.search-result-type {
  grid-row: 1 / span 2;
  align-self: start;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ems-mid);
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 87, 184, 0.15);
  border-radius: 999px;
  padding: 0.28rem 0.5rem;
  white-space: nowrap;
}

.search-result-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.search-result-snippet {
  grid-column: 2;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.search-view-all {
  display: block;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ems-mid);
  padding: 0.7rem 0.85rem;
  border-top: 1px solid var(--border);
  text-decoration: none !important;
}

.search-view-all:hover {
  background: var(--surface);
  color: var(--ems);
}

.search-empty,
.search-empty-page {
  padding: 0.9rem 1rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Full search page */
.search-page-form {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}

.search-page-input {
  flex: 1 1 220px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  touch-action: manipulation;
}

.search-page-input:focus {
  outline: 2px solid var(--ems-mid);
  outline-offset: 2px;
  border-color: rgba(0, 87, 184, 0.45);
}

.search-page-count {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.search-page-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.search-page-list .search-result-item {
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
}

.search-page-list .search-result-item:hover,
.search-page-list .search-result-item.is-active {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

@media (max-width: 900px) {
  .header-search {
    max-width: none;
    min-width: 0;
    width: 100%;
    flex: none;
  }

  .header-search-input,
  .search-page-input {
    font-size: 16px;
  }

  .search-panel {
    left: 0;
    right: 0;
    min-width: 0;
  }
}

/* Slightly tighter search field on wide desktops only (still ≥16px = no zoom) */
@media (min-width: 901px) {
  .header-search-input {
    font-size: 16px;
  }
}
