/* ---------- Colours in one place, so they are easy to change ---------- */
/* Taken from the Bits & Tux posters: navy text, gold highlight, warm sand ground */
:root {
  --brand: #14234a;          /* navy */
  --brand-text: #ffffff;
  --accent: #f5b82e;         /* gold */
  --bg: #f7efe2;             /* warm sand */
  --card: #ffffff;
  --text: #1c1f2a;
  --muted: #5d6476;
  --border: #e6dccb;
}

/* ---------- Page basics ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Soft, blurred copy of the page's poster behind everything.
   Mostly visible on wide screens, where the content column doesn't fill the width. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
  filter: blur(28px) saturate(1.1);
  opacity: 0.45;
  transform: scale(1.1);       /* hides blurred edges */
}
body.page-home::before,
body.page-helpline::before { background-image: url("../images/bits-tux-helpline.webp"); }

/* The global header's styles are in css/header.css */

/* Page title bar (helpline page) */
.topbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--brand);
  color: var(--brand-text);
}
.topbar h1 { margin: 0; font-size: 1.15rem; }
.back {
  color: var(--brand-text);
  text-decoration: none;
  font-size: 1.4rem;
  min-width: 44px;            /* big enough to tap with a finger (NFR-03) */
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* Content area, centred and narrow so it reads well on phones and desktops */
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

/* White card holding the helpline menu */
.panel {
  padding: 16px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(20, 35, 74, 0.12);
}

/* ---------- Home page: full-screen Bits & Tux poster (FR-01.1) ---------- */
/* The sky colour fills any space above the poster on tall phones,
   so the poster's own sky simply continues upward. */
body.page-home {
  min-height: 100vh;
  background: #a6d1fb;                           /* exact colour of the poster's top edge */
}
body.page-home::before { opacity: 0; }          /* not needed on phones */
@media (min-aspect-ratio: 2/3) {
  body.page-home::before { opacity: 0.55; }     /* wide screens: blurred sides */
}

/* The stage keeps the poster's exact shape (2 wide : 3 tall), as big as fits,
   sitting at the bottom of the screen so the ground meets the screen edge. */
.stage {
  /* stage width: as wide as the screen, or as tall as the space under the header allows */
  --sw: min(100vw, (100vh - var(--header-h)) * 2 / 3);
  --sw: min(100vw, (100dvh - var(--header-h) - env(safe-area-inset-top)) * 2 / 3);
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--sw);
  aspect-ratio: 2 / 3;
  background: url("../images/bits-tux-helpline.webp") center / 100% 100% no-repeat;
}

/* Button group: starts just right of the horse's front knee
   (knee is at about 50% across, 75% down the poster). */
.stage-actions {
  position: absolute;
  left: 56%;
  top: min(72%, calc(100% - 156px));             /* moves up only if the screen is too short */
  width: 41%;
  display: flex;
  flex-direction: column;
  gap: calc(var(--sw) * 0.02);
}

.btn-open,
.btn-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  border-radius: 999px;
  min-height: 44px;                              /* finger-sized (NFR-03) */
  line-height: 1.2;
}
.btn-open {
  font-size: clamp(16px, calc(var(--sw) * 0.05), 24px);
  font-weight: 700;
  background: var(--brand);
  color: var(--brand-text);
  border: 3px solid var(--accent);
  box-shadow: 0 4px 14px rgba(20, 35, 74, 0.35);
}
.btn-link {
  padding: 6px 10px;
  font-size: clamp(12px, calc(var(--sw) * 0.034), 16px);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand);
  border: 1px solid var(--accent);
  box-shadow: 0 2px 8px rgba(20, 35, 74, 0.2);
}

/* Phones turned sideways: the screen is too short for buttons on the poster.
   Poster sits left of centre; buttons move beside it, on the right. */
@media (orientation: landscape) and (max-height: 500px) {
  .stage {
    left: max(16px, calc(50% - var(--sw) - 16px));
    transform: none;
  }
  .stage-actions {
    left: calc(100% + 32px);
    top: 50%;
    transform: translateY(-50%);
    width: min(240px, calc(100vw - var(--sw) - 80px));
    gap: 10px;
  }
  .btn-open { font-size: 18px; }
  .btn-link { font-size: 14px; }
}

/* ---------- Landing page (landing.html): full-screen image + glass card ---------- */
body.page-landing::before { background-image: url("../images/bits-tux-mela-ride.webp"); }

/* The image fills the screen under the header. On wide screens it stays a
   phone-shaped column in the middle, with the blurred copy on the sides. */
.landing {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h) - env(safe-area-inset-top));
  padding: 20px 16px;
  background: url("../images/bits-tux-mela-ride.webp") center bottom / cover no-repeat;
}

/* Frosted-glass card, placed in the sky so it never covers Bits or Tux */
.landing-card {
  margin-top: 2vh;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
          backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 32px rgba(20, 35, 74, 0.18);
}

/* Main action: title + subtitle, with an arrow on the right */
.landing-main {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 16px;
  color: var(--brand);
  text-decoration: none;
}
.landing-main:active { background: rgba(20, 35, 74, 0.06); }
.landing-text  { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.landing-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.landing-sub   { font-size: 0.92rem; font-weight: 500; color: var(--muted); line-height: 1.35; }
.landing-arrow {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}

/* WhatsApp contact row */
.landing-whatsapp {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 18px;
  border-top: 1px solid rgba(20, 35, 74, 0.1);
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text);
  text-decoration: none;
}
.landing-whatsapp svg { flex: none; color: #1fa855; }
.landing-whatsapp strong { white-space: nowrap; }
.landing-whatsapp:active { background: rgba(31, 168, 85, 0.08); }

/* ---------- Site status result panel (bottom of the home page) ---------- */
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, 480px);
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 4px solid var(--accent);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 30px rgba(20, 35, 74, 0.3);
  z-index: 20;
}
.sheet[hidden] { display: none; }
.sheet.state-up   { border-top-color: #2e9e57; }
.sheet.state-down { border-top-color: #d64545; }

.sheet-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  font-size: 1.6rem;
  color: var(--muted);
  cursor: pointer;
}
.sheet-title { margin: 0 40px 6px 0; font-size: 1.15rem; font-weight: 700; color: var(--brand); }
.sheet-text  { margin: 0 0 4px; color: var(--text); }
.sheet-meta  { margin: 0; font-size: 0.85rem; color: var(--muted); }
.sheet-text:empty, .sheet-meta:empty { display: none; }

.sheet-actions { display: grid; gap: 8px; margin-top: 14px; }
.sheet-actions:empty { display: none; }
.sheet-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  background: var(--brand);
  color: var(--brand-text);
  border: 2px solid var(--accent);
  cursor: pointer;
}
.sheet-btn.secondary { background: var(--card); color: var(--brand); }

/* ---------- Helpline service menu (FR-01.2) ---------- */
.section-title {
  font-size: 0.95rem;
  color: var(--brand);
  margin: 20px 0 10px;
  padding-left: 8px;
  border-left: 4px solid var(--accent);
}
.panel > .section-title:first-child { margin-top: 4px; }

/* The main action tile (site status) stands out */
.tile-primary {
  border: 2px solid var(--accent);
  background: #fff8e6;
}
.menu {
  display: grid;
  gap: 10px;
}
.tile {
  display: block;
  width: 100%;
  min-height: 64px;           /* touch-friendly (NFR-03) */
  padding: 14px 16px;
  text-align: left;
  font: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
}
.tile:disabled { cursor: default; opacity: 0.6; }
.tile-title { display: block; font-weight: 600; }
.tile-sub   { display: block; margin-top: 2px; font-size: 0.9rem; color: var(--muted); }
.badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}
