/* AsiaPost TV - full-screen television layout */

/* Noto Sans Bengali (self-hosted, SIL Open Font License) */
@font-face { font-family: "Noto Sans Bengali"; font-weight: 500; font-style: normal; font-display: swap; src: local("Noto Sans Bengali Medium"), url(../fonts/NotoSansBengali-500.ttf) format("truetype"); }
@font-face { font-family: "Noto Sans Bengali"; font-weight: 700; font-style: normal; font-display: swap; src: local("Noto Sans Bengali Bold"), url(../fonts/NotoSansBengali-700.ttf) format("truetype"); }

:root {
  --ticker-h: 48px;
  --accent: #b91f27; /* Asia Post logo red */
  --ticker-bg: #0b0b0d;
  --font: "Noto Sans Bengali", "Nirmala UI", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

@media (min-width: 900px) {
  :root { --ticker-h: 60px; }
}
@media (min-width: 1500px) and (min-height: 900px) {
  :root { --ticker-h: 70px; }
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

/* ---- Player ------------------------------------------------------------ */
#tv {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
  overflow: hidden;
  z-index: 1;
}
#tv iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none; /* behaves like a TV: no accidental pausing by clicking */
}
/* Enabled only while playback is blocked so a viewer can press YouTube's own play button. */
#tv.interactive iframe { pointer-events: auto; }

/* ---- Minimal status message (errors only) -------------------------------- */
.status {
  position: fixed;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  z-index: 5;
  max-width: 90vw;
  padding: 0.6em 1.1em;
  background: rgba(0, 0, 0, 0.75);
  color: #ddd;
  font-size: 15px;
  text-align: center;
  border-radius: 4px;
}

/* ---- Corner badge ----------------------------------------------------------- */
.badge {
  position: fixed;
  top: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 12px;
  left: calc(env(safe-area-inset-left, 0px) + 12px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.55em;
  height: 44px;
  padding: 0 1em 0 0.8em;
  background: rgba(16, 17, 20, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  max-width: calc(100vw - 200px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.badge::before {
  content: "";
  flex: none;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: #e5303a;
}
@media (max-width: 640px) {
  .badge { font-size: 12px; height: 36px; padding: 0 0.8em 0 0.65em; left: 8px; top: 8px; max-width: calc(100vw - 176px); }
  .volume { height: 36px; padding: 0 3px; right: 8px; top: 8px; }
}

/* ---- Unmute hint (shown only while muted) ---------------------------------- */
.vol-hint {
  position: fixed;
  top: 66px;
  top: calc(env(safe-area-inset-top, 0px) + 66px);
  right: 12px;
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  z-index: 19;
  max-width: calc(100vw - 24px);
  padding: 0.55em 0.95em;
  background: rgba(16, 17, 20, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s;
}
.vol-hint::before { /* arrow pointing up at the speaker button */
  content: "";
  position: absolute;
  top: -6px;
  right: 142px;
  width: 10px;
  height: 10px;
  background: rgba(16, 17, 20, 0.82);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}
.vol-hint.gone { opacity: 0; }

/* ---- Volume ------------------------------------------------------------- */
.volume {
  position: fixed;
  top: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 12px;
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  padding: 0 5px;
  /* light glass effect */
  background: -webkit-linear-gradient(135deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08));
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08));
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 16px rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  opacity: 1;
  transition: opacity 0.3s;
}
.volume.idle { opacity: 0.6; }
.volume.idle.is-muted { opacity: 0.85; }

.volume button {
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.volume button:hover { background: rgba(255, 255, 255, 0.18); }
.volume button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.volume svg { width: 22px; height: 22px; display: block; }
.volume output {
  min-width: 2.4em;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.volume .cross { display: none; }
.volume.is-muted .cross { display: inline; }
.volume.is-muted .waves { display: none; }
.volume.is-muted output { opacity: 0.55; }

/* ---- News ticker (lower-third style: coloured date box + white news bar) ---- */
.ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ticker-h);
  z-index: 10;
  display: flex;
  align-items: stretch;
  background: #fff;
  overflow: hidden;
}

/* Date box: the date and the Asia Post logo take turns with a slide, plus a light sweep. */
.ticker-date {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: grid;
  background: var(--accent);
  color: #fff;
  overflow: hidden;
}
.td-date {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: calc(var(--ticker-h) * 0.06) calc(var(--ticker-h) * 0.4) 0 calc(var(--ticker-h) * 0.35); /* top padding centres Bengali glyphs vertically */
  font-size: calc(var(--ticker-h) * 0.44);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  -webkit-animation: td-date-cycle 10s ease-out infinite;
  animation: td-date-cycle 10s ease-out infinite;
}
.td-logo {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0; /* out of flow: the box is exactly as wide as the date */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-right: 3px solid var(--accent);
  -webkit-transform: translateY(100%);
  transform: translateY(100%);
  -webkit-animation: td-logo-cycle 10s cubic-bezier(.65, 0, .35, 1) infinite;
  animation: td-logo-cycle 10s cubic-bezier(.65, 0, .35, 1) infinite;
}
.td-logo img { display: block; width: 82%; height: auto; max-height: 64%; object-fit: contain; }
.ticker-date::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%);
  -webkit-transform: translateX(-150%) skewX(-20deg);
  transform: translateX(-150%) skewX(-20deg);
  -webkit-animation: td-shine 4s ease-in-out infinite;
  animation: td-shine 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes td-logo-cycle {
  0%, 40% { transform: translateY(100%); }
  47%, 87% { transform: translateY(0); }
  94%, 100% { transform: translateY(-100%); }
}
@keyframes td-date-cycle {
  0%, 40% { opacity: 1; transform: translateY(0); }
  44%, 90% { opacity: 0; transform: translateY(35%); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes td-shine {
  0% { transform: translateX(-150%) skewX(-20deg); }
  35%, 100% { transform: translateX(380%) skewX(-20deg); }
}
@-webkit-keyframes td-logo-cycle {
  0%, 40% { -webkit-transform: translateY(100%); }
  47%, 87% { -webkit-transform: translateY(0); }
  94%, 100% { -webkit-transform: translateY(-100%); }
}
@-webkit-keyframes td-date-cycle {
  0%, 40% { opacity: 1; -webkit-transform: translateY(0); }
  44%, 90% { opacity: 0; -webkit-transform: translateY(35%); }
  100% { opacity: 1; -webkit-transform: translateY(0); }
}
@-webkit-keyframes td-shine {
  0% { -webkit-transform: translateX(-150%) skewX(-20deg); }
  35%, 100% { -webkit-transform: translateX(380%) skewX(-20deg); }
}

.ticker-scroll {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #fff;
}

.ticker-track {
  display: flex;
  width: max-content;
  will-change: transform;
  -webkit-animation: tk-scroll var(--tk-duration, 60s) linear infinite;
  animation: tk-scroll var(--tk-duration, 60s) linear infinite;
}
.ticker-track.paused { -webkit-animation-play-state: paused; animation-play-state: paused; }

@-webkit-keyframes tk-scroll { from { -webkit-transform: translate3d(0, 0, 0); } to { -webkit-transform: translate3d(-50%, 0, 0); } }
@keyframes tk-scroll { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }

.tk-group { display: flex; flex: none; }

.tk-item {
  flex: none;
  display: flex;
  align-items: center;
  white-space: nowrap;
  padding-left: calc(var(--ticker-h) * 0.45);
  font-size: calc(var(--ticker-h) * 0.5);
  font-weight: 500;
  /* Bengali glyphs sit high in the line box: nudge the text down so the space above and below is equal */
  box-sizing: border-box;
  height: var(--ticker-h);
  padding-top: calc(var(--ticker-h) * 0.07);
  line-height: calc(var(--ticker-h) * 0.93);
  color: #1b1b1d;
}
/* Asia Post icon between two headlines */
.tk-item::after {
  content: "";
  display: block;
  flex: none;
  width: calc(var(--ticker-h) * 0.55);
  height: calc(var(--ticker-h) * 0.55);
  margin-left: calc(var(--ticker-h) * 0.45);
  background: url(../images/news-icon.ico) center / contain no-repeat;
  -webkit-transform: translateY(calc(var(--ticker-h) * -0.035));
  transform: translateY(calc(var(--ticker-h) * -0.035));
}

/* ---- Small screens: slimmer ticker so more headline text is visible -------- */
@media (max-width: 640px) {
  :root { --ticker-h: 34px; }
  .td-date { font-size: calc(var(--ticker-h) * 0.44); padding: calc(var(--ticker-h) * 0.06) calc(var(--ticker-h) * 0.4) 0; }
  .tk-item { font-size: calc(var(--ticker-h) * 0.5); padding-left: calc(var(--ticker-h) * 0.3); }
  .tk-item::after { width: calc(var(--ticker-h) * 0.5); height: calc(var(--ticker-h) * 0.5); margin-left: calc(var(--ticker-h) * 0.3); }
  .volume { height: 36px; padding: 0 3px; top: 8px; right: 8px; }
  .vol-hint { top: 52px; right: 8px; font-size: 12.5px; }
  .vol-hint::before { right: 112px; }
  .volume button { width: 34px; height: 34px; }
  .volume svg { width: 20px; height: 20px; }
  .volume output { min-width: 2em; font-size: 12px; }
}
@media (max-width: 640px) and (orientation: landscape) {
  :root { --ticker-h: 30px; }
}
