/* VetPass "Branches": one accent per branch, branch heroes, motion control, army drop, strip, rail.
   Accents are the services' traditional colours used as hairlines only (header edge, hero edge, note edge,
   rail marker): never text on a failing ground, never flags or stripes. Max ~10% of any page. */

/* ---------- accents (light = on ivory, dark = on navy) ---------- */
body { --b-light: #1b1b1b; --b-dark: #c9a227; }
body.branch-army   { --b-light: #1b1b1b; --b-dark: #c9a227; }
body.branch-marine { --b-light: #a6192e; --b-dark: #d4a72c; }
body.branch-navy   { --b-light: #0b2545; --b-dark: #c5a253; }
body.branch-af     { --b-light: #00308f; --b-dark: #b8c0c8; }
body.branch-space  { --b-light: #0a0e1a; --b-dark: #d9dde3; }
body.branch-cg     { --b-light: #c8102e; --b-dark: #ffffff; }
body.branch-ng     { --b-light: #8c6a3f; --b-dark: #c9a36a; }
.site-header { border-bottom: 3px solid var(--b-dark); }

/* ---------- hero: poster first, video on top once it plays ---------- */
.hero-branch .hero-stage { position: relative; overflow: hidden; background: var(--navy-950); }
.hero-branch .hero-stage picture { display: block; width: 100%; height: 100%; }
.hero-poster, .hero-video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.hero-video { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; transition: opacity 0.9s ease; background: transparent; }
/* The video starts at 1 px and grows to the full hero once it is playing. Reason: Chrome counts a video's first
   painted frame as a Largest Contentful Paint candidate sized at that moment; at full size it would replace the
   poster as the LCP and push LCP out to the moment the video starts. Starting small keeps the poster as the LCP. */
.hero-branch.is-playing .hero-video { width: 100%; height: 100%; opacity: 1; }
.hero-army .hero-poster, .hero-army .hero-video { object-position: 50% 38%; }
.hero-marine .hero-poster, .hero-marine .hero-video { object-position: 50% 60%; }
.hero-af .hero-poster, .hero-af .hero-video { object-position: 50% 55%; }
.hero-space .hero-poster, .hero-space .hero-video { object-position: 50% 62%; }
.hero-ng .hero-poster, .hero-ng .hero-video { object-position: 50% 55%; }
.hero-post .hero-poster { object-position: 50% 45%; }
.hero-branch { border-bottom: 3px solid var(--b-dark); }
.hero-note { background: var(--navy-950); color: var(--on-navy-soft); border-bottom: 1px solid var(--rule-navy); }
.hero-note p { margin: 0; padding-block: 0.7rem; font-size: 0.8125rem; line-height: 1.5; max-width: 60rem; }
.hero-note strong { color: var(--on-navy); }
.hero-branch .hero-body h1, .hero-branch .hero-body .lede { text-shadow: 0 1px 18px var(--shadow-text); }
.hero-army { min-height: clamp(34rem, 88svh, 58rem); }
.emergency { margin-top: var(--space-3); padding: 0.7rem 1rem; background: var(--notice-bg); color: var(--ink); border-left: 4px solid var(--notice-rule); border-radius: 0 8px 8px 0; font-size: var(--step--1); max-width: 40rem; }
.emergency a { color: inherit; text-decoration: underline; }

/* floating Play/Pause: top right under the header (clear of the headline and caption), visible while a moving hero is on screen, second in the Tab order */
.motion-bar { position: fixed; top: 5.4rem; right: max(1rem, env(safe-area-inset-right)); z-index: 60; }
@media (max-width: 59.99rem) { .motion-bar { top: 4.3rem; } }
.motion-bar[hidden] { display: none; }
.motion-btn { min-height: 2.75rem; padding: 0.55rem 1.05rem; border-radius: 999px; border: 1.5px solid var(--b-dark); background: var(--navy-900); color: var(--on-navy);
  font: 600 0.875rem/1.2 var(--font-body); cursor: pointer; box-shadow: 0 6px 20px -8px rgb(0 0 0 / 0.55); }
.motion-btn:hover { background: var(--navy-700); }
.motion-btn:focus-visible { outline: 3px solid var(--focus-on-dark); outline-offset: 3px; }

/* ---------- cover box: layers share one 3:2 frame so they always line up ---------- */
.hero-layers .hero-stage, .drop-art { container-type: size; }
.cover-box { position: absolute; left: 50%; top: 42%; width: max(100cqw, 150cqh); aspect-ratio: 3 / 2; translate: -50% -42%; }
.cover-box picture, .cover-box > picture img { display: block; width: 100%; height: 100%; }
.cover-box img { max-width: none; }
.cg-flat { width: 100%; height: 100%; object-fit: fill; transition: opacity 0.6s ease; }
/* layers start at 1 px so the poster stays the LCP element (same reason as .hero-video), then grow in place */
.cg-layer { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; object-fit: fill; pointer-events: none; will-change: transform; transition: opacity 0.6s ease; }
.cg-bg { z-index: 1; } .cg-heli { z-index: 2; } .cg-fg { z-index: 3; }
.layers-ready .cg-bg { width: 100%; height: 100%; opacity: 1; }
.layers-ready .cg-heli { opacity: 1; }
.layers-ready .cg-fg { width: 100%; height: auto; opacity: 1; }
.layers-ready .cg-flat { opacity: 0; }
.hero-layers .cover-box > picture { position: absolute; inset: 0; z-index: 0; }
@media (prefers-reduced-motion: no-preference) {
  .hero-layers.motion-on .cover-box { animation: cg-push 30s ease-in-out infinite alternate; }
  .hero-layers.motion-on .cg-heli { animation: cg-bob 7s ease-in-out infinite alternate; }
}
@keyframes cg-push { from { scale: 1; } to { scale: 1.07; } }
@keyframes cg-bob { from { translate: 0 0; } to { translate: -0.8% 2.2%; } }

/* ---------- Army beat 2: the drop ---------- */
.skip-jump { position: absolute; left: -999px; top: 0; z-index: 70; padding: 0.6rem 1rem; background: var(--paper); color: var(--ink); font-weight: 600; }
.skip-jump:focus { left: var(--gutter, 1rem); top: 0.5rem; }
.drop { position: relative; background: var(--navy-950); color: var(--on-navy); border-bottom: 3px solid var(--b-dark); }
.drop-stage { position: relative; height: 100svh; min-height: 30rem; overflow: hidden; background: var(--navy-950); display: flex; flex-direction: column; }
.drop-art { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.drop-still { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.drop-layer { position: absolute; display: block; max-width: none; height: auto; transform-origin: 50% 50%; will-change: transform; pointer-events: none; }
.drop-plate { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; transform-origin: 50% 85%; }
.drop:not(.drop-live) .drop-layer, .drop:not(.drop-live) .drop-plate { display: none; }
.drop-live .drop-still { display: none; }
.drop-cap { position: relative; flex: none; z-index: 6; background: rgb(11 21 36 / 0.9); color: var(--on-navy); }
.drop-cap p { margin: 0; padding: 0.7rem 0; font-size: 0.8125rem; line-height: 1.5; max-width: 60rem; }
.drop-hint { position: absolute; z-index: 6; left: 50%; bottom: 5.4rem; translate: -50% 0; padding: 0.35rem 0.9rem; border-radius: 999px; background: rgb(11 21 36 / 0.78); color: var(--on-navy); font-size: 0.8125rem; letter-spacing: 0.04em; }
.drop:not(.drop-live) .drop-hint { display: none; }
.drop-live .cap-static, .drop:not(.drop-live) .cap-live { display: none; }

/* ---------- branch strip (table of contents under the home hero) ---------- */
.strip { padding-block: var(--space-6); background: var(--sand); color: var(--ink); }
.strip h2 { margin-bottom: var(--space-2); }
.strip > .wrap > p { max-width: 44rem; color: var(--ink-soft); }
.strip ol { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr)); }
.tile { position: relative; background: var(--paper); border-radius: 14px; overflow: hidden; border: 1px solid var(--rule); border-top: 4px solid var(--tile-accent, var(--b-light)); box-shadow: var(--shadow-card); }
.tile-media { position: relative; aspect-ratio: 16 / 10; background: var(--navy-950); }
.tile-media picture, .tile-media img, .tile-media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-media video { position: absolute; inset: 0; opacity: 0; transition: opacity 0.5s; }
.tile.is-playing .tile-media video { opacity: 1; }
.tile-play { position: absolute; left: 0.6rem; bottom: 0.6rem; min-height: 2.75rem; padding: 0.45rem 0.9rem; border-radius: 999px; border: 1.5px solid var(--on-navy); background: rgb(11 21 36 / 0.86); color: var(--on-navy);
  font: 600 0.8125rem/1.2 var(--font-body); cursor: pointer; }
.tile-play:focus-visible { outline: 3px solid var(--focus-on-dark); outline-offset: 2px; }
.tile-body { padding: 0.8rem 1rem 1rem; }
.tile-body h3 { font-size: var(--step-1); margin: 0; }
.tile-body p { margin: 0.2rem 0 0; font-size: var(--step--1); color: var(--ink-soft); }
.tile-body a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.tile-body a:hover { text-decoration-thickness: 2px; }
.tile-n { display: inline-block; min-width: 1.4em; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tile[data-branch="army"] { --tile-accent: #1b1b1b; }
.tile[data-branch="marine"] { --tile-accent: #a6192e; }
.tile[data-branch="navy"] { --tile-accent: #0b2545; }
.tile[data-branch="af"] { --tile-accent: #00308f; }
.tile[data-branch="space"] { --tile-accent: #0a0e1a; }
.tile[data-branch="cg"] { --tile-accent: #c8102e; }
.tile[data-branch="ng"] { --tile-accent: #8c6a3f; }

/* ---------- footer: precedence rail + legal ---------- */
.rail { margin-bottom: var(--space-5); padding-bottom: var(--space-4); border-bottom: 1px solid var(--rule-navy); }
.rail h2 { font-size: var(--step-0); margin-bottom: var(--space-2); }
.rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.rail li a { display: grid; grid-template-columns: auto 1fr; column-gap: 0.55rem; align-items: baseline; padding: 0.55rem 0.7rem; border-radius: 8px; border: 1px solid var(--rule-navy); border-bottom: 3px solid var(--rule-navy);
  color: var(--on-navy); text-decoration: none; min-height: 2.75rem; }
.rail li a:hover { background: var(--navy-800); }
.rail li.is-here a { border-bottom-color: var(--b-dark); background: var(--navy-800); }
.rail-n { grid-row: span 2; color: var(--on-navy-soft); font-variant-numeric: tabular-nums; font-size: 0.8125rem; }
.rail-name { font-weight: 600; font-size: 0.9375rem; }
.rail small { color: var(--on-navy-soft); font-size: 0.75rem; grid-column: 2; }
.rail-note { margin-top: var(--space-2); color: var(--on-navy-soft); font-size: 0.8125rem; max-width: 52rem; }
.credits .edits { display: block; color: var(--on-navy-soft); font-size: 0.78rem; margin-top: 0.15rem; }
.footer-legal .dow { font-weight: 600; }

@media (max-width: 47.99rem) {
  .hero-army { min-height: 44rem; }
  .motion-btn { font-size: 0.8125rem; padding: 0.5rem 0.9rem; }
  .drop-stage { min-height: 28rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-video, .cg-flat, .tile-media video { transition: none; }
}

/* lighter scrim than the photo heroes of the base site so the footage reads; text still sits on >= 0.5 navy */
.hero-branch .hero-scrim { background: linear-gradient(90deg, rgb(11 21 36 / 0.92) 0%, rgb(11 21 36 / 0.86) 34%, rgb(11 21 36 / 0.66) 58%, rgb(11 21 36 / 0.2) 80%, rgb(11 21 36 / 0) 95%); }
.hero-branch .hero-scrim::after { content: ""; position: absolute; inset: auto 0 0 0; height: 34%; background: linear-gradient(0deg, rgb(11 21 36 / 0.55), rgb(11 21 36 / 0)); }
@media (max-width: 47.99rem) {
  .hero-branch .hero-scrim { background: linear-gradient(0deg, rgb(11 21 36 / 0.92) 0%, rgb(11 21 36 / 0.84) 46%, rgb(11 21 36 / 0.46) 66%, rgb(11 21 36 / 0.1) 86%); }
  .hero-branch .hero-scrim::after { display: none; }
}

/* Phone menu: collapsed from the first paint. Before this, the full menu showed until site.js ran, then collapsed:
   a 300 px layout shift (CLS 0.30) on every phone page. Without JavaScript nojs.css (loaded by <noscript>) shows it. */
@media (max-width: 60rem) { .main-nav:not(.open) { display: none; } }

/* Air Force on phones: show the whole three-ship formation (letterboxed on a matching dusk sky) instead of a cover crop that cuts it off */
@media (max-width: 47.99rem) {
  .hero-af .hero-stage { background: linear-gradient(180deg, #646a7e 0%, #777a8c 50%, #6f6f7b 100%); }
  .hero-af .hero-poster, .hero-af .hero-video { object-fit: contain; object-position: 50% 22%; -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14%, #000 86%, transparent 100%); mask-image: linear-gradient(180deg, transparent 0, #000 14%, #000 86%, transparent 100%); }
}

/* phones: keep the subject in frame */
@media (max-width: 47.99rem) {
  .hero-army .hero-poster, .hero-army .hero-video { object-position: 18% 38%; }
  .drop-art .cover-box { translate: -37% -50%; }
}
