/* JotSpace Service Runner — Cast Receiver
   Renders CastFrame layouts (LYRICS / TITLE / VERSE / HOLD / BLANK) on the TV.
   Five themes mirror the in-app SongPresentation palette. */

:root {
  --bg: #000000;
  --fg: #EAEAEA;
  --muted: #9A9A9A;
  --accent: #FFCC66;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  transition: background-color 360ms ease, color 360ms ease;
}

body.theme-default     { --bg: #000000; --fg: #EAEAEA; --muted: #9A9A9A; --accent: #FFCC66; }
body.theme-cream       { --bg: #F7EFE0; --fg: #2A2014; --muted: #6B5946; --accent: #8C5E2A; }
body.theme-charcoal    { --bg: #1B1D22; --fg: #EDEDED; --muted: #B6B6B6; --accent: #D9C9A6; }
body.theme-true_black  { --bg: #000000; --fg: #EAEAEA; --muted: #9A9A9A; --accent: #FFCC66; }
body.theme-sepia       { --bg: #EDE3D0; --fg: #3A2C1A; --muted: #6F5840; --accent: #8B5A2B; }

#stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.layer {
  position: absolute;
  inset: 0;
  padding: 6vh 8vw;
  display: none;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transition: opacity 260ms ease;
}

#body-layer { gap: 1.5vh; }
#hold-layer { align-items: center; justify-content: center; text-align: center; gap: 3vh; }

.hymn {
  color: var(--accent);
  font-size: 2vh;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 600;
  display: none;
}

.title {
  font-size: 6vh;
  letter-spacing: 0.04em;
  font-weight: 700;
  margin: 0;
  display: none;
}

.sub {
  font-size: 2.6vh;
  opacity: 0.75;
  display: none;
}

.divider {
  width: 12vw;
  height: 0.4vh;
  background: var(--accent);
  border-radius: 0.4vh;
  display: none;
}

.content {
  font-size: 4vh;
  line-height: 1.5;
  white-space: pre-wrap;
  display: none;
  overflow-y: auto;
  max-height: 80vh;
  scrollbar-width: none;
}
.content::-webkit-scrollbar { display: none; }

.hold-title {
  font-size: 9vh;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  display: none;
}

.hold-sub {
  font-size: 3.2vh;
  opacity: 0.75;
  text-align: center;
  display: none;
}

.watermark {
  position: absolute;
  bottom: 4vh;
  right: 5vw;
  color: var(--accent);
  opacity: 0.5;
  font-size: 1.6vh;
  letter-spacing: 0.3em;
  display: none;
}

/* Layouts toggle which layer is shown */
body.layout-lyrics #body-layer,
body.layout-title  #body-layer,
body.layout-verse  #body-layer { display: flex; opacity: 1; }
body.layout-hold   #hold-layer { display: flex; opacity: 1; }

body.layout-lyrics .title,
body.layout-title  .title,
body.layout-verse  .title { display: block; }

body.layout-lyrics .content,
body.layout-verse  .content { display: block; }

body.layout-lyrics .divider,
body.layout-verse  .divider { display: block; }

body.layout-lyrics .hymn { display: block; }

body.layout-lyrics .sub,
body.layout-verse  .sub { display: block; }

body.layout-title .title { font-size: 9.5vh; }
body.layout-title .sub   { display: none; }
body.layout-title .divider { display: none; }
body.layout-title .content { display: none; }
body.layout-title .hymn  { display: none; }

body.layout-hold  .hold-title { display: block; }
body.layout-hold  .hold-sub   { display: block; }

body.layout-blank #stage { display: none; }
body.layout-blank #idle  { display: none; }

body:not(.layout-blank):not(.layout-idle) .watermark { display: block; }
body.layout-idle .watermark { display: none; }

/* Idle splash before any frame arrives */
#idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
  color: var(--fg);
}
body.layout-idle #idle { display: flex; }
body:not(.layout-idle) #idle { display: none; }
.idle-pulse {
  width: 12vh;
  height: 12vh;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.25;
  animation: pulse 2s ease-in-out infinite;
}
.idle-text {
  font-size: 3vh;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.idle-sub {
  font-size: 2vh;
  opacity: 0.55;
}
@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 0.25; }
  50%      { transform: scale(1.3); opacity: 0.5; }
}

/* Hide hymn cell when blank */
body.layout-lyrics .hymn:empty,
body.layout-lyrics .hymn[data-empty="true"] { display: none; }

/* Hide divider when title is blank */
body.layout-lyrics .title:empty + .sub,
body.layout-lyrics .title:empty ~ .divider { display: none; }
