/* ==========================================================
   ✅ BASE.CSS — The Definitive World-Class Foundation
   - Architecture: Modern CSS Logical Properties
   - Standard: 2026 High-Performance Travel Industry Spec
   - Optimization: OLED-Safe, Haptic-Ready, Zero-Jank
========================================================== */

/* 1. COMPATIBILITY LAYER (Variable Fallbacks)
   Ensures the UI survives even if tokens.css takes 100ms longer to load.
   We map your Brand Tokens to Semantic Names here.
   ------------------------------------------------------- */
:root {
  /* Layout Dimensions */
  --navbar-height: clamp(70px, 8vh, 90px);
  --container-max: var(--container-width, 1200px);
  --container-pad: clamp(1.25rem, 5vw, 2.5rem);

  /* Typography Reference */
  --font-main: var(
    --font-body,
    "Poppins",
    system-ui,
    -apple-system,
    sans-serif
  );
  --font-display: var(--font-display, "Playfair Display", serif);

  /* Brand Semantic Mapping */
  --primary: var(--logo-blue, #0b2a4a);
  --primary-soft: rgba(11, 42, 74, 0.08);
  --accent: var(--logo-yellow, #ffd400);
  --callout: var(--accent-red, #ef4444);

  /* Neutral Scale */
  --dark: #0f172a;
  --text-main: var(--text-main, #334155);
  --text-muted: var(--text-body, #64748b);
  --white: #ffffff;
  --bg-surface: var(--bg-off-white, #f8f9fa);

  /* Border & UI */
  --border-light: #e2e8f0;
  --radius-md: 14px;

  /* Motion Constants */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 200ms;
}

/* 2. THE ULTIMATE RESET & PERFORMANCE FIXES
   ------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* Removes mobile tap flash */
}

html {
  width: 100%;
  height: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--navbar-height);
  -webkit-text-size-adjust: 100%;
  hanging-punctuation: first last;

  /* Modern Layout Shift Prevention */
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--white);

  /* Font Rendering Perfection */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  overflow-x: hidden;
  width: 100%;
  min-height: 100dvh; /* Dynamic viewport for modern mobile */
  display: flex;
  flex-direction: column;
}

/* 3. MODERN TYPOGRAPHY HIERARCHY
   Using Logical Properties and Char-Limit Science
   ------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--primary);
  letter-spacing: -0.02em;
  text-wrap: balance; /* Prevents single-word widows on new browsers */
  margin-bottom: 0.75em;
}

h1 {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
}
h2 {
  font-size: clamp(2rem, 5vw, 3rem);
}
h3 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

p {
  max-inline-size: 75ch; /* Optimum reading width */
  text-wrap: pretty; /* Intelligent line breaking (Chrome 117+) */
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
  cursor: pointer;
}

/* 4. ASSETS & MEDIA (ZERO CLS)
   ------------------------------------------------------- */
img,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
  font-style: italic;
  shape-margin: 1rem;

  /* CLS Protection: prevents layout shift before image loads */
  object-fit: cover;
  vertical-align: middle;
}

/* Note: content-visibility removed from here to prevent collapse bugs. 
   Handled via classes in layout.css or home.css */

/* 5. INTERACTIVE & FORM ELEMENTS (HAPTIC READY)
   ------------------------------------------------------- */
button,
.btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  user-select: none;
  transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

button:active,
.btn:active {
  transform: scale(0.96); /* Physical "Haptic" click effect */
}

input,
textarea,
select {
  appearance: none;
  width: 100%;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--primary);
  transition: all var(--dur-fast) var(--ease-out);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  background: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

/* 6. LAYOUT COMPONENTS
   ------------------------------------------------------- */
.container {
  width: min(100% - (var(--container-pad) * 2), var(--container-max));
  margin-inline: auto;
}

section {
  padding-block: clamp(4rem, 8vw, 7rem);
  position: relative;
  isolation: isolate; /* Local z-index stacking context */
}

/* 7. ACCESSIBILITY & A11Y (NON-NEGOTIABLE)
   ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Keyboard Navigation Focus Ring */
:focus-visible {
  outline: 2px solid var(--callout);
  outline-offset: 4px;
}

/* Screen Reader Only Utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 8. SCROLLBAR (PREMIUM GLASS LOOK)
   ------------------------------------------------------- */
@media (min-width: 1024px) {
  ::-webkit-scrollbar {
    width: 10px;
  }
  ::-webkit-scrollbar-track {
    background: var(--bg-surface);
  }
  ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border: 3px solid var(--bg-surface); /* Creates floating effect */
    border-radius: 100vw;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }
}

/* 9. UTILITIES (CORE PERFORMANCE)
   ------------------------------------------------------- */
.no-scroll {
  overflow: hidden;
  touch-action: none;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 10. MOBILE SPECIFIC OPTIMIZATIONS (PWA READY)
   ------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --navbar-height: 64px;
    --container-pad: 1.25rem;
  }

  /* Ensuring touch targets meet the 44px+ Standard */
  input,
  button,
  .btn,
  a.nav-link {
    min-height: 48px;
  }

  p {
    font-size: 0.95rem; /* Better readability on small screens */
  }
}

/* 11. LAYOUT CONTAINMENT
   Prevents Reflows on heavy content sections */
main {
  /* Only contain style, layout can break sticky headers if applied blindly */
  contain: style;
}
