/* ============================================
   PIT Holdings - Global Styles
   Design System: Variables, Reset, Background
   ============================================ */

/* --- Custom Properties --- */
:root {
    /* PIT Brand Palette */
    --pit-50: #F4F6ED;
    --pit-100: #E8EBD9;
    --pit-200: #D1D8B3;
    --pit-300: #BAC48D;
    --pit-400: #A3B167;
    --pit-500: #8B9A5B;
    --pit-600: #6F7B49;
    --pit-700: #535C37;
    --pit-800: #373D24;
    --pit-900: #1C1F12;

    /* Glass */
    --glass-white: rgba(255, 255, 255, 0.03);
    --glass-white-hover: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(139, 154, 91, 0.3);
    --glass-olive: rgba(139, 154, 91, 0.08);
    --glass-olive-strong: rgba(139, 154, 91, 0.15);

    /* Neutrals - boosted contrast for readability on dark bg */
    --black: #000000;
    --gray-950: #080808;
    --gray-900: #0e0e0e;
    --gray-800: #1a1a1a;
    --gray-700: #2a2a2a;
    --gray-600: #5a5a5a;
    --gray-500: #8a8a8a;
    --gray-400: #a8a8a8;
    --gray-300: #c8c8c8;
    --gray-200: #e0e0e0;
    --white: #ffffff;

    /* Glow / Shadow tokens (used across components) */
    --glow-color: rgba(139, 154, 91, 0.3);
    --glow-color-strong: rgba(139, 154, 91, 0.5);
    --glow-color-subtle: rgba(139, 154, 91, 0.1);
    --glow-color-faint: rgba(139, 154, 91, 0.08);
    --shadow-dark: rgba(0, 0, 0, 0.3);
    --shadow-darker: rgba(0, 0, 0, 0.5);
    --shadow-light: rgba(0, 0, 0, 0.2);

    /* Semantic surface tokens */
    --bg-body: #000000;
    --bg-surface: #0e0e0e;
    --text-primary: #ffffff;
    --text-secondary: #a8a8a8;
    --text-muted: #8a8a8a;
    --overlay-dark: rgba(10, 12, 10, 0.95);
    --input-bg: rgba(255, 255, 255, 0.03);
    --input-border: rgba(255, 255, 255, 0.08);

    /* Blur */
    --blur-sm: 8px;
    --blur-md: 16px;
    --blur-lg: 32px;
    --blur-xl: 64px;

    /* Easing */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Light Theme --- */
:root[data-theme="light"] {
    /* Brand olive - adjusted for light bg */
    --pit-400: #7A8A4E;
    --pit-500: #6F7B49;

    /* Glass inverted for light */
    --glass-white: rgba(0, 0, 0, 0.03);
    --glass-white-hover: rgba(0, 0, 0, 0.06);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-hover: rgba(139, 154, 91, 0.3);
    --glass-olive: rgba(139, 154, 91, 0.06);
    --glass-olive-strong: rgba(139, 154, 91, 0.12);

    /* Neutrals inverted */
    --black: #ffffff;
    --gray-950: #fafafa;
    --gray-900: #f5f5f5;
    --gray-800: #ebebeb;
    --gray-700: #e0e0e0;
    --gray-600: #a0a0a0;
    --gray-500: #707070;
    --gray-400: #505050;
    --gray-300: #383838;
    --gray-200: #202020;
    --white: #111111;

    /* Glow / Shadow - toned down for light */
    --glow-color: rgba(139, 154, 91, 0.15);
    --glow-color-strong: rgba(139, 154, 91, 0.25);
    --glow-color-subtle: rgba(139, 154, 91, 0.05);
    --glow-color-faint: rgba(139, 154, 91, 0.04);
    --shadow-dark: rgba(0, 0, 0, 0.08);
    --shadow-darker: rgba(0, 0, 0, 0.15);
    --shadow-light: rgba(0, 0, 0, 0.06);

    /* Semantic surface tokens */
    --bg-body: #f5f5f0;
    --bg-surface: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #505050;
    --text-muted: #707070;
    --overlay-dark: rgba(245, 245, 240, 0.95);
    --input-bg: rgba(0, 0, 0, 0.03);
    --input-border: rgba(0, 0, 0, 0.08);
}

/* Theme transition (added via JS after first paint to prevent FOUC) */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, fill 0.3s ease, stroke 0.3s ease !important;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

::selection {
    background: var(--pit-500);
    color: var(--black);
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

/* --- Skip Navigation (a11y) --- */
.skip-nav {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    background: var(--pit-500);
    color: var(--black);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 0 0 12px 12px;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.3s;
}

.skip-nav:focus {
    top: 0;
}

/* --- Ambient Background --- */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(var(--blur-xl));
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--pit-700) 0%, transparent 70%);
    top: -20%;
    left: -10%;
}

.orb-2 {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--pit-800) 0%, transparent 70%);
    bottom: -20%;
    right: -15%;
    animation-delay: -7s;
    animation-duration: 25s;
}

.orb-3 {
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, var(--pit-600) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
    animation-duration: 30s;
    opacity: 0.2;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(5%, 10%) scale(1.05); }
    50% { transform: translate(-5%, 5%) scale(0.95); }
    75% { transform: translate(8%, -5%) scale(1.02); }
}

/* Noise overlay */
.noise {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* --- Section Layout --- */
section {
    position: relative;
    z-index: 10;
    padding: 2rem 2rem;
}

.section-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    margin-bottom: 2rem;
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-label-line {
    width: 30px;
    height: 1px;
    background: var(--pit-500);
}

.section-label-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--pit-400);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.section-desc {
    font-size: 1.1rem;
    color: var(--gray-400);
    max-width: 600px;
    margin-top: 1rem;
}

/* --- Typography Helpers --- */
.accent {
    background: linear-gradient(135deg, var(--pit-400), var(--pit-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mono {
    font-family: 'Space Mono', monospace;
}

/* --- Scroll Reveal --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s var(--ease-out);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .orb {
        animation: none;
    }
}

/* --- Light Theme Global Overrides --- */
:root[data-theme="light"] .orb-1 {
    background: radial-gradient(circle, rgba(139, 154, 91, 0.08) 0%, transparent 70%);
    opacity: 0.6;
}

:root[data-theme="light"] .orb-2 {
    background: radial-gradient(circle, rgba(139, 154, 91, 0.06) 0%, transparent 70%);
    opacity: 0.5;
}

:root[data-theme="light"] .orb-3 {
    background: radial-gradient(circle, rgba(139, 154, 91, 0.04) 0%, transparent 70%);
    opacity: 0.3;
}

:root[data-theme="light"] .noise {
    opacity: 0.015;
}

:root[data-theme="light"] ::selection {
    background: var(--pit-500);
    color: #ffffff;
}

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--glass-white);
    backdrop-filter: blur(var(--blur-sm));
    -webkit-backdrop-filter: blur(var(--blur-sm));
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    padding: 0;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--glass-white-hover);
    border-color: var(--glass-border-hover);
    transform: scale(1.1);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke: var(--pit-400);
    fill: none;
    stroke-width: 1.5;
    transition: transform 0.3s var(--ease-out), opacity 0.3s;
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}
