/* Apple Theme Variables & Reset */
:root {
    --sf-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --bg-color: #fbfbfd;
    --nav-bg: rgba(255, 255, 255, 0.8);
    --card-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --pill-btn-bg: #1d1d1f;
    --pill-btn-hover: #333336;
    --pill-btn-text: #ffffff;
    --accent-blue: #0066cc;
    --loader-bg: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
}

body.dark-mode {
    --bg-color: #000000;
    --nav-bg: rgba(28, 28, 30, 0.8);
    --card-bg: #1c1c1e;
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --pill-btn-bg: #2c2c2e;
    --pill-btn-hover: #3a3a3c;
    --pill-btn-text: #ffffff;
    --accent-blue: #2997ff;
    --loader-bg: #000000;
    --border-color: rgba(255, 255, 255, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--sf-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Image Logo Styling */
.apple-logo-img {
    object-fit: contain;
    display: block;
}

.loader-logo {
    width: 85px;
    height: 85px;
}

.nav-logo-img {
    width: 26px;
    height: 26px;
}

.icon-logo-img {
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
}

/* Splash Screen / Loader Animation */
.intro-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #ffffff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), visibility 1s;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: pulseLogo 2s ease-in-out infinite alternate;
}

.intro-title {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    opacity: 0;
    animation: fadeInText 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.loader-bar {
    width: 140px;
    height: 3px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    opacity: 0;
    animation: fadeInText 1s ease 0.5s forwards;
}

.loader-progress {
    width: 0%;
    height: 100%;
    background: var(--text-primary);
    border-radius: 3px;
    animation: loadBar 1.8s cubic-bezier(0.65, 0, 0.35, 1) 0.6s forwards;
}

@keyframes pulseLogo {
    0% { transform: scale(0.96); opacity: 0.85; }
    100% { transform: scale(1.04); opacity: 1; }
}

@keyframes fadeInText {
    to { opacity: 1; transform: translateY(0); }
    from { opacity: 0; transform: translateY(10px); }
}

@keyframes loadBar {
    to { width: 100%; }
}

.intro-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Apple Light Navbar */
.apple-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-container {
    max-width: 1024px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 22px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.nav-brand:hover {
    opacity: 1;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    margin-left: 24px;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* SCROLLETYLLING ENGINE STYLES */
.scrolly-wrapper {
    width: 100%;
}

.scrolly-section {
    position: relative;
    width: 100%;
    min-height: 120vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.sticky-section {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.scrolly-content {
    position: relative;
    z-index: 10;
    max-width: 850px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.scrolly-overlay {
    position: absolute;
    z-index: 20;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    width: 100%;
    max-width: 800px;
    text-align: center;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 3D Showcase Fullscreen Canvas Iframe */
.showcase-bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.showcase-bg-canvas iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none; /* Non-interactive in scrollytelling showcase mode */
}

/* Word by Word Animation Title */
.word-anim-title {
    font-size: 68px;
    font-weight: 700;
    letter-spacing: -1.5px;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.1;
}

.word-anim-title .word {
    display: inline-block;
    opacity: 0.18;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    margin: 0 6px;
}

.word-anim-title .word.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.scrolly-subtitle {
    font-size: 22px;
    color: var(--text-secondary);
    max-width: 540px;
    line-height: 1.4;
}

/* Scroll Chevron Indicator */
.scroll-indicator {
    margin-top: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scroll-chevron {
    width: 24px;
    height: 24px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    animation: bounceChevron 2s infinite;
}

@keyframes bounceChevron {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) rotate(45deg); opacity: 0.6; }
    40% { transform: translateY(10px) rotate(45deg); opacity: 1; }
    60% { transform: translateY(5px) rotate(45deg); opacity: 0.8; }
}

/* Testing Hub Section */
.hub-section {
    min-height: 100vh;
    z-index: 30;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

/* Main Hero Section */
.hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 100px 20px;
    min-height: 100vh;
    background: var(--bg-color);
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease;
}

.hero-badge {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent-blue);
    margin-bottom: 16px;
}

.hero-title {
    font-size: 72px;
    font-weight: 700;
    letter-spacing: -1.5px;
    color: var(--text-primary);
    margin-bottom: 16px;
    max-width: 800px;
    line-height: 1.05;
}

.hero-subtitle {
    font-size: 24px;
    font-weight: 400;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.38;
    margin-bottom: 40px;
    letter-spacing: -0.3px;
}

/* Call To Action Buttons */
.cta-container {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
}

.apple-pill-btn {
    background-color: var(--pill-btn-bg);
    color: var(--pill-btn-text);
    border: none;
    border-radius: 9999px;
    padding: 14px 32px;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.3px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.apple-pill-btn:hover {
    background-color: var(--pill-btn-hover);
    transform: scale(1.04);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.apple-pill-btn:active {
    transform: scale(0.98);
}

/* Modal Popup Overlay */
.modal-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-section.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

body.dark-mode .modal-backdrop {
    background: rgba(0, 0, 0, 0.8);
}

.modal-card {
    position: relative;
    z-index: 10;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 44px;
    max-width: 680px;
    width: 90%;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    transform: scale(1);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease;
    text-align: center;
}

body.dark-mode .apple-logo-img {
    filter: invert(1) brightness(2);
}

.modal-card-duo {
    max-width: 1200px;
    width: 96%;
    padding: 32px 24px 24px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.iframe-container {
    width: 100%;
    height: 70vh;
    min-height: 400px;
    max-height: 720px;
    flex-grow: 1;
    border-radius: 16px;
    overflow: hidden;
    margin: 16px 0 24px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
    background: #f6f6f3;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.modal-section.hidden .modal-card {
    transform: scale(0.92);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.card-tag {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-blue);
    font-weight: 600;
    margin-bottom: 12px;
}

.modal-card h2 {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -0.8px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.modal-card p {
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.47;
    margin-bottom: 30px;
}

.troubleshoot-nav-btn {
    background: rgba(0, 102, 204, 0.08);
    border: 1px solid rgba(0, 102, 204, 0.2);
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 9999px;
    cursor: pointer;
    margin-left: 16px;
    transition: all 0.2s ease;
}

.troubleshoot-nav-btn:hover {
    background: rgba(0, 102, 204, 0.16);
    transform: scale(1.03);
}

body.dark-mode .troubleshoot-nav-btn {
    background: rgba(41, 151, 255, 0.12);
    border: 1px solid rgba(41, 151, 255, 0.3);
    color: #2997ff;
}

.settings-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    margin-left: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 50%;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.settings-nav-btn:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .settings-nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Settings Modal UI */
.settings-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 24px 0 10px;
    text-align: left;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

body.dark-mode .setting-item {
    background: rgba(255, 255, 255, 0.04);
}

.setting-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.setting-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.toggle-btn {
    background: var(--pill-btn-bg);
    color: var(--pill-btn-text);
    border: none;
    padding: 10px 20px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    opacity: 0.9;
    transform: scale(1.03);
}

/* Liquid Glass System Buttons Mode */
body.liquid-glass-buttons-active .apple-pill-btn,
body.liquid-glass-buttons-active .toggle-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.15)) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12),
                inset 0 0 12px rgba(255, 255, 255, 0.6) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

body.dark-mode.liquid-glass-buttons-active .apple-pill-btn,
body.dark-mode.liquid-glass-buttons-active .toggle-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05)) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5),
                inset 0 0 12px rgba(255, 255, 255, 0.25) !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .word-anim-title {
        font-size: 42px;
    }
    .hero-title {
        font-size: 44px;
    }
    .hero-subtitle {
        font-size: 18px;
    }
    .cta-container {
        flex-direction: column;
        width: 100%;
    }
    .apple-pill-btn {
        width: 100%;
        max-width: 260px;
    }
}

@media (max-height: 800px) {
    .iframe-container {
        height: 60vh;
        min-height: 300px;
    }
    .modal-card h2 {
        font-size: 28px;
        margin-bottom: 8px;
    }
    .modal-card p {
        font-size: 15px;
        margin-bottom: 16px;
    }
}
