/* =============================================================
   BASE.CSS - Design System Tokens & Reset
   Thiru.Vi.Ka. Higher Secondary School
   ============================================================= */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Mukta+Malar:wght@400;700&display=swap');

/* Tamil Font Support */
[lang="ta"] {
  --font-body: 'Mukta Malar', sans-serif !important;
  --font-heading: 'Mukta Malar', sans-serif !important;
  --font-main: 'Mukta Malar', sans-serif !important;
}

/* Language Toggle Styling */
.lang-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--color-gold-metallic);
  color: var(--color-gold-metallic);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-right: 15px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  z-index: 1001;
  position: relative;
}

.lang-toggle:hover {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-gold);
}

[lang="ta"] .lang-toggle {
  font-family: var(--font-tamil);
}

/* ─── CSS Custom Properties (Design Tokens) ─── */
:root {
  /* Fonts */
  --font-main: 'Outfit', sans-serif;
  --font-heading: 'Playfair Display', serif;
  --font-tamil: 'Mukta Malar', sans-serif;

  /* Primary Colors - Navy & Gold */
  --color-gold-metallic: #D4AF37;
  --color-gold-vivid: #FFD700;
  --color-gold-dark: #C5A028;
  --color-navy-deep: #020412;
  --color-navy-surface: #0A1128;
  --color-navy-accent: #1B3B6F;
  --color-black: #010208;

  /* Semantic Colors */
  --color-success: #10B981;
  --color-error: #EF4444;
  --color-warning: #F59E0B;
  --color-info: #3B82F6;

  /* Text Colors — Dark Mode (default) */
  --text-primary: #FFFFFF;
  --text-secondary: #CBD5E1;
  --text-muted: #64748B;
  
  /* ─── Backgrounds & Core Themes ─── */
  --bg-primary: #020412;
  --bg-secondary: #0A1128;
  --bg-card: rgba(10, 15, 38, 0.85);
  --bg-card-hover: rgba(15, 23, 42, 0.95);
  --bg-glass: rgba(2, 4, 18, 0.6);
  --bg-glass-strong: rgba(10, 15, 38, 0.85);
  --bg-input: rgba(255, 255, 255, 0.05);

  /* ─── Gradients ─── */
  --gradient-bg: linear-gradient(135deg, #020412 0%, #0A1128 50%, #010208 100%);
  --gradient-hero: linear-gradient(180deg, transparent 0%, rgba(2,4,18,0.9) 100%);
  --gradient-card: linear-gradient(135deg, rgba(0,209,255,0.05), rgba(122,0,255,0.05));
  --gradient-gold: linear-gradient(135deg, #FFD700 0%, #D4AF37 100%);
  --gradient-primary: linear-gradient(135deg, #1B3B6F 0%, #0A1128 100%);

  /* ─── Shadows ─── */
  --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 25px 60px rgba(0, 0, 0, 0.8);
  --shadow-glow-blue: 0 0 20px rgba(0, 209, 255, 0.2);
  --shadow-glow-gold: 0 0 20px rgba(212, 175, 55, 0.2);
  --shadow-glow-vivid: 0 0 30px rgba(255, 215, 0, 0.4);
  --shadow-neumorphic: inset 0 0 20px rgba(255,255,255,0.05), 10px 10px 30px rgba(0,0,0,0.5);

  
  --border-glass: rgba(0, 209, 255, 0.2); 
  --border-white: rgba(255, 255, 255, 0.1);

  /* ─── Spacing (Premium Expanded Scale) ─── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1.25rem;  /* Expanded from 1rem */
  --space-5: 1.5rem;
  --space-6: 2rem;     /* Expanded from 1.5rem */
  --space-8: 2.5rem;   /* Expanded */
  --space-10: 3rem;
  --space-12: 4rem;    /* Expanded */
  --space-16: 5rem;
  --space-20: 6rem;
  --space-24: 8rem;

  /* ─── Typography ─── */
  --font-heading: 'Outfit', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  
  --text-xs: clamp(0.7rem, 0.8vw, 0.75rem);
  --text-sm: clamp(0.85rem, 0.9vw, 0.9rem);
  --text-base: clamp(1rem, 1vw, 1.1rem);
  --text-lg: clamp(1.1rem, 1.2vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.4vw, 1.4rem);
  --text-2xl: clamp(1.5rem, 2vw, 1.75rem);
  --text-3xl: clamp(1.8rem, 2.5vw, 2.2rem);
  --text-4xl: clamp(2.2rem, 3vw, 2.75rem);
  --text-5xl: clamp(2.75rem, 4vw, 3.5rem);
  --text-6xl: clamp(3.5rem, 5vw, 4.25rem);
  --text-hero: clamp(4rem, 6vw, 5.5rem);
  
  /* ─── Border Radius ─── */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* ─── Transitions ─── */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  --nav-height: 80px;

  /* Z-Index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-tooltip: 600;

  /* Layout */
  --max-width: 1280px;
  --nav-height: 72px;
  --sidebar-width: 280px;
}

/* Light theme completely disabled to enforce pure Navy & Gold premium dark UI */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-bg);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  z-index: -2;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(0,191,255,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(122,0,255,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(255,215,0,0.04) 0%, transparent 50%);
  z-index: -1;
  pointer-events: none;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-electric-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-soft-gold);
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-electric-blue);
  box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.15);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-5xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
}

ul, ol {
  list-style: none;
}

::selection {
  background: rgba(0, 191, 255, 0.3);
  color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 191, 255, 0.3);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 191, 255, 0.5);
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--color-electric-blue);
  color: var(--text-inverse);
  border-radius: var(--radius-md);
  z-index: var(--z-tooltip);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

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

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ─── Fail-safe for Reveal ─── */
/* If browser doesn't support IntersectionObserver or JS hangs, ensure visibility */
.reveal, .reveal--left, .reveal--right, .reveal--scale {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

/* Re-enable opacity 0 ONLY if JS is running */
body.js-enabled .reveal, 
body.js-enabled .reveal--left, 
body.js-enabled .reveal--right, 
body.js-enabled .reveal--scale {
  opacity: 0;
}

body.js-enabled .reveal.visible,
body.js-enabled .reveal--left.visible, 
body.js-enabled .reveal--right.visible,
body.js-enabled .reveal--scale.visible {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}
