/*
 * Explorer One public Feature Atlas. Loaded only by templates/explorer-one-features.php, after
 * explorer-one-v2.css, whose .eo2 tokens (colour roles, type, radius, spacing, kbd, buttons)
 * it reuses. Every selector is scoped under .eoa. No new fonts, icons or colours.
 *
 * Sticky model (no content bleed):
 *  - The shared header is sticky and opaque (inline in the template). --eoa-header is its
 *    height plus any admin-bar offset; the script measures it, the values below are fallbacks.
 *  - Wide screens: the category list is a sticky sidebar in its own grid column, so page
 *    content never scrolls underneath it.
 *  - Narrow screens: the category list becomes an opaque, full-width bar stuck directly under
 *    the header (1px overlap hides sub-pixel gaps; the header paints above it).
 *  - Section anchors land below everything sticky through one shared --eoa-offset.
 */

.eoa {
  --eoa-header: 4.3125rem;
  --eoa-bar: 0px;
  --eoa-offset: calc(var(--eoa-header) + var(--eoa-bar) + 1.5rem);
}
@media (max-width: 47.99rem) { .eoa { --eoa-header: 3.8125rem; } }
@media (max-width: 63.99rem) { .eoa { --eoa-bar: 3.5rem; } }

.eoa-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- intro ---------- */
.eoa-intro {
  background: linear-gradient(180deg, var(--surface-blue) 0%, var(--surface-cool) 100%);
  border-bottom: 1px solid var(--border-light);
}
.eoa-intro__inner { display: grid; gap: clamp(2rem, 4vw, 3rem) var(--s-col); align-items: center; padding-block: clamp(3rem, 6vw, 5rem) clamp(2.5rem, 5vw, 3.5rem); }
@media (min-width: 62rem) { .eoa-intro__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); } }
.eoa-intro__text { min-width: 0; }
/* Screenshot frame at the hero capture's native ratio (no crop); reuses .eo2-frame and the .eo2-slot placeholder. */
.eoa-intro__media { width: 100%; max-width: 44rem; aspect-ratio: 1625 / 968; }
/* Stacked (tablet/phone): cap the width so the hero does not grow tall. */
@media (max-width: 61.99rem) { .eoa-intro__media { max-width: 32rem; } }
.eoa-crumb { margin-bottom: 1.5rem; color: var(--text-secondary); font-size: var(--fs-sm); }
.eoa-crumb a { font-weight: 600; text-decoration: none; }
.eoa-crumb a:hover { text-decoration: underline; }
.eoa-crumb span[aria-hidden] { margin-inline: 0.4rem; color: var(--border-light); }
.eo2 .eoa-intro h1 { max-width: 15ch; font-size: clamp(2.5rem, 1.5rem + 3.4vw, 4.25rem); }
.eoa-intro h1 span { color: var(--brand); }
.eoa-intro__lead { margin-top: 1.25rem; font-size: var(--fs-lead); line-height: 1.55; max-width: 40rem; }

.eoa-search { margin-top: 2rem; max-width: 36rem; }
.eoa-search label { display: block; margin-bottom: 0.5rem; color: var(--text-primary); font-size: var(--fs-sm); font-weight: 600; }
.eoa-search input {
  width: 100%; min-height: 3.25rem; padding: 0.75rem 1rem;
  border: 1px solid var(--border-light); border-radius: var(--r-md); background: var(--surface-card);
  color: var(--text-primary); font: 400 var(--fs-base)/1.4 var(--font); box-shadow: var(--e1);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.eoa-search input::placeholder { color: var(--text-secondary); opacity: 1; }
.eoa-search input:hover { border-color: var(--c-blue-300); }
.eoa-search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--brand); border-radius: var(--r-md); }
.eoa-count { margin-top: 0.6rem; color: var(--text-secondary); font-size: var(--fs-xs); }

/* ---------- layout and category navigation ---------- */
.eoa-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s-col); align-items: start; }
.eoa-nav { min-width: 0; }
@media (min-width: 64rem) { .eoa-layout { grid-template-columns: 15rem minmax(0, 1fr); } }

.eoa-nav__title { margin: 0 0 0.75rem; color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.eoa-nav ul { margin: 0; padding: 0; list-style: none; }
.eoa-nav a {
  display: flex; align-items: baseline; gap: 0.6rem; padding: 0.45rem 0.75rem;
  border-radius: var(--r-sm); color: var(--text-secondary); font-size: var(--fs-sm); line-height: 1.35; text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.eoa-nav a:hover { background: var(--surface-blue); color: var(--text-primary); }
.eoa-nav a[aria-current="true"] { background: var(--brand-soft); color: var(--brand-pressed); font-weight: 600; }
.eoa-nav a[data-eoa-none] { opacity: 0.45; }
.eoa-nav__num { flex: none; color: var(--c-blue-400); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }

@media (min-width: 64rem) {
  .eoa-nav {
    position: sticky; top: calc(var(--eoa-header) + 1.5rem);
    max-height: calc(100vh - var(--eoa-header) - 3rem); overflow-y: auto; overscroll-behavior: contain;
    margin-top: clamp(2.5rem, 4vw, 3.5rem); padding-right: 0.25rem; scrollbar-width: thin;
  }
}

@media (max-width: 63.99rem) {
  .eoa-nav {
    position: sticky; z-index: 90; top: calc(var(--eoa-header) - 1px);
    margin-inline: calc(-1 * var(--gutter)); padding: 0.2rem calc(var(--gutter) - 0.3rem);
    background: var(--surface-canvas); border-bottom: 1px solid var(--border-light);
  }
  .eoa-nav__title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* The 0.3rem padding keeps chip focus rings inside the scrolling list, which would otherwise clip them. */
  .eoa-nav ul { display: flex; gap: 0.5rem; padding: 0.3rem; overflow-x: auto; scrollbar-width: none; scroll-padding-inline: var(--gutter); }
  .eoa-nav ul::-webkit-scrollbar { display: none; }
  .eoa-nav li { flex: none; }
  .eoa-nav a {
    min-height: 2.5rem; align-items: center; padding: 0.4rem 0.9rem;
    border: 1px solid var(--border-light); border-radius: 999px; background: var(--surface-card); color: var(--text-primary); white-space: nowrap;
  }
  .eoa-nav a[aria-current="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
  .eoa-nav__num { display: none; }
}

/* ---------- categories ---------- */
.eoa-content { min-width: 0; padding-bottom: var(--s-section-sm); }
.eo2 .eoa-cat { padding-top: clamp(2.5rem, 4vw, 3.5rem); scroll-margin-top: var(--eoa-offset); }
.eoa-cat + .eoa-cat { margin-top: clamp(1rem, 2vw, 1.5rem); border-top: 1px solid var(--border-light); }
.eoa-cat__head { display: grid; gap: 0.5rem; margin-bottom: 1.75rem; }
.eoa-cat__num { color: var(--brand); font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.eo2 .eoa-cat h2 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); line-height: 1.15; letter-spacing: -0.02em; }
.eoa-cat__deck { color: var(--text-body); font-size: var(--fs-lead); line-height: 1.55; max-width: 40rem; }

/* ---------- flow trees ---------- */
.eoa-flow { margin: 0 0 2rem; padding: clamp(1.25rem, 2.5vw, 1.75rem); border: 1px solid var(--c-blue-200); border-radius: var(--r-lg); background: var(--surface-blue); }
.eoa-flow figcaption { margin-bottom: 1rem; color: var(--brand-pressed); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.eoa-flow ol { display: grid; gap: 1.25rem; margin: 0; padding: 0; list-style: none; counter-reset: eoa-step; }
.eoa-flow li { position: relative; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); align-content: start; gap: 0.15rem 0.85rem; counter-increment: eoa-step; }
.eoa-flow li::before {
  content: counter(eoa-step); grid-row: span 2; display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border-radius: 50%; background: var(--brand); color: #fff; font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums;
}
.eoa-flow__title { color: var(--text-primary); font-weight: 650; line-height: 1.35; }
.eoa-flow__text { color: var(--text-body); font-size: var(--fs-sm); line-height: 1.5; }
/* Vertical connector on narrow screens. */
.eoa-flow li:not(:last-child)::after { content: ""; position: absolute; left: calc(1.125rem - 1px); top: 2.5rem; bottom: -1.1rem; width: 2px; border-radius: 2px; background: var(--c-blue-200); }

@media (min-width: 48rem) {
  .eoa-flow ol { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
  .eoa-flow li { grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
  .eoa-flow li::before { grid-row: auto; margin-bottom: 0.4rem; }
  /* Horizontal connector from one step's number to the next. */
  .eoa-flow li:not(:last-child)::after { left: 2.75rem; right: -1rem; top: calc(1.125rem - 1px); bottom: auto; width: auto; height: 2px; }
}

/* ---------- feature entries ---------- */
.eoa-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border-light); }
.eoa-item { display: grid; gap: 0.5rem 2rem; padding-block: 1.25rem; border-bottom: 1px solid var(--border-light); }
@media (min-width: 48rem) { .eoa-item { grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); } }
.eo2 .eoa-item h3 { font-size: var(--fs-base); font-weight: 650; line-height: 1.4; letter-spacing: -0.005em; }
.eoa-item__body { display: grid; gap: 0.45rem; }
.eoa-item__what { color: var(--text-primary); }
.eoa-item__why, .eoa-item__how { color: var(--text-body); font-size: var(--fs-sm); line-height: 1.6; }
.eoa-label { margin-right: 0.35rem; color: var(--brand-pressed); font-size: var(--fs-xs); font-weight: 650; }
.eoa-label::after { content: ":"; }
.eoa-item kbd, .eoa-flow kbd, .eoa-keys kbd { margin-block: 0.1em; }
.eoa-step { color: var(--text-secondary); }
.eoa-combo { white-space: nowrap; }

/* ---------- shortcut reference ---------- */
.eoa-keys { margin-top: 2rem; padding: clamp(1.25rem, 2.5vw, 1.75rem); border: 1px solid var(--border-light); border-radius: var(--r-lg); background: var(--surface-cool); }
.eo2 .eoa-keys__title { margin-bottom: 1rem; font-size: var(--fs-base); }
.eoa-keys dl { display: grid; gap: 0 2rem; margin: 0; }
@media (min-width: 40rem) { .eoa-keys dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.eoa-keys dl > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; padding-block: 0.6rem; border-bottom: 1px solid var(--border-light); }
.eoa-keys dt { color: var(--text-primary); font-size: var(--fs-sm); }
.eoa-keys dd { margin: 0; color: var(--text-body); font-size: var(--fs-sm); }

/* ---------- empty search state ---------- */
.eoa-empty { margin-top: clamp(2.5rem, 4vw, 3.5rem); padding: 1.5rem; border: 1px dashed var(--c-blue-300); border-radius: var(--r-lg); background: var(--surface-blue); }
.eoa-empty p { margin-bottom: 1rem; color: var(--text-body); }
.eoa-empty strong { color: var(--text-primary); }

/* ---------- closing band ---------- */
.eo2 .eoa-end { margin-top: var(--s-section-sm); padding: clamp(2rem, 5vw, 3.5rem); border-radius: var(--r-xl); background: var(--surface-navy); color: var(--text-on-dark-body); scroll-margin-top: var(--eoa-offset); --focus: #fff; }
.eo2 .eoa-end h2 { color: var(--text-on-dark); font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); line-height: 1.15; }
.eoa-end p { margin-top: 0.75rem; }
.eoa-end__actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; margin-top: 1.75rem; }
/* Secondary "Back to the overview" on the navy band: white in every state (focus ring is already white via --focus). */
.eo2 .eoa-end .eo2-btn--ghost-dark, .eo2 .eoa-end .eo2-btn--ghost-dark:hover, .eo2 .eoa-end .eo2-btn--ghost-dark:focus-visible { color: #fff; }
.eo2 .eoa-end .eo2-btn--ghost-dark:hover { background: rgba(255, 255, 255, 0.1); }

@media (prefers-reduced-motion: reduce) {
  .eoa-nav a, .eoa-search input { transition: none; }
}
@media (forced-colors: active) {
  .eoa-nav a[aria-current="true"] { outline: 2px solid CanvasText; }
  .eoa-flow li::before { border: 1px solid CanvasText; }
}
@media print {
  .eoa-nav, .eoa-search, .eoa-end { display: none; }
}
