/* =======================================================
   ITEMBA AIR-CONDITIONING | Arctic ICE UI — style.css (v3.0 PROD)
   Author: Arcta Studio
   Strategy: Mobile & Tablet First | SPA-Optimized | A11y-Safe
   ======================================================= */

/* === Root Variables (Mobile First) === */
:root {
  /* Palette */
  --primary: #00cfff;
  --primary-dark: #0085ff;
  --primary-light: #d6f2ff;
  --secondary: #002b45;
  --accent: #00ffaa;
  --danger: #ff4d4d;

  --dark: #081e2c;
  --light: #eafaff;
  --white: #ffffff;
  --black: #000000;
  --gray: #6c757d;
  --gray-700: #455463;
  --gray-light: #cbd9e3;

  /* Backgrounds */
  --bg-body: linear-gradient(to bottom, #001d2e 0%, #003a5e 50%, #00cfff 100%);
  --bg-elev: rgba(255, 255, 255, 0.10);
  --bg-elev-strong: rgba(0, 43, 69, 0.65);

  /* Text */
  --text-primary: #f0faff;
  --text-secondary: #cceeff;
  --text-light: #e0f7ff;
  --text-muted: #b3eaff;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.12);
  --shadow: 0 2px 8px rgba(0,0,0,0.18);
  --shadow-lg: 0 8px 24px rgba(0, 207, 255, 0.25);
  --glow: 0 0 12px rgba(0, 207, 255, 0.45);

  /* Borders & Radius */
  --border: rgba(255,255,255,0.10);
  --radius: 12px;
  --radius-lg: 18px;

  /* Typography - Mobile Sizes */
  --font-main: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --size-100: 0.75rem;     /* 12px */
  --size-200: 0.875rem;    /* 14px */
  --size-300: 1rem;        /* 16px */
  --size-400: 1.125rem;    /* 18px */
  --size-500: 1.25rem;     /* 20px */
  --size-600: 1.5rem;      /* 24px */
  --lh-tight: 1.2;
  --lh-base: 1.4;

  /* Layout */
  --container-pad: 0.75rem;
  --container-max: 1200px;

  /* Transitions */
  --t-fast: 150ms;
  --t-mid: 250ms;
  --t-slow: 450ms;
  
  /* Safe Area Insets for iOS */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* === Base Reset (Mobile Optimized) === */
*,
*::before,
*::after { 
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body { 
  height: 100%;
  touch-action: manipulation; /* Prevents double-tap zoom on buttons */
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--font-main);
  font-size: var(--size-300);
  line-height: var(--lh-base);
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100svh;
  min-height: -webkit-fill-available; /* Fix for mobile Safari */
  overflow-x: hidden;
  overscroll-behavior-y: contain; /* Prevent pull-to-refresh on mobile */
}

/* === Snowflake Molecular Background Layer === */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -4;
  background: url('/assets/site/bg.webp') center/cover repeat;
  opacity: 0.99;
  pointer-events: none;
}

/* === Typography (Mobile First) === */
h1, h2, h3, h4, h5 {
  color: var(--text-light);
  font-weight: 700;
  line-height: var(--lh-tight);
  margin: 0 0 0.5rem;
  letter-spacing: 0.1px;
}

h1 { 
  font-size: var(--size-500);
  margin-bottom: 0.75rem;
}

h2 { 
  font-size: var(--size-400);
  margin-bottom: 0.5rem;
}

h3 { 
  font-size: var(--size-300);
  margin-bottom: 0.5rem;
}

p {
  color: var(--text-muted);
  font-size: var(--size-200);
  margin: 0 0 0.75rem;
  text-align: justify;
  line-height: var(--lh-base);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--t-fast) ease;
}

a:hover { 
  color: var(--accent); 
  text-decoration: underline; 
}

/* Mobile-friendly focus states */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Remove default button styles on mobile */
button {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

/* === Touch-friendly Containers === */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
  padding-left: calc(var(--container-pad) + var(--safe-left));
  padding-right: calc(var(--container-pad) + var(--safe-right));
}

.home-section {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 90vh;
  padding: 2rem var(--container-pad);
  padding-bottom: calc(2rem + var(--safe-bottom));
  content-visibility: auto;
  contain-intrinsic-size: 500px;
  transition: opacity var(--t-slow) ease, transform var(--t-slow) ease;
  opacity: 0;
  transform: translateY(10px);
}

.home-section[style*="display: flex"] {
  opacity: 1;
  transform: translateY(0);
}

/* === Hero (Mobile Optimized) === */
#hero {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 100svh;
  min-height: -webkit-fill-available;
  background: #001825;
  overflow: hidden;
  padding-top: var(--safe-top);
}

#hero video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 24, 37, 0.65);
  z-index: -1;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: calc(100% - 1.5rem);
  max-width: 95vw;
  margin-inline: auto;
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--bg-elev-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  color: var(--white);
  text-align: center;
}

/* === Touch-friendly Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 44px; /* Minimum touch target size (WCAG) */
  min-width: 44px;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  font-size: var(--size-200);
  text-align: center;
  background: var(--primary);
  color: var(--dark);
  cursor: pointer;
  transition: all var(--t-fast) ease;
  user-select: none;
  touch-action: manipulation;
}

.btn:hover,
.btn:active {
  background: var(--primary-dark);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: var(--glow);
}

.btn--secondary { background: var(--secondary); color: var(--light); }
.btn--ghost { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn--outline { border: 1px solid var(--border); background: transparent; color: var(--white); }
.btn--danger { background: var(--danger); color: var(--white); }

/* Button groups for mobile */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* === Mobile Navigation === */
.nav {
  position: sticky;
  top: 0;
  z-index: 99;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 24, 37, 0.85);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem var(--container-pad);
  padding-top: calc(0.5rem + var(--safe-top));
  padding-left: calc(var(--container-pad) + var(--safe-left));
  padding-right: calc(var(--container-pad) + var(--safe-right));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav__brand {
  color: var(--text-light);
  font-weight: 700;
  font-size: var(--size-300);
  white-space: nowrap;
}

/* Mobile menu toggle (if needed) */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: var(--size-400);
  cursor: pointer;
  padding: 0.5rem;
}

.nav__menu {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.nav__link {
  color: var(--text-secondary);
  font-size: var(--size-200);
  padding: 0.375rem 0.5rem;
  position: relative;
  transition: color var(--t-fast);
  white-space: nowrap;
}

.nav__link:hover,
.nav__link.active {
  color: var(--primary);
}

.nav__link.active::after {
  content: '';
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: -2px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* === Frost Canvas (Mobile Optimized) === */
#frostCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -3;
  pointer-events: none;
}

/* === Mobile Utilities === */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.fade-up { animation: fadeUp 0.3s ease-out both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === Mobile Footer === */
footer {
  background: #001e2e;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem var(--container-pad);
  padding-bottom: calc(1rem + var(--safe-bottom));
  font-size: var(--size-100);
  border-top: 1px solid var(--border);
}

/* === Responsive Breakpoints === */

/* Small Tablets (≥ 640px) */
@media (min-width: 640px) {
  :root {
    --container-pad: 1rem;
    --size-100: 0.875rem;
    --size-200: 0.9375rem;
    --size-300: 1rem;
    --size-400: 1.125rem;
    --size-500: 1.375rem;
    --size-600: 1.5rem;
  }
  
  h1 { font-size: var(--size-500); }
  h2 { font-size: var(--size-400); }
  h3 { font-size: var(--size-300); }
  
  .hero-content {
    padding: 2rem;
    max-width: 600px;
  }
  
  .btn-group {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .nav__menu {
    gap: 1rem;
  }
}

/* Tablets (≥ 768px) */
@media (min-width: 768px) {
  :root {
    --size-500: 1.5rem;
    --size-600: 1.75rem;
  }
  
  .container { 
    max-width: 720px; 
    padding-inline: 1.5rem;
  }
  
  h1 { 
    font-size: var(--size-600); 
    margin-bottom: 1rem;
  }
  
  .hero-content { 
    padding: 2.5rem; 
    max-width: 700px;
  }
  
  .home-section {
    padding: 3rem var(--container-pad);
  }
  
  .btn {
    padding: 0.875rem 1.25rem;
    font-size: var(--size-300);
  }
  
  .nav {
    padding: 0.75rem var(--container-pad);
    padding-top: calc(0.75rem + var(--safe-top));
  }
}

/* Desktop (≥ 1024px) */
@media (min-width: 1024px) {
  :root {
    --size-500: 1.75rem;
    --size-600: 2.25rem;
    --container-pad: 2rem;
  }
  
  .container { 
    max-width: var(--container-max); 
    padding-inline: 2rem;
  }
  
  h1 { 
    font-size: var(--size-600); 
    margin-bottom: 1.25rem;
  }
  
  .btn { 
    padding: 1rem 1.5rem; 
    font-size: var(--size-300);
    box-shadow: var(--glow);
  }
  
  .home-section { 
    padding: 4rem 2rem; 
  }
  
  .hero-content { 
    max-width: 800px; 
    padding: 3rem; 
  }
}

/* Large Desktop (≥ 1200px) */
@media (min-width: 1200px) {
  :root {
    --size-600: 2.5rem;
  }
  
  h1 { 
    font-size: var(--size-600); 
    margin-bottom: 1.5rem;
  }
}

/* === Mobile-specific Overrides === */

/* Prevent text selection on interactive elements */
.btn, .nav__link {
  -webkit-user-select: none;
  user-select: none;
}

/* Improve scrolling on iOS */
.home-section, .container {
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for cleaner mobile look */
@media (max-width: 767px) {
  ::-webkit-scrollbar {
    display: none;
  }
  
  .nav__menu {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .nav__menu::-webkit-scrollbar {
    display: none;
  }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  #hero {
    min-height: 120vh;
  }
  
  .hero-content {
    padding: 1rem;
    max-width: 90vw;
  }
  
  .nav {
    padding: 0.25rem var(--container-pad);
    padding-top: calc(0.25rem + var(--safe-top));
  }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .btn, .nav__link {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}