/* Warm Paper Theme - Notion-like aesthetic */

:root {
    /* Warm Paper Palette */
    --paper-bg: #FAF8F5;
    --paper-bg-alt: #F5F3EF;
    --paper-surface: #FFFFFF;
    --paper-border: #E8E4DE;
    --paper-border-dark: #D4CFC7;

    /* Text Colors */
    --text-primary: #37352F;
    --text-secondary: #6B6B6B;
    --text-muted: #9B9A97;
    --text-accent: #2E7D6B;

    /* Accent Color */
    --accent-primary: #2E7D6B;
    --accent-secondary: #256b5b;

    /* Subtle Tints for Categories (paper-friendly) */
    --tint-blue: rgba(46, 125, 107, 0.06);
    --tint-warm: rgba(180, 140, 100, 0.08);

    /* Shadows */
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);

    /* Spacing - WIDER content */
    --content-max-width: 960px;
    --section-spacing: 4rem;
    --nav-width: 240px;

    /* Border Color for navigation buttons */
    --border-color: var(--paper-border);
}

/* Base Styles */
body {
    background-color: var(--paper-bg);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Links */
a {
    color: var(--text-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

a:hover {
    color: #256b5b;
}

/* ==================== LAYOUT WITH NAVIGATION ==================== */

/* Document wrapper for sidebar layout */
.doc-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.doc-nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--nav-width);
    background: var(--paper-surface);
    border-right: 1px solid var(--paper-border);
    overflow-y: auto;
    padding: 1.5rem;
    z-index: 100;
    display: none;
    scrollbar-width: thin;
    scrollbar-color: var(--paper-border) transparent;
}

.doc-nav::-webkit-scrollbar {
    width: 4px;
}

.doc-nav::-webkit-scrollbar-track {
    background: transparent;
}

.doc-nav::-webkit-scrollbar-thumb {
    background: var(--paper-border);
    border-radius: 2px;
}

@media (min-width: 1100px) {
    .doc-nav {
        display: block;
    }

    .doc-main {
        margin-left: var(--nav-width);
    }

    .paper-content {
        max-width: 900px;
    }
}

.doc-nav-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--paper-border);
}

.doc-nav-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.doc-nav-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.doc-nav-section {
    margin-bottom: 1.25rem;
}

.doc-nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.doc-nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-nav-links li {
    margin-bottom: 0.125rem;
}

.doc-nav-links a {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    border-left: 2px solid transparent;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.doc-nav-links a .nav-number {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 1.25rem;
    padding-top: 0.1rem;
}

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

.doc-nav-links a.active {
    background: rgba(46, 125, 107, 0.08);
    color: var(--text-accent);
    font-weight: 500;
    border-left-color: var(--text-accent);
}

.doc-nav-links a.active .nav-number {
    color: var(--text-accent);
}

/* Franchise Navigation Links */
.franchise-links a {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.franchise-links a.current-page {
    background: var(--paper-bg);
    color: var(--text-primary);
    font-weight: 600;
    border-left: 2px solid var(--text-primary);
}

.franchise-links a:not(.current-page):hover {
    background: var(--paper-bg);
}

/* Main content area */
.doc-main {
    flex: 1;
    min-width: 0;
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    background: var(--text-primary);
    color: var(--paper-surface);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.mobile-nav-toggle:hover {
    transform: scale(1.05);
}

.mobile-nav-toggle.active {
    background: var(--text-accent);
}

@media (max-width: 1099px) {
    .mobile-nav-toggle {
        display: flex;
    }
}

/* Mobile nav overlay */
.doc-nav.mobile-open {
    display: block;
    width: 280px;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ==================== TABLE OF CONTENTS (inline) ==================== */

.toc {
    background: var(--paper-surface);
    border: 1px solid var(--paper-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.25rem;
}

@media (min-width: 640px) {
    .toc-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .toc-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

.toc-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.toc-list a:hover {
    background: var(--paper-bg);
    color: var(--text-primary);
}

.toc-number {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 1.25rem;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 5rem;
    width: 40px;
    height: 40px;
    background: var(--paper-surface);
    border: 1px solid var(--paper-border);
    border-radius: 50%;
    cursor: pointer;
    z-index: 150;
    box-shadow: var(--shadow-card);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.back-to-top:hover {
    background: var(--paper-bg);
    color: var(--text-primary);
}

.back-to-top.visible {
    display: flex;
}

/* ==================== PAPER CONTENT CONTAINER ==================== */

.paper-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

@media (min-width: 640px) {
    .paper-content {
        padding: 3rem 2.5rem;
    }
}

@media (min-width: 1024px) {
    .paper-content {
        padding: 3rem 3rem;
    }
}

/* ==================== PAGE HEADER ==================== */

.paper-header {
    background: var(--paper-surface);
    border-bottom: 1px solid var(--paper-border);
}

.paper-header .header-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.paper-header .header-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.paper-header .header-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ==================== SECTION HEADERS ==================== */

.section-header {
    margin-bottom: 1.5rem;
    scroll-margin-top: 2rem;
}

.section-number {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.25rem;
}

.section-title {
    font-size: 1.625rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Section Spacing */
.paper-section {
    margin-bottom: var(--section-spacing);
    scroll-margin-top: 2rem;
}

/* ==================== CARDS ==================== */

.paper-card {
    background: var(--paper-surface);
    border: 1px solid var(--paper-border);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.paper-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.paper-card .card-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Callout Boxes */
.paper-callout {
    background: linear-gradient(135deg, #FBF9F7 0%, #F5F3EF 100%);
    border-left: 3px solid var(--paper-border-dark);
    padding: 1rem 1.5rem;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Feature Cards */
.feature-card {
    padding: 1.5rem;
}

.feature-card .feature-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.feature-card .feature-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Stat Cards */
.stat-card {
    text-align: center;
    padding: 1.5rem 1rem;
}

.stat-card .stat-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-card .stat-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.stat-card .stat-bonus {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-accent);
    background: rgba(46, 125, 107, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

/* ==================== IMAGE BLOCKS ==================== */

.image-block {
    margin: 1.5rem 0;
}

.image-block img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--paper-border);
}

.image-block .image-caption {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

/* ==================== LIST CARDS ==================== */

.list-card .list-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.list-card .list-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-card .list-items li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--paper-border);
}

.list-card .list-items li:last-child {
    border-bottom: none;
}

.list-card .list-items li strong {
    color: var(--text-primary);
}

/* ==================== GRID LAYOUTS ==================== */

.card-grid {
    display: grid;
    gap: 1.25rem;
}

.card-grid-2 {
    grid-template-columns: 1fr;
}

.card-grid-3 {
    grid-template-columns: 1fr;
}

.card-grid-4 {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .card-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    .card-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .card-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    .card-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==================== TIMELINE ==================== */

.timeline-item {
    position: relative;
    padding-left: 2.5rem;
    padding-bottom: 1.5rem;
    border-left: 2px solid var(--paper-border);
    margin-left: 0.75rem;
}

.timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.timeline-phase {
    position: absolute;
    left: -0.75rem;
    top: 0;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--paper-surface);
    border: 2px solid var(--paper-border-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.timeline-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.timeline-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ==================== DATA TABLES ==================== */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.875rem;
    border-bottom: 2px solid var(--paper-border);
    background: var(--paper-bg);
}

.data-table td {
    padding: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--paper-border);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(0, 0, 0, 0.01);
}

/* ==================== COLLAPSIBLE SECTIONS ==================== */

details {
    background: var(--paper-surface);
    border: 1px solid var(--paper-border);
    border-radius: 8px;
    margin-bottom: 1rem;
}

details summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.15s ease;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary:hover {
    background: var(--paper-bg);
}

details summary .chevron {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

details[open] summary .chevron {
    transform: rotate(180deg);
}

details > div {
    padding: 1.5rem;
    border-top: 1px solid var(--paper-border);
}

/* ==================== FOOTER ==================== */

.paper-footer {
    border-top: 1px solid var(--paper-border);
    padding: 2rem 0;
    margin-top: 3rem;
}

.paper-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* ==================== TYPOGRAPHY UTILITIES ==================== */

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

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.font-semibold {
    font-weight: 600;
}

/* ==================== SPACING UTILITIES ==================== */

.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* ==================== LOGIN PAGE ==================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: var(--paper-surface);
    border: 1px solid var(--paper-border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-card);
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

.login-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1px solid var(--paper-border);
    border-radius: 6px;
    background: var(--paper-bg);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input:focus {
    outline: none;
    border-color: var(--paper-border-dark);
    box-shadow: 0 0 0 3px rgba(212, 207, 199, 0.3);
}

.login-input::placeholder {
    color: var(--text-muted);
}

.login-button {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--paper-surface);
    background: var(--text-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.login-button:hover {
    background: #4a4a4a;
}

/* ==================== SMOOTH SCROLL ==================== */

html {
    scroll-behavior: smooth;
}

/* Anchor offset for fixed headers */
[id] {
    scroll-margin-top: 2rem;
}
