/*
 * Anisotropic Turbulence - Thomas DeWitt
 * Maximized visualization layout
 */

/* ===== CSS Custom Properties ===== */
:root {
    --bg-warm: #f5f5f5;
    --text-primary: #2d2d2d;
    --text-muted: #6b6b6b;
    --text-active: #999;
    --control-bg: #f0f0f0;
    --control-border: #ddd;
    --header-height: 64px;
    --sidebar-width: 440px;
    --content-gap: 1.5rem;
    --transition-fast: 0.15s ease;
    --transition-medium: 0.3s ease;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'EB Garamond', Georgia, serif;
}

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

html, body {
    height: 100%;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-serif);
    background-color: var(--bg-warm);
    color: var(--text-primary);
    line-height: 1.5;
    cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' style='font-size:24px'><text y='24'>☁️</text></svg>") 16 16, auto;
}

/* Raining cloud on clickable elements */
a, button, [role="button"], input[type="range"] {
    cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' style='font-size:24px'><text y='24'>🌧️</text></svg>") 16 16, pointer;
}

/* Lightning cloud on click */
a:active, button:active, [role="button"]:active {
    cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' style='font-size:24px'><text y='24'>⛈️</text></svg>") 16 16, pointer;
}

/* ===== Header Navigation ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding: 0 1rem;
    background: linear-gradient(to bottom, var(--bg-warm) 0%, var(--bg-warm) 80%, transparent 100%);
    font-family: var(--font-sans);
    font-size: 0.875rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color var(--transition-fast);
    padding: 0.5rem 0;
    display: block;
}

.nav-link:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link em {
    font-style: italic;
}

/* Active nav link - lighter color */
.nav-link.active {
    color: var(--text-active);
}

/* Static breadcrumb styles (for subpages like Turbulence) */
.nav-item.static-breadcrumb {
    display: flex;
    align-items: center;
}

.breadcrumb-divider {
    margin: 0 0.5rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.breadcrumb-current {
    color: var(--text-active);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30vw;
    display: inline-block;
    padding: 0.5rem 0;
}

/* Hamburger (hidden on desktop) */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    padding: 0;
    margin-left: auto;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-warm);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-medium), visibility 0s var(--transition-medium);
}

.mobile-menu.open {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-medium), visibility 0s 0s;
}

.mobile-menu-content {
    padding: calc(var(--header-height) + 2rem) 1rem 2rem;
}

.mobile-menu .mobile-nav-item {
    margin-bottom: 1.5rem;
}

.mobile-menu .mobile-nav-link {
    display: block;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.mobile-menu .mobile-nav-link em {
    font-style: italic;
}

.mobile-menu .mobile-dropdown {
    padding-left: 1rem;
}

.mobile-menu .mobile-dropdown-link {
    display: block;
    font-size: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 0;
}

.mobile-menu .mobile-dropdown-link:hover {
    color: var(--text-primary);
}

.mobile-menu .mobile-nav-link.active,
.mobile-menu .mobile-dropdown-link.active {
    color: var(--text-active);
}

/* ===== Main Content - Maximized Layout ===== */
.content {
    min-height: calc(100vh - var(--header-height));
    padding: calc(var(--header-height) + 0.75rem) 0.75rem 0.75rem;
}

.main-layout {
    display: flex;
    gap: var(--content-gap);
    min-height: calc(100vh - var(--header-height) - 1.5rem);
    align-items: flex-start;
}

/* ===== Visualization Section ===== */
.viz-section {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: sticky;
    top: calc(var(--header-height) + 0.75rem);
    align-self: flex-start;
    gap: 0.5rem;
}

.canvas-wrapper {
    position: relative;
    width: calc(100vh - var(--header-height) - 1.5rem);
    height: calc(100vh - var(--header-height) - 1.5rem);
    max-width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.canvas-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.up-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--font-sans);
    flex-shrink: 0;
}

.up-arrow {
    font-size: 1rem;
}

/* ===== Sidebar ===== */
.sidebar {
    flex: 0 0 var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ===== Controls Section ===== */
.controls-section {
    background-color: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: 6px;
    padding: 1rem;
}

/* Toggle */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.toggle-label {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.toggle-label.active {
    color: var(--text-primary);
}

.toggle {
    width: 36px;
    height: 18px;
    background: #ccc;
    border-radius: 9px;
    position: relative;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.toggle::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle.active {
    background: #888;
}

.toggle.active::after {
    transform: translateX(18px);
}

/* Slider */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.slider-label {
    text-align: center;
}

#turbulenceSlider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #ccc, #888);
    border-radius: 2px;
    outline: none;
}

#turbulenceSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid #888;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: border-color var(--transition-fast);
}

#turbulenceSlider::-webkit-slider-thumb:hover {
    border-color: var(--text-primary);
}

#turbulenceSlider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid #888;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: border-color var(--transition-fast);
}

#turbulenceSlider::-moz-range-thumb:hover {
    border-color: var(--text-primary);
}

/* ===== About Section ===== */
.about-section {
    background-color: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: 6px;
    overflow: hidden;
}

.about-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: left;
    transition: color var(--transition-fast);
}

.about-toggle:hover {
    color: var(--text-primary);
}

.about-toggle.open {
    border-bottom: 1px solid var(--control-border);
}

.about-label {
    font-weight: 500;
}

.about-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition-fast);
}

.about-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-medium);
    padding: 0 1rem;
}

.about-content.open {
    max-height: 600px;
    padding: 0.75rem 1rem 1rem;
}

.about-content p {
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.about-content p:last-child {
    margin-bottom: 0;
}

.about-content .references {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
    line-height: 1.6;
}

.about-content a {
    color: inherit;
    text-decoration: underline;
}

.about-content a:hover {
    text-decoration: none;
}

/* ===== Responsive Design ===== */
@media (max-width: 1100px) {
    :root {
        --sidebar-width: 320px;
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 240px;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    .site-header {
        padding: 0 0.75rem;
    }

    /* Hide desktop nav, show hamburger */
    .site-nav {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    /* Hamburger animation when menu open */
    .site-header.menu-open .hamburger span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .site-header.menu-open .hamburger span:nth-child(2) {
        opacity: 0;
    }

    .site-header.menu-open .hamburger span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .content {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        padding: calc(var(--header-height) + 0.75rem) 0.75rem 1rem;
        overflow: visible;
        min-height: 100vh;
    }

    .main-layout {
        flex-direction: column;
        height: auto;
    }

    .viz-section {
        width: 100%;
        justify-content: center;
    }

    .canvas-wrapper {
        width: min(calc(100vw - 1.5rem - 2rem), calc(100vh - var(--header-height) - 15rem));
        height: auto;
    }

    .up-indicator {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
    }

    .sidebar {
        flex: none;
        width: 100%;
        max-height: none;
    }

    :root {
        --sidebar-width: 100%;
    }
}

@media (max-width: 480px) {
    .content {
        padding: calc(var(--header-height) + 0.5rem) 0.5rem 1rem;
    }

    .controls-section {
        padding: 0.75rem;
    }

    .canvas-wrapper {
        width: calc(100vw - 1rem - 1.5rem);
    }
}

/* ===== Print Styles ===== */
@media print {
    .site-header {
        display: none;
    }

    .content {
        padding: 1rem;
        position: relative;
    }
}
