/* ==========================================================================
   CUSTOM TYPOGRAPHY (Cal Sans for Headings, Valley Sans for Body)
   ========================================================================== */
@font-face {
    font-family: 'Cal Sans';
    src: url('/fonts/CalSans-Regular.ttf') format('truetype'),
         url('/public/fonts/CalSans-Regular.ttf') format('truetype'),
         url('../fonts/CalSans-Regular.ttf') format('truetype'),
         url('../../fonts/CalSans-Regular.ttf') format('truetype');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Valley Sans';
    src: url('/fonts/ValleySans-VariableFont_wght.ttf') format('truetype'),
         url('/public/fonts/ValleySans-VariableFont_wght.ttf') format('truetype'),
         url('../fonts/ValleySans-VariableFont_wght.ttf') format('truetype'),
         url('../../fonts/ValleySans-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'LogoFont';
    src: url('/fonts/Logo.ttf') format('truetype'),
         url('/public/fonts/Logo.ttf') format('truetype'),
         url('../fonts/Logo.ttf') format('truetype'),
         url('../../fonts/Logo.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TitleFont';
    src: url('/fonts/Title.ttf') format('truetype'),
         url('/public/fonts/Title.ttf') format('truetype'),
         url('../fonts/Title.ttf') format('truetype'),
         url('../../fonts/Title.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ==========================================================================
   GLOBAL THEME VARIABLES
   ========================================================================== */

:root {
    /* --- Base Typography --- */
    --font-heading: 'Cal Sans', 'Space Grotesk', 'Noto Sans Sinhala', 'Noto Sans Tamil', sans-serif;
    --font-display: var(--font-heading);
    --font-sans: 'Valley Sans', 'Inter', 'Noto Sans Sinhala', 'Noto Sans Tamil', system-ui, -apple-system, sans-serif;
    --transition-speed: 0.3s;
}

/* --- LIGHT MODE (DEFAULT) --- */
:root, [data-theme="light"] {
    /* Backgrounds (Palette: #E3F2FD base) */
    --bg-body: #E3F2FD;
    --bg-card: rgba(255, 255, 255, 0.88);
    --bg-surface: #FFFFFF;
    --bg-glass-heavy: rgba(255, 255, 255, 0.85);
    
    /* Text (Palette: #0D47A1 deep navy) */
    --text-main: #0D47A1;
    --text-muted: #475569;
    --text-inverse: #ffffff;
    
    /* Accents (Palette: #2196F3 brand, #90CAF9 sky accent) */
    --color-brand: #2196F3;
    --color-brand-hover: #1976D2;
    --color-brand-accent: #90CAF9;
    --color-brand-dim: rgba(33, 150, 243, 0.12);
    --color-cyan: #00BCD4;
    --color-danger: #ef4444;
    --color-success: #22c55e;
    
    /* Borders (Palette: #90CAF9) */
    --border-color: rgba(144, 202, 249, 0.45);
    --border-hover: rgba(33, 150, 243, 0.5);
    --border-glass-light: rgba(255, 255, 255, 0.7);
    
    /* Shadows */
    --shadow-glass: 0 10px 35px rgba(33, 150, 243, 0.08);
    --shadow-hover: 0 12px 35px rgba(33, 150, 243, 0.18);
    --shadow-inner: inset 0 2px 4px rgba(13, 71, 161, 0.04);
}

/* --- DARK MODE --- */
[data-theme="dark"] {
    /* Backgrounds (Palette: deep sleek dark) */
    --bg-body: #16181B;
    --bg-card: rgba(30, 33, 39, 0.90);
    --bg-surface: #1E2026;
    --bg-glass-heavy: rgba(10, 16, 30, 0.78);
    
    /* Text */
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --text-inverse: #16181B;
    
    /* Accents (Palette: #5F85DB brand, #90B8F8 sky highlight) */
    --color-brand: #5F85DB;
    --color-brand-hover: #739BF0;
    --color-brand-accent: #90B8F8;
    --color-brand-dim: rgba(95, 133, 219, 0.16);
    --color-cyan: #00BCD4;
    --color-danger: #ef4444;
    --color-success: #22c55e;
    
    /* Borders */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(144, 184, 248, 0.35);
    --border-glass-light: rgba(255, 255, 255, 0.05);
    
    /* Shadows */
    --shadow-glass: 0 10px 40px rgba(0, 0, 0, 0.60);
    --shadow-hover: 0 12px 35px rgba(95, 133, 219, 0.22);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   GLOBAL HTML/BODY RESETS
   ========================================================================= */
body {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
    font-family: var(--font-sans);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    padding-bottom: 90px;
}
@media (min-width: 1280px) {
    body { padding-bottom: 0; }
}

/* Headings Typography (Cal Sans) */
h1, h2, h3, h4, h5, h6,
.font-display,
.font-heading,
.font-title,
.font-grotesk {
    font-family: var(--font-heading) !important;
}

/* Logo & Title branding fonts preservation */
.font-logo, [class*="font-logo"] {
    font-family: 'LogoFont', 'Cal Sans', sans-serif !important;
}
.font-titlefont, [class*="font-titlefont"] {
    font-family: 'TitleFont', 'Cal Sans', sans-serif !important;
}

/* Ensure FontAwesome icons keep FontAwesome font */
i.fa-solid, i.fa-regular, i.fa-brands, i[class*="fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", FontAwesome !important;
}

/* Ensure monospace elements keep monospace */
.font-mono, code, pre, kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* Smooth scrolling for the whole page */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-brand-dim); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-brand); }


/* ==========================================================================
   IOS LIQUID GLASS SYSTEM
   ========================================================================== */

/* Base Card */
.skin-card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 1.5rem !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-glass) !important;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.skin-card:hover {
    border-color: var(--border-hover) !important;
    box-shadow: var(--shadow-hover) !important;
    transform: translateY(-2px);
}

/* Form Inputs */
.custom-input {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    box-shadow: var(--shadow-inner);
    transition: all 0.2s ease;
}

.custom-input:focus {
    outline: none !important;
    border-color: var(--color-brand) !important;
    box-shadow: 0 0 0 2px var(--color-brand-dim) !important;
}

/* Buttons */
.btn-brand {
    background-color: var(--color-brand) !important;
    color: #ffffff !important;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.25) !important;
}
[data-theme="dark"] .btn-brand {
    box-shadow: 0 4px 15px rgba(95, 133, 219, 0.3) !important;
}
.btn-brand:hover {
    background-color: var(--color-brand-hover) !important;
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.35) !important;
    transform: translateY(-1px);
}
[data-theme="dark"] .btn-brand:hover {
    box-shadow: 0 6px 20px rgba(95, 133, 219, 0.4) !important;
}
.btn-brand:active {
    transform: translateY(1px);
}

/* ==========================================================================
   GLOBAL BACKGROUND SHAPES
   ========================================================================== */
.global-bg-shapes {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.global-bg-shapes .shape-1 {
    position: absolute;
    top: -10%; left: -10%;
    width: 50%; height: 50%;
    border-radius: 50%;
    background: var(--color-brand);
    opacity: 0.1;
    filter: blur(120px);
    transition: opacity var(--transition-speed) ease;
}

.global-bg-shapes .shape-2 {
    position: absolute;
    bottom: -10%; right: -10%;
    width: 40%; height: 50%;
    border-radius: 50%;
    background: var(--color-brand-accent);
    opacity: 0.08;
    filter: blur(120px);
    transition: opacity var(--transition-speed) ease;
}

/* Dim shapes in dark mode */
[data-theme="dark"] .global-bg-shapes .shape-1 {
    opacity: 0.07;
}
[data-theme="dark"] .global-bg-shapes .shape-2 {
    opacity: 0.05;
}

/* ==========================================================================
   EXCEPTIONS / REDEEM CARD (Remains Dark/Gold)
   ========================================================================== */
.redeem-card {
    background-color: #0a0a0a !important;
    border-color: rgba(255, 183, 3, 0.2) !important;
}


/* ==========================================================================
   PREMIUM VISUAL COMPOSITION SYSTEM (Our Services)
   ========================================================================== */
.card-glow { box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 20px 60px -20px rgba(0,0,0,0.6); }

.visual-box {
    position: relative;
    height: 180px;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    background:
        radial-gradient(140px 100px at 50% 42%, var(--glow), transparent 72%),
        radial-gradient(circle at 50% 100%, rgba(0,0,0,0.55), transparent 60%),
        #070b16;
}
.visual-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: .35;
    -webkit-mask-image: radial-gradient(circle at 50% 42%, black, transparent 75%);
    mask-image: radial-gradient(circle at 50% 42%, black, transparent 75%);
}
.visual-glow {
    position: absolute;
    width: 110px; height: 110px;
    left: 50%; top: 44%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    filter: blur(20px);
    opacity: .5;
}
.orbit-ring {
    position: absolute;
    width: 148px; height: 148px;
    left: 50%; top: 44%;
    transform: translate(-50%, -50%);
    opacity: .55;
}
.orbit-particle {
    position: absolute;
    width: 7px; height: 7px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--accent);
    opacity: .85;
}
.main-tile {
    position: relative;
    z-index: 10;
    width: 62px; height: 62px;
    border-radius: 17px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    box-shadow: 0 0 28px var(--glow), inset 0 1px 0 rgba(255,255,255,0.3);
}
.main-tile i { color: #fff; font-size: 1.4rem; }
.feature-chip {
    position: absolute;
    z-index: 15;
    display: flex; align-items: center; gap: 5px;
    padding: 5px 9px;
    border-radius: 9px;
    background: rgba(9,13,24,0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 9px; font-weight: 700; color: rgba(255,255,255,.78);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    white-space: nowrap;
}
.feature-chip i { color: var(--accent); font-size: 9px; }
.chip-tl { top: 10px; left: 10px; }
.chip-tr { top: 10px; right: 10px; }
.chip-bl { bottom: 10px; left: 10px; }
.chip-br { bottom: 10px; right: 10px; }

.btn-premium { box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 6px 18px -4px var(--btn-shadow, rgba(0,0,0,0.4)); }

@media (prefers-reduced-motion: no-preference) {
    .float-a { animation: floatY 4.2s ease-in-out infinite; }
    .float-b { animation: floatY 4.8s ease-in-out infinite; animation-delay: .35s; }
    .float-c { animation: floatY 5.4s ease-in-out infinite; animation-delay: .7s; }
    .orbit-spin { animation: spin 22s linear infinite; }
    .orbit-spin-rev { animation: spinRev 28s linear infinite; }
    .pulse-glow { animation: pulseGlow 4.5s ease-in-out infinite; }
    .drift-a { animation: driftA 6s ease-in-out infinite; }
    .drift-b { animation: driftB 6.6s ease-in-out infinite; animation-delay: .5s; }
    .drift-c { animation: driftA 5.4s ease-in-out infinite; animation-delay: .2s; }
}
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes spin { from { transform: translate(-50%,-50%) rotate(0deg); } to { transform: translate(-50%,-50%) rotate(360deg); } }
@keyframes spinRev { from { transform: translate(-50%,-50%) rotate(360deg); } to { transform: translate(-50%,-50%) rotate(0deg); } }
@keyframes pulseGlow { 0%,100% { opacity: .38; } 50% { opacity: .7; } }
@keyframes driftA { 0%,100% { transform: translate(0,0); } 50% { transform: translate(4px,-5px); } }
@keyframes driftB { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-5px,4px); } }

/* Fix word spacing in headlines */
h1, h2, h3, h4, h5, h6, .font-display, .font-title, .font-heading { word-spacing: 0.15em; letter-spacing: 0.02em; }
