/* Empire Five · resources slice, wave 2: press states, touch targets, FAQ, size chart tools, contents sheet, 404 match. */

/* ---------- tactile press + ripple ---------- */
/* .btn elements get the shared 20-system ripple; this one covers rows, cards and FAQ questions only. */
.res-guide-row, .res-routes a, .res-tools a, .res-related a,
.res-faq-main .faq summary, .res-sec .faq summary { position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.res-ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .12; transform: scale(0); pointer-events: none; animation: res-ripple .6s var(--ease) forwards; }
.res-routes a.is-main .res-ripple { background: #9db6ff; opacity: .22; }
@keyframes res-ripple { to { transform: scale(1); opacity: 0; } }
.res-guide-row, .res-routes a, .res-tools a, .res-file, .res-404-sports .chip, .res-faq-side .faq-toc a { transition: transform .18s var(--ease), background-color .2s, border-color .2s, color .2s; }
.res-guide-row:active, .res-tools a:active { transform: scale(.99); }
.res-routes a:active, .res-404-sports .chip:active, .res-faq-side .faq-toc a:active { transform: scale(.97); }
.res-faq-main .faq summary:active, .res-sec .faq summary:active { background: var(--accent-soft); }

/* Hover lift only on real hover devices; tap gets the press state instead. */
@media (hover: hover) and (pointer: fine) {
  .res-routes a:hover { transform: translateY(-2px); }
  .res-file:hover { transform: translateY(-2px); }
  .res-404-sports .chip:hover { border-color: var(--accent); color: var(--accent-ink); }
}
/* Touch screens keep :hover after a tap (and after Back); undo the hover look so a row does not stay lit. */
@media (hover: none) {
  .res-guide-row:hover, .res-tools a:hover { background: transparent; }
  .res-guide-row:hover h2 { color: inherit; }
  .res-guide-row:hover .res-guide-no { color: var(--ink-2); }
  .res-routes a:not(.is-main):not(.is-guess):hover { border-color: var(--rule); }
  .res-guide-row:hover .res-guide-meta .icon, .res-tools a:hover .icon, .res-routes a:hover .icon, .res-related a:hover .icon { transform: none; }
}

/* ---------- touch targets (44px minimum) ---------- */
@media (pointer: coarse) {
  .res-toc li a, .res-legal-toc li a { min-height: 44px; align-items: center; }
  .res-faq-side .faq-toc a { min-height: 44px; }
  .res-404-sports .chip, .res-sizes .seg.tabs button { min-height: 44px; }
  .res-faq-main .faq summary, .res-sec .faq summary { min-height: 56px; }
  .res-related a { min-height: 52px; }
}
.res-faq-side .faq-toc { scroll-snap-type: x proximity; scroll-padding-inline: 10px; }
.res-faq-side .faq-toc a { scroll-snap-align: start; }

/* ---------- keyboard focus ---------- */
.res-guide-row:focus-visible, .res-routes a:focus-visible, .res-tools a:focus-visible, .res-related a:focus-visible,
.res-faq-main .faq summary:focus-visible, .res-sec .faq summary:focus-visible, .res-toc a:focus-visible, .res-faq-side .faq-toc a:focus-visible,
.res-anchor:focus-visible, .res-copy:focus-visible, .res-pill:focus-visible, .res-sheet a:focus-visible, .res-sheet button:focus-visible,
.res-units button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- FAQ ---------- */
.res-faq-main .faq { transition: border-color .2s, box-shadow .25s; }
.res-faq-main .faq[open] { border-color: var(--rule-strong); }
.res-faq-main .faq[open] summary span { color: var(--ink); }
.res-faq-main .faq.is-target, .res-sec .faq.is-target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.res-faq-main .faq[id], .res-sec .faq[id] { scroll-margin-top: calc(var(--head-h) + 24px); }
.res-copy { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 8px 0 -8px; padding: 0 10px 0 0; border: 0; background: none; color: var(--ink-2); font: 500 .7rem/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: color .2s; }
.res-copy:hover, .res-copy.is-done { color: var(--accent-ink); }
.res-faq-tools input::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- section copy-link (guides, legal) ---------- */
.res-prose h2 { position: relative; }
.res-clauses h2 { position: relative; }
.res-anchor { position: absolute; right: 0; top: 0; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius); background: none; color: var(--ink-2); cursor: pointer; opacity: .55; transition: opacity .2s, color .2s, background-color .2s; }
.res-anchor:hover, .res-anchor:focus-visible { opacity: 1; color: var(--accent-ink); background: var(--accent-soft); }
.res-anchor.is-done { opacity: 1; color: var(--accent-ink); }
.res-sec > h2 { padding-right: 48px; }
.res-clause > h2 { padding-right: 48px; }
@media (hover: hover) and (pointer: fine) {
  .res-anchor { opacity: 0; }
  .res-sec > h2:hover .res-anchor, .res-clause > h2:hover .res-anchor, .res-anchor:focus-visible, .res-anchor.is-done { opacity: 1; }
}

/* ---------- size charts ---------- */
.res-sizes .seg.tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.res-sizes .seg.tabs::-webkit-scrollbar { display: none; }
.res-sizes .seg.tabs button { flex: none; scroll-snap-align: start; transition: transform .15s var(--ease), background-color .2s, color .2s; }
.res-sizes .seg.tabs button:active { transform: scale(.96); }
@media (min-width: 761px) { .res-sizes .seg.tabs { flex-wrap: wrap; overflow: visible; } }
.res-sizes table.sizes tbody tr { cursor: pointer; transition: background-color .15s; }
.res-sizes table.sizes td:first-child, .res-sizes table.sizes th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--rule); font-weight: 600; }
.res-sizes table.sizes thead th:first-child { z-index: 2; }
.res-sizes table.sizes tbody tr.is-picked td { background: var(--accent-soft); color: var(--accent-ink); }
.res-sizes table.sizes tbody tr.is-picked td:first-child { box-shadow: inset 3px 0 0 var(--accent), 1px 0 0 var(--rule); }
.res-sizes table.sizes .is-col { background: var(--surface-2, var(--bg)); }
@media (hover: hover) { .res-sizes table.sizes tbody tr:hover td { background: var(--bg); } .res-sizes table.sizes tbody tr.is-picked:hover td { background: var(--accent-soft); } }

.res-size-tools { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 24px; }
.res-units { display: inline-flex; padding: 3px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--surface); }
.res-units button { min-height: 40px; min-width: 52px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font: 500 .74rem/1 var(--f-mono); letter-spacing: .06em; cursor: pointer; transition: background-color .2s, color .2s, transform .15s var(--ease); }
.res-units button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.res-units button:active { transform: scale(.95); }
.res-finder { display: grid; gap: 6px; min-width: 0; }
.res-finder label { font: 500 .7rem/1.2 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.res-finder-row { display: flex; gap: 8px; }
.res-finder input, .res-finder select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 1rem; }
.res-finder input { width: 9em; min-width: 0; font-variant-numeric: tabular-nums; }
.res-finder input:focus, .res-finder select:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
.res-finder .btn { min-height: 44px; }
.res-finder .hint { margin: 0; min-height: 1.2em; }
@media (max-width: 520px) {
  .res-size-tools { display: grid; grid-template-columns: 1fr; }
  .res-finder input { flex: 1; width: auto; }
}

/* ---------- contents pill + bottom sheet (guides and legal, small screens) ---------- */
.res-pill { display: none; }
.res-sheet { display: none; }
@media (max-width: 900px) {
  .res-pill { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 44; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: var(--navy); color: #fff; font: 600 .9rem/1 var(--f-display); box-shadow: var(--shadow-hover); cursor: pointer; transform: translateY(calc(100% + 30px)); opacity: 0; pointer-events: none; transition: transform .35s var(--ease), opacity .25s; -webkit-tap-highlight-color: transparent; }
  .res-pill.is-on { transform: none; opacity: 1; pointer-events: auto; }
  .res-pill.is-on:active { transform: scale(.96); }
  .res-pill .icon { color: #9db6ff; }
  .res-pill-n { font: 500 .7rem/1 var(--f-mono); letter-spacing: .06em; color: #c9d3e3; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.2); }
  .res-sheet-open .res-pill { opacity: 0; pointer-events: none; }

  .res-sheet { position: fixed; inset: 0; z-index: 70; display: block; }
  .res-sheet[hidden] { display: none; }
  .res-sheet-back { position: absolute; inset: 0; background: rgba(14,27,44,.45); opacity: 0; transition: opacity .28s; }
  .res-sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-height: min(78vh, 640px); padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(14,27,44,.2); transform: translateY(100%); transition: transform .32s var(--ease); }
  .res-sheet.is-open .res-sheet-back { opacity: 1; }
  .res-sheet.is-open .res-sheet-panel { transform: none; }
  .res-sheet-panel.is-drag { transition: none; }
  .res-sheet-grip { display: grid; place-items: center; height: 24px; touch-action: none; cursor: grab; }
  .res-sheet-grip span { width: 40px; height: 4px; border-radius: 4px; background: var(--rule-strong); }
  .res-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); touch-action: none; }
  .res-sheet-head .res-label { margin: 0; }
  .res-sheet-x { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px; border: 0; background: none; color: var(--ink); cursor: pointer; border-radius: 50%; }
  .res-sheet-x:active { background: var(--accent-soft); }
  .res-sheet-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .res-sheet-body ol { list-style: none; margin: 0; padding: 0; }
  .res-sheet-body a { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 6px; min-height: 50px; padding: 6px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-size: .98rem; line-height: 1.35; transition: background-color .15s, color .15s; }
  .res-sheet-body a span { font: 500 .72rem/1 var(--f-mono); color: var(--ink-2); }
  .res-sheet-body a:active { background: var(--accent-soft); }
  .res-sheet-body a.is-active { color: var(--accent-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }
  .res-sheet-body a.is-active span { color: var(--accent-ink); }
  .res-sheet-cta { margin-top: 14px; width: 100%; justify-content: center; min-height: 48px; }
  .res-sheet-open, .res-sheet-open body { overflow: hidden; }
}
@media (min-width: 861px) { .res-pill.res-pill-legal, .res-sheet.res-sheet-legal { display: none; } }

/* ---------- 404 closest match ---------- */
.res-404-guess { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; width: fit-content; max-width: 100%; margin: clamp(20px, 3vw, 28px) 0 0; padding: 10px 10px 10px 14px; border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.res-404-guess .res-label { margin: 0; color: var(--accent-ink); }
.res-404-guess + .res-routes { margin-top: 16px; }
.res-404-sports .chip.is-guess { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.res-routes a.is-guess:not(.is-main) { border-color: var(--accent); }

/* ---------- downloads ---------- */
.res-file .btn.is-done { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- motion and print ---------- */
@media (prefers-reduced-motion: reduce) {
  .res-ripple { display: none; }
  .res-guide-row, .res-routes a, .res-tools a, .res-file, .res-404-sports .chip, .res-faq-side .faq-toc a,
  .res-pill, .res-sheet-panel, .res-sheet-back, .res-units button, .res-sizes .seg.tabs button { transition: none !important; }
  .res-guide-row:active, .res-tools a:active, .res-routes a:active, .res-404-sports .chip:active, .res-pill.is-on:active, .res-units button:active { transform: none; }
}
@media print {
  .res-pill, .res-sheet, .res-anchor, .res-copy, .res-size-tools { display: none !important; }
}
