/* LG Smart Dashboard - dark theme, optimized for a 1920x1080 TV display.
 *
 * Legacy browser compatibility (webOS 3.4.0, ~2014 WebKit):
 * - Flexbox with -webkit- prefixes (2012 spec) plus the 2011 -webkit-box
 *   syntax for maximum compatibility.
 * - No `gap` in flex containers (unsupported) - margins are used instead.
 * - No `object-fit` (unsupported) - photos are centered with absolute
 *   positioning; `object-fit: cover` is a progressive enhancement inside
 *   @supports, which the old browser ignores, so the centering fallback
 *   stays in effect there.
 * - Base layout is the responsive column fallback; the fixed 1920x1080 row
 *   layout applies only at min-width: 1920px. (The previous
 *   `max-width: 1920px` query matched the TV's exact 1920px viewport and
 *   silently swapped the TV layout for the column fallback - fixed.)
 */

* { margin: 0; padding: 0; -webkit-box-sizing: border-box; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  background: #0d1117;
  color: #e6edf3;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}

/* Base layout: 50/50 split (row) at all viewports; the 1920px media query
 * only tunes font sizes. (The previous column+wrap fallback let the right
 * column wrap beside the left one, squeezing the photo to a few pixels -
 * fixed by making the split the base layout.) */
.dashboard {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-box-align: stretch;
  -webkit-flex-direction: row;
  flex-direction: row;
  width: 100%;
  height: 100%;
  padding: 32px;
  position: relative;
}

/* 50/50 split: two equal columns at all viewports. `min-width: 0` lets the
 * columns shrink below their content size so both stay exactly 50%. */
.col-left, .col-right {
  -webkit-flex: 1 1 0;
  flex: 1 1 0;
  min-width: 0;
}

/* Column spacing: 12px margins on each side = 24px gap (no `gap` support) */
.col-left > .panel,
.col-right > .panel {
  margin: 0 12px 24px 12px;
}

/* Columns are vertical stacks (base layout and TV layout) */
.col-left, .col-right {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
}

.panel {
  background: #161b22;
  border: 1px solid #30363d;
  padding: 24px;
}

.panel-title {
  font-size: 28px;
  font-weight: 600;
  color: #8b949e;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Clock panel */
.panel-clock {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  align-items: center;
}
.clock {
  font-size: 72px;
  font-weight: 300;
  letter-spacing: 4px;
}
.date {
  font-size: 32px;
  color: #8b949e;
  margin-top: 8px;
}

/* Weather panel */
.panel-weather {
  min-height: 220px;
}
.weather-current {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  align-items: center;
  margin-bottom: 24px;
}
.weather-current > * + * { margin-left: 32px; }
.weather-temp {
  font-size: 96px;
  font-weight: 300;
}
.weather-label {
  font-size: 32px;
  color: #8b949e;
}
.weather-meta {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  font-size: 24px;
  color: #8b949e;
}
.weather-meta > * + * { margin-left: 24px; }
/* Calendar panel */
.panel-calendar {
  min-height: 220px;
}
.event-list {
  list-style: none;
}
.event-list li {
  padding: 12px 0;
  border-bottom: 1px solid #30363d;
  font-size: 24px;
}
.event-list .time {
  color: #58a6ff;
  font-size: 20px;
  margin-right: 12px;
}
.event-list .title {
  font-weight: 600;
}
.event-list .loc {
  color: #8b949e;
  font-size: 20px;
  margin-top: 4px;
}
.empty {
  color: #8b949e;
  font-size: 24px;
  padding: 24px 0;
}

/* Losung panel (Herrnhuter Brüdergemeine, daily verse) */
.panel-losung {
  min-height: 220px;
}
.losung-theme {
  font-size: 20px;
  color: #8b949e;
  margin-bottom: 12px;
}
.losung-verse {
  font-size: 22px;
  line-height: 1.5;
  color: #e6edf3;
  border-left: 3px solid #58a6ff;
  padding: 8px 12px;
  margin: 12px 0 4px 0;
}
.losung-ref {
  font-size: 18px;
  color: #58a6ff;
  text-align: right;
  margin: 0 0 12px 12px;
}
.losung-third {
  font-size: 18px;
  color: #8b949e;
  border-top: 1px solid #30363d;
  padding-top: 12px;
  margin-top: 12px;
}

/* Photo panel */
.panel-photos {
  position: relative;
  overflow: hidden;
  min-height: 300px;
}
/* Fallback for browsers without object-fit: center the photo, preserve
   aspect ratio. Modern browsers get object-fit: cover via @supports. */
.photo {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: 100%;
  max-height: 100%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  display: block;
}
@supports (object-fit: cover) {
  .photo {
    left: 0;
    top: 0;
    max-width: none;
    max-height: none;
    -webkit-transform: none;
    transform: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
/* Screen-off button (anchored to .dashboard, which is position:relative) */
.btn-screen-off {
  position: absolute;
  bottom: 32px;
  right: 32px;
  background: #da3633;
  color: #fff;
  border: 0;
  padding: 16px 28px;
  font-size: 28px;
  font-weight: 600;
  cursor: pointer;
  z-index: 10;
}
.btn-screen-off:hover {
  background: #f85149;
}
.btn-screen-off:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* TV layout: exactly 1920px wide viewport (the TV). The 50/50 split is the
 * base layout; this query only fixes the size and tunes font sizes. */
@media (min-width: 1920px) {
  .dashboard {
    width: 1920px;
    height: 1080px;
    padding: 0;
  }
  /* Left column: clock fixed share, weather + losung share the rest */
  .panel-clock { -webkit-flex: 0 0 auto; flex: 0 0 auto; min-height: 240px; }
  .panel-weather { -webkit-flex: 1 1 0; flex: 1 1 0; }
  .panel-losung { -webkit-flex: 1 1 0; flex: 1 1 0; }
  .col-left > .panel:last-child { margin-bottom: 0; }
  /* Right column: photo fills the full column height */
  .panel-photos { -webkit-flex: 1 1 0; flex: 1 1 0; }
  .clock { font-size: 120px; }
  .weather-temp { font-size: 80px; }
  .losung-verse { font-size: 20px; }
  .losung-ref { font-size: 16px; }
  .losung-theme { font-size: 18px; }
  .losung-third { font-size: 16px; }
}
