/* Firefighters: The Game (AITCOH firefighter campaign).
   Palette per BRAND.md + the 2026-07 firefighter email campaign:
   fire reds #8C001A/#B31217/#E5372E, Radiant Gold #fdd841, charcoal #333,
   night surfaces #0b0c0d/#1c1c1e/#23272b, Light Linen #fffce5. */

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../assets/fonts/Montserrat-VariableFont_wght.ttf') format('truetype-variations');
}
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url('../assets/fonts/SourceSans3-VariableFont_wght.ttf') format('truetype-variations');
}

:root {
    --gold: #fdd841;
    --gold-deep: #e8b219;
    --charcoal: #333333;
    --linen: #fffce5;
    --night: #0b0c0d;
    --panel: #1c1c1e;
    --panel-2: #23272b;
    --line: #3d4247;
    --red-deep: #8C001A;
    --red: #B31217;
    --red-hot: #E5372E;
    --orange: #ff7a1a;
    --water: #4db2ff;
    --ok: #7fd069;
    --heading: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
    --body: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body {
    background: radial-gradient(120% 90% at 50% -10%, #2a0d08 0%, var(--night) 55%);
    color: var(--linen);
    font-family: var(--body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.shell { max-width: 1020px; margin: 0 auto; padding: 20px 14px 30px; }

/* Masthead */
.masthead { text-align: center; padding: 6px 0 14px; }
.masthead__kicker {
    font-family: var(--heading); font-weight: 700; font-size: 12px;
    letter-spacing: 4px; color: var(--gold);
}
.masthead__title {
    margin-top: 8px; line-height: 0;
    position: relative; display: inline-block; max-width: 100%;
}
.masthead__wordmark { width: min(560px, 92%); height: auto; position: relative; z-index: 2; }

/* Fiery glow behind the wordmark */
.masthead__title::before {
    content: ""; position: absolute; z-index: 0;
    left: 6%; right: 6%; top: -18%; bottom: -18%;
    background: radial-gradient(closest-side, rgba(255, 122, 26, 0.5) 0%, rgba(229, 55, 46, 0.28) 55%, transparent 78%);
    filter: blur(10px);
    animation: glow-pulse 3.6s ease-in-out infinite alternate;
}
@keyframes glow-pulse {
    from { opacity: 0.7; transform: scale(0.96); }
    to   { opacity: 1;   transform: scale(1.05); }
}

/* Rising smoke puffs behind the letters */
.masthead__fx { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.masthead__fx i {
    position: absolute; bottom: 8%; width: 84px; height: 84px; border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 66, 60, 0.5) 0%, transparent 68%);
    filter: blur(12px); opacity: 0;
    animation: smoke-rise 7s linear infinite;
}
.masthead__fx i:nth-child(1) { left: 10%; animation-delay: 0s; }
.masthead__fx i:nth-child(2) { left: 36%; animation-delay: 2s; animation-duration: 8s; }
.masthead__fx i:nth-child(3) { left: 58%; animation-delay: 4.2s; }
.masthead__fx i:nth-child(4) { left: 78%; animation-delay: 1.1s; animation-duration: 6.2s; }
@keyframes smoke-rise {
    0%   { transform: translate(0, 26px) scale(0.55); opacity: 0; }
    22%  { opacity: 0.55; }
    100% { transform: translate(34px, -130px) scale(1.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .masthead__title::before { animation: none; }
    .masthead__fx { display: none; }
}

/* Stage */
.stage {
    position: relative; border: 1px solid var(--line); border-radius: 12px;
    overflow: hidden; background: var(--night);
    box-shadow: 0 10px 50px rgba(179, 18, 23, 0.22), 0 2px 14px rgba(0,0,0,0.6);
}
#game { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }

/* HUD */
.hud {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; gap: 14px; align-items: center;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(11,12,13,0.88) 0%, rgba(11,12,13,0.55) 70%, transparent 100%);
    pointer-events: none;
}
.hud__group { min-width: 120px; }
.hud__group--wind { min-width: 90px; }
.hud__group--right { margin-left: auto; display: flex; gap: 16px; align-items: center; }
.hud__label {
    font-family: var(--heading); font-weight: 700; font-size: 10px;
    letter-spacing: 2px; color: #a9a29b; margin-bottom: 4px;
}
.hud__stat { display: flex; flex-direction: column; align-items: flex-end; }
.hud__value { font-family: var(--heading); font-weight: 800; font-size: 18px; color: var(--linen); }
.hud__value--fire { color: var(--red-hot); }
.hud__value--trees { color: var(--orange); }
.meter {
    height: 12px; border-radius: 6px; background: rgba(255,255,255,0.12);
    overflow: hidden; border: 1px solid rgba(255,255,255,0.18);
}
.meter__fill { height: 100%; width: 100%; border-radius: 6px; transition: width 0.15s linear; }
.meter__fill--water { background: linear-gradient(90deg, #2b7fd4, var(--water)); }
.meter__fill--house { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
.meter__fill--danger { background: linear-gradient(90deg, var(--red-deep), var(--red-hot)); }
.wind { display: flex; align-items: center; gap: 6px; font-family: var(--heading); font-weight: 800; font-size: 15px; }
.wind__arrow { color: var(--orange); display: inline-block; transform-origin: center; }
.hud__pause {
    pointer-events: auto; background: rgba(255,255,255,0.1); color: var(--linen);
    border: 1px solid rgba(255,255,255,0.25); border-radius: 8px;
    font-family: var(--heading); font-weight: 800; font-size: 13px;
    width: 34px; height: 34px; cursor: pointer;
}
.hud__pause:hover { background: rgba(255,255,255,0.2); }
.hud__pause.muted { opacity: 0.35; }
.hud__radio {
    pointer-events: auto; background: rgba(255,255,255,0.1);
    border: 1px solid rgba(253, 216, 65, 0.45); border-radius: 8px;
    width: 34px; height: 34px; cursor: pointer; padding: 4px;
}
.hud__radio img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hud__radio:hover { background: rgba(253, 216, 65, 0.2); }
.hud__radio.used { opacity: 0.3; cursor: default; border-color: rgba(255,255,255,0.2); }

/* Alerts */
.alert {
    position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
    background: rgba(140, 0, 26, 0.92); border: 1px solid var(--red-hot);
    color: #fff; font-family: var(--heading); font-weight: 800;
    font-size: 13px; letter-spacing: 1.5px; padding: 8px 18px; border-radius: 8px;
    pointer-events: none; white-space: nowrap; max-width: 94%; overflow: hidden;
    text-overflow: ellipsis;
}

/* Overlays */
.overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(11, 12, 13, 0.82); backdrop-filter: blur(3px); padding: 16px; z-index: 5;
}
.overlay__card {
    max-width: 520px; width: 100%; text-align: center;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line); border-top: 3px solid var(--red-hot);
    border-radius: 14px; padding: 26px 26px 24px;
    max-height: 100%; overflow-y: auto;
}
.overlay__card--slim { max-width: 320px; }
.overlay__card--slim .btn { display: block; width: 100%; margin-top: 10px; }
.overlay__card--split {
    max-width: 720px; display: flex; gap: 22px; align-items: center;
    text-align: left; padding: 18px;
}
.overlay__poster {
    /* Natural 2:3 aspect, never cropped */
    width: 218px; height: auto; flex: 0 0 auto; align-self: center;
    border-radius: 10px;
    border: 1px solid rgba(253, 216, 65, 0.35);
    box-shadow: 0 6px 24px rgba(140, 0, 26, 0.5);
}
.overlay__main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.overlay__card--split .overlay__list { margin-left: 0; }
.overlay__card--split .btn--ceasy { align-self: flex-start; }
.overlay__card--ember {
    background:
        linear-gradient(180deg, rgba(17, 15, 14, 0.82), rgba(11, 12, 13, 0.9)),
        url('../assets/images/overlay-bg.jpg') center / cover no-repeat;
}
.overlay__kicker {
    font-family: var(--heading); font-weight: 700; font-size: 11px;
    letter-spacing: 3px; color: var(--gold); margin-bottom: 8px;
}
.overlay__title {
    font-family: var(--heading); font-weight: 800; font-size: clamp(22px, 4vw, 32px);
    letter-spacing: 1px; margin-bottom: 12px;
}
.overlay__body { color: #cfc9bd; font-size: 15px; line-height: 1.55; margin-bottom: 14px; }
.overlay__list {
    list-style: none; text-align: left; margin: 0 auto 18px; max-width: 340px;
    color: var(--linen); font-size: 14px;
}
.overlay__list li { padding: 5px 0 5px 22px; position: relative; }
.overlay__list li::before { content: "\25B8"; color: var(--orange); position: absolute; left: 4px; }

/* Buttons: btn--ceasy per the C-Easy™ button rule (Radiant Gold gradient, charcoal text) */
.btn {
    display: inline-block; border: 0; border-radius: 10px; cursor: pointer;
    font-family: var(--heading); font-weight: 800; letter-spacing: 1.5px;
    font-size: 15px; padding: 14px 30px; text-decoration: none; text-align: center;
}
.btn--ceasy {
    background: linear-gradient(180deg, #ffe9a8 0%, var(--gold) 45%, var(--gold-deep) 100%);
    color: var(--charcoal);
    box-shadow: 0 4px 18px rgba(253, 216, 65, 0.35);
}
.btn--ceasy:hover { filter: brightness(1.06); }
.btn--next {
    background: linear-gradient(180deg, var(--red-hot), var(--red));
    color: #fff; font-size: 13px; padding: 12px 22px;
    box-shadow: 0 4px 16px rgba(229, 55, 46, 0.4);
}
.btn--next:hover { filter: brightness(1.08); }
.btn--ghost {
    background: transparent; color: var(--linen);
    border: 1px solid var(--line); font-size: 13px; padding: 11px 20px;
}
.btn--ghost:hover { border-color: var(--gold); color: var(--gold); }

/* Score */
.score { max-width: 360px; margin: 0 auto 8px; }
.score__row {
    display: flex; justify-content: space-between; padding: 6px 2px;
    border-bottom: 1px dashed var(--line); font-size: 14px; color: #cfc9bd;
}
.score__row span:last-child { font-family: var(--heading); font-weight: 700; color: var(--linen); }
.score__total {
    display: flex; justify-content: space-between; max-width: 360px; margin: 10px auto 2px;
    font-family: var(--heading); font-weight: 800; font-size: 19px; color: var(--gold);
    letter-spacing: 1px;
}
.score__rank {
    font-family: var(--heading); font-weight: 700; font-size: 13px; letter-spacing: 2px;
    color: var(--orange); margin-bottom: 16px;
}

/* Recruitment pitch */
.pitch { border-top: 1px solid var(--line); padding-top: 16px; }
.pitch__line { color: #cfc9bd; font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
.pitch .btn--ceasy { width: 100%; max-width: 360px; }
/* The row always spans exactly the CTA's width; buttons split it evenly */
.pitch__row {
    display: flex; gap: 10px; margin: 10px auto 0;
    width: 100%; max-width: 360px;
}
.pitch__row .btn {
    flex: 1 1 0; padding-left: 6px; padding-right: 6px;
    font-size: 12px; letter-spacing: 0.5px; white-space: nowrap;
}

/* Footer */
.footer { text-align: center; padding: 26px 8px 8px; }
.footer__createdby {
    font-family: var(--heading); font-weight: 700; font-size: 10px;
    letter-spacing: 3px; color: #8a938f; margin-bottom: 8px;
}
.footer__logo { width: 250px; max-width: 76%; height: auto; margin-bottom: 14px; }
.footer__legal {
    color: #8a938f; font-size: 11.5px; line-height: 1.55; max-width: 760px;
    margin: 0 auto 8px;
}

@media (max-width: 900px) {
    /* Below desktop widths the 16:9 stage is too short to hold the overlay
       cards, so they cover the viewport instead; buttons stay reachable */
    .overlay { position: fixed; z-index: 50; }
}

@media (max-width: 640px) {
    .shell { padding: 12px 6px 22px; }
    .overlay__card--split { flex-direction: column; text-align: center; max-width: 420px; }
    .overlay__poster { display: none; }
    .overlay__main { justify-content: flex-start; }
    .overlay__card--split .btn--ceasy { align-self: center; }
    /* HUD wraps to two rows: meters on top, stats and controls below */
    .hud { gap: 6px 10px; padding: 8px; flex-wrap: wrap; }
    .hud__group { min-width: 96px; }
    .hud__group--wind { display: none; }
    .hud__group--right { margin-left: 0; width: 100%; justify-content: space-between; gap: 8px; }
    .hud__value { font-size: 15px; }
    .hud__radio, .hud__pause { width: 40px; height: 40px; }
    .overlay__card { padding: 18px 14px 16px; }
    .alert { font-size: 11px; top: 96px; }
}

@media (prefers-reduced-motion: reduce) {
    .meter__fill { transition: none; }
}

/* Landscape phones: the game fills the screen edge to edge (class toggled
   from JS when the world is rendered at the exact viewport aspect ratio). */
body.landscape-fill { overflow: hidden; }
body.landscape-fill .shell { max-width: none; margin: 0; padding: 0; }
body.landscape-fill .masthead,
body.landscape-fill .footer { display: none; }
body.landscape-fill .stage {
    border: 0; border-radius: 0; box-shadow: none;
    height: 100vh; height: 100dvh;
}
body.landscape-fill #game { width: 100%; height: 100%; aspect-ratio: auto; }
