/* ============================================================
   APEX HELICAM, hud.css : the turret overlay

   1rem = 10px on a 1080p screen and scales with the height of the window,
   so the overlay keeps its proportions on any resolution without ever
   using transform: scale (which blurs text in FiveM's CEF).

   THE LOOK IS THE LOOK OF THE REAL EQUIPMENT
     · a character generator, not a user interface: lines of fixed pitch text
       that hug the four corners, and the whole middle of the screen left to
       the picture. No cards, no panels, no titles with a life of their own
     · ONE ink. Colour means something, the way it does in a cockpit:
       green an engaged mode, amber a caution, red a warning. Nothing else
       is ever coloured
     · emphasis is INVERSE VIDEO, the oldest trick of an on screen display
     · every line sits on a strip of "text background" exactly as wide as its
       text, so it reads over a street at noon and over a white thermal
       picture alike, with a hard one pixel edge and no glow

   Rules this file keeps, all learnt the hard way in CEF:
     · no backdrop-filter (it composites as an opaque black box)
     · no `filter` at all: it forces a compositing layer over the transparent
       page. Line art gets its dark edge from a second, wider stroke instead
     · no color-mix (comes out transparent): tints are set from JS as rgba
     · motion is opacity only
     · [hidden] always wins over display
   ============================================================ */

@font-face {
    font-family: 'GTAArtDeco';
    src: url('../fonts/GTAArtDeco-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: block;
}
@font-face {
    font-family: 'GTAArtDeco';
    src: url('../fonts/GTAArtDeco-Medium.ttf') format('truetype');
    font-weight: 500 900;
    font-display: block;
}

:root {
    --scale: 1;
    --osd: #FFC6D4;                      /* the ink, set from Config.hud.color */
    --osd-dim: rgba(255, 198, 212, .68);
    --osd-faint: rgba(255, 198, 212, .32);
    --plate: rgba(12, 13, 27, .46);         /* text background, from Config.hud.backing */
    --plate-strong: rgba(12, 13, 27, .72);
    --chip-ink: #0F0C1A;                 /* text in inverse video */
    --engaged: #E6FFA3;
    --caution: #FFDF80;
    --warning: #F4717C;
    --edge: .1rem .1rem 0 #000, -.1rem -.1rem 0 #000, .1rem -.1rem 0 #000, -.1rem .1rem 0 #000,
            0 .1rem 0 #000, 0 -.1rem 0 #000, .1rem 0 0 #000, -.1rem 0 0 #000, 0 0 .28rem rgba(0, 0, 0, .8);
    --m: 3.4rem;                         /* how close to the edge the text lives */
}

[hidden] { display: none !important; }

/* 1rem = 8.64px at 1080p (hud.js mirrors the 125 in its gate arithmetic) */
html { font-size: calc(100vh / 125 * var(--scale)); }

html, body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    user-select: none;
}

body {
    background: transparent;
    font-family: 'GTAArtDeco', Arial, sans-serif;
    font-weight: 400;
    color: var(--osd);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

/* A monospace cell is as wide for a colon as for a digit, which reads as
   "12: 00: 00". Punctuation is pulled in so numbers read as one word. */
.pt { margin: 0 .02em; }

/* ─── Image processor + blackout ─────────────────────────── */
#optics {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
}

#cover {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .09s linear;
}
#cover.on { opacity: 1; transition: none; }
#cover span { font-size: 1.6rem; letter-spacing: .4em; color: var(--osd-dim); }

/* ─── Frame ──────────────────────────────────────────────── */
#hud {
    position: fixed;
    inset: 0;
    text-shadow: var(--edge);
    opacity: 0;
    transition: opacity .22s ease-out;
}
#hud.on { opacity: 1; }

.lens, .ar { position: absolute; inset: 0; pointer-events: none; }

.tac, .bcs { position: absolute; inset: 0; }
#hud.skin-tactical .bcs,
#hud.skin-broadcast .tac, #hud.skin-broadcast .ar { display: none; }

/* ─── The line: the only building block ──────────────────── */
.stack { position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: .16rem; }
.stack.tl { left: var(--m);  top: 3rem; }
.stack.tr { right: var(--m); top: 3rem; align-items: flex-end; }
.stack.bl { left: var(--m);  bottom: 13.4rem; }
.stack.br { right: var(--m); bottom: 13.4rem; align-items: flex-end; }

.ln {
    display: inline-flex;
    align-items: baseline;
    gap: .8rem;
    background: var(--plate);
    padding: .34rem .85rem .26rem;
    white-space: nowrap;
    font-size: 1.48rem;
    line-height: 1.28;
    max-width: 100%;
    box-sizing: border-box;
}
.ln i  { font-style: normal; color: var(--osd-dim); font-size: 1.16rem; letter-spacing: .12em; }
.ln b  { font-weight: 700; }
.ln u  { text-decoration: none; color: var(--osd-dim); font-size: 1.02rem; letter-spacing: .08em; margin-left: -.45rem; }
.ln b + i, .ln u + i, .ln span + i { margin-left: .7rem; }
.ln span { color: var(--osd-dim); }
.ln.dim, .ln.dim span { color: var(--osd-dim); font-size: 1.2rem; letter-spacing: .14em; }
.ln.dim span:empty { display: none; }

/* inverse video: an engaged mode, a read out, a number plate */
.ann {
    background: var(--osd);
    color: var(--chip-ink) !important;
    text-shadow: none;
    font-weight: 700;
    padding: 0 .55rem;
    letter-spacing: .1em;
    box-shadow: 0 0 0 .1rem rgba(0, 0, 0, .5);
}
.ann.engaged { background: var(--engaged); }
.ann.caution { background: var(--caution); }
.ann.warning { background: var(--warning); }
.blink { animation: blink .5s steps(2, start) infinite; }

/* ─── Top ────────────────────────────────────────────────── */
.tape { position: absolute; top: 2.6rem; left: 0; right: 0; margin: 0 auto; width: 70rem; height: 6.65rem; }
.tape canvas { width: 70rem; height: 6.65rem; display: block; }

.ln.unit { padding-top: .3rem; }
.ln.unit b { font-size: 1.75rem; letter-spacing: .18em; line-height: 1.15; }
.links { display: flex; flex-direction: column; align-items: flex-end; gap: .16rem; }
.links .ln { font-size: 1.22rem; letter-spacing: .1em; color: var(--osd-dim); }
.links .hot { color: var(--osd); }
.links .hot::before { content: ''; align-self: center; width: .78rem; height: .78rem; border-radius: 50%; background: var(--warning); animation: blink 1.1s steps(2, start) infinite; }

/* moving map */
.mapBox { margin-top: .5rem; display: flex; flex-direction: column; align-items: flex-end; gap: .16rem; }
.mapBox canvas { width: 20rem; height: 20rem; display: block; background: var(--plate-strong); box-shadow: 0 0 0 .1rem var(--osd-faint), 0 0 0 .2rem rgba(0, 0, 0, .55); }
.ln.cap { font-size: 1.12rem; }
.ln.cap i { font-size: 1.02rem; }

/* ─── Target track log ───────────────────────────────────── */
.stack.tk { left: var(--m); bottom: 27rem; }
.ln.spd b { font-size: 1.85rem; line-height: 1.05; letter-spacing: .08em; }
.ln.spd #tkHdg { font-size: 1.48rem; }
#tkTrend { color: var(--osd); font-size: 1.2rem; letter-spacing: .12em; }
#tkTrend.caution { color: var(--caution); }
.stack.tk.coast .ln b:not(.ann) { color: var(--osd-dim); }
#hud.lvl-3 .stack.tk { display: none; }

/* ─── Sensor ─────────────────────────────────────────────── */
.ln.big { align-items: baseline; gap: 1.1rem; padding-top: .4rem; }
.ln.big b { font-size: 2.1rem; letter-spacing: .12em; line-height: 1.05; }
.ln.big span { color: var(--osd); font-size: 1.3rem; letter-spacing: .12em; }
#snFovName { font-size: 1.12rem; letter-spacing: .12em; }

.zoombar { position: relative; width: 24rem; height: 1.3rem; background: var(--plate); }
.zoombar::before { content: ''; position: absolute; left: .9rem; right: .9rem; top: 50%; border-top: .1rem solid var(--osd-faint); }
.zoombar::after  { content: ''; position: absolute; left: .9rem; right: .9rem; top: .35rem; bottom: .35rem; border-left: .1rem solid var(--osd-dim); border-right: .1rem solid var(--osd-dim); }
.zoombar span { position: absolute; top: .2rem; width: .3rem; height: .9rem; background: var(--osd); box-shadow: 0 0 0 .1rem #000; left: .9rem; }

#spotState.on { color: var(--engaged); }

/* ─── Turret ─────────────────────────────────────────────── */
.gimbal { width: 14.5rem; background: var(--plate); padding: .4rem .5rem .2rem .2rem; box-sizing: border-box; }
.gimbal svg { width: 100%; display: block; overflow: visible; }

/* line art: a wide black stroke under the ink instead of a filter */
svg .under     { fill: none; stroke: rgba(0, 0, 0, .82); stroke-width: 3.4; stroke-linecap: square; stroke-linejoin: miter; }
svg .ink       { fill: none; stroke: var(--osd); stroke-width: 1.25; stroke-linecap: square; }
svg .ink.dim   { stroke: var(--osd-dim); }
svg .underFill { fill: #000; stroke: rgba(0, 0, 0, .82); stroke-width: 2.4; stroke-linejoin: round; }
svg .fill      { fill: var(--osd); stroke: none; }
svg .wedge     { fill: var(--osd-faint); stroke: none; }
svg .svgText   { font-family: 'GTAArtDeco', Arial, sans-serif; font-size: 7.5px; fill: var(--osd-dim); stroke: #000; stroke-width: 2.2; paint-order: stroke; letter-spacing: 0; }
svg .svgText.mid { text-anchor: middle; fill: var(--osd); font-weight: 700; }

/* ─── Bottom lines ───────────────────────────────────────── */
.bottom {
    position: absolute;
    left: var(--m);
    right: var(--m);
    bottom: 4.7rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .16rem;
}
.bottom .ln { overflow: hidden; }
.bottom .ln > span { overflow: hidden; text-overflow: ellipsis; color: var(--osd); }
.loc span { color: var(--osd-dim); }
.tinfo s { text-decoration: none; color: var(--osd-faint); margin: 0 .8rem; }
.tinfo .plate { font-weight: 700; padding: 0 .55rem; background: var(--osd); color: var(--chip-ink); text-shadow: none; letter-spacing: .14em; }
.tinfo .warning { color: var(--warning); font-weight: 700; }
.tinfo .caution { color: var(--caution); }
.tinfo .dimmed { color: var(--osd-dim); }

/* ─── Reticle ────────────────────────────────────────────── */
.reticle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 19rem;
    height: 19rem;
    margin: -9.5rem 0 0 -9.5rem;
}
.reticle svg { width: 100%; height: 100%; display: block; overflow: visible; }
.reticle .diamond, .reticle .brackets { display: none; }
.reticle.scan .brackets { display: block; }        /* the acquisition gate only means something while nothing is held */
.reticle.trk .cross, .reticle.coast .cross { opacity: .3; }
.reticle.geo .diamond { display: block; }
.reticle.geo .cross { opacity: .45; }

/* ─── Tracker gate ───────────────────────────────────────── */
.gate { position: absolute; left: 0; top: 0; width: 10%; height: 10%; --gate-ink: var(--engaged); }
/* Each corner is a true L: the ink (::after) over a black L one pixel wider
   on both sides (::before). A box-shadow would close the corner into a box. */
.gate i { position: absolute; width: 1.6rem; height: 1.6rem; }
.gate i::before, .gate i::after { content: ''; position: absolute; border: 0 solid; }
.gate i::before { inset: -.1rem; border-color: rgba(0, 0, 0, .8); }
.gate i::after  { inset: 0; border-color: var(--gate-ink); }
.gate i:nth-child(1) { left: 0;  top: 0; }
.gate i:nth-child(2) { right: 0; top: 0; }
.gate i:nth-child(3) { right: 0; bottom: 0; }
.gate i:nth-child(4) { left: 0;  bottom: 0; }
.gate i:nth-child(1)::before, .gate i:nth-child(4)::before { border-left-width: .4rem; }
.gate i:nth-child(2)::before, .gate i:nth-child(3)::before { border-right-width: .4rem; }
.gate i:nth-child(1)::before, .gate i:nth-child(2)::before { border-top-width: .4rem; }
.gate i:nth-child(3)::before, .gate i:nth-child(4)::before { border-bottom-width: .4rem; }
.gate i:nth-child(1)::after, .gate i:nth-child(4)::after { border-left-width: .2rem; }
.gate i:nth-child(2)::after, .gate i:nth-child(3)::after { border-right-width: .2rem; }
.gate i:nth-child(1)::after, .gate i:nth-child(2)::after { border-top-width: .2rem; }
.gate i:nth-child(3)::after, .gate i:nth-child(4)::after { border-bottom-width: .2rem; }
.gate span {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: .5rem;
    font-size: 1.12rem;
    color: var(--engaged);
    background: var(--plate);
    padding: .22rem .6rem .16rem;
    white-space: nowrap;
    letter-spacing: .1em;
}
.gate.coast { --gate-ink: var(--caution); animation: blink .5s steps(2, start) infinite; }
.gate.coast i::after { border-style: dashed; }
.gate.coast span { color: var(--caution); }

/* ─── Street names over the picture ──────────────────────── */
.st {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    font-size: 1.06rem;
    font-weight: 400;
    letter-spacing: .14em;
    white-space: nowrap;
    padding: .14rem .55rem .08rem .65rem;
    background: var(--plate);
    opacity: 0;
    transition: opacity .25s linear;
}
.st.on { opacity: .86; }

/* ─── Messages ───────────────────────────────────────────── */
.msg {
    position: absolute;
    left: 0;
    right: 0;
    top: 63%;
    text-align: center;
    font-size: 1.42rem;
    font-weight: 700;
    letter-spacing: .22em;
    opacity: 0;
    transition: opacity .18s ease-out;
}
.msg span { display: inline-block; background: var(--plate-strong); padding: .5rem 1.5rem .4rem 1.74rem; }
.msg.on { opacity: 1; }
.msg.warning span { background: var(--warning); color: var(--chip-ink); text-shadow: none; }
.msg.caution span { background: var(--caution); color: var(--chip-ink); text-shadow: none; }
.msg.engaged span { background: var(--osd); color: var(--chip-ink); text-shadow: none; }

.viewer { position: absolute; left: 0; right: 0; top: 11.2rem; text-align: center; font-size: 1.2rem; letter-spacing: .32em; }
.viewer span { display: inline-block; background: var(--caution); color: var(--chip-ink); text-shadow: none; font-weight: 700; padding: .3rem .9rem .22rem 1.2rem; }

/* ─── Softkeys ───────────────────────────────────────────── */
/* The controls, dressed as the legends of a display's bezel keys. */
.soft {
    position: absolute;
    left: var(--m);
    right: var(--m);
    bottom: 1.8rem;
    display: flex;
    justify-content: center;
    gap: .16rem;
    font-size: .96rem;
    letter-spacing: .1em;
    opacity: var(--soft-dim, .28);
    transition: opacity 1.4s ease-out;
}
.soft.fresh { opacity: 1; transition: opacity .18s ease-out; }
.sk { display: flex; align-items: stretch; background: var(--plate); }
.sk b { font-weight: 700; padding: .32rem .52rem .26rem; min-width: 1.5rem; text-align: center; color: var(--osd); box-shadow: inset 0 0 0 .1rem var(--osd-faint); }
.sk i { font-style: normal; padding: .32rem .68rem .26rem .58rem; color: var(--osd-dim); }
.sk.active b { background: var(--engaged); color: var(--chip-ink); text-shadow: none; box-shadow: none; }
.sk.active i { color: var(--engaged); }
.sk.active.caution b { background: var(--caution); }
.sk.active.caution i { color: var(--caution); }
.sk.na { opacity: .3; }

/* ─── Key help (overlay key, level 1) ────────────────────── */
.keys {
    position: absolute;
    left: 0; right: 0;
    bottom: 14rem;
    margin: 0 auto;
    width: 88rem;
    box-sizing: border-box;
    padding: 1.1rem 1.5rem 1rem;
    background: var(--plate-strong);
    box-shadow: inset 0 .16rem 0 var(--osd-dim);
    font-size: 1.12rem;
    text-transform: none;
    letter-spacing: .02em;
    display: grid;
    grid-template-columns: repeat(3, auto 1fr);
    column-gap: 1rem;
    row-gap: .5rem;
    align-items: center;
    opacity: 0;
    transition: opacity .22s ease-out;
}
.keys.on { opacity: 1; }
.keys b { justify-self: end; font-weight: 700; text-transform: uppercase; padding: .16rem .6rem .1rem; box-shadow: inset 0 0 0 .1rem var(--osd-dim); min-width: 2rem; text-align: center; }
.keys span { color: var(--osd-dim); padding-right: 1.4rem; }

/* ─── Declutter ──────────────────────────────────────────── */
#hud.lvl-2 .stack.tl, #hud.lvl-2 .stack.br, #hud.lvl-2 .mapBox, #hud.lvl-2 #tgLine,
#hud.lvl-2 .zoombar, #hud.lvl-2 .soft, #hud.lvl-2 .reticle .brackets { display: none; }
#hud.lvl-3 .tac, #hud.lvl-3 .bcs, #hud.lvl-3 .viewer, #hud.lvl-3 .soft, #hud.lvl-3 .lens,
#hud.lvl-3 .ar, #hud.lvl-3 .reticle .brackets { display: none; }

/* ─── Broadcast skin ─────────────────────────────────────── */
.bcsTop { position: absolute; top: 4rem; left: 5.2rem; right: 5.2rem; display: flex; justify-content: space-between; align-items: center; }
.bug { display: flex; align-items: stretch; gap: .2rem; font-size: 1.9rem; }
.bug .live { font-size: 1.4rem; font-weight: 700; padding: .5rem 1.1rem .4rem 1.3rem; background: rgba(12, 12, 14, .82); color: var(--osd-dim); letter-spacing: .22em; text-shadow: none; display: flex; align-items: center; }
.bug .live.on { background: #E0261B; color: #fff; }
.bug b { font-weight: 700; background: rgba(12, 12, 14, .82); padding: .4rem 1.2rem .3rem; color: #fff; text-shadow: none; }
.bug i { font-style: normal; color: var(--osd-dim); font-size: 1.3rem; background: var(--plate); padding: 0 1rem; display: flex; align-items: center; letter-spacing: .16em; }
.clock { font-size: 1.9rem; font-weight: 700; background: var(--plate); padding: .4rem 1.1rem .3rem; }
.frame i { position: absolute; width: 5rem; height: 5rem; border: 0 solid var(--osd-dim); }
.frame i:nth-child(1) { left: 5.2rem;  top: 10.5rem;    border-left-width: .15rem;  border-top-width: .15rem; }
.frame i:nth-child(2) { right: 5.2rem; top: 10.5rem;    border-right-width: .15rem; border-top-width: .15rem; }
.frame i:nth-child(3) { right: 5.2rem; bottom: 15.5rem; border-right-width: .15rem; border-bottom-width: .15rem; }
.frame i:nth-child(4) { left: 5.2rem;  bottom: 15.5rem; border-left-width: .15rem;  border-bottom-width: .15rem; }
.third { position: absolute; left: 5.2rem; bottom: 6.4rem; max-width: 110rem; display: flex; flex-direction: column; align-items: flex-start; }
.third .where { display: inline-block; font-size: 2.4rem; font-weight: 700; padding: .75rem 1.6rem .6rem; background: rgba(12, 12, 14, .84); box-shadow: inset .5rem 0 0 #E0261B; text-shadow: none; color: #fff; }
.third .where:empty { display: none; }
.third .sub { margin-top: .2rem; font-size: 1.25rem; color: var(--osd-dim); display: inline-flex; gap: 2rem; background: var(--plate); padding: .4rem 1.2rem .3rem; letter-spacing: .1em; }
#hud.skin-broadcast .reticle .cross { opacity: .4; }

/* ─── Advisories ─────────────────────────────────────────── */
/* A crew alerting list: newest on top, a square in the colour of the level,
   the text as the equipment would print it. Each line fades on its own. */
#adv {
    position: fixed;
    left: 0; right: 0;
    bottom: 31rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .16rem;
    text-shadow: var(--edge);
    pointer-events: none;
}
.adv {
    display: inline-flex;
    align-items: center;
    gap: .8rem;
    background: var(--plate);
    padding: .34rem 1rem .28rem .8rem;
    font-size: 1.22rem;
    letter-spacing: .1em;
    white-space: nowrap;
    max-width: 110rem;
    opacity: 0;
    transition: opacity .2s ease-out;
}
.adv.on { opacity: 1; }
.adv i { width: .8rem; height: .8rem; background: var(--osd); box-shadow: 0 0 0 .1rem rgba(0, 0, 0, .55); flex: none; }
.adv.engaged i { background: var(--engaged); }
.adv.caution i { background: var(--caution); }
.adv.caution span { color: var(--caution); }
.adv.warning i { background: var(--warning); }
.adv.warning span { color: var(--warning); }

/* ─── Autopilot / public address strip ───────────────────── */
/* Lives outside the overlay: the pilot sees it with the camera closed. */
#sys {
    position: fixed;
    left: 0; right: 0;
    top: 9.9rem;
    display: flex;
    justify-content: center;
    gap: .16rem;
    text-shadow: var(--edge);
    pointer-events: none;
}
#sys .ln { font-size: 1.3rem; }
#sys .ln span { font-size: 1.05rem; letter-spacing: .12em; }

/* ─── Pilot cue ──────────────────────────────────────────── */
#cue {
    position: fixed;
    left: 0; right: 0;
    top: 13.4rem;
    margin: 0 auto;
    width: 44rem;
    text-shadow: var(--edge);
    font-size: 1.36rem;
    display: flex;
    flex-direction: column;
    gap: .16rem;
}
.cueHead, .cueData { display: flex; justify-content: space-between; align-items: baseline; background: var(--plate); padding: .36rem .9rem .28rem; }
.cueHead b { font-size: 1.45rem; letter-spacing: .14em; }
.cueHead span { letter-spacing: .1em; }
.cueHead span.coast { color: var(--caution); }
.cueBar { position: relative; height: 1.9rem; background: var(--plate); }
.cueBar::before { content: ''; position: absolute; left: 1rem; right: 1rem; top: 50%; border-top: .1rem solid var(--osd-faint); }
.cueBar .nose { position: absolute; left: 50%; top: .3rem; bottom: .3rem; border-left: .15rem solid var(--osd); }
.cueBar span { position: absolute; top: .42rem; width: 1.05rem; height: 1.05rem; margin-left: -.52rem; background: var(--engaged); box-shadow: 0 0 0 .12rem #000; transition: left .2s linear; left: 50%; }
.cueBar span.edge { background: var(--caution); }
.cueData b { font-size: 1.7rem; }
.cueData span { color: var(--osd-dim); }

@keyframes blink { to { visibility: hidden; } }
