/*
 * Kiosk UI. Portrait touch screens of any resolution.
 *
 * Everything is sized in rem, and the root font-size is a fixed fraction of the screen:
 * 1rem = 2.2 × min(1vw, 9/16 vh). On a 9:16 screen that is 2.2% of the width; on a squatter
 * screen (3:4, 10:16) height becomes the limit. So the layout keeps its proportions on
 * 720×1280, 1080×1920, 2160×3840 ... without media queries.
 */

:root {
  --brand: #0055bb;
  --brand-2: #0088d1;
  --ink: #1c2733;
  --muted: #5b6b7d;
  --bg: #eef2f7;
  --card: #ffffff;
  --radius: 0.9rem;
  --gap: 0.8rem;
  --shadow: 0 0.15rem 0.6rem rgba(0, 40, 100, 0.15);
}

* { box-sizing: border-box; }

html {
  font-size: calc(2.2 * min(1vw, 0.5625vh));
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Roboto", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  display: flex;
  flex-direction: column;
}

img { -webkit-user-drag: none; }
button { font: inherit; color: inherit; }
svg { display: block; }

/* ── Masthead ──────────────────────────────────────────────────────────── */

.masthead {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1rem 1.4rem 1.2rem;
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow);
  z-index: 1;
}

/* brand gradient underline */
.masthead::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0.35rem;
  background: linear-gradient(90deg, var(--brand), var(--brand-2) 60%, #39b6e8);
}

/* faint atom motif behind the clock, echoing the logo */
.masthead-orbits {
  position: absolute;
  right: -3rem;
  top: 50%;
  width: 16rem;
  height: 16rem;
  transform: translateY(-50%);
  color: var(--brand);
  opacity: 0.06;
  pointer-events: none;
  animation: spin 120s linear infinite;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

.masthead-logo {
  flex: 0 0 auto;
  height: 5.2rem;
  width: auto;
}

.masthead-text {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 1.2rem;
  border-left: 0.2rem solid var(--brand);
}

.masthead-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--brand);
}
.masthead-subtitle {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--brand);
  margin-top: 0.15rem;
}
.masthead-address {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.4rem;
}
.nowrap { white-space: nowrap; }

.masthead-clock {
  position: relative;
  flex: 0 0 auto;
  text-align: right;
}
.clock-time {
  font-size: 3rem;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.clock-date {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.3rem;
  white-space: nowrap;
}

/* ── Views ─────────────────────────────────────────────────────────────── */

main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap);
}
.view.active { display: flex; }

/* ── Main menu ─────────────────────────────────────────────────────────── */

.menu {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.menu-button {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 6.5rem;
  padding: 0.9rem 1.1rem;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  text-align: left;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.08s ease;
}
.menu-button:active { transform: scale(0.97); filter: brightness(0.9); }

.menu-icon {
  flex: 0 0 auto;
  width: 3.4rem;
  height: 3.4rem;
  padding: 0.6rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.menu-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-label { min-width: 0; }
.menu-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.15;
}
.menu-subtitle {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.25rem;
}

/* ── Slideshow ─────────────────────────────────────────────────────────── */

.slideshow {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.slide.shown { opacity: 1; }

.slide-dots {
  position: absolute;
  left: 0; right: 0; bottom: 0.6rem;
  display: flex;
  justify-content: center;
  gap: 0.45rem;
}
.slide-dots span {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: rgba(0, 85, 187, 0.25);
  transition: background 0.3s, transform 0.3s;
}
.slide-dots span.on { background: var(--brand); transform: scale(1.3); }

/* ── Sub-screen toolbar ────────────────────────────────────────────────── */

.toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--gap);
}

.tool {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 4.2rem;
  padding: 0 1.4rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.tool:active { filter: brightness(0.85); }
.tool:disabled { background: #b8c4d3; box-shadow: none; }
.tool svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.15;
}

/* ── Schedule ──────────────────────────────────────────────────────────── */

#schedule-frame {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

/* ── Floor plans: stacked, each sized by its own aspect ratio, never overflowing ── */

.plans {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.plan {
  flex: 1 1 0;           /* flex-grow is set from the image's aspect ratio in kiosk.js */
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0.5rem 0.8rem 0.8rem;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.plan figcaption {
  flex: 0 0 auto;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 0.3rem;
}
.plan img {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  object-fit: contain;
}

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.98);
}
#lightbox[hidden] { display: none; }
#lightbox img {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  padding: 1rem;
}
.lightbox-hint {
  flex: 0 0 auto;
  padding: 1rem;
  text-align: center;
  font-size: 1rem;
  color: var(--muted);
}
