/* ======================================================
   RCE Design System — Unified Brand Tokens & Components
   Reilly Coding Education™
   ====================================================== */

/* --- Google Fonts --- */
@import url('https://fonts.cdnfonts.com/css/zodiak');
@import url('https://fonts.cdnfonts.com/css/satoshi');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

/* --- Design Tokens --- */
:root {
    /* Brand Colors */
    --rce-primary: #01696f;
    --rce-primary-dark: #004f54;
    --rce-primary-rgb: 1, 105, 111;
    --rce-accent: #964219;
    --rce-accent-rgb: 150, 66, 25;

    /* Accent Palette — Sage, Mint, Frost */
    --rce-sage: #c5ddd4;
    --rce-sage-light: #e4efeb;
    --rce-sage-dark: #8fbfaf;
    --rce-mint: #a8d5cb;
    --rce-frost: #d6eaf0;
    --rce-frost-dark: #a3cee0;
    --rce-leaf: #5a9e82;

    /* Surfaces */
    --rce-bg: #faf9f5;
    --rce-surface: #ffffff;
    --rce-surface-low: #f5f4f0;
    --rce-surface-container: #efeeea;
    --rce-surface-high: #e9e8e4;
    --rce-surface-dim: #dbdad6;

    /* Text */
    --rce-text: #1b1c1a;
    --rce-text-muted: #3f4949;
    --rce-text-subtle: #6f797a;
    --rce-text-inverse: #f2f1ed;

    /* Borders */
    --rce-border: rgba(27, 28, 26, 0.05);
    --rce-border-subtle: rgba(190, 200, 201, 0.15);

    /* Typography */
    --rce-font-display: 'Zodiak', Georgia, serif;
    --rce-font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Fluid Type Scale */
    --rce-text-xs: 0.75rem;
    --rce-text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --rce-text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --rce-text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
    --rce-text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
    --rce-text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
    --rce-text-3xl: clamp(2.5rem, 1.5rem + 3.5vw, 5rem);

    /* Spacing */
    --rce-section-py: clamp(4rem, 3rem + 4vw, 8rem);
    --rce-container-px: clamp(1.25rem, 1rem + 2vw, 3rem);

    /* Shadows */
    --rce-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --rce-shadow-md: 0 4px 24px rgba(25, 24, 20, 0.04);
    --rce-shadow-lg: 0 12px 32px rgba(25, 24, 20, 0.08);
    --rce-shadow-xl: 0 32px 64px rgba(27, 28, 26, 0.06);

    /* Transitions */
    --rce-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --rce-duration: 0.3s;
}

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

body {
    font-family: var(--rce-font-body);
    background-color: var(--rce-bg);
    color: var(--rce-text);
    line-height: 1.7;
    font-size: var(--rce-text-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
button { border: none; font-family: inherit; cursor: pointer; background: none; }

/* --- Typography --- */
h1, h2, h3, h4 {
    font-family: var(--rce-font-display);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--rce-text);
}

.rce-display { font-size: var(--rce-text-3xl); }
.rce-h1 { font-size: var(--rce-text-2xl); }
.rce-h2 { font-size: var(--rce-text-xl); }
.rce-h3 { font-size: var(--rce-text-lg); font-family: var(--rce-font-body); font-weight: 500; }
.rce-body { font-size: var(--rce-text-base); }
.rce-small { font-size: var(--rce-text-sm); }
.rce-label {
    font-size: var(--rce-text-xs);
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--rce-primary);
}

.rce-muted { color: var(--rce-text-muted); }
.rce-subtle { color: var(--rce-text-subtle); }

/* --- Layout --- */
.rce-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--rce-container-px);
}

.rce-container-wide {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--rce-container-px);
}

.rce-section {
    padding: var(--rce-section-py) 0;
    position: relative;
}

/* --- Interactive Elements --- */
.rce-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: var(--rce-text-sm);
    transition: transform var(--rce-duration) var(--rce-ease),
                background var(--rce-duration) ease,
                box-shadow var(--rce-duration) ease;
    min-height: 48px;
    cursor: pointer;
}

.rce-btn-primary {
    background: var(--rce-primary);
    color: var(--rce-text-inverse);
    box-shadow: 0 4px 16px rgba(var(--rce-primary-rgb), 0.2);
}
.rce-btn-primary:hover {
    transform: translateY(-2px);
    background: var(--rce-primary-dark);
    box-shadow: 0 8px 24px rgba(var(--rce-primary-rgb), 0.3);
}
.rce-btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.rce-btn-secondary {
    background: rgba(27, 28, 26, 0.04);
    color: var(--rce-text);
    backdrop-filter: blur(8px);
}
.rce-btn-secondary:hover {
    background: var(--rce-text);
    color: var(--rce-text-inverse);
    transform: translateY(-2px);
}

.rce-btn-ghost {
    background: transparent;
    color: var(--rce-primary);
    padding: 0.5rem 0;
    border-radius: 0;
}
.rce-btn-ghost:hover {
    gap: 1rem;
}

/* --- Cards --- */
.rce-card {
    background: var(--rce-surface);
    border: 1px solid var(--rce-border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--rce-shadow-md);
    transition: transform var(--rce-duration) var(--rce-ease),
                box-shadow var(--rce-duration) ease;
}
.rce-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--rce-shadow-lg);
}

.rce-card-glass {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--rce-shadow-sm);
}

/* Ghost border (used on subtle containers) */
.rce-ghost-border {
    border: 1px solid var(--rce-border-subtle);
}

/* --- Material Symbols --- */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* --- Teal Gradient --- */
.rce-teal-gradient {
    background: linear-gradient(135deg, var(--rce-primary-dark) 0%, var(--rce-primary) 100%);
}

/* --- Reveal Animations --- */
.rce-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--rce-ease),
                transform 0.8s var(--rce-ease);
}
.rce-reveal.visible { opacity: 1; transform: translateY(0); }

.rce-stagger {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--rce-ease), transform 0.6s var(--rce-ease);
    transition-delay: calc(var(--i, 0) * 100ms);
}
.rce-stagger.visible { opacity: 1; transform: translateY(0); }

/* --- Film Grain Texture --- */
.rce-grain::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    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)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 100;
}

/* --- Reduced Motion --- */
@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;
    }
    .rce-reveal, .rce-stagger { opacity: 1; transform: none; }
}

/* --- Skip Link (Accessibility) --- */
.rce-skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    padding: 0.5rem 1rem;
    background: var(--rce-primary);
    color: white;
    border-radius: 4px;
    z-index: 1000;
    font-weight: 600;
}
.rce-skip-link:focus { top: 1rem; }
