/* Sorcer Design System
 * Light/Dark Mode with High Contrast
 * ================================== */

:root {
    /* Light Mode (default) */
    --sorcer-bg: #ffffff;
    --sorcer-surface: #f5f5f7;
    --sorcer-text: #0a0a0f;
    --sorcer-muted: #555555;
    --sorcer-accent: #2D5BFF;
    --sorcer-border: #e0e0e0;
    --sorcer-grid: #e8e8e8;
    --sorcer-logo-invert: 1;  /* Invert white logo to dark for light bg */

    /* Typography */
    --font-sans: 'Inter Tight', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

    /* Spacing */
    --section-padding-y: 8rem;
    --section-padding-x: 6rem;
    --section-padding-x-mobile: 1.5rem;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --sorcer-bg: #0a0a0f;
    --sorcer-surface: #16161c;
    --sorcer-text: #ffffff;
    --sorcer-muted: #a0a0a0;
    --sorcer-accent: #2D5BFF;
    --sorcer-border: #2a2a35;
    --sorcer-grid: #1a1a22;
    --sorcer-logo-invert: 0;  /* Keep white logo as-is for dark bg */
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--sorcer-bg);
    color: var(--sorcer-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

h1 {
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 800;
}

h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
}

p {
    font-family: var(--font-mono);
    color: var(--sorcer-muted);
}

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

/* Utility Classes */
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); }

.text-accent { color: var(--sorcer-accent); }
.text-muted { color: var(--sorcer-muted); }
.text-white { color: var(--sorcer-text); }

.bg-surface { background-color: var(--sorcer-surface); }
.bg-dark { background-color: var(--sorcer-bg); }

.glow-text {
    text-shadow: 0 0 20px rgba(45, 91, 255, 0.3);
}

/* Grid Background */
.bg-grid {
    position: fixed;
    inset: 0;
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, var(--sorcer-grid) 1px, transparent 1px),
        linear-gradient(to bottom, var(--sorcer-grid) 1px, transparent 1px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
    transition: background-image 0.2s ease;
}

[data-theme="dark"] .bg-grid {
    opacity: 0.3;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1.5rem var(--section-padding-x);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Dark mode: use blend mode for contrast on varied backgrounds */
[data-theme="dark"] .navbar {
    mix-blend-mode: difference;
}

/* Light mode: no blend mode, use explicit colors */
[data-theme="light"] .navbar {
    mix-blend-mode: normal;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--sorcer-border);
}

@media (max-width: 768px) {
    .navbar {
        padding: 1.5rem var(--section-padding-x-mobile);
    }
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-brand img {
    height: 2rem;
    width: auto;
    transition: filter 0.2s ease;
}

/* Light mode: make logo dark */
[data-theme="light"] .navbar-brand img {
    filter: brightness(0);  /* Black logo for light bg */
}

/* Dark mode: keep logo light/white */
[data-theme="dark"] .navbar-brand img {
    filter: brightness(0) invert(1);  /* White logo for dark bg */
}

.navbar-brand .wordmark {
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
    color: var(--sorcer-text);
}

/* Explicit wordmark colors for each theme */
[data-theme="light"] .navbar-brand .wordmark {
    color: #0a0a0f;
}

[data-theme="dark"] .navbar-brand .wordmark {
    color: #ffffff;
}

.navbar-links {
    display: flex;
    gap: 2rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--sorcer-muted);
}

.navbar-links a:hover {
    color: var(--sorcer-text);
}

/* Light mode: ensure nav links are dark */
[data-theme="light"] .navbar-links {
    color: #555555;
}

[data-theme="light"] .navbar-links a:hover {
    color: #0a0a0f;
}

@media (max-width: 1280px) {
    .navbar-links {
        display: none;
    }
}

@media (max-width: 1440px) {
    .navbar-links {
        gap: 0.75rem;
        font-size: 0.7rem;
    }
}

/* Language Toggle */
.lang-toggle {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.25rem;
}

[data-theme="light"] .lang-toggle {
    background: rgba(0, 0, 0, 0.05);
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--sorcer-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    /* cursor handled by global rule */
    transition: all var(--transition-fast);
    text-transform: uppercase;
}

.lang-btn.active {
    background: var(--sorcer-accent);
    color: var(--sorcer-text);
}

.lang-btn:hover:not(.active) {
    color: var(--sorcer-text);
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(128, 128, 128, 0.15);
    border: 1px solid var(--sorcer-border);
    border-radius: 0.25rem;
    /* cursor handled by global rule */
    transition: all var(--transition-fast);
}

/* Light mode explicit styles */
[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.08);
    border-color: #d0d0d0;
}

[data-theme="light"] .theme-toggle svg {
    stroke: #0a0a0f;
}

/* Dark mode explicit styles */
[data-theme="dark"] .theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-color: #3a3a45;
}

[data-theme="dark"] .theme-toggle svg {
    stroke: #ffffff;
}

.theme-toggle:hover {
    border-color: var(--sorcer-accent);
    background: rgba(45, 91, 255, 0.15);
}

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.2s ease, stroke 0.2s ease;
}

.theme-toggle:hover svg {
    transform: rotate(15deg);
}

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

/* Light mode: show moon (click to go dark) */
.theme-toggle .icon-moon {
    display: block;
}

/* Dark mode: show sun (click to go light) */
[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

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

/* Language Content */
/* Language content - CSS-based switching (prevents flash before JS loads) */
.lang-content { display: none; }
.lang-content.active { display: block; }
span.lang-content { display: none; }
span.lang-content.active { display: inline; }

/* Immediate language switching via html[data-lang] - takes priority */
html[data-lang="en"] .lang-content[data-lang="en"] { display: block; }
html[data-lang="en"] span.lang-content[data-lang="en"] { display: inline; }
html[data-lang="en"] .lang-content[data-lang="fr"] { display: none !important; }

html[data-lang="fr"] .lang-content[data-lang="fr"] { display: block; }
html[data-lang="fr"] span.lang-content[data-lang="fr"] { display: inline; }
html[data-lang="fr"] .lang-content[data-lang="en"] { display: none !important; }

/* Sections */
.section {
    position: relative;
    padding: var(--section-padding-y) var(--section-padding-x);
    border-bottom: 1px solid var(--sorcer-border);
}

@media (max-width: 768px) {
    .section {
        padding: 4rem var(--section-padding-x-mobile);
    }
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--sorcer-accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.section-title {
    font-family: var(--font-sans);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.section-fineprint {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-style: italic;
    color: var(--sorcer-muted);
    margin-top: -1rem;
    margin-bottom: 2rem;
}

/* Section Logo (above Contact, etc.) */
.section-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.section-logo img {
    width: 50px;
    height: auto;
    opacity: 0.8;
    transition: filter 0.2s ease;
}

/* Theme adaptation for section logo */
[data-theme="light"] .section-logo img {
    filter: brightness(0);
}

[data-theme="dark"] .section-logo img {
    filter: brightness(0) invert(1);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--section-padding-y) var(--section-padding-x);
    border-bottom: 1px solid var(--sorcer-border);
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .hero {
        padding: 6rem var(--section-padding-x-mobile);
    }
}

.hero-content {
    max-width: 64rem;
    position: relative;
    z-index: 1;
}

.hero-badge {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--sorcer-accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
}

.hero h1 {
    margin-bottom: 2rem;
}

.hero h1 .accent {
    color: var(--sorcer-accent);
    text-shadow: 0 0 30px rgba(45, 91, 255, 0.4);
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    color: var(--sorcer-muted);
    max-width: 36rem;
    margin-bottom: 3rem;
    line-height: 1.7;
}

.hero-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150vw;
    max-width: none;
    pointer-events: none;
    user-select: none;
    z-index: 0;
    opacity: 0.06;  /* Base opacity - controlled by JS on scroll */
    transition: opacity 0.3s ease;
}

.hero-watermark img {
    width: 100%;
    height: auto;
}

/* Light mode: dark watermark on light bg */
[data-theme="light"] .hero-watermark img {
    filter: brightness(0);  /* Black logo */
}

/* Dark mode: light watermark on dark bg */
[data-theme="dark"] .hero-watermark img {
    filter: brightness(0) invert(1);  /* White logo */
}

/* Fade watermark on scroll - applied via JS */
.hero-watermark.faded {
    opacity: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border: none;
    /* cursor handled by global rule */
    transition: all var(--transition-base);
}

.btn-primary {
    background-color: var(--sorcer-text);
    color: var(--sorcer-bg);
}

.btn-primary:hover {
    background-color: var(--sorcer-accent);
    color: var(--sorcer-text);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--sorcer-border);
    color: var(--sorcer-text);
}

.btn-outline:hover {
    border-color: var(--sorcer-accent);
    color: var(--sorcer-accent);
}

.btn-accent {
    background-color: var(--sorcer-accent);
    color: var(--sorcer-text);
}

.btn-accent:hover {
    background-color: #4169ff;
}

/* Hero CTA Group */
.hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Grid Layout */
.grid-12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 3rem;
}

@media (max-width: 768px) {
    .grid-12 {
        grid-template-columns: 1fr;
    }
}

.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

@media (max-width: 768px) {
    .col-4, .col-5, .col-7, .col-8 { grid-column: span 12; }
}

/* Cards */
.card {
    background: var(--sorcer-bg);
    border: 1px solid var(--sorcer-border);
    padding: 2rem;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--sorcer-accent);
}

.card-active {
    border-color: var(--sorcer-accent);
    position: relative;
}

.card-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--sorcer-accent);
    color: var(--sorcer-text);
}

.card-badge-muted {
    background: var(--sorcer-border);
    color: var(--sorcer-muted);
}

.card-title {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--sorcer-text);
}

.card-description {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--sorcer-muted);
    margin-bottom: 1.5rem;
}

.card-inactive {
    opacity: 0.7;
}

.card-inactive:hover {
    opacity: 1;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* Blockquote */
blockquote {
    border-left: 2px solid var(--sorcer-accent);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-style: italic;
    color: var(--sorcer-muted);
}

blockquote strong {
    color: var(--sorcer-text);
    font-style: normal;
}

/* CMS Content Sections */
.cms-section {
    padding: var(--section-padding-y) var(--section-padding-x);
    border-bottom: 1px solid var(--sorcer-border);
}

.cms-section:nth-child(even) {
    background: var(--sorcer-surface);
}

@media (max-width: 768px) {
    .cms-section {
        padding: 4rem var(--section-padding-x-mobile);
    }
}

.cms-content {
    max-width: 64rem;
}

.cms-content p {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    color: var(--sorcer-muted);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.cms-content strong {
    color: var(--sorcer-text);
}

.cms-content h4 {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    color: var(--sorcer-text);
    margin: 2rem 0 0.75rem;
}

/* Info Box (from Rentry !!!info) */
.info-box {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--sorcer-accent);
    color: var(--sorcer-text);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    margin-top: 1.5rem;
}

/* Footer */
.footer {
    padding: 6rem var(--section-padding-x);
    background: var(--sorcer-surface);
    border-top: 1px solid var(--sorcer-border);
    text-align: center;
}

@media (max-width: 768px) {
    .footer {
        padding: 4rem var(--section-padding-x-mobile);
    }
}

.footer h2 {
    font-size: clamp(2.5rem, 7vw, 5rem);
    margin-bottom: 2rem;
}

.footer-email {
    display: inline-block;
    padding: 1.5rem 3rem;
    background: var(--sorcer-text);
    color: var(--sorcer-bg);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 4rem;
    transition: all var(--transition-base);
}

.footer-email:hover {
    background: var(--sorcer-accent);
    color: var(--sorcer-text);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--sorcer-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--sorcer-muted);
}

.footer-bottom a:hover {
    color: var(--sorcer-text);
}

.footer-logo {
    height: 1rem;
    opacity: 0.5;
    transition: filter 0.2s ease;
}

/* Light mode: make footer logo dark */
[data-theme="light"] .footer-logo {
    filter: brightness(0);
}

/* Dark mode: make footer logo light */
[data-theme="dark"] .footer-logo {
    filter: brightness(0) invert(1);
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    min-height: 300px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 2px solid var(--sorcer-border);
    border-top-color: var(--sorcer-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-mono);
    color: var(--sorcer-muted);
    font-size: 0.875rem;
}

/* Error State */
.error-message {
    padding: 2rem;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #ff3b30;
    text-align: center;
    max-width: 500px;
    margin: 3rem auto;
    font-family: var(--font-mono);
}

/* Cache Indicator */
.cache-indicator {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.5rem 1rem;
    background: var(--sorcer-surface);
    border: 1px solid var(--sorcer-border);
    color: var(--sorcer-text);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    border-radius: 0.25rem;
    opacity: 0;
    transition: opacity var(--transition-base), background-color 0.2s ease;
    z-index: 1000;
}

.cache-indicator.show {
    opacity: 1;
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--sorcer-text);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    /* cursor handled by global rule */
}

@media (max-width: 1280px) {
    .mobile-menu-btn {
        display: block;
    }
}

.mobile-menu {
    position: fixed;
    inset: 0;
    background: var(--sorcer-bg);
    z-index: 90;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.mobile-menu.open {
    display: flex;
}

.mobile-menu a {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    color: var(--sorcer-muted);
    transition: color var(--transition-fast);
}

.mobile-menu a:hover {
    color: var(--sorcer-text);
}

.mobile-menu-close {
    margin-top: 2rem;
    padding: 0.5rem 1rem;
    background: none;
    border: 1px solid var(--sorcer-border);
    color: var(--sorcer-muted);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    /* cursor handled by global rule */
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.6s ease forwards;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--sorcer-muted);
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--sorcer-accent);
}

.back-link svg {
    width: 1rem;
    height: 1rem;
}

/* Specific section styling from mockup */
.manifesto-quote {
    font-family: var(--font-sans);
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 300;
    line-height: 1.3;
    color: var(--sorcer-text);
    margin-bottom: 3rem;
}

.methodology-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.methodology-item {
    padding: 1rem;
    border: 1px solid var(--sorcer-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-fast);
    /* cursor handled by global rule */
}

.methodology-item:hover {
    border-color: var(--sorcer-accent);
}

.methodology-item span:last-child {
    color: var(--sorcer-accent);
}

/* Custom Cursor */
.cursor-dot {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #2D5BFF;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.15s ease;
    transform: translate(-50%, -50%);
}

/* Subtle glow effect */
.cursor-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(45, 91, 255, 0.4) 0%, transparent 70%);
    border-radius: 50%;
}

/* Scale effect on hover - separate from position */
.cursor-dot.hovering {
    transform: translate(-50%, -50%) scale(1.5);
    transition: opacity 0.3s ease, transform 0.15s ease;
}

/* Hide cursor dot on touch devices */
@media (hover: none) {
    .cursor-dot {
        display: none !important;
    }
}

/* ========================================
   CURSOR OVERRIDE - ABSOLUTE FINAL RULES
   DO NOT ADD ANYTHING AFTER THIS
   ======================================== */
@media (hover: hover) and (pointer: fine) {
    html { cursor: none !important; }
    body { cursor: none !important; }
    * { cursor: none !important; }
    *:hover { cursor: none !important; }
    *:focus { cursor: none !important; }
    *:active { cursor: none !important; }
    *::before { cursor: none !important; }
    *::after { cursor: none !important; }

    .cursor-dot {
        pointer-events: none !important;
    }
}
