/* ============================================
   CSS Reset and Root Variables
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-surface: #FAFBFC;
    --text-primary: #1B2E3E;
    --accent-primary: #0066CC;
    --accent-secondary: #00A896;
    --accent-tertiary: #004E89;
    --accent-warning: #D97706;
    --divider-light: #E8EBF0;
    --divider-section: #0066CC;

    --font-display: "Playfair Display", serif;
    --font-body: "Inter", sans-serif;
    --font-mono: "IBM Plex Mono", monospace;

    --transition-smooth: all 0.3s ease;
    --transition-slow: all 0.6s ease;
}

/* ============================================
   Typography
   ============================================ */

html {
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background-color: var(--bg-surface);
    line-height: 1.6;
    overflow-x: hidden;
}

h1 {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.3;
    margin-bottom: 1.5rem;
}

h3 {
    font-family: var(--font-body);
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}

p {
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    letter-spacing: -0.01em;
    line-height: 1.8;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    display: inline-block;
}

a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    transition: left 0.3s ease;
}

a:hover::after {
    left: 0;
}

.tagline {
    font-size: clamp(1rem, 1.1vw, 1.3rem);
    color: var(--text-primary);
    opacity: 0.85;
    font-weight: 300;
}

/* ============================================
   Section Structure
   ============================================ */

.section {
    min-height: 100vh;
    padding: clamp(2rem, 8vw, 4rem);
    padding-left: clamp(4rem, 10vw, 6rem);
    border-top: 1px solid var(--divider-section);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section:first-of-type {
    border-top: none;
}

.section:nth-child(even) {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(250, 251, 252, 0.98) 100%);
}

.section:nth-child(odd) {
    background: linear-gradient(to bottom, rgba(250, 251, 252, 1) 0%, rgba(248, 250, 252, 0.96) 100%);
}

/* ============================================
   Hero Section
   ============================================ */

.hero-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.compass-rose {
    width: 200px;
    height: 200px;
    margin-bottom: 2rem;
    animation: compassRotate 0.8s ease-in-out;
}

@keyframes compassRotate {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

.hero-section h1 {
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.scroll-hint {
    margin-top: 3rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-secondary);
    animation: pulse-arrow 2s ease-in-out infinite;
}

@keyframes pulse-arrow {
    0%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(8px);
        opacity: 0.6;
    }
}

.waterline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right,
        transparent 0%,
        var(--accent-primary) 25%,
        var(--accent-primary) 75%,
        transparent 100%);
    opacity: 0.5;
}

/* ============================================
   Categories Section
   ============================================ */

.categories-section {
    min-height: auto;
    padding: clamp(3rem, 8vw, 5rem);
    padding-left: clamp(4rem, 10vw, 6rem);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.category-tile {
    padding: 2rem;
    border: 1px solid var(--divider-light);
    border-radius: 0;
    background: var(--bg-surface);
    transition: var(--transition-smooth);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.category-tile::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -100%;
    width: 100%;
    height: 3px;
    background: var(--accent-secondary);
    transition: left 0.4s ease;
}

.category-tile:hover {
    background: linear-gradient(135deg, rgba(0, 168, 150, 0.05) 0%, rgba(0, 102, 204, 0.05) 100%);
    border-color: var(--accent-primary);
}

.category-tile:hover::before {
    left: 0;
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.category-tile h3 {
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.category-tile p {
    font-size: 0.95rem;
    color: var(--text-primary);
    opacity: 0.75;
}

/* ============================================
   Index Sections
   ============================================ */

.index-section {
    padding: clamp(3rem, 8vw, 5rem);
    padding-left: clamp(4rem, 10vw, 6rem);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.section-icon {
    font-size: 2rem;
    display: block;
}

.section-header h2 {
    margin-bottom: 0;
}

/* ============================================
   Tables & Index
   ============================================ */

.index-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}

.index-table thead {
    border-bottom: 1px solid var(--divider-light);
}

.index-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-tertiary);
    font-family: var(--font-mono);
}

.index-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--divider-light);
    font-size: clamp(0.95rem, 1vw, 1.05rem);
    line-height: 1.6;
}

.index-table tbody tr:nth-child(even) {
    background-color: #F0F4F8;
}

.index-table tbody tr:hover {
    background-color: rgba(0, 102, 204, 0.03);
}

.entry-link {
    color: var(--accent-primary);
    font-weight: 500;
}

.entry-link::after {
    background: var(--accent-primary);
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--accent-primary);
    color: white;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    border-radius: 0;
}

/* ============================================
   Sidebar Navigation
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 60px;
    background: var(--bg-surface);
    border-right: 1px solid var(--divider-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    height: 100%;
    padding: 2rem 0;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.1em;
    margin-top: 1rem;
}

.nav-dots {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-grow: 1;
    align-items: center;
    margin: 2rem 0;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--divider-light);
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid var(--divider-light);
}

.nav-dot.active {
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.nav-dot:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    margin-bottom: 1rem;
}

.menu-toggle span {
    width: 20px;
    height: 2px;
    background: var(--accent-primary);
    transition: var(--transition-smooth);
}

/* ============================================
   Mobile Navigation Panel
   ============================================ */

.mobile-nav-panel {
    position: fixed;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-surface);
    z-index: 999;
    padding: 2rem;
    transition: left 0.3s ease;
    border-right: 1px solid var(--divider-light);
    display: none;
    flex-direction: column;
}

.mobile-nav-panel.active {
    left: 0;
}

.close-panel {
    font-size: 2rem;
    color: var(--accent-primary);
    cursor: pointer;
    margin-bottom: 2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-categories {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-cat-link {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-primary);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid transparent;
    transition: var(--transition-smooth);
}

.mobile-cat-link:hover {
    border-bottom-color: var(--accent-secondary);
}

/* ============================================
   Main Content Adjustment
   ============================================ */

body {
    display: grid;
    grid-template-columns: 60px 1fr;
    min-height: 100vh;
}

main, section {
    grid-column: 2;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        z-index: 1001;
    }

    .menu-toggle {
        display: flex;
    }

    .sidebar {
        width: auto;
        height: 60px;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--divider-light);
    }

    .sidebar-nav {
        width: 100%;
        flex-direction: row;
        padding: 0 1rem;
        gap: 1rem;
        height: auto;
        justify-content: space-between;
    }

    .logo {
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        margin-top: 0;
        margin-right: auto;
    }

    .nav-dots {
        display: none;
    }

    body {
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr;
    }

    .section {
        grid-column: 1;
        padding-left: clamp(1.5rem, 5vw, 2rem);
    }

    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }

    .index-table {
        font-size: 0.9rem;
    }

    .index-table th,
    .index-table td {
        padding: 0.75rem 0.5rem;
    }

    .mobile-nav-panel {
        display: flex;
        width: 70vw;
        max-width: 300px;
    }

    .menu-toggle {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 2rem 1rem;
    }

    .compass-rose {
        width: 150px;
        height: 150px;
    }

    .section {
        padding: 2rem 1rem;
        padding-left: 1rem;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .index-table {
        font-size: 0.85rem;
    }

    .index-table th,
    .index-table td {
        padding: 0.5rem 0.25rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    h1 {
        font-size: clamp(1.8rem, 5vw, 2.4rem);
    }

    h2 {
        font-size: clamp(1.4rem, 3vw, 1.8rem);
    }

    .entry-link {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ============================================
   Scroll Effects
   ============================================ */

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .sidebar,
    .mobile-nav-panel,
    .menu-toggle,
    .scroll-hint {
        display: none;
    }

    body {
        grid-template-columns: 1fr;
    }

    .section {
        page-break-inside: avoid;
        padding-left: 2rem;
    }
}
