/*
 * Holdfast CWRP loading screen — Grand Army of the Republic theme.
 * Structure follows the Veilnet design system (hairline panels, corner
 * brackets, mono callsigns, ambient layer); colours are Republic:
 * roundel maroon + gold, Venator red, hologram blue.
 *
 * Kept to CSS that GMod's embedded Chromium handles: no color-mix(), no
 * aspect-ratio, no individual translate/scale properties.
 */

:root {
  --canvas: #05070b;
  --panel: rgba(8, 11, 17, 0.84);
  --raised: #151b25;
  --grid: rgba(111, 211, 255, 0.06);
  --hairline: #26303d;
  --line-strong: #5a6676;
  --text: #ece9e2;          /* Venator hull white */
  --text-muted: #8e98a6;

  --maroon: #7a2324;        /* roundel ring */
  --red: #c4282e;           /* Venator stripe red */
  --red-text: #ff5a52;
  --gold: #f0e464;          /* roundel gold */
  --holo: #6fd3ff;          /* hologram blue */
  --holo-soft: rgba(111, 211, 255, 0.28);
  --ok: #58e0a0;
  --warn: #f0a640;

  /* aliases used by inline styles */
  --signal: var(--red);
  --corona: var(--holo);

  --font-sans: 'Space Grotesk', 'Segoe UI', Tahoma, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;

  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-bracket: cubic-bezier(0.3, 1.4, 0.5, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  cursor: default;
}

/* ---------- Type ---------- */
.type-display { font-size: 60px; line-height: 62px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.type-heading { font-size: 20px; line-height: 26px; font-weight: 600; }
.type-eyebrow { font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.32em; text-transform: uppercase; }
.type-body-sm { font-size: 14px; line-height: 21px; }
.type-readout { font-family: var(--font-mono); font-size: 28px; line-height: 32px; font-weight: 500; font-variant-numeric: tabular-nums; }
.type-data { font-family: var(--font-mono); font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; }
.type-callsign { font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; }
.muted { color: var(--text-muted); }
.corona, .holo { color: var(--holo); }
.gold { color: var(--gold); }
.signal { color: var(--red-text); }

/* ---------- Ambient ---------- */
.ambient { position: fixed; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; pointer-events: none; z-index: 0; }

.bg {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background-size: cover; background-position: center;
  opacity: 0;
  transition: opacity 3.5s ease;
  -webkit-filter: brightness(0.62) saturate(0.95);
  filter: brightness(0.62) saturate(0.95);
}
.bg.on { opacity: 1; }

/* Darken top (header) and bottom (progress) so text holds over the art. */
.shade {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background:
    linear-gradient(180deg, rgba(5, 7, 11, 0.75) 0%, rgba(5, 7, 11, 0.25) 30%, rgba(5, 7, 11, 0.35) 65%, rgba(5, 7, 11, 0.92) 100%);
}

.grid {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 10%, transparent 60%);
  mask-image: radial-gradient(circle at 50% 50%, #000 10%, transparent 60%);
}
.scan {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: repeating-linear-gradient(0deg, rgba(111, 211, 255, 0.035) 0 1px, transparent 1px 3px);
}
.vignette {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.7) 100%);
}
.ring {
  position: absolute; left: 50%; top: 50%;
  width: 520px; height: 520px; margin: -260px 0 0 -260px;
  border: 1px solid rgba(111, 211, 255, 0.10); border-radius: 50%;
  animation: ring-in 4.5s var(--ease-out) both;
}
.ring-outer {
  width: 760px; height: 760px; margin: -380px 0 0 -380px;
  border: 1px dashed rgba(240, 228, 100, 0.07);
  animation-delay: 0.3s;
}

/* Hyperspace streak on load */
.jump {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 40; pointer-events: none; opacity: 0;
  background-image:
    radial-gradient(1px 1px at 50% 50%, var(--text), transparent),
    radial-gradient(1px 1px at 20px 30px, var(--text), transparent),
    radial-gradient(1px 1px at 140px 90px, var(--holo), transparent),
    radial-gradient(1px 1px at 200px 180px, var(--text), transparent);
  background-size: 260px 260px;
  animation: jump 1.4s var(--ease-out) both;
}

/* ---------- Layout ---------- */
.screen {
  position: relative; z-index: 1;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 5vh 48px 4vh;
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
}
.screen > * { -webkit-flex-shrink: 0; flex-shrink: 0; }

.head { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; margin-top: auto; }

/* Emblem: roundel with a rotating holo ring */
.emblem {
  position: relative;
  width: 84px; height: 84px; -webkit-flex: none; flex: none;
  margin-right: 26px;
  border-radius: 50%;
  color: var(--gold);
  padding: 12px;
  background: rgba(8, 11, 17, 0.7);
  box-shadow: 0 0 0 1px var(--hairline), 0 0 40px rgba(196, 40, 46, 0.25);
}
.emblem::before {
  content: '';
  position: absolute; top: -7px; right: -7px; bottom: -7px; left: -7px;
  border-radius: 50%;
  border: 1px dashed var(--holo-soft);
  border-top-color: var(--holo);
  animation: spin 14s linear infinite;
}
.emblem svg { width: 100%; height: 100%; display: block; }
.emblem img { width: 100%; height: 100%; display: block; border-radius: 50%; }
.emblem.has-img { padding: 6px; }

.head-text { -webkit-flex: 1; flex: 1; min-width: 0; }
.head-text h1 {
  margin: 2px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8);
}
.subline { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; }
.subline .type-eyebrow { color: var(--gold); }

/* Venator hull stripes */
.stripes {
  width: 110px; height: 10px; margin-left: 16px;
  background: repeating-linear-gradient(-60deg, var(--red) 0 8px, transparent 8px 14px);
  opacity: 0.9;
}


.joining {
  margin: 20px 0 22px;
  padding: 8px 14px;
  border-left: 3px solid var(--gold);
  background: linear-gradient(90deg, rgba(122, 35, 36, 0.75), rgba(122, 35, 36, 0.15) 60%, transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.joining .muted { color: rgba(236, 233, 226, 0.65); }
.joining .corona { margin-left: 8px; color: var(--text); font-weight: 500; }

.screen > .cols {
  display: -webkit-flex; display: flex;
  -webkit-flex: 0 1 auto; flex: 0 1 auto;
  min-height: 0;
}
.cols > .panel { -webkit-flex: 1 1 0; flex: 1 1 0; min-width: 0; margin-right: 16px; }
.cols > .panel:last-child { margin-right: 0; }

.lower { display: -webkit-flex; display: flex; margin-top: 16px; }
.lower .comms { -webkit-flex: 2 1 0; flex: 2 1 0; margin-right: 16px; }
.lower .log { -webkit-flex: 1 1 0; flex: 1 1 0; }

/* ---------- Panel ---------- */
.panel {
  position: relative;
  padding: 0 18px 18px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  overflow: hidden;
  animation: panel-in 1.1s var(--ease-out) both;
}
.panel::before, .panel::after {
  content: '';
  position: absolute; width: 12px; height: 12px; z-index: 2;
  border-color: var(--bracket, var(--holo));
  border-style: solid;
  animation: bracket-in 0.9s var(--ease-bracket) 2.2s both;
}
.panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.panel[data-bracket='corona'], .panel[data-bracket='gold'] { --bracket: var(--gold); }
.panel[data-bracket='signal'] { --bracket: var(--red); }

/* Header band: roundel maroon fading out, gold tab */
.panel-head {
  display: -webkit-flex; display: flex;
  -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-align-items: center; align-items: center;
  margin: 0 -18px 14px;
  padding: 10px 18px 9px 16px;
  border-left: 3px solid var(--gold);
  border-bottom: 1px solid rgba(196, 40, 46, 0.45);
  background: linear-gradient(90deg, rgba(122, 35, 36, 0.7), rgba(122, 35, 36, 0.12) 75%, transparent);
}
.panel-head .type-callsign { color: var(--text); }
.panel-head .muted { color: rgba(236, 233, 226, 0.6); }

/* About */
#about { color: var(--text); }
.discord { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--hairline); }
.discord .muted { margin-right: 10px; font-size: 11px; letter-spacing: 0.2em; }

/* Rules */
.rules { list-style: none; counter-reset: r; }
.rules li {
  counter-increment: r;
  position: relative;
  padding: 7px 0 7px 36px;
  font-size: 14px; line-height: 20px;
  border-bottom: 1px solid rgba(38, 48, 61, 0.6);
  animation: panel-in 0.9s var(--ease-out) both;
}
.rules li:last-child { border-bottom: 0; }
.rule-title { font-weight: 600; }
.rule-text { margin-top: 2px; font-size: 12.5px; line-height: 17px; color: var(--text-muted); }

/* Rules strip: full width, four rules per row. */
.rules-panel { margin-top: 16px; }
.rules { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin: 0 -10px; }
.rules li {
  width: 25%;
  padding: 4px 14px 8px 46px;
  border-bottom: 0;
}
.rules li .rule-title { padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid rgba(196, 40, 46, 0.35); }

.rules li::before {
  content: counter(r, decimal-leading-zero);
  position: absolute; left: 12px; top: 4px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  color: var(--gold);
}

/* Staff */
.staff { list-style: none; }
.staff li {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(38, 48, 61, 0.6);
  animation: panel-in 0.9s var(--ease-out) both;
}
.staff li:last-child { border-bottom: 0; }
.avatar {
  width: 40px; height: 40px; -webkit-flex: none; flex: none;
  margin-right: 12px;
  border: 1px solid var(--maroon);
  border-left: 3px solid var(--red);
  background: var(--raised);
  color: var(--gold);
  font-family: var(--font-mono); font-size: 14px; font-weight: 500;
  text-align: center; line-height: 38px;
  overflow: hidden;
}
.avatar img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.staff .name { font-size: 15px; line-height: 20px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.staff .rank { color: var(--holo); }
.staff .who { min-width: 0; }
.staff .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { position: relative; }
.avatar .online {
  position: absolute; right: 2px; bottom: 2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 2px var(--canvas), 0 0 6px var(--ok);
}

/* Readouts */
.readouts > div {
  display: -webkit-flex; display: flex;
  -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-align-items: baseline; align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid rgba(38, 48, 61, 0.6);
}
.readouts dd { text-align: right; margin-left: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.readouts .type-readout { font-size: 22px; line-height: 26px; color: var(--gold); }

/* Comms / tips — holo transmission */
.comms .tip { color: var(--holo); text-shadow: 0 0 8px rgba(111, 211, 255, 0.35); }
.tip { min-height: 40px; }
.tip .gold { text-shadow: none; }
.cursor {
  display: inline-block; width: 9px; height: 16px; margin-left: 4px; vertical-align: -3px;
  background: var(--holo);
  animation: blink 1s steps(1) infinite;
}

/* Log */
.log ul { list-style: none; height: 40px; overflow: hidden; }
.log li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); animation: log-in 0.3s var(--ease-out) both; }
.log li:first-child { color: var(--text); }
.log li .ok { color: var(--ok); }
.log li .gt { color: var(--gold); }

/* ---------- Progress ---------- */
.progress-wrap { margin-top: auto; padding-top: 20px; }
.diamond-rule { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; margin-bottom: 14px; }
.diamond-rule::before, .diamond-rule::after { content: ''; -webkit-flex: 1; flex: 1; height: 1px; background: var(--hairline); }
.diamond-rule::before { background: linear-gradient(90deg, transparent, var(--maroon)); }
.diamond-rule::after { background: linear-gradient(90deg, var(--maroon), transparent); }
.diamond { width: 9px; height: 9px; margin: 0 12px; border: 1px solid var(--gold); background: var(--maroon); transform: rotate(45deg); }

.progress-meta {
  display: -webkit-flex; display: flex;
  -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-align-items: flex-end; align-items: flex-end;
  margin-bottom: 10px;
}
.progress-meta > div:first-child { min-width: 0; -webkit-flex: 1; flex: 1; margin-right: 24px; }
.progress-meta .right { text-align: right; }
.progress-meta .type-readout { color: var(--gold); }
.file { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Segmented bar: Venator red into roundel gold */
.bar {
  position: relative; height: 8px;
  background: rgba(21, 27, 37, 0.9);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.bar > span {
  position: absolute; top: 0; bottom: 0; left: 0; width: 100%;
  background: linear-gradient(90deg, var(--maroon), var(--red) 55%, var(--gold));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.5s var(--ease-out);
}
.bar::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 2;
  background: repeating-linear-gradient(90deg, transparent 0 10px, rgba(5, 7, 11, 0.9) 10px 12px);
  pointer-events: none;
}
.bar-glint {
  position: absolute; top: 0; bottom: 0; left: -30%; width: 30%; z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: glint 2.4s ease-in-out infinite;
}
.bar.done > span { background: linear-gradient(90deg, var(--holo), var(--ok)); }

/* ---------- Helpers ---------- */
.rise { animation: rise 1.6s var(--ease-out) 0.2s both; }
.fade-in { animation: panel-in 1.2s var(--ease-out) both; }
.pulse { animation: pulse 2.4s ease-in-out infinite; }

/* ---------- Smaller screens (e.g. 1366x768, 1280x720) ---------- */
@media (max-height: 900px) {
  .rule-text { display: none; }
  .rules li { padding-bottom: 4px; }
  .rules li .rule-title { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
}
@media (max-height: 820px) {
  .screen { padding-top: 2vh; padding-bottom: 2.5vh; }
  .avatar { width: 32px; height: 32px; line-height: 30px; font-size: 12px; }
  .staff .name { font-size: 14px; line-height: 18px; }
  .panel-head { padding-top: 8px; padding-bottom: 7px; margin-bottom: 10px; }
  .panel { padding-bottom: 12px; }
  .rules-panel, .lower { margin-top: 10px !important; }
  .progress-wrap { padding-top: 10px; }
  .diamond-rule { margin-bottom: 8px; }
  .tip { min-height: 20px; }
  .type-display { font-size: 44px; line-height: 48px; }
  .emblem { width: 68px; height: 68px; }
  .joining { margin: 12px 0 14px; }
  .staff li { padding: 5px 0; }
  .rule-text { display: none; }
}
@media (max-width: 1100px) {
  .screen { padding-left: 24px; padding-right: 24px; }
  .type-display { font-size: 38px; line-height: 42px; }
  .stripes { display: none; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .jump { display: none; }
}

@keyframes ring-in { from { transform: scale(0.6); opacity: 0; } }
@keyframes jump { 0% { transform: scaleX(18); opacity: 0.9; } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); letter-spacing: 0.6em; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes bracket-in { from { transform: scale(0); opacity: 0; } }
@keyframes pulse { 50% { opacity: 0.25; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes type { to { max-width: 100%; } }
@keyframes log-in { from { opacity: 0; transform: translateX(-8px); } }
@keyframes glint { 0% { left: -30%; } 100% { left: 100%; } }
