/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    color: #0f172a;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    padding-bottom: 74px; /* Account for fixed navbar height */
}

/* Brand token for logo tint */
:root { --logo-color: #6AFF8C; }

/* Light/Dark mode helpers */
body.light { background: #ffffff; color: #0f172a; }
/* Dark theme uses earth-brown palette */
body.dark { background: #1a1410; color: #e5e7eb; }

/* Background Canvas */
#bg-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* firmly behind effects */
    background: radial-gradient(ellipse at center, #0a1f0a 0%, #000 100%);
}

/* Light background gradient override */
body.light #bg-effect { background: radial-gradient(ellipse at center, #f3f8f5 0%, #ffffff 100%); }
body.dark #bg-effect { background: radial-gradient(ellipse at center, #1f1915 0%, #1a1410 100%); }

/* Effects layer and visibility */
.effects-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1; /* above background */
    pointer-events: none;
}
.effect-canvas, .effect-dom {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.effect-canvas.active, .effect-dom.active {
    opacity: 1;
}
.effect-dom { pointer-events: none; }

/* Golden Ratio Container - Modified for 50% height reduction */
.golden-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px; /* Minimum 100px padding as requested */
    z-index: 1;
    pointer-events: none;
    opacity: 0; /* hidden until reveal */
}

/* Content Card - 50% height reduction with golden ratio width */
.content-card {
    width: 100%;
    max-width: 30em; /* em-based width for accessible scaling */
    height: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(34, 197, 94, 0.15);
    padding: 1.6em 2.2em; /* em-based padding */
    box-shadow: 
        0 0 1px rgba(34, 197, 94, 0.2),
        0 0 40px rgba(34, 197, 94, 0.06),
        0 0 80px rgba(34, 197, 94, 0.04),
        inset 0 0 60px rgba(34, 197, 94, 0.02);
    pointer-events: all;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transform-origin: center;
    transform: scale(0.1);
    opacity: 0; /* revealed via body.show-modal */
}

/* Dark variant card */
body.dark .content-card { background: rgba(36, 28, 22, 0.9); color: #e7e5e4; border: 1px solid rgba(96, 64, 32, 0.25); box-shadow: 0 0 1px rgba(96, 64, 32, 0.3), 0 0 50px rgba(96, 64, 32, 0.12), 0 0 100px rgba(96, 64, 32, 0.08), inset 0 0 60px rgba(96, 64, 32, 0.04); }

/* Header Section - Reduced for 50% height */
.header-section {
    text-align: center;
}

.logo-mark {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 24px; /* Reduced from 32px */
    margin-bottom: 12px; /* Reduced from 20px */
}

/* barnsley fern mark as single symbol */
.fern-mark { font-size: 28px; line-height: 1; }

.terra { 
    color: #22c55e; 
    animation: pulse 3s ease-in-out infinite;
}

.tech { 
    color: #f59e0b;
    animation: pulse 3s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

h1 {
    font-size: 22px; /* Reduced from 28px */
    font-weight: 300;
    color: #111;
    margin-bottom: 6px; /* Reduced from 8px */
}

.gradient-text {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
}

/* lowercase brand word */
.brand-terra { text-transform: lowercase; font-weight: 600; letter-spacing: 0.2px; }

.tagline {
    color: #4b5563;
    font-size: 12px; /* Reduced from 14px */
    font-variant: small-caps;
    font-weight: 600;
    letter-spacing: 0.8px;
    opacity: 0.9;
    margin-bottom: 10px;
}

/* force small-caps visual */
.smallcaps { font-variant: small-caps; letter-spacing: 0.6px; }

/* Content Section - Reduced for 50% height */
.content-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px; /* Reduced from 30px */
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px; /* Reduced from 20px */
}

.info-box {
    padding: 12px; /* Reduced from 20px */
    background: rgba(34, 197, 94, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(34, 197, 94, 0.1);
}

.info-box h3 {
    font-size: 12px; /* Reduced from 14px */
    color: #22c55e;
    margin-bottom: 6px; /* Reduced from 8px */
    font-weight: 600;
}

.info-box p {
    font-size: 11px; /* Reduced from 12px */
    color: #475569;
    line-height: 1.4;
}

.status-message {
    text-align: center;
    padding: 12px; /* Reduced from 20px */
    background: rgba(34, 197, 94, 0.03);
    border-radius: 10px;
}

.status-message p {
    color: #334155;
    font-size: 11px; /* Reduced from 13px */
    margin-bottom: 6px; /* Reduced from 8px */
}

.status-message code {
    display: inline-block;
    padding: 3px 8px; /* Reduced from 4px 12px */
    background: rgba(34, 197, 94, 0.1);
    border-radius: 5px;
    font-size: 10px; /* Reduced from 11px */
    color: #22c55e;
    font-family: 'SF Mono', Monaco, monospace;
}

/* Auth Button - Reduced size */
.auth-button {
    display: inline-block;
    width: 100%;
    padding: 10px 20px; /* Reduced from 14px 24px */
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 12px; /* Reduced from 14px */
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(34, 197, 94, 0.3);
}

.auth-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(34, 197, 94, 0.4);
}

/* Quick links grid */
.quick-links { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.ql { display: inline-flex; align-items: center; justify-content: center; height: 38px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.08); background: rgba(0,0,0,0.03); color: #0f172a; text-decoration: none; font-size: 16px; }
body.dark .ql { border-color: rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color: #e5e7eb; }
.ql:hover { transform: translateY(-1px); border-color: rgba(34,197,94,0.35); color: #22c55e; }
@media (max-width: 768px) { .quick-links { grid-template-columns: repeat(5, 1fr); } }

/* Theme Controls - Proper Navbar Style */
/* Gallery link button - positioned in top right (same as back button on demo page) */
.gallery-link {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #111827;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 18px;
    transition: all 0.2s ease;
}
/* Unified pill control style for top-right buttons across pages */
.control-pill {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #111827;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 18px;
    transition: all 0.2s ease;
}
body.dark .control-pill {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.6);
    color: #f3f4f6;
}
.control-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

/* Text pill for labels like Theme Customizer / Exit */
.text-pill {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #111827;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
body.dark .text-pill { border-color: rgba(255,255,255,0.2); background: rgba(0,0,0,0.6); color: #f3f4f6; }
.text-pill:hover { transform: translateY(-2px); border-color: rgba(34,197,94,0.4); color: #22c55e; }
.text-pill.maroon { color: #7b2c2c; border-color: rgba(123,44,44,0.3); }
body.dark .text-pill.maroon { color: #f3d6d6; border-color: rgba(255,255,255,0.25); }

/* Shared top-right container */
.top-bar { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; gap: 10px; align-items: center; }
.top-bar .mode-toggle { position: static; }
body.dark .gallery-link {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.6);
    color: #f3f4f6;
}
.gallery-link:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

/* Light/Dark toggle - positioned to the left of gallery link */
.mode-toggle {
    position: fixed;
    top: 20px;
    right: 72px; /* leave gap to the right-side gallery pill */
    z-index: 200;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #111827;
    cursor: pointer;
}
body.dark .mode-toggle {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.6);
    color: #f3f4f6;
}

/* Marquee control bar */
.theme-marquee {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    overflow: hidden;
    z-index: 100;
    opacity: 0; /* hidden until reveal */
    transform: translateY(12px);
}
.marquee-track {
    display: flex;
    animation: marquee 18s linear infinite;
}
/* Pause marquee on hover */
.theme-marquee:hover .marquee-track { animation-play-state: paused; }
.theme-controls {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    margin-right: 0; /* remove gap to make seamless */
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}
/* Light mode styling for marquee bar */
body.light .theme-controls {
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.08);
}
/* Dark mode earth-brown bottom nav */
body.dark .theme-controls {
    background: rgba(36, 28, 22, 0.92);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
}
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.theme-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
body.light .theme-btn {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.6);
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}
body.light .theme-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.9);
    border-color: rgba(0, 0, 0, 0.15);
}

/* More subtle active state */
.theme-btn.active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
    transform: translateY(-2px);
}

/* Tooltip for theme name */
.theme-btn[data-title]:hover::after {
    content: attr(data-title);
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: rgba(0,0,0,0.85);
    color: #f8fafc;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 11px;
    pointer-events: none;
}
body.light .theme-btn[data-title]:hover::after { background: rgba(0,0,0,0.85); color: #f8fafc; }

/* Inline brand logo inside the card under quick links */
.brand-logo-inline { display: block; height: 14px; margin: 8px auto 0; opacity: 0.9; }
body.dark .brand-logo-inline { filter: brightness(0) invert(1); opacity: 0.95; }

/* Scalar wave arrows */
.wave-wrapper { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(18, 1fr); grid-auto-rows: 24px; gap: 6px; opacity: 0.4; }
.wave-arrow { width: 8px; height: 8px; border-right: 2px solid rgba(134,239,172,0.6); border-top: 2px solid rgba(134,239,172,0.6); transform: rotate(45deg); }

/* Sanskrit floating glyphs */
.sanskrit-glyph { position: absolute; color: #22c55e; opacity: 0.25; animation: floatGlyph 24s linear infinite; }
@keyframes floatGlyph { from { transform: translateY(10vh) rotate(0deg);} to { transform: translateY(-10vh) rotate(360deg);} }

/* Responsive Design */
@media (max-width: 768px) {
    .golden-container {
        padding: 50px; /* Reduced padding on mobile but still substantial */
    }
    
    .content-card {
        padding: 1.2em 1.6em;
        max-width: 26em;
    }
    .tagline { margin-bottom: 8px; }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .theme-controls { padding: 12px 10px; }
    
    .theme-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
        flex-shrink: 0;
    }
}

/* Ultra-wide screens */
@media (min-width: 1920px) {
    .golden-container {
        padding: 150px; /* Even more padding on large screens */
    }
    
    .content-card {
        max-width: 480px;
    }
}

/* Loading and Transitions */
@keyframes fadeInOpacity { from { opacity: 0; } to { opacity: 1; } }

/* Modal zoom-in when triggered */
@keyframes modalZoomIn {
    0% { transform: scale(0.1); opacity: 0; filter: saturate(0.7) blur(0.4px); }
    60% { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); opacity: 1; filter: none; }
}

/* Reveal sequence classes */
.reveal-nav .theme-marquee { opacity: 1; transform: translateY(0); transition: opacity 140ms ease-out, transform 200ms ease-out; }
.theme-marquee { opacity: 0; transform: translateY(12px); }
.show-modal .content-card { animation: modalZoomIn 400ms cubic-bezier(0.16,1,0.3,1) forwards; }
.show-modal .golden-container { opacity: 1; transition: opacity 80ms ease-out; }