:root {
    --apple-bg: #ffffff;
    --apple-text: #1d1d1f;
    --apple-gray: #f5f5f7;
    --apple-gray-2: #e8e8ed;
    --apple-blue: #0071e3;
    --apple-purple: #bf5af2;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: #ffffff;
    color: #1d1d1f;
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Loading Spinner */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #ffffff;
    color: #1d1d1f;
    font-family: 'Inter', sans-serif;
    flex-direction: column;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #0071e3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

*:focus-visible {
    outline: 2px solid rgba(100, 160, 255, 0.6);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Glassmorphism Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Apple Nav Styles */
.apple-nav {
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    transition: background-color 0.5s cubic-bezier(0.28, 0.11, 0.32, 1);
}

.apple-nav-link {
    color: #1d1d1f;
    text-decoration: none;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: -0.01em;
    opacity: 0.8;
    transition: opacity 0.3s ease, color 0.3s ease, text-shadow 0.3s ease;
    display: flex;
    align-items: center;
}

.apple-nav-link:hover {
    opacity: 1;
    color: var(--apple-blue);
    text-shadow: 0 0 10px rgba(0, 113, 227, 0.4);
}

.logo-link {
    opacity: 1;
    /* Logo always visible */
}

/* MudBlazor Overrides for Apple Style */
.mud-typography {
    font-family: var(--font-family) !important;
    color: var(--apple-text) !important;
}

.mud-paper {
    background-color: var(--apple-gray) !important;
    color: var(--apple-text) !important;
    border: 1px solid var(--glass-border);
    box-shadow: none !important;
    border-radius: 12px;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 0px;
    /* Hide scrollbar for cleaner look, typical on Mac */
    background: transparent;
}

/* Canvas Container */
#renderCanvas {
    width: 100%;
    height: 100%;
    touch-action: none;
    outline: none;
    border-radius: 12px;
}

/* =========================================
   COMPONENT STYLES (Refactored from Razor)
   ========================================= */

/* --- Hero Section (Home) --- */
.hero-section {
    height: 100vh;
    width: 100%;
    background-color: #ffffff;
    margin-top: -44px;
    /* Pull up behind nav */
    padding-top: 44px;
}

.fade-in-up {
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Apple Cards (Home) --- */
.apple-card {
    background: #111111;
    border-radius: 18px;
    padding: 0;
    height: 420px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    /* Soft shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    /* Implied link */
}

.apple-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.card-image {
    width: 100%;
    height: 60%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.apple-card:hover .card-image {
    transform: scale(1.05);
}

.card-content {
    padding: 24px;
    background-color: #111111;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 1;
}

/* Override MudBlazor typography inside dark cards */
.card-content .mud-typography.mud-typography-h5 {
    color: #ffffff !important;
}

.card-content .mud-typography.mud-typography-body2 {
    color: #a1a1a6 !important;
}

/* --- Story Pages (Hydrogen, etc.) --- */
.content-wrapper {
    background: #ffffff;
    min-height: 100vh;
    padding-top: 40px;
}

.intro-box {
    padding: 60px 20px;
    text-align: center;
}

.story-text {
    font-size: 1.25rem;
    line-height: 1.8;
    color: #424245;
    margin-bottom: 2rem;
}

.story-text a,
.inline-link {
    color: var(--apple-blue);
    text-decoration: none;
    position: relative;
    transition: all 0.2s ease;
}

.story-text a:hover,
.inline-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Animations */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Canvas Containers --- */
.canvas-container {
    width: 100%;
    height: 400px;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    margin: 40px 0;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Canvas loading pulse — visible until Babylon scene renders */
.canvas-container canvas {
    position: relative;
    z-index: 1;
}

.canvas-container::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse at center, rgba(40, 40, 80, 0.3) 0%, transparent 70%);
    animation: canvasPulse 2.5s ease-in-out infinite;
}

@keyframes canvasPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

.canvas-container.large {
    height: 500px;
}

.canvas-container.extra-large {
    height: 600px;
}

@media (max-width: 960px) {
    .canvas-container {
        height: 350px;
    }

    .canvas-container.large {
        height: 400px;
    }

    .canvas-container.extra-large {
        height: 450px;
    }
}

@media (max-width: 600px) {
    .canvas-container {
        margin: 20px 0;
        height: 250px;
    }

    .canvas-container.large {
        margin: 20px 0;
        height: 300px;
    }

    .canvas-container.extra-large {
        margin: 20px 0;
        height: 350px;
    }
}

canvas {
    width: 100%;
    height: 100%;
    outline: none;
}

.caption {
    position: absolute;
    bottom: 4px;
    left: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.05rem;
    font-family: 'Inter', sans-serif;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px;
    border-radius: 99px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    z-index: 2;
}

.read-time {
    position: fixed;
    top: 78px;
    right: 24px;
    z-index: 98;
    background: rgba(50, 50, 50, 0.85);
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    pointer-events: none;
}

.caption-top {
    position: absolute;
    top: 15px;
    left: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.15rem;
    font-family: 'Inter', sans-serif;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px;
    border-radius: 99px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    z-index: 2;
}

.image-container {
    position: relative;
}

.image-caption {
    position: absolute;
    bottom: 20px;
    left: 16px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 14px;
    border-radius: 99px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* --- Hydrogen Spectrum Barcode (High Contrast Neon) --- */
.spectrum-container {
    width: 100%;
    height: 80px;
    /* Neutral dark background to let colors pop */
    background: linear-gradient(to bottom, #111, #000);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.spectrum-line {
    position: absolute;
    top: 10%;
    bottom: 25%;
    /* Leave room for labels/glow reflection */
    width: 12px;
    border-radius: 4px;

    /* Intense Glow Effect */
    box-shadow:
        0 0 5px currentColor,
        0 0 15px currentColor,
        0 0 30px currentColor;
    /* Multi-layered glow */

    opacity: 1;
    z-index: 10;
}

/* Reflection/Fade at bottom */
.spectrum-line::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to bottom, currentColor, transparent);
    opacity: 0.3;
    filter: blur(4px);
}

.spectrum-label {
    position: absolute;
    bottom: -2px;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Balmer Series approximate lines - BRIGHTER COLORS */
.line-red {
    left: 80%;
    background-color: #ff5555;
    /* Brighter Red */
    color: #ff0000;
    /* Deep red glow */
}

.line-teal {
    left: 45%;
    background-color: #00ffff;
    /* Brighter Cyan */
    color: #00cccc;
}

.line-blue {
    left: 25%;
    background-color: #5599ff;
    /* Brighter Blue */
    color: #0044ff;
}

.line-violet {
    left: 10%;
    background-color: #cc66ff;
    /* Brighter Violet */
    color: #8800cc;
}

/* --- Luxury Next Link Block --- */
.luxury-next-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1b1e2e 0%, #2d324d 100%);
    border: 1px solid rgba(138, 180, 248, 0.2);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.luxury-next-tile::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at right center, rgba(138, 180, 248, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.luxury-next-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(27, 30, 46, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(138, 180, 248, 0.4);
}

.luxury-next-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    z-index: 1;
}

.next-thumbnail {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.next-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.luxury-next-text-group {
    display: flex;
    flex-direction: column;
}

.luxury-next-label {
    color: #a4c8ff;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
    font-weight: 500;
}

.luxury-next-title {
    color: #ffffff;
    font-size: 26px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.fiber-container {
    flex-grow: 1;
    height: 48px;
    margin: 0 40px;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.fiber-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.fiber-base {
    stroke: rgba(138, 180, 248, 0.08);
    stroke-width: 1px;
    fill: none;
}

.fiber-path {
    fill: none;
    stroke-linecap: round;
    animation: fiberFlow linear infinite;
}

.fiber-path-1 {
    stroke: #b392f0;
    /* Soft purple */
    stroke-width: 2px;
    stroke-dasharray: 40 60;
    animation-duration: 8s;
    /* Slower */
    opacity: 0.7;
    filter: drop-shadow(0 0 6px #b392f0);
}

.fiber-path-2 {
    stroke: #aecbfa;
    /* Lighter soft blue */
    stroke-width: 1.5px;
    stroke-dasharray: 25 75;
    animation-duration: 12s;
    /* Slower */
    opacity: 0.7;
    filter: drop-shadow(0 0 8px #aecbfa);
}

.fiber-path-3 {
    stroke: #669df6;
    /* Deeper calming blue */
    stroke-width: 2.5px;
    stroke-dasharray: 60 40;
    animation-duration: 10s;
    /* Slower */
    opacity: 0.5;
    filter: drop-shadow(0 0 10px #669df6);
}

.fiber-path-4 {
    stroke: #e8f0fe;
    /* Nearly white blue */
    stroke-width: 1px;
    stroke-dasharray: 15 85;
    animation-duration: 14s;
    /* Slower */
    opacity: 0.8;
    filter: drop-shadow(0 0 4px #e8f0fe);
}

@keyframes fiberFlow {
    from {
        stroke-dashoffset: 100;
    }

    to {
        stroke-dashoffset: 0;
    }
}

/* --- Floating Dust Particles --- */
.dust-particle {
    position: absolute;
    background: #ffffff;
    border-radius: 50%;
    filter: blur(1px);
    opacity: 0;
    animation: floatDust linear infinite;
}

@keyframes floatDust {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }

    20% {
        opacity: 0.4;
    }

    80% {
        opacity: 0.4;
    }

    100% {
        transform: translate(30px, -15px);
        opacity: 0;
    }
}

.luxury-next-arrow {
    color: #8ab4f8;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1;
}

.luxury-next-tile:hover .luxury-next-arrow {
    transform: translateX(8px);
    color: #ffffff;
}

/* --- Shared Utility Styles --- */
.hero-title {
    font-weight: 700;
}

.hero-subtitle {
    color: #86868b;
    font-weight: 300;
}

.section-title {
    font-weight: 600;
}

.caption-note {
    color: #86868b;
    max-width: 600px;
    margin: 0 auto;
}

.inline-link {
    color: #0071e3;
    text-decoration: none;
}

.pill-button {
    border-radius: 99px;
    text-transform: none;
}

/* Search Results */
.search-result-item:hover {
    background-color: #f5f5f7;
}

/* Breadcrumb */
.breadcrumb-nav a:hover {
    color: #0071e3;
    text-decoration: none;
}

/* --- Dark Tiles (Shared) --- */
.dark-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0;
    border-radius: 20px;
    background-color: #111111;
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 240px;
    overflow: hidden;
}

.dark-tile:hover {
    transform: translateY(-6px);
    background-color: #1a1a1c;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2);
}

.dark-tile .mud-typography {
    color: inherit !important;
}

.dark-tile-content {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    align-items: flex-start;
}

.tile-image-wrapper {
    margin-bottom: 0px;
    border-radius: 0;
    width: 100%;
    height: 140px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tile-title {
    font-weight: 600 !important;
    margin-bottom: 8px;
    color: #ffffff !important;
}

.tile-desc {
    color: #86868b !important;
    line-height: 1.4;
}

/* --- Static Ambient Footer --- */
.luxury-footer-static {
    position: relative;
    overflow: hidden;
    padding-bottom: 40px;
    background: transparent;
    min-height: 120px;
}

.footer-divider {
    border-color: rgba(138, 180, 248, 0.1) !important;
}