/* ===== NYPD COST COUNTER — CSS ===== */
/* Aesthetic: NYC municipal brutalism — bold, utilitarian, urgent */

:root {
  --nypd-blue: #003087;
  --nypd-blue-light: #1a4db0;
  --alert-red: #e8000d;
  --alert-amber: #ffb800;
  --white: #f5f5f0;
  --off-black: #0a0a0a;
  --dark-gray: #141414;
  --mid-gray: #2a2a2a;
  --mono: 'Share Tech Mono', monospace;
  --display: 'Oswald', sans-serif;
  --box-officer: rgba(0, 48, 135, 0.85);
  --box-vehicle: rgba(255, 184, 0, 0.85);
}

@font-face {
  font-family: 'Erotique Alternate Trial';
  src: url('fonts/ErotiqueTrial.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--off-black);
  color: var(--white);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* ===== SPLASH — MOBILE FIRST ===== */
#splash {
  position: fixed;
  inset: 0;
  background: var(--off-black);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  z-index: 100;
  overflow: hidden;
}

/* Mobile gradient overlays */
#splash::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 57vh;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent 87%);
  z-index: 2;
  pointer-events: none;
}

#splash::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 30vh;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent 42%);
  z-index: 2;
  pointer-events: none;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scattered images ── */
.splash-images {
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.splash-img {
  position: absolute;
  object-fit: cover;
  display: block;
}

.splash-img:not([src]), .splash-img[src=""] { visibility: hidden; }

/* ── Background photo ── */
.splash-bg {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.splash-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 0.3;
}

/* Mobile image positions */
.img-logo       { top: 5.7vh; left: 2.5%;  width: 24%;  height: auto; }
.img-officer-tr { top: 0;     left: 63%;   width: 61%;  height: auto; }
.img-car        { top: 57vh;  left: 7%;    width: 29%;  height: auto; }
.img-officer-mr { top: 65vh;  left: 53%;   width: 27%;  height: auto; }
.img-officer-bl { display: block; top: 75vh; left: -30%; width: 80%; height: auto; }
.img-officer-br { top: 75vh;  left: 40%;   width: 96%;  height: auto; }

/* ── Logo icon above title ── */
.splash-icon {
  position: relative;
  align-self: center;
  z-index: 5;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.splash-icon img {
  height: 2.2rem;
  width: auto;
  display: block;
  object-fit: contain;
}

/* ── Main content ── */
.splash-inner {
  position: relative;
  z-index: 10;
  width: 100%;
  flex: 1;
  padding: 4vh 0 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeUp 0.6s ease both;
}

.splash-inner h1 {
  font-family: 'Erotique Alternate Trial', serif;
  font-size: clamp(2rem, 10vw, 2.8rem);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: 0.01em;
  text-transform: none;
  text-align: center;
  background: linear-gradient(to bottom, #ffffff, #9f9f9f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 28px rgba(255,255,255,0.4));
  margin-bottom: 0.8rem;
  width: 100%;
}

.splash-inner h1 span {
  color: var(--white);
  font-size: inherit;
  display: block;
}

.tagline {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(245,245,240,0.85);
  margin-bottom: 1rem;
  text-align: center;
  padding: 0 1.5rem;
  width: 100%;
}

#startBtn {
  display: block;
  width: 239px;
  align-self: center;
  background: #ffffff;
  color: #000000;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 0.75rem 1rem;
  border: none;
  clip-path: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

#startBtn:active { opacity: 0.75; }

/* Methodology — mobile: pushed to bottom of screen, red border */
.methodology {
  width: calc(100% - 3rem);
  margin: auto auto 1rem;
  background: rgba(0,0,0,0.75);
  border: 1px solid #f81616;
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  line-height: 1.6;
  text-align: center;
  color: rgba(245,245,240,0.75);
}

.methodology span {
  color: rgba(245,245,240,0.75);
  font-size: 0.78rem;
  display: block;
}

/* ===== DESKTOP SPLASH (≥ 900px) ===== */
@media (min-width: 900px) {

  #splash {
    align-items: center;
    justify-content: center;
  }

  /* Desktop image positions */
  .img-logo       { top: 2%;   left: 1.5%; width: 12%;  height: 18%; }
  .img-car        { top: 26%;  left: 1.5%; width: 22%;  height: 24%; }
  .img-officer-bl { display: block; top: 52%; left: -1%;  width: 18%;  height: 42%; }
  .img-officer-tr { top: 1%;   right: 0%;  width: 18%;  height: 44%; height: 44%; }
  .img-officer-mr { top: 42%;  right: 29%; width: 17%;  height: 30%; }
  .img-officer-br { bottom: 0; right: 0;   width: 18%;  height: 42%; }

  .splash-icon {
    position: static;
    transform: none;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
  }

  .splash-inner {
    position: relative;
    z-index: 10;
    max-width: 640px;
    width: auto;
    padding: 0 2rem;
    align-items: center;
    text-align: center;
  }

  .splash-inner h1 {
    font-size: clamp(5rem, 10vw, 9rem);
    margin-bottom: 1.5rem;
    width: auto;
  }

  .tagline {
    font-size: 1rem;
    margin-bottom: 2rem;
    width: auto;
  }

  #startBtn {
    background: #ffffff;
    color: #000000;
    border: none;
    width: auto;
    padding: 0.9rem 3rem;
    font-size: 0.78rem;
  }

  #startBtn:active {
    opacity: 0.85;
    background: #ffffff;
  }

  .methodology {
    position: fixed;
    bottom: 2.5rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-color: #f81616;
    padding: 1rem 2.5rem;
    font-size: 0.72rem;
    white-space: nowrap;
    z-index: 10;
  }

  .methodology span {
    font-size: 0.72rem;
  }
}

/* ===== DESKTOP SPLASH ===== */

@media (min-width: 900px) {

  #splash {
    background-image: none;
  }

  #splash::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: 75%; height: 47%;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 13%, transparent);
    z-index: 2;
    pointer-events: none;
  }

  #splash::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 100%; height: 25%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    z-index: 2;
    pointer-events: none;
  }

  .splash-bg {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
  }

  .splash-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left center;
    opacity: 0.35;
  }

  /* Scattered photo collage */
  .splash-images {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .splash-img {
    position: absolute;
    object-fit: cover;
    display: block;
    background: rgba(255,255,255,0.04); /* placeholder tint when src is empty */
  }

  /* hide broken-image icon on empty src */
  .splash-img:not([src]), .splash-img[src=""] {
    visibility: hidden;
  }

  .img-logo       { top: 2%;   left: 1.5%; width: 14%;  height: auto; }
  .img-car        { top: 22%;  left: 12%;  width: 16%;  height: auto; }
  .img-officer-bl { top: 51%;  left: -5%;  width: 31%;  height: 60%; }
  .img-officer-tr { top: 0;    right: -3%; width: 27%;  height: 52%; }
  .img-officer-mr { top: 47%;  right: 20%; width: 12%;  height: 23%; }
  .img-officer-br { top: 52%;  right: 0;   width: 44%;  height: 80%; }

  /* Center content */
  .splash-inner {
    position: relative;
    z-index: 10;
    max-width: 640px;
    padding: 0 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .badge, .disclaimer { display: none; }

  .splash-icon {
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.9;
  }

  .splash-icon img {
    height: 3.6rem;
    width: auto;
  }

  .splash-inner h1 {
    font-family: 'Erotique Alternate Trial', serif;
    font-size: clamp(3.5rem, 7vw, 7rem);
    font-weight: 400;
    line-height: 0.88;
    letter-spacing: 0.01em;
    text-transform: none;
    background: linear-gradient(to bottom, #ffffff, #9f9f9f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 40px rgba(255,255,255,0.45));
    margin-bottom: 1.5rem;
  }

  .splash-inner h1 span {
    color: var(--white);
    font-size: inherit;
    display: block;
  }

  .tagline {
    font-family: Georgia, serif;
    font-size: 1rem;
    line-height: 1.8;
    letter-spacing: 0.01em;
    color: rgba(245,245,240,0.85);
    margin-bottom: 3rem;
  }

  #startBtn {
    background: #ffffff;
    border: none;
    clip-path: none;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    padding: 0.9rem 3rem;
    color: #000000;
    width: auto;
    margin-bottom: 0;
    transition: opacity 0.15s;
  }

  #startBtn:active {
    opacity: 0.85;
  }

  .methodology {
    position: relative;
    background: rgba(0,0,0,0.75);
    border: 1px solid #f81616;
    padding: 1rem 2.5rem;
    font-size: 0.72rem;
    line-height: 1.9;
    text-align: center;
    color: rgba(245,245,240,0.7);
    white-space: nowrap;
    margin: 0 auto 2rem;
    z-index: 10;
  }

  .methodology span {
    color: rgba(245,245,240,0.7);
    font-size: 0.72rem;
    display: block;
  }
}

/* ===== APP SCREEN ===== */
#app {
  position: fixed;
  inset: 0;
}

#app.hidden {
  display: none;
}

#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* hide the raw video — we draw it on canvas */
  opacity: 0;
  pointer-events: none;
}

#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== HUD ===== */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0;
  pointer-events: none;
  z-index: 10;
}

#totalDisplay {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: transparent;
  padding: 0;
  gap: 0;
}

.hud-top-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: #ffffff;
  padding: 0.45rem 0.75rem;
}

.hud-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: #000000;
  text-transform: uppercase;
  white-space: nowrap;
}

#totalAmount {
  font-family: var(--mono);
  font-size: clamp(2.4rem, 9vw, 4rem);
  font-weight: 700;
  color: #000000;
  line-height: 1;
  letter-spacing: -0.01em;
  transition: opacity 0.15s;
  background: #ffffff;
  padding: 0.2rem 0.75rem;
}

#totalAmount.tick {
  opacity: 0.6;
}

.hud-sublabel {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: #000000;
  text-transform: uppercase;
  background: #ffffff;
  padding: 0.45rem 0.75rem;
}

/* ===== REC INDICATOR ===== */
#recIndicator {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--alert-red);
  font-family: var(--mono);
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  background: var(--alert-red);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.8); }
}

/* ===== BOTTOM BAR ===== */
#bottomBar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.5rem;
  padding: 0.9rem 1rem;
  background: #ffffff;
  z-index: 10;
}

#bottomBar button {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  padding: 0;
  border: none;
  background: transparent;
  color: #000000;
  cursor: pointer;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: all;
}

#bottomBar button:active {
  opacity: 0.4;
}

#statusMsg {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  color: #000000;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
}

/* ===== INFO DRAWER ===== */
#infoDrawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--dark-gray);
  border-top: 3px solid var(--nypd-blue);
  padding: 1.5rem 1.25rem 2rem;
  z-index: 20;
  animation: slideUp 0.3s ease both;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

#infoDrawer.hidden {
  display: none;
}

#closeDrawer {
  float: right;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--white);
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

#infoDrawer h2 {
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--alert-amber);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

#infoDrawer ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

#infoDrawer li {
  font-size: 0.72rem;
  line-height: 1.65;
  color: rgba(245,245,240,0.75);
  border-left: 2px solid var(--nypd-blue-light);
  padding-left: 0.75rem;
}

#infoDrawer li strong {
  color: var(--white);
}

.sources {
  font-size: 0.65rem;
  color: rgba(245,245,240,0.4);
  line-height: 1.8;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 0.75rem;
}

.sources strong {
  color: rgba(245,245,240,0.6);
}

/* ===== UTILITY ===== */
.hidden {
  display: none !important;
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #bottomBar {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
}
