/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.65;
    color: #2c3e50;
    background-color: #ffffff;
    font-size: 18px;
    font-weight: 400;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 30px;
}

/* Typography - Warren Buffett Style */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Georgia', serif;
    font-weight: 400;
    line-height: 1.3;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
}

h2 {
    font-size: 2rem;
    font-weight: 300;
}

h3 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-top: 2.5rem;
}

p {
    margin-bottom: 1.5rem;
    text-align: left;
    max-width: 65ch;
}

strong {
    color: #1a1a1a;
    font-weight: 600;
}

em {
    color: #555;
    font-style: italic;
}

/* Header - Minimal Warren Buffett Style */
.header {
    background: #ffffff;
    color: #2c3e50;
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid #e8e8e8;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.3rem;
    font-weight: 400;
    margin: 0;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: #666;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    padding: 0.5rem 0;
}

.nav-link:hover,
.nav-link.active {
    color: #1a1a1a;
    border-bottom: 1px solid #1a1a1a;
}

/* Hero Section - Minimal Elegant */
.hero {
    background: #ffffff;
    color: #2c3e50;
    padding: 140px 0 100px;
    margin-top: 80px;
    border-bottom: 1px solid #f0f0f0;
}

.hero-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #fff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #1a1a1a;
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: #555;
    font-weight: 400;
}

.hero-author {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: #666;
    font-style: italic;
}

.hero-description {
    font-size: 1rem;
    color: #555;
    margin-bottom: 3rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.hero-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    justify-content: center;
    font-size: 0.9rem;
}

.version, .year {
    background: #f8f9fa;
    color: #666;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-weight: 400;
    border: 1px solid #e9ecef;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 2rem;
    border-radius: 2px;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #1a1a1a;
    font-family: 'Georgia', serif;
}

.btn-primary {
    background: #1a1a1a;
    color: white;
}

.btn-primary:hover {
    background: white;
    color: #1a1a1a;
}

.btn-secondary {
    background: transparent;
    color: #1a1a1a;
}

.btn-secondary:hover {
    background: #f8f9fa;
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 3rem;
}

.book-visual {
    width: 180px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.tio-huli-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0.8;
}

/* Table of Contents - Minimal Style */
.toc {
    padding: 80px 0;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 4rem;
    color: #1a1a1a;
    font-weight: 300;
}

.toc-content {
    display: grid;
    gap: 2rem;
}

.toc-item {
    background: white;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e8e8e8;
    padding: 0;
}

.toc-item:hover {
    border-color: #ccc;
}

.toc-link {
    display: block;
    padding: 2rem 2.5rem;
    text-decoration: none;
    color: inherit;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.toc-link:hover {
    border-left-color: #1a1a1a;
    background: #fafafa;
}

.chapter-number {
    background: #1a1a1a;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 400;
    margin-bottom: 1rem;
    font-family: 'Georgia', serif;
}

.chapter-info h3 {
    margin-bottom: 0.8rem;
    color: #1a1a1a;
    font-size: 1.2rem;
    font-weight: 400;
}

.chapter-info p {
    color: #666;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.toc-extras {
    display: flex;
    gap: 2rem;
    margin-top: 4rem;
    justify-content: center;
    flex-wrap: wrap;
}

.toc-extra-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: transparent;
    color: #1a1a1a;
    text-decoration: none;
    border: 1px solid #1a1a1a;
    font-weight: 400;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: 'Georgia', serif;
}

.toc-extra-link:hover {
    background: #1a1a1a;
    color: white;
}

/* Chapters - Clean Minimal Style */
.chapters {
    background: white;
    padding: 0 0 80px;
}

.chapter {
    max-width: 100%;
    margin: 0 auto 100px;
    padding: 60px 0;
    background: white;
    border-top: 1px solid #f0f0f0;
}

.chapter-header {
    text-align: left;
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #f0f0f0;
}

.chapter-label {
    display: inline-block;
    background: #1a1a1a;
    color: white;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: 'Georgia', serif;
}

.chapter-title {
    font-size: 2.5rem;
    color: #1a1a1a;
    margin: 0;
    font-weight: 300;
    line-height: 1.2;
}

.chapter-intro {
    font-size: 1.1rem;
    color: #555;
    font-style: italic;
    margin-bottom: 3rem;
    padding: 1.5rem 0 1.5rem 2rem;
    background: transparent;
    border-left: 2px solid #ccc;
    line-height: 1.6;
}

.chapter-section {
    margin-bottom: 3rem;
}

.chapter-section h3 {
    font-size: 1.4rem;
    color: #1a1a1a;
    margin-bottom: 1.5rem;
    margin-top: 3rem;
    font-weight: 400;
}

.asset-list {
    list-style: none;
    margin: 1.5rem 0;
    padding-left: 0;
}

.asset-list li {
    padding: 1rem 0 1rem 1.5rem;
    margin-bottom: 1rem;
    background: transparent;
    border-left: 2px solid #e0e0e0;
    position: relative;
}

.asset-list li::before {
    content: '•';
    position: absolute;
    left: 0.5rem;
    color: #666;
}

.comparison-paths {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.path {
    padding: 1.5rem;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #00D084;
}

.path h4 {
    color: #2d3748;
    margin-bottom: 1rem;
}

.formula {
    background: #edf2f7;
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    border-left: 4px solid #38b2ac;
}

.formula h4 {
    color: #2d3748;
    margin-bottom: 1rem;
}

.chapter-summary {
    background: #fafafa;
    padding: 2rem;
    border: 1px solid #e8e8e8;
    margin-top: 4rem;
}

.chapter-summary h4 {
    color: #1a1a1a;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Chapter Images - Minimal Style */
.chapter-image {
    margin: 3rem 0;
    text-align: center;
    background: transparent;
    padding: 0;
}

.chapter-image img {
    max-width: 100%;
    height: auto;
    border: 1px solid #e0e0e0;
    transition: opacity 0.3s ease;
}

.chapter-image img:hover {
    opacity: 0.9;
}

.image-caption {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-top: 0.8rem;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Tio Huli Brand Colors */
:root {
    --tio-huli-green: #00D084;
    --tio-huli-dark: #1a1a1a;
    --tio-huli-light: #f7fafc;
    --tio-huli-gray: #718096;
}

/* Enhanced Visual Elements */
.hero-title {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #fff, #00D084);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Investment Themed Icons */
.financial-icon {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: var(--tio-huli-green);
    border-radius: 50%;
    color: white;
    text-align: center;
    line-height: 40px;
    margin-right: 1rem;
    font-size: 1.2rem;
}

/* Formula Boxes - Warren Buffett Clean Style */
.formula {
    background: #fafafa;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid #e8e8e8;
}

.formula h4 {
    color: #1a1a1a;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Warren Buffett Quote Style */
blockquote {
    border-left: 2px solid #ccc;
    padding-left: 2rem;
    margin: 2rem 0;
    font-style: italic;
    color: #555;
    font-size: 1.1rem;
}

/* Clean Data Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.8rem;
    border-bottom: 1px solid #e8e8e8;
}

th {
    font-weight: 600;
    color: #1a1a1a;
}

/* Refined Mobile Styles */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .chapter {
        padding: 40px 0;
    }
    
    .chapter-title {
        font-size: 1.8rem;
    }
    
    .chapter-image {
        margin: 2rem 0;
    }
    
    .toc-link {
        padding: 1.5rem 2rem;
    }
    
    .hero-actions {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .btn {
        padding: 0.9rem 2rem;
        width: auto;
    }
    
    .book-visual {
        width: 150px;
        height: 100px;
    }
}

/* Progress Bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1001;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #38b2ac);
    width: 0%;
    transition: width 0.3s ease;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    background: #1a1a1a;
    color: white;
    border: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    font-size: 0.8rem;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .nav-toggle {
        display: block;
    }

    .nav-list {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #667eea;
        flex-direction: column;
        padding: 1rem 0;
        gap: 0;
    }

    .nav-list.active {
        display: flex;
    }

    .nav-link {
        padding: 0.8rem 2rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .hero {
        padding: 100px 0 60px;
        margin-top: 60px;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.4rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .hero-meta {
        justify-content: center;
        flex-wrap: wrap;
    }

    .section-title {
        font-size: 2rem;
    }

    .chapter {
        margin: 0 15px 60px;
        padding: 25px;
    }

    .chapter-title {
        font-size: 1.8rem;
    }

    .comparison-paths {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .toc-extras {
        flex-direction: column;
        align-items: center;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .chapter {
        padding: 20px;
        margin: 0 10px 40px;
    }

    .toc-link {
        padding: 1.5rem;
        gap: 1rem;
    }

    .chapter-number {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .nav,
    .hero-actions,
    .toc-extras,
    .progress-bar,
    .back-to-top {
        display: none;
    }

    .hero {
        margin-top: 0;
        padding: 40px 0;
    }

    .chapter {
        box-shadow: none;
        border: 1px solid #e2e8f0;
        page-break-inside: avoid;
    }

    body {
        background: white;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Focus styles for accessibility */
*:focus {
    outline: 1px solid #1a1a1a;
    outline-offset: 2px;
}

.nav-link:focus,
.btn:focus,
.toc-link:focus {
    outline: 1px solid #1a1a1a;
}