/* CSS Variables for Theme */
:root {
    /* Brand colors */
    --brand-turquoise: #18d9ea; /* turquoise */
    --brand-violet: #6366f1;     /* indigo/violet */
    --brand-violet-deep: #7c3aed;/* deep violet */
    --bg-primary: #0c0a1a;
    --bg-secondary: rgba(15, 13, 30, 0.95);
    --bg-mobile-nav: rgba(15, 13, 30, 0.98);
    --bg-card: rgba(26, 26, 58, 0.4);
    --bg-logo-bar: rgba(230, 232, 240, 0.98);
    --bg-footer: transparent;
    --text-primary: #e0e0e0;
    --text-secondary: #9ca3af;
    --text-heading: white;
    --text-nav: #d1d5db;
    --text-nav-hover: #a5b4fc;
    --border-color: rgba(129, 140, 248, 0.15);
    --border-nav-mobile: rgba(129, 140, 248, 0.2);
    --shadow-nav: rgba(0, 0, 0, 0.3);
    --shadow-mobile-nav: rgba(0,0,0,0.5);
    --shadow-logo-bar: rgba(0,0,0,0.2);
    --hero-overlay-1: rgba(78, 70, 229, 0.5);
    --hero-overlay-2: rgba(67, 56, 202, 0.6);
    --hamburger-bg: #ffffff;
    --step-icon-bg: rgba(78, 70, 229, 0.1);
    --step-icon-border: rgba(78, 70, 229, 0.3);
    --step-icon-color: #818cf8;
    --privacy-icon-color: #34d399;
    --feature-checkmark: #818cf8;
    --uni-logo-filter: brightness(0) invert(1);
    --text-shadow-hero-h1: 2px 2px 8px rgba(0,0,0,0.3);
    --text-shadow-hero-p: 1px 1px 4px rgba(0,0,0,0.3);
}

body.light-mode {
    --bg-primary: #f9fafb;
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-mobile-nav: rgba(255, 255, 255, 0.98);
    --bg-card: rgba(255, 255, 255, 0.6);
    --bg-logo-bar: rgba(255, 255, 255, 0.98);
    --bg-footer: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-heading: #111827;
    --text-nav: #4b5563;
    --text-nav-hover: #5B54D9;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-nav-mobile: rgba(0, 0, 0, 0.08);
    --shadow-nav: rgba(0, 0, 0, 0.05);
    --shadow-mobile-nav: rgba(0,0,0,0.1);
    --shadow-logo-bar: rgba(0,0,0,0.08);
    --hero-overlay-1: rgba(139, 92, 246, 0.15);
    --hero-overlay-2: rgba(99, 102, 241, 0.2);
    --hamburger-bg: #111827;
    --step-icon-bg: rgba(139, 92, 246, 0.08);
    --step-icon-border: rgba(139, 92, 246, 0.2);
    --step-icon-color: #7c3aed;
    --privacy-icon-color: #10b981;
    --feature-checkmark: #7c3aed;
    --uni-logo-filter: none;
    --text-shadow-hero-h1: 1px 1px 3px rgba(255,255,255,0.8);
    --text-shadow-hero-p: 1px 1px 2px rgba(255,255,255,0.5);
}

/* Mobile-First Base Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; line-height: 1.6; color: var(--text-primary); background-color: var(--bg-primary); background-image: linear-gradient(180deg, rgba(24,217,234,0.20) 0%, rgba(14,155,182,0.18) 30%, rgba(99,102,241,0.16) 70%, rgba(124,58,237,0.20) 100%); background-attachment: fixed; transition: background-color 0.3s ease, color 0.3s ease, background-image 0.6s ease; padding-top: 70px; }

/* Navigation */
nav { background: var(--bg-secondary); backdrop-filter: blur(10px); padding: 1rem; position: fixed; top: 0; left: 0; right: 0; width: 100%; z-index: 100; border-bottom: 1px solid var(--border-color); box-shadow: 0 2px 10px var(--shadow-nav); transition: background-color 0.3s ease, border-color 0.3s ease; }
nav .container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; position: relative; }
.logo { font-size: 1.3rem; font-weight: 700; color: var(--text-heading); display: flex; align-items: center; gap: 0.5rem; z-index: 101; letter-spacing: 0.5px; transition: color 0.3s ease; }
.logo-icon { width: 28px; height: 28px; }
.brand-name { display: inline-flex; align-items: baseline; gap: 0.05rem; }
.brand-re { color: var(--brand-turquoise); }
.brand-dream { color: #ffffff; }
.brand-ai { color: var(--brand-turquoise); }

/* Light mode brand treatment: Dream should be black */
body.light-mode .brand-dream { color: #111827; }

/* Hero logo styling */
.hero-brand-logo { width: 280px; max-width: 70vw; height: auto; margin: 0 auto 0.75rem auto; display: block; filter: drop-shadow(0 6px 20px rgba(0,0,0,0.35)); }

/* Dark mode logo */
body:not(.light-mode) .hero-brand-logo { content: url('images/reDreamAI_logo_darkmode_transparent_optimized.png'); }

/* Hamburger Menu */
.menu-toggle { display: flex; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 8px; z-index: 101; }
.menu-toggle span { width: 25px; height: 3px; background: var(--hamburger-bg); border-radius: 3px; transition: all 0.3s ease; }
.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(7px, 7px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }

/* Mobile Navigation */
.nav-links { position: fixed; top: 0; right: -100%; width: 250px; height: 100vh; background: var(--bg-mobile-nav); backdrop-filter: blur(20px); box-shadow: -2px 0 20px var(--shadow-mobile-nav); display: flex; flex-direction: column; padding: 5rem 2rem 2rem; gap: 1.5rem; transition: right 0.3s ease, background-color 0.3s ease; z-index: 100; border-left: 1px solid var(--border-nav-mobile); }
.nav-links.active { right: 0; }
.nav-links a { margin-left: 0; text-decoration: none; color: var(--text-nav); font-weight: 500; transition: color 0.3s; font-size: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); }
.nav-links a:hover { color: var(--text-nav-hover); }
.nav-links a.cta-button { border-bottom: none; color: #001b22; }
.nav-links a.cta-button:hover { color: #001b22; }
/* Small nav button now reuses hero CTA styles */
.cta-button--sm { padding: 0.65rem 1.6rem; font-size: 1.05rem; border-radius: 50px; display: inline-flex; align-items: center; justify-content: center; line-height: 2; white-space: nowrap; }

/* Theme Toggle Button */
.theme-toggle { background: none; border: 2px solid var(--border-color); border-radius: 50%; width: 40px; height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; padding: 0; margin: 0.5rem 0; flex-shrink: 0; }
.theme-toggle:hover { transform: scale(1.1); border-color: var(--text-nav-hover); }
.theme-toggle svg { width: 20px; height: 20px; fill: var(--text-heading); transition: fill 0.3s ease; }

/* Language Toggle Button */
.language-toggle { 
    background: none; 
    border: 2px solid var(--border-color); 
    border-radius: 50px; 
    padding: 0.5rem 0.75rem; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-width: 3rem; 
    height: 40px; 
    margin: 0.5rem 0.5rem 0.5rem 0; 
    flex-shrink: 0; 
    transition: all 0.3s ease;
}
.language-toggle:hover { 
    transform: scale(1.05); 
    border-color: var(--text-nav-hover); 
}
.language-toggle .lang-text { 
    font-size: 0.875rem; 
    font-weight: 600; 
    color: var(--text-heading); 
    transition: color 0.3s ease; 
}

@media (min-width: 481px) { 
    .theme-toggle { margin: 0; } 
    .language-toggle { margin: 0; }
}

/* Overlay for mobile menu */
.nav-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: rgba(0, 0, 0, 0.7); z-index: 99; }
.nav-overlay.active { display: block; }

/* Hero Container */
.hero-container { 
    display: flex; 
    flex-direction: column; 
    height: auto;
    min-height: calc(100vh - 70px); 
    position: relative; 
    margin-top: 0;
    margin-bottom: 0;
}

.hero { 
    background: linear-gradient(rgba(24, 217, 234, 0.28), rgba(124, 58, 237, 0.32)), url('images/background_real_cloud_big.png') center/cover; 
    color: var(--text-heading); 
    padding: 40px 1rem 1.5rem; 
    text-align: center; 
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex: 1; 
    transition: color 0.3s ease; 
    min-height: calc(100vh - 70px - 8rem);
}

/* Darker overlay for dark mode */
body:not(.light-mode) .hero { background: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), /* darken layer */linear-gradient(rgba(24, 217, 234, 0.48), rgba(124, 58, 237, 0.65)), url('images/background_real_cloud_big.png') center/cover; }
.hero-content { position: relative; z-index: 2; padding-bottom: 0.5rem; }
.hero h1 { font-size: 2rem; margin-bottom: 0.75rem; font-weight: 700; text-shadow: var(--text-shadow-hero-h1); line-height: 1.2; color: var(--text-heading); transition: color 0.3s ease; }
.hero p { font-size: 1rem; margin-bottom: 1.5rem; opacity: 0.95; max-width: 600px; margin-left: auto; margin-right: auto; text-shadow: var(--text-shadow-hero-p); color: var(--text-primary); transition: color 0.3s ease; }
.cta-button { display: inline-block; background: linear-gradient(90deg, var(--brand-violet), var(--brand-turquoise)); background-size: 200% 100%; background-position: 0% 50%; color: #001b22; padding: 0.875rem 2rem; border-radius: 50px; text-decoration: none; font-weight: 600; font-size: 1rem; transition: all 0.3s; box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25); position: relative; z-index: 5; }
.cta-button:hover { transform: translateY(-2px); background-position: 100% 50%; box-shadow: 0 10px 28px rgba(24, 217, 234, 0.35), 0 6px 20px rgba(99, 102, 241, 0.22); }
/* Ensure nav button looks identical to hero button, at smaller scale */
nav .cta-button { background: linear-gradient(90deg, var(--brand-violet), var(--brand-turquoise)); background-size: 200% 100%; background-position: 0% 50%; color: #001b22; padding: 0.65rem 1.25rem; border-radius: 50px; text-decoration: none; font-weight: 600; font-size: 1.05rem; box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25); position: relative; z-index: 5; border: none; display: inline-block; }
nav .cta-button:hover { transform: translateY(-2px); background-position: 100% 50%; box-shadow: 0 10px 28px rgba(24, 217, 234, 0.35), 0 6px 20px rgba(99, 102, 241, 0.22); }

/* Logo Bar */
.hero-logos { background: var(--bg-logo-bar); backdrop-filter: blur(20px); left: 0; right: 0; padding: 0.6rem 0; min-height: 4.5rem; box-shadow: 0 -2px 20px var(--shadow-logo-bar); border-top: 1px solid var(--border-color); flex-shrink: 0; overflow: hidden; position: relative; z-index: 3; transition: background-color 0.3s ease, border-color 0.3s ease; overscroll-behavior: none; touch-action: none; }
.logo-track { display: flex; align-items: center; gap: 2rem; animation: scroll 25s linear infinite; width: max-content; will-change: transform; overflow-x: hidden; }
.hero-logos:hover .logo-track { animation-play-state: paused; }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(calc(-100% / 3)); } }
.hero-logo { width: auto; height: 48px; opacity: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)); transition: all 0.3s; flex-shrink: 0; }
.hero-logo img { width: 100%; height: 100%; object-fit: contain; }
.hero-logo:hover { transform: scale(1.05); opacity: 1; }

/* Content Sections */
.section { padding: 3rem 0; }

.section-title { font-size: 1.75rem; text-align: center; margin-bottom: 2rem; color: var(--text-heading); font-weight: 700; transition: color 0.3s ease; }
.section-subtitle { text-align: center; color: var(--text-secondary); margin-top: 0.5rem; max-width: 600px; margin-left: auto; margin-right: auto; font-size: 0.95rem; transition: color 0.3s ease; }

/* Utility classes */
.block { display: block; }
.container { max-width: 1200px; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }

/* How It Works */
.steps-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-top: 2rem; }
.step-card { text-align: center; }
.step-icon { width: 80px; height: 80px; margin: 0 auto 1.5rem; background: var(--step-icon-bg); border: 1px solid var(--step-icon-border); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background-color 0.3s ease, border-color 0.3s ease; }
.step-icon svg { width: 40px; height: 40px; color: var(--step-icon-color); transition: color 0.3s ease; }
.step-card h3 { font-size: 1.4rem; color: var(--text-heading); margin-bottom: 0.75rem; font-weight: 600; transition: color 0.3s ease; }
.step-card p { color: var(--text-secondary); line-height: 1.7; font-size: 0.95rem; transition: color 0.3s ease; }

[id] {
    /* Creating top margin gap when clicking on navigation link */
    scroll-margin-top: 55px; 
}
/* Science Section */
.science-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: center; }
.glass-card { background: var(--bg-card); backdrop-filter: blur(10px); border: 1px solid var(--border-color); border-radius: 1.5rem; padding: 1.5rem; transition: background-color 0.3s ease, border-color 0.3s ease; max-width: 100%; box-sizing: border-box; }
.glass-card img { max-width: 100%; height: auto; }
.feature-list { margin-top: 1.5rem; }
.feature-item { display: flex; align-items: start; margin-bottom: 1rem; }
.feature-item span:first-child { color: var(--feature-checkmark); margin-right: 0.75rem; margin-top: 0.25rem; font-size: 1.2rem; transition: color 0.3s ease; }
.feature-item strong { color: var(--text-heading); transition: color 0.3s ease; }

/* Privacy Section */
.privacy-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-top: 2rem; justify-items: center; text-align: center; }
.privacy-item { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; }
.privacy-item svg { width: 24px; height: 24px; color: var(--privacy-icon-color); flex-shrink: 0; transition: color 0.3s ease; margin-bottom: 0.25rem; }
.privacy-item span { display: block; text-align: center; }

/* FAQ Section */
.faq-container { max-width: 800px; margin: 0 auto; }
.faq-item { background: var(--bg-card); backdrop-filter: blur(10px); border: 1px solid var(--border-color); border-radius: 1rem; padding: 1.5rem; margin-bottom: 1rem; cursor: pointer; transition: background-color 0.3s ease, border-color 0.3s ease; }
.faq-question { font-weight: 600; font-size: 1.1rem; color: var(--text-heading); display: flex; justify-content: space-between; align-items: center; transition: color 0.3s ease; }
.faq-question svg { width: 20px; height: 20px; transition: transform 0.3s, fill 0.3s ease; fill: var(--text-secondary); }
.faq-answer { color: var(--text-secondary); margin-top: 1rem; line-height: 1.7; font-size: 0.95rem; transition: color 0.3s ease; }
summary.faq-question { display: flex; align-items: center; justify-content: space-between; width: 100%; cursor: pointer; list-style: none; padding: 0.75rem 1rem; border-radius: 0.5rem; transition: background-color 0.2s ease; }
summary.faq-question:hover { background-color: rgba(129, 140, 248, 0.08); }
summary.faq-question::-webkit-details-marker { display: none; }
details.faq-item { padding: 0; border: 1px solid var(--border-color); border-radius: 0.5rem; margin-bottom: 0.75rem; background: var(--bg-card); }
details.faq-item > .faq-answer { padding: 0 1rem 1rem 1rem; }
p.faq-answer { margin: 0.75rem 0 0 0; line-height: 1.7; }

/* Footer */
footer { border-top: 1px solid var(--border-color); padding: 2rem 1.5rem; text-align: center; color: var(--text-secondary); background: var(--bg-footer); transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease; }
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); text-decoration: none; transition: color 0.3s; }
.footer-links a:hover { color: var(--text-heading); }

/* Tablet Styles (481px and up) */
@media (min-width: 481px) {
    nav { padding: 1.25rem 1.5rem; }
    .logo { font-size: 1.5rem; }
    .menu-toggle { display: none; }
    .nav-links { position: static; width: auto; height: auto; background: transparent; box-shadow: none; flex-direction: row; padding: 0; gap: 2rem; border-left: none; align-items: center; }
    .nav-links a { padding: 0; border-bottom: none; font-size: 0.95rem; color: var(--text-nav); }
    .nav-links a:hover { color: var(--text-nav-hover); }
    .nav-overlay { display: none !important; }
    .hero-container { min-height: calc(100vh - 70px); height: auto; }
    .hero { padding: 50px 2rem 2rem; min-height: calc(100vh - 70px - 9rem); }
    .hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
    .hero p { font-size: 1.15rem; margin-bottom: 2rem; }
    .hero-logos { padding: 0.75rem 0; min-height: 6rem; }
    .logo-track { gap: 2.5rem; }
    /* Uniform logo height on tablets */
    .hero-logo { height: 56px; }
    .section { padding: 4rem 2rem; }
    .section-title { font-size: 2.25rem; }
    .steps-grid { grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
    .step-icon { width: 96px; height: 96px; }
    .step-icon svg { width: 48px; height: 48px; }
    .science-grid { grid-template-columns: 1fr 1fr; gap: 3rem; }
    .privacy-grid { grid-template-columns: repeat(2, 1fr); gap: 2rem; justify-items: center; }
}

/* Desktop Styles (769px and up) */
@media (min-width: 769px) {
    nav { padding: 1.5rem 2rem; }
    .logo { font-size: 1.75rem; }
    .nav-links { gap: 2.5rem; align-items: center; }
    .nav-links a { font-size: 1rem; color: var(--text-nav); }
    .nav-links a:hover { color: var(--text-nav-hover); }
    .hero-container { min-height: calc(100vh - 70px); height: auto; }
    .hero { padding: 60px 2rem 2.5rem; min-height: calc(100vh - 70px - 10rem); }
    .hero h1 { font-size: 3.5rem; margin-bottom: 1rem; }
    .hero p { font-size: 1.3rem; margin-bottom: 2.5rem; }
    .cta-button { padding: 1rem 2.5rem; font-size: 1.1rem; }
    /* Desktop-only: widen nav CTA sides */
    nav .cta-button { padding-left: 1.8rem; padding-right: 1.8rem; min-width: 10.5rem; }
    .hero-logos { padding: 1.25rem 0; min-height: 8rem; }
    .logo-track { gap: 3rem; }
    /* Uniform logo height on desktop */
    .hero-logo { height: 72px; }
    .section { padding: 5rem 2rem; }
    .section-title { font-size: 2.75rem; }
    .section-subtitle { font-size: 1.1rem; }
    .steps-grid { gap: 3rem; }
    .step-card h3 { font-size: 1.5rem; }
    .step-card p { font-size: 1rem; }
    .glass-card { padding: 3rem; }
    .privacy-grid { grid-template-columns: repeat(3, auto); justify-content: center; justify-items: center; column-gap: 3rem; }
}

/* Prevent text cutoff on all screens */
.hero h1, .section-title, .hero p, .glass-card p { overflow-wrap: break-word; word-break: break-word; max-width: 100%; }

/* Ensure all sections have proper padding on small screens */
@media (max-width: 768px) {
    .hero { padding: 35px 1rem 1.25rem; min-height: calc(100vh - 70px - 8.5rem); }
    .hero-content { padding-bottom: 0.5rem; }
    .hero h1 { margin-bottom: 0.6rem; }
    .hero p { margin-bottom: 1.25rem; }
    .section { padding: 3rem 0; }
    .section-title { font-size: 1.75rem; line-height: 1.3; margin-bottom: 1rem; }
    .glass-card { padding: 1.25rem; }
    .glass-card img { height: 60px !important; margin-bottom: 1rem !important; }
    .hero-logos { padding: 0.6rem 0; min-height: 4.5rem; }
}

/* iPhone 11 and similar devices (max 400px) */
@media (max-width: 400px) {
    .hero { padding: 30px 1rem 1rem; min-height: calc(100vh - 70px - 9rem); }
    .hero h1 { font-size: 1.75rem !important; line-height: 1.3; margin-bottom: 0.5rem; }
    .hero p { font-size: 0.9rem !important; margin-bottom: 1.25rem; }
    .hero-content { padding: 0 0.5rem; padding-bottom: 0.25rem; }
    .hero-brand-logo { width: 220px !important; margin-bottom: 0.5rem !important; }
    .section-title { font-size: 1.5rem !important; }
    .glass-card { padding: 1rem; }
    .glass-card img { height: 50px !important; }
    .hero-logos { padding: 0.5rem 0; min-height: 4rem; }
}

/* App Preview Section */
.app-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.app-preview-item {
    text-align: center;
}

.app-screenshot {
    position: relative;
    width: 100%;
    max-width: 350px;
    margin: 0 auto 1.5rem;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.app-screenshot:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.3);
}

.app-screenshot img {
    width: 100%;
    height: auto;
    display: block;
}

.app-preview-item h3 {
    font-size: 1.3rem;
    color: var(--text-heading);
    margin-bottom: 0.75rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.app-preview-item p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

/* Theme-based Image Switching */
/* Hide dark images by default (light mode) */
.theme-image-dark {
    display: none;
}

.theme-image-light {
    display: block;
}

/* In dark mode, show dark images and hide light images */
body:not(.light-mode) .theme-image-dark {
    display: block;
}

body:not(.light-mode) .theme-image-light {
    display: none;
}

/* In light mode, show light images and hide dark images */
body.light-mode .theme-image-dark {
    display: none;
}

body.light-mode .theme-image-light {
    display: block;
}

@media (min-width: 900px) {
    .app-preview-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3rem;
    }
}