/* Display v2 — PORTRAIT for Samsung QM55R-B (Tizen 4 / Chromium 56)
   Target: ~1080×1920 (or 2160×3840). Tall axis is primary.
   Avoid: clamp(), flex gap, inset, :has(), aspect-ratio
*/
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body.v2-page {
  overflow: hidden;
  color: #fff;
  font-family: Helvetica, Arial, sans-serif;
  background: #0a2f45;
  -webkit-font-smoothing: antialiased;
}

/* Background slideshow */
.v2-bg {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  background-color: #0a2f45;
  overflow: hidden;
}

.v2-slide {
  position: absolute;
  top: -3%;
  right: -3%;
  bottom: -3%;
  left: -3%;
  background-size: cover;
  background-position: center center;
  opacity: 0;
  -webkit-transform: scale(1);
  transform: scale(1);
  -webkit-transition: opacity 1.2s ease-in-out;
  transition: opacity 1.2s ease-in-out;
  pointer-events: none;
}

.v2-slide.is-active {
  opacity: 1;
  z-index: 1;
  -webkit-animation: v2-zoom 20s ease-in-out forwards;
  animation: v2-zoom 20s ease-in-out forwards;
}

@-webkit-keyframes v2-zoom {
  from { -webkit-transform: scale(1); transform: scale(1); }
  to { -webkit-transform: scale(1.06); transform: scale(1.06); }
}

@keyframes v2-zoom {
  from { -webkit-transform: scale(1); transform: scale(1); }
  to { -webkit-transform: scale(1.06); transform: scale(1.06); }
}

/* Full-screen scrim — stronger at top/bottom for portrait reading */
.v2-scrim {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  background:
    -webkit-linear-gradient(top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.35) 28%, rgba(0, 0, 0, 0.28) 70%, rgba(0, 0, 0, 0.55) 100%);
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.35) 28%, rgba(0, 0, 0, 0.28) 70%, rgba(0, 0, 0, 0.55) 100%);
}

.v2-shell {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  /* Portrait: use horizontal padding from width, vertical from height */
  padding: 2.2vh 4.5vw 0;
}

/* Header stacked & centered — uses vertical space, not side-by-side */
.v2-header {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  text-align: center;
  padding-top: 0.8vh;
  padding-bottom: 2vh;
}

.v2-brand {
  min-width: 0;
}

.v2-building-name {
  margin: 0;
  /* Portrait width is ~1080: 8.5vw ≈ 92px — readable across a lobby */
  font-size: 8.5vw;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.v2-divider {
  width: 7vw;
  height: 4px;
  margin: 1vh auto;
  background: #ffcc00;
}

.v2-address {
  margin: 0;
  font-size: 3.2vw;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

/* Time + weather share one row, 50/50 */
.v2-status-row {
  margin-top: 1.6vh;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  width: 100%;
}

.v2-status-row .v2-clock-wrap {
  width: 50%;
  text-align: left;
  padding-right: 2.5vw;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.v2-status-row.is-weather-off .v2-clock-wrap {
  width: 100%;
  text-align: center;
  padding-right: 0;
}

.v2-time {
  font-size: 5vw;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.v2-date {
  margin-top: 0.55vh;
  font-size: 2.2vw;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.84);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* Weather — right half, mirrors clock hierarchy (primary + secondary line) */
.v2-weather {
  width: 50%;
  padding-left: 2.5vw;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  text-align: right;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.v2-weather.is-hidden {
  display: none;
}

.v2-weather-main {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: end;
  -webkit-justify-content: flex-end;
  justify-content: flex-end;
}

.v2-weather-icon {
  display: inline-block;
  width: 4.2vw;
  height: 4.2vw;
  margin-right: 1.1vw;
  line-height: 0;
  color: rgba(255, 255, 255, 0.95);
}

.v2-weather-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.v2-weather-temp {
  font-size: 5vw;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #fff;
}

.v2-weather-meta {
  margin-top: 0.55vh;
  font-size: 2.2vw;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Units fill the tall middle */
.v2-main {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  align-items: stretch;
  padding-bottom: 1.4vh;
}

.v2-units {
  width: 100%;
  margin: 0 auto;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-flex-wrap: nowrap;
  flex-wrap: nowrap;
  -webkit-box-pack: start;
  -webkit-justify-content: flex-start;
  justify-content: flex-start;
}

/* Single full-width column — correct for portrait */
.v2-unit {
  width: 100%;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  align-items: stretch;
  background: #ffffff;
  color: #111;
  overflow: hidden;
  -webkit-box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  margin-bottom: 1.1vh;
}

.v2-unit-num {
  /* Fixed width so every row aligns in one straight column (3-digit unit #) */
  width: 14vw;
  min-width: 14vw;
  max-width: 14vw;
  -webkit-flex: 0 0 14vw;
  flex: 0 0 14vw;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 1.4vh 0.6vw;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #111;
  background: #fff;
  border-right: 4px solid #d5d9de;
}

.v2-unit-tenant {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 1.4vh 2.2vw;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: #111;
  background: #fff;
  overflow: hidden;
}

.v2-unit-tenant-text {
  display: inline-block;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* Overflowing names: no ellipsis, ping-pong scroll via JS-injected keyframes */
.v2-unit-tenant-text.is-scrolling {
  max-width: none;
  width: auto;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  overflow: visible;
  text-overflow: clip;
  will-change: transform;
}

.v2-unit.is-vacant,
.v2-unit.is-vacant .v2-unit-num,
.v2-unit.is-vacant .v2-unit-tenant {
  background: #ffcc00;
  color: #111;
}

.v2-unit.is-vacant .v2-unit-num {
  border-right-color: #e0b400;
}

/*
  Density uses both vw (readable width) and vh (row height).
  Portrait has lots of vertical room — stay large until many units.
*/
.v2-units.density-xl .v2-unit-num,
.v2-units.density-xl .v2-unit-tenant {
  font-size: 4.4vw;
  padding-top: 1.8vh;
  padding-bottom: 1.8vh;
}

.v2-units.density-lg .v2-unit-num,
.v2-units.density-lg .v2-unit-tenant {
  font-size: 3.8vw;
  padding-top: 1.5vh;
  padding-bottom: 1.5vh;
}

.v2-units.density-md .v2-unit-num,
.v2-units.density-md .v2-unit-tenant {
  font-size: 3.2vw;
  padding-top: 1.2vh;
  padding-bottom: 1.2vh;
}

.v2-units.density-sm .v2-unit-num,
.v2-units.density-sm .v2-unit-tenant {
  font-size: 2.7vw;
  padding-top: 0.9vh;
  padding-bottom: 0.9vh;
}

.v2-units.density-xs .v2-unit-num,
.v2-units.density-xs .v2-unit-tenant {
  font-size: 2.3vw;
  padding-top: 0.7vh;
  padding-bottom: 0.7vh;
}

.v2-units.density-xl .v2-unit { margin-bottom: 1.4vh; }
.v2-units.density-lg .v2-unit { margin-bottom: 1.15vh; }
.v2-units.density-md .v2-unit { margin-bottom: 0.95vh; }
.v2-units.density-sm .v2-unit { margin-bottom: 0.75vh; }
.v2-units.density-xs .v2-unit { margin-bottom: 0.55vh; }

/* Footer marquee */
.v2-footer {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  margin-left: -4.5vw;
  margin-right: -4.5vw;
  background: #ffffff;
  color: #111;
  overflow: hidden;
  height: 4.6vh;
  min-height: 56px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.v2-footer-track {
  display: inline-block;
  white-space: nowrap;
  font-size: 2.8vw;
  font-weight: 700;
  letter-spacing: 0.02em;
  will-change: transform;
  -webkit-animation: v2-marquee 40s linear infinite;
  animation: v2-marquee 40s linear infinite;
}

.v2-footer-half {
  display: inline-block;
  white-space: nowrap;
}

.v2-footer-seg {
  display: inline-block;
  white-space: pre;
}

@-webkit-keyframes v2-marquee {
  from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
  to { -webkit-transform: translate3d(-50%, 0, 0); transform: translate3d(-50%, 0, 0); }
}

@keyframes v2-marquee {
  from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
  to { -webkit-transform: translate3d(-50%, 0, 0); transform: translate3d(-50%, 0, 0); }
}
