/* standards/v2/chrome/chrome.css — Zero-template behavioral house chrome kit.
 * Supplies only structural/accessibility/layout invariants (FM-001, FM-394, FM-818, FM-1018, FM-1107).
 * Every microsite supplies its own visual identity via semantic tokens:
 *   --bg, --fg, --mut, --line, --acc, --col (widest column, e.g. 64rem), --gut (gutter, default 1.25rem)
 */

/* 1. hidden must actually hide, including SVG icons (FM-394, FM-1107) */
[hidden] { display: none !important; }
svg[hidden] { display: none !important; }

/* 2. Screen-reader-only text (FM-001) */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 3. Stable viewport height variable (locked by chrome.js against FB/IG Android WebView bar jump, FM-858) */
:root { --vh: 1vh; }

/* 4. Reading rail in the right gutter — zero hitbox bleed (FM-818, FM-1018) */
.rail { display: none; }
@media (min-width: 1100px) {
  .rail {
    --col: 46rem;
    --gut: 1.25rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 50%;
    left: calc(50% + var(--col) / 2 + var(--gut));
    transform: translateY(-50%);
    z-index: 40;
    margin: 0;
    padding: 0.4rem 0;
    max-height: calc(var(--vh) * 100 - 7rem);
    transition: opacity 0.2s ease;
  }
  html.in-story .rail { opacity: 0.55; }
  html.in-story .rail:hover, html.in-story .rail:focus-within { opacity: 1; }
  .rail::before {
    content: "";
    position: absolute;
    left: calc(0.875rem - 0.5px);
    top: 1.1rem;
    bottom: 1.1rem;
    width: 1px;
    background: var(--line, currentColor);
    opacity: 0.45;
  }
  .rail-dot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    text-decoration: none;
    border-radius: 50%;
  }
  .rail-dot .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mut, currentColor);
    box-shadow: 0 0 0 3px var(--bg, transparent);
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    flex: none;
  }
  .rail-dot:hover .dot, .rail-dot:focus-visible .dot {
    background: var(--acc, currentColor);
    transform: scale(1.25);
  }
  .rail-dot[aria-current="true"] .dot {
    background: var(--acc, currentColor);
    transform: scale(1.45);
    box-shadow: 0 0 0 3px var(--bg, transparent), 0 0 0 4.5px color-mix(in srgb, var(--acc, currentColor) 38%, transparent);
  }
  .rail-dot:focus-visible { outline: 2px solid var(--acc, currentColor); outline-offset: -1px; }
  .rail-label {
    position: absolute;
    right: calc(100% + 0.3rem);
    top: 50%;
    transform: translate(6px, -50%);
    padding: 0.22rem 0.65rem;
    border: 1px solid var(--line, currentColor);
    border-radius: 0.5rem;
    background: var(--bg, Canvas);
    color: var(--fg, CanvasText);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
  }
  .rail-dot:hover .rail-label, .rail-dot:focus-visible .rail-label {
    opacity: 1;
    transform: translate(0, -50%);
  }
}
@media (min-width: 1400px) {
  .rail-label {
    right: auto;
    left: calc(100% + 0.15rem);
    max-width: calc(50vw - var(--col) / 2 - var(--gut) - 3.25rem);
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.1rem 0.2rem;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    color: var(--mut, currentColor);
    transform: translate(-4px, -50%);
  }
  .rail-dot:hover .rail-label, .rail-dot:focus-visible .rail-label { color: var(--acc, currentColor); }
}
@media print { .rail, .share-row { display: none !important; } }

/* 5. Compact quiet share row (CORE.md) */
.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.share-row .share-label {
  font-size: 0.85rem;
  color: var(--mut, inherit);
  margin-right: 0.25rem;
}
.share-row .share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-soft, var(--line, currentColor));
  background: transparent;
  color: var(--fg, inherit);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.share-row .share-btn:hover, .share-row .share-btn:focus-visible {
  border-color: var(--acc, currentColor);
  color: var(--acc, currentColor);
}
@media (pointer: coarse) {
  .share-row .share-btn { width: 44px; height: 44px; }
}

/* 6. Play/Pause icon state via data-on (never aria-pressed) */
[data-play-btn][data-on="true"] .ic-play { display: none; }
[data-play-btn][data-on="false"] .ic-pause { display: none; }

@media (prefers-reduced-motion: reduce) {
  .rail, .rail .dot, .rail-label, .share-row .share-btn { transition: none; }
}
@media (forced-colors: active) {
  .rail::before { background: CanvasText; }
  .rail-dot .dot { background: CanvasText; box-shadow: none; }
  .rail-dot[aria-current="true"] .dot { background: Highlight; }
  .rail-label { border-color: CanvasText; }
}
