/* ── Splash Screen ────────────────────────────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 600ms ease;
}

#splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-bg {
  position: absolute;
  inset: 0;
  background: url('splash.png') center center / cover no-repeat;
}

.splash-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.15) 0%,
    rgba(0,0,0,0.55) 50%,
    rgba(0,0,0,0.80) 100%
  );
}

.splash-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  width: 100%;
  padding: 0 32px calc(60px + env(safe-area-inset-bottom));
  text-align: center;
}

/* Flag */
.flag {
  display: flex;
  flex-direction: column;
  width: 72px;
  height: 48px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  margin-bottom: 28px;
  flex-shrink: 0;
}
.flag-stripe { flex: 1; }
.flag-red    { background: #EA2839; }
.flag-blue   { background: #1A3A6B; }
.flag-yellow { background: #FFD500; }
.flag-green  { background: #007A3D; }

/* Text */
.splash-sub {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  margin-bottom: 4px;
}

.splash-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 4.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  /* override the h1 flag-stripe border */
  border: none;
  padding: 0;
}

.splash-tagline {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  margin-bottom: 6px;
}

.splash-year {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.2em;
  margin-bottom: 48px;
}

.splash-btn {
  width: 100%;
  max-width: 320px;
  padding: 18px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 50px;
  color: #fff;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
  -webkit-tap-highlight-color: transparent;
}

.splash-btn:hover {
  background: rgba(255,255,255,0.28);
  border-color: #fff;
}

/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Mauritius-inspired palette:
     flag colours (red, blue, yellow, green) softened for readability */
  --teal:        #0A7E6E;   /* lagoon water */
  --teal-dark:   #065F52;
  --teal-light:  #CCFBF1;
  --gold:        #D97706;   /* warm sunshine / flag yellow */
  --gold-light:  #FEF3C7;
  --text:        #1A1A2E;
  --text-muted:  #4A5568;
  --bg:          #F7F4EF;   /* warm sandy off-white */
  --surface:     #FFFFFF;
  --border:      #D4C9BB;   /* warm beige border */
  --danger:      #B91C1C;
  --success:     #0A7E6E;

  /* keep these aliased so existing code using --blue still works */
  --blue:        var(--teal);
  --blue-dark:   var(--teal-dark);
  --blue-light:  var(--teal-light);

  --radius:      14px;
  --radius-sm:   10px;
  --nav-height:  64px;
  --tap-min:     52px;
}

html { font-size: 18px; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

/* ── Bottom Navigation ────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 3px solid var(--teal);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,.10);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 6px 2px;
  min-height: var(--nav-height);
  transition: color 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn svg { width: 24px; height: 24px; flex-shrink: 0; }

.nav-btn.active {
  color: var(--blue);
}

.nav-btn.active svg path,
.nav-btn.active svg circle,
.nav-btn.active svg rect,
.nav-btn.active svg polyline,
.nav-btn.active svg line,
.nav-btn.active svg polygon {
  stroke: var(--blue);
}

/* ── Page Sections ────────────────────────────────────────────── */
.page {
  display: none;
  padding: 20px 16px;
  max-width: 600px;
  margin: 0 auto;
}
.page.active { display: block; }

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--teal-dark);
  padding-bottom: 12px;
  border-bottom: 3px solid;
  border-image: linear-gradient(90deg, #D62828 0%, #1A3A6B 33%, #F5A623 66%, #1B7A3E 100%) 1;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}

/* ── Inputs & Buttons ─────────────────────────────────────────── */
input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 150ms ease;
}

input:focus, textarea:focus {
  border-color: var(--blue);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  min-height: var(--tap-min);
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { background: var(--border); cursor: not-allowed; color: var(--text-muted); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--blue);
  color: var(--blue);
}
.btn-outline:hover { background: var(--blue-light); }

/* ── Currency Converter ───────────────────────────────────────── */
#currency .rate-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

#currency .result-display {
  background: linear-gradient(135deg, var(--teal-light), var(--gold-light));
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  margin: 16px 0;
  border: 1px solid var(--border);
}

#currency .result-display .amount {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--teal-dark);
}

#currency .result-display .label {
  font-size: 0.9rem;
  color: var(--teal-dark);
  margin-top: 4px;
  opacity: 0.8;
}

/* ── Phrase Learner ───────────────────────────────────────────── */
.phrase-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}

.phrase-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.phrase-langs {
  flex: 1;
}

.phrase-card .english {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.phrase-card .french-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--teal-dark);
}

.phrase-card .audio-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--teal-light);
  border: none;
  border-radius: 50%;
  color: var(--teal-dark);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 150ms ease;
}

.phrase-card .audio-btn:hover { background: var(--teal); color: #fff; }

.phrase-category {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 20px 0 8px;
}
.phrase-category:first-child { margin-top: 0; }

/* ── Phrasebook Lookup ────────────────────────────────────────── */
#lookup .search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
#lookup .search-row input { flex: 1; }
#lookup .search-row button { width: auto; padding: 14px 20px; }

.translation-result {
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  padding: 20px;
}

.translation-result .translated {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 12px;
}

/* ── Label Translator ─────────────────────────────────────────── */
.video-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
}

#label-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* animated scan line so he knows it's actively reading */
.scanning-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  animation: scan 2.5s ease-in-out infinite;
  top: 0;
}

@keyframes scan {
  0%   { top: 10%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 90%; opacity: 0; }
}

.ocr-result, .translate-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  white-space: pre-wrap;
  font-size: 1rem;
  line-height: 1.6;
}

.result-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ── Itinerary ────────────────────────────────────────────────── */
.itinerary-day {
  margin-bottom: 24px;
}

.itinerary-day h2 {
  color: var(--blue-dark);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.itinerary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: start;
}

.itinerary-time {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--blue);
  padding-top: 2px;
}

.itinerary-detail strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

.itinerary-detail p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Emergency Contacts ───────────────────────────────────────── */
.contact-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.contact-item .contact-info strong {
  display: block;
  font-size: 1rem;
}

.contact-item .contact-info span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.contact-item a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: var(--tap-min);
}

.contact-item a:hover { background: var(--blue-dark); }

.contact-important a {
  background: var(--danger);
}
.contact-important a:hover { background: #991b1b; }

/* ── Utility ──────────────────────────────────────────────────── */
.status-msg {
  font-size: 0.95rem;
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.status-msg.error {
  background: #FEE2E2;
  color: var(--danger);
}

.status-msg.info {
  background: var(--blue-light);
  color: var(--blue-dark);
}

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
