/* Key West Ortho TV Dashboard - broadcast graphics package, clinic palette (Chunk 7 + redesign).
   24-hour cable-news style, clinic colors. Squared corners, gray-fade box borders.
   R012 colors, R114 layout, R151 skin, R152 crawl, R154 no underlines.
   Self-hosted Inter font (place WOFF2 files in assets/fonts/ - see that folder's README.txt). */

/* Self-hosted Inter (https://fonts.google.com/specimen/Inter - download WOFF2, place in assets/fonts/).
   Falls back to system fonts if the files are absent. */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-ExtraBold.woff2') format('woff2');
  font-weight: 800; font-style: normal; font-display: swap;
}

:root {
  --navy: #15295b;
  --navy-mid: #102046;
  --navy-deep: #0a142e;       /* deep near-black navy for panel gradients */
  --orange: #DD6420;
  --orange-lite: #f08a3e;
  --white: #ffffff;
  --light: #f4f7fb;
  /* Severity colors - status text/badges ONLY (R012/R151). */
  --good: #16a34a;
  --caution: #facc15;
  --warning: #f97316;
  --danger: #dc2626;
  --font-head: 'Inter', "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: 'Inter', "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: 100vw; height: 100vh;
  overflow: hidden;
  background: var(--navy-deep);
  color: var(--white);
  font-family: var(--font-body);
}

a { text-decoration: none; color: inherit; }

.tv-shell {
  display: grid;
  grid-template-rows: 12vh 1fr 8.5vh;
  height: 100vh; width: 100vw;
  position: relative;
}

/* ===================== Header ===================== */
.tv-header {
  display: grid;
  grid-template-columns: 2fr 3fr;     /* matches .main-grid so column 2 lines up with card #1 */
  gap: 1vw;
  align-items: center;
  padding: 0 1.6vw;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  border-bottom: 0.35vh solid var(--orange);
}
.header-right { display: flex; align-items: center; justify-content: space-between; min-width: 0; --qr-size: 8.5vh; }
.brand { display: flex; flex-direction: row; align-items: center; gap: 1.4vw; min-width: 0; flex: 0 1 auto; }
.brand-logo {
  height: 8.5vh;
  width: auto;
  max-width: 30vw;
  object-fit: contain;          /* never distort the logo proportions */
  /* Navy logo art rendered white for the dark header. */
  filter: brightness(0) invert(1);
}
.brand-text {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 48px);
  color: var(--white);
}
.brand-tagline {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: clamp(9px, 0.78vw, 15px);
  color: var(--orange-lite);
  white-space: nowrap;
}

.warnings:empty { display: none; }
.meta-block { display: flex; align-items: center; gap: 0.6vw; }
.meta-icon { color: var(--orange); width: clamp(18px, 1.7vw, 34px); height: clamp(18px, 1.7vw, 34px); display: inline-flex; }
.meta-icon svg { width: 100%; height: 100%; }
.meta-text { display: flex; flex-direction: column; line-height: 1.0; }
.meta-weekday { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.08em; font-size: clamp(11px, 1vw, 20px); color: var(--light); }
.meta-date { font-family: var(--font-head); font-size: clamp(13px, 1.2vw, 24px); color: var(--white); font-weight: 600; }
.clock {
  font-family: var(--font-head);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: clamp(26px, 2.7vw, 56px);
  color: var(--orange);
  line-height: 1;
}
.ampm { font-family: var(--font-head); font-size: clamp(12px, 1.1vw, 22px); color: var(--orange-lite); align-self: flex-start; }
/* Calendar (date) and clock blocks: exactly as tall as the QR code, with their
   contents scaled proportionally (uniform vh-based sizing, no distortion). */
.date-block, .clock-block { height: var(--qr-size); }
.date-block .meta-icon,
.clock-block .meta-icon { width: calc(var(--qr-size) * 0.6); height: calc(var(--qr-size) * 0.6); }
.date-block .meta-text { height: 100%; justify-content: center; line-height: 1.05; }
.date-block .meta-weekday { font-size: calc(var(--qr-size) * 0.34); }
.date-block .meta-date { font-size: calc(var(--qr-size) * 0.46); }
.clock-block .clock { font-size: calc(var(--qr-size) * 0.82); line-height: 1; }
.clock-block .ampm { font-size: calc(var(--qr-size) * 0.3); }

.updated-block { flex-direction: column; align-items: flex-end; gap: 0; line-height: 1.05; }
.updated-label { font-family: var(--font-head); letter-spacing: 0.1em; font-size: clamp(9px, 0.75vw, 14px); color: #8fa0c6; }
.last-updated { font-size: clamp(11px, 0.95vw, 18px); color: var(--light); font-weight: 600; }
.warnings { display: flex; gap: 0.4vw; flex-wrap: wrap; max-width: 14vw; justify-content: flex-end; }
.warn-chip {
  background: linear-gradient(180deg, var(--orange-lite), var(--orange));
  color: var(--white);
  font-family: var(--font-head);
  font-size: clamp(10px, 0.85vw, 16px);
  font-weight: 700; text-transform: uppercase;
  padding: 0.3vh 0.6vw; letter-spacing: 0.05em;
}

/* ===================== Main grid: hero 40% / cards 60% ===================== */
.main-grid {
  display: grid;
  grid-template-columns: 2fr 3fr;   /* 40% / 60% */
  gap: 1vw;
  padding: 1.1vh 1.6vw;
  min-height: 0;
}

/* ===================== Hero (left, mirrors active card) ===================== */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.6vh 1.6vw;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(221,100,32,0.14) 0%, rgba(10,20,46,0) 50%),
    var(--navy-deep);
  border: 2px solid transparent;
  border-image: linear-gradient(160deg, #7585ac 0%, #34406a 55%, #1c2748 100%) 1;
  box-shadow: inset 0 0 7vh rgba(0,0,0,0.5);
}
/* Skyline backdrop: brightened image behind the content, light navy tint. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  /* Per-card backdrop set by tv.js via the --hero-bg variable; falls back to one image. */
  background-image: var(--hero-bg, url('../img/hero-bg.png'));
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 1;
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero-head { border-bottom: 0.25vh solid rgba(255,255,255,0.12); padding-bottom: 0.6vh; }
.hero-title {
  margin: 0;
  font-family: var(--font-head);
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: 0.01em;
  font-size: clamp(26px, 2.9vw, 58px);
}
.hero-sub {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--orange-lite);
  font-size: clamp(15px, 1.5vw, 30px);
  font-weight: 600;
}
.hero-mid { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 1.4vh; }
.hero-body { display: flex; align-items: center; min-height: 0; gap: 1.4vw; padding: 0.6vh 0; }
.hero-icon { flex: 0 0 auto; width: clamp(90px, 9.5vw, 200px); height: clamp(90px, 9.5vw, 200px); }
.hero-icon svg { width: 100%; height: 100%; display: block; }
.hero-figure { flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.3vh; min-width: 0; }
.hero-metric-label { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.06em; color: var(--light); font-size: clamp(14px, 1.3vw, 26px); }
.hero-metric-value {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 0.92;
  font-size: clamp(46px, 6.2vw, 130px);
  color: var(--white);
  text-shadow: 0 0.4vh 1.4vh rgba(0,0,0,0.55);
}
.hero-status { margin: 0.3vh 0; }
.hero-message {
  margin: 0;
  font-size: clamp(16px, 1.45vw, 30px);
  color: #eef2fb; line-height: 1.22;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions {
  margin: 0; padding: 0.4vh 0; list-style: none;
  display: grid; grid-template-columns: 1fr 1fr;     /* 2 + 2 layout */
  gap: 0.9vh 1.6vw; flex: 0 0 auto;
}
.hero-actions li {
  display: flex; align-items: center; gap: 0.7vw;
  font-size: clamp(13px, 1.2vw, 25px);
  color: #f0f4fc;
}
.hero-actions li::before {
  content: "\2713";
  flex: 0 0 auto;
  width: clamp(20px, 1.8vw, 36px); height: clamp(20px, 1.8vw, 36px);
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--orange-lite), var(--orange));
  color: var(--white); font-weight: 700;
  border-radius: 50%;
  font-size: clamp(12px, 1vw, 20px);
}
.hero-foot {
  flex: 0 0 auto;
  border-top: 0.25vh solid rgba(255,255,255,0.12);
  padding-top: 0.8vh;
  display: flex; align-items: center;
  min-height: 22%;            /* bottom third of the card holds the message */
}

/* ===================== Right grid: 8 on-air tiles ===================== */
.right-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.8vw;
  min-height: 0;
}
.card {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 0.5vh;
  padding: 1vh 0.7vw 1vh;
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%);
  border: 2px solid transparent;
  border-image: linear-gradient(160deg, #6c7aa0 0%, #34406a 55%, #1c2748 100%) 1;
  overflow: hidden; min-height: 0;
}
.card.active {
  border: 2px solid transparent;
  border-image: linear-gradient(160deg, var(--orange-lite), var(--orange)) 1;
  box-shadow: 0 0 1.4vh rgba(221,100,32,0.8), inset 0 0 4vh rgba(221,100,32,0.12);
}
.card-num {
  position: absolute; top: 0.7vh; left: 0.7vw;
  width: clamp(18px, 1.5vw, 30px); height: clamp(18px, 1.5vw, 30px);
  display: flex; align-items: center; justify-content: center;
  background: var(--navy-deep);
  border: 1px solid #46557d;
  color: #aebbdb; font-family: var(--font-head); font-weight: 700;
  font-size: clamp(11px, 0.95vw, 18px);
}
.card-title {
  padding: 0 1.6vw;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-weight: 600;
  font-size: clamp(12px, 1.05vw, 22px);
  line-height: 1.04;
  color: var(--light);
}
.card-icon { width: clamp(58px, 6.2vw, 124px); height: clamp(58px, 6.2vw, 124px); margin: 0.4vh auto; }
.card-icon svg { width: 100%; height: 100%; display: block; }
.card-status {
  font-family: var(--font-head);
  font-weight: 700; text-transform: uppercase;
  font-size: clamp(22px, 2.2vw, 48px);
  line-height: 1.0;
  margin-top: auto;
}
.card-sub { font-size: clamp(11px, 0.95vw, 18px); color: #c7d2ea; line-height: 1.06; }
.card-sub2 {
  font-size: clamp(10px, 0.85vw, 16px); color: #93a1c4; line-height: 1.08;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Status text colors (used by .card-status and the hero chip text variant). */
.txt-low { color: var(--good); }
.txt-moderate { color: var(--caution); }
.txt-caution { color: var(--caution); }
.txt-high { color: var(--warning); }
.txt-warning { color: var(--warning); }
.txt-danger { color: var(--danger); }

/* Hero chip badge (squared, severity bg). */
.chip {
  display: inline-block;
  font-family: var(--font-head);
  font-size: clamp(14px, 1.4vw, 30px);
  font-weight: 700; text-transform: uppercase;
  padding: 0.3vh 0.9vw;
  color: var(--white);
  box-shadow: inset 0 0.2vh 0 rgba(255,255,255,0.25), 0 0.3vh 0.6vh rgba(0,0,0,0.4);
}
.risk-low { background: var(--good); }
.risk-moderate { background: var(--caution); color: #1b1b1b; }
.risk-caution { background: var(--caution); color: #1b1b1b; }
.risk-high { background: var(--warning); }
.risk-warning { background: var(--warning); }
.risk-danger { background: var(--danger); }

/* ===================== Bottom ticker: continuous crawl ===================== */
.ticker-bar {
  display: flex; align-items: stretch;
  background: var(--navy);
  border-top: 0.35vh solid var(--orange);
  overflow: hidden; position: relative;
}
.ticker-flag {
  display: flex; align-items: center;
  /* Extra right padding leaves room for the chevron notch. */
  padding: 0 3vw 0 1.7vw;
  /* Darker brand orange, medium-to-dark vertical fade. */
  background: linear-gradient(180deg, #e07a33 0%, #c25a1a 100%);
  color: var(--white);
  font-family: var(--font-head);
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em;
  font-size: clamp(22px, 2.5vw, 48px);
  flex: 0 0 auto;
  /* Jagged right edge: a leftward V-notch cut into the right side (swallowtail). */
  clip-path: polygon(0 0, 100% 0, calc(100% - 1.4vw) 50%, 100% 100%, 0 100%);
  /* Subtle darker inner border (follows the clipped edges). */
  box-shadow: inset 0 0 0 0.32vh rgba(74,30,6,0.55);
}
.ticker-flag.warn { background: linear-gradient(180deg, #fbbf24 0%, var(--warning) 100%); }
.ticker-track { position: relative; flex: 1 1 auto; overflow: hidden; }
.ticker-line {
  position: absolute; top: 0; height: 100%;
  display: flex; align-items: center;
  white-space: nowrap;
  font-family: var(--font-head);
  color: var(--white);
  text-transform: uppercase; letter-spacing: 0.02em;
  font-weight: 600;
  font-size: clamp(24px, 2vw, 42px);
  will-change: transform;
}
.tick-sep::before { content: "\2022"; color: var(--orange); padding: 0 1.2vw; }

/* ===================== Permanent QR (next to the logo, same height) ===================== */
.qr-badge { flex: 0 0 auto; display: inline-flex; }
.qr-img { height: var(--qr-size); width: var(--qr-size); display: block; background: var(--white); }
.qr-fallback { color: var(--light); font-weight: 700; font-size: clamp(9px, 0.7vw, 13px); word-break: break-all; max-width: 12vw; }

/* ===================== Browser-testing fallback ===================== */
@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .right-card-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(4, 1fr); }
  .qr-badge { max-width: 28vw; }
  .hero-body { flex-direction: column; }

  /* --- MOBILE-ONLY content trim (does not affect the desktop/TV display) --- */
  /* 8 cards: show only the number, name, and reading. Hide the graphic and the
     two small detail lines below the status. */
  .card-icon,
  .card-sub,
  .card-sub2 { display: none; }

  /* Big card (hero): drop the 4 action checkmarks and the message paragraph
     below the main portion. Title, icon, metric, and status stay. */
  .hero-actions,
  .hero-foot { display: none; }
}
