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

:root {
    --primary-color: #1a237e;
    --secondary-color: #283593;
    --accent-color: #ff6f00;
    --text-dark: #212121;
    --text-light: #757575;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --border-color: rgba(26, 35, 126, 0.1);
    --card-bg: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.95);
}

/* Dark mode variables */
[data-theme="dark"] {
    --primary-color: #5c6bc0;
    --secondary-color: #7986cb;
    --accent-color: #ffb74d;
    --text-dark: #e0e0e0;
    --text-light: #bdbdbd;
    --bg-light: #1a1a1a;
    --bg-white: #121212;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: #1e1e1e;
    --nav-bg: rgba(18, 18, 18, 0.95);
}

/* Smooth transitions for theme switching */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-white);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
    position: relative;
    padding-left: 60px;
}

h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-image: url('../images/interconnected-nodes.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 60px;
    width: 150px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), transparent);
}

h3 {
    font-size: 1.8rem;
    color: var(--secondary-color);
}

h4 {
    font-size: 1.3rem;
    color: var(--text-dark);
}

p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.lead {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Navigation */
#navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

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

.nav-menu a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: var(--accent-color);
}

.language-toggle {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.lang-btn {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.lang-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.theme-toggle:hover {
    background-color: var(--primary-color);
}

.theme-toggle:hover svg {
    stroke: white;
}

.theme-toggle svg {
    position: absolute;
    transition: all 0.3s ease;
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.moon-icon {
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="dark"] .sun-icon {
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="dark"] .moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.nav-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-dark);
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-toggle:hover {
    background-color: var(--bg-light);
}

.nav-toggle:active {
    transform: scale(0.95);
}

/* Hero Section */
.hero {
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 10rem 2rem 6rem;
    text-align: center;
    margin-top: 60px;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/latticework.svg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
    z-index: 1;
}

.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 70%, rgba(255, 111, 0, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 900px;
    margin: 0 auto;
}

.hero-content h1 {
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    position: relative;
}

.hero-content h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    animation: fadeInUp 1s ease 0.5s;
    animation-fill-mode: both;
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 3rem;
    opacity: 0.9;
    animation: fadeInUp 1s ease 0.2s;
    animation-fill-mode: both;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    font-weight: 300;
    line-height: 1.4;
}

.cta-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-color), #ff8f00);
    color: white;
    padding: 1.2rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    animation: fadeInUp 1s ease 0.4s;
    animation-fill-mode: both;
    position: relative;
    overflow: hidden;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255, 111, 0, 0.2);
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.cta-button:hover::before {
    left: 100%;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 111, 0, 0.4);
    background: linear-gradient(135deg, #ff8f00, var(--accent-color));
}

.cta-button .arrow-icon {
    margin-left: 8px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.cta-button:hover .arrow-icon {
    transform: translateX(5px);
}

/* Hero particles and enhanced elements */
.hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.particle {
    position: absolute;
    background: rgba(255, 111, 0, 0.6);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.particle-1 {
    width: 8px;
    height: 8px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.particle-2 {
    width: 12px;
    height: 12px;
    top: 60%;
    left: 20%;
    animation-delay: 1s;
}

.particle-3 {
    width: 6px;
    height: 6px;
    top: 40%;
    right: 15%;
    animation-delay: 2s;
}

.particle-4 {
    width: 10px;
    height: 10px;
    top: 80%;
    right: 30%;
    animation-delay: 3s;
}

.particle-5 {
    width: 14px;
    height: 14px;
    top: 30%;
    left: 80%;
    animation-delay: 4s;
}

.particle-6 {
    width: 8px;
    height: 8px;
    top: 70%;
    left: 70%;
    animation-delay: 5s;
}

.hero-icon {
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease 0.3s;
    animation-fill-mode: both;
}

.hero-icon img {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    animation: pulse 2s ease-in-out infinite;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin: 2rem 0 3rem;
    animation: fadeInUp 1s ease 0.6s;
    animation-fill-mode: both;
}

.stat {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.stat:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Search Section */
.search-section {
    padding: 2rem 0;
    background-color: var(--bg-light);
    margin-top: 60px;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    background-color: var(--card-bg);
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 111, 0, 0.1);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-results {
    max-width: 800px;
    margin: 2rem auto 0;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    background-color: var(--card-bg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-result-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.search-result-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.search-result-excerpt {
    color: var(--text-light);
    line-height: 1.6;
}

.search-highlight {
    background-color: var(--accent-color);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
}

.search-no-results {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
}

/* Main Content */
main {
    margin-top: 0;
}

.section {
    padding: 4rem 0;
}

.section-alt {
    background-color: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.content-block {
    margin-bottom: 3rem;
}

.subsection {
    margin-bottom: 3rem;
}

/* Special Boxes */
.highlight-box {
    background-color: #e8eaf6;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
}

.key-insight {
    background-color: #fff3e0;
    border: 2px solid var(--accent-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.key-insight h4 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

blockquote {
    font-style: italic;
    font-size: 1.2rem;
    color: var(--text-light);
    border-left: 4px solid var(--secondary-color);
    padding-left: 1.5rem;
    margin: 2rem 0;
}

/* Pillars Grid */
.pillar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.pillar-card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.pillar-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.pillar-card h3 {
    margin-bottom: 1rem;
}

.example-box {
    background-color: var(--bg-light);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.example-box h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.example-box ul {
    list-style-position: inside;
    margin-left: 0.5rem;
}

.formula {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    text-align: center;
    margin-top: 1rem;
}

/* Toolkit Grid */
.toolkit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.toolkit-category {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.toolkit-category h3 {
    margin-bottom: 1.5rem;
}

.toolkit-category ul {
    list-style: none;
}

.toolkit-category li {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
}

.toolkit-category li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 2rem 0;
}

.misjudgment-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    border-radius: 8px;
    overflow: hidden;
}

.misjudgment-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.misjudgment-table td {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.misjudgment-table tr:hover {
    background-color: #f5f5f5;
}

.table-note {
    font-style: italic;
    color: var(--text-light);
    margin-top: 1rem;
}

/* Case Study */
.case-study {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

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

.analysis-box {
    background-color: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
}

.analysis-box h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

/* Framework Box */
.framework-box {
    background-color: #e8eaf6;
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.filter-list {
    counter-reset: filter-counter;
    list-style: none;
}

.filter-list li {
    counter-increment: filter-counter;
    margin-bottom: 1rem;
    padding-left: 2rem;
    position: relative;
}

.filter-list li:before {
    content: counter(filter-counter);
    position: absolute;
    left: 0;
    background-color: var(--accent-color);
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Critical Section */
.warning-box {
    background-color: #ffebee;
    border: 2px solid #ef5350;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.warning-box h3 {
    color: #c62828;
    margin-bottom: 1rem;
}

.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.challenge-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-top: 3px solid #ef5350;
}

.warning-quote {
    background-color: #ffebee;
    border-left: 4px solid #c62828;
    color: #b71c1c;
}

/* Conclusion */
.conclusion-content {
    text-align: center;
}

.legacy-box {
    background-color: var(--primary-color);
    color: white;
    padding: 3rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.legacy-box h3 {
    color: white;
    margin-bottom: 1.5rem;
}

.final-thought {
    font-size: 1.1rem;
    font-style: italic;
    margin-top: 2rem;
    opacity: 0.9;
}

/* Social Sharing */
.social-sharing {
    background-color: var(--bg-light);
    padding: 3rem 0;
    text-align: center;
    margin-top: 4rem;
}

.social-sharing h3 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    color: white;
    min-width: 140px;
    justify-content: center;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.social-btn.twitter {
    background-color: #1da1f2;
}

.social-btn.twitter:hover {
    background-color: #0d8bd9;
}

.social-btn.linkedin {
    background-color: #0077b5;
}

.social-btn.linkedin:hover {
    background-color: #005885;
}

.social-btn.facebook {
    background-color: #4267b2;
}

.social-btn.facebook:hover {
    background-color: #365899;
}

.social-btn.email {
    background-color: var(--accent-color);
}

.social-btn.email:hover {
    background-color: #e65100;
}

/* Footer */
footer {
    background-color: var(--text-dark);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

footer p {
    margin-bottom: 0.5rem;
}

footer small {
    opacity: 0.7;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* New detailed content styles */
.disciplines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.discipline-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--accent-color);
    text-align: center;
}

.discipline-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.lattice-visual {
    background-color: #e8eaf6;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    border-left: 4px solid var(--primary-color);
}

.comparison-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.comparison-side h4 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.comparison-side ul {
    list-style: none;
}

.comparison-side li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.comparison-side:first-child li:before {
    content: "✗";
    position: absolute;
    left: 0;
    color: #ef5350;
    font-weight: bold;
}

.comparison-side:last-child li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4caf50;
    font-weight: bold;
}

/* Expanded pillar styles */
.pillar-detailed {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.pillar-card-expanded {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1), 0 1px 8px rgba(0,0,0,0.1);
    border-top: 5px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.pillar-card-expanded::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,111,0,0.03) 0%, transparent 70%);
    z-index: 1;
}

.pillar-card-expanded > * {
    position: relative;
    z-index: 2;
}

.munger-quote {
    font-size: 1.3rem;
    color: var(--primary-color);
    font-style: italic;
    background-color: #f8f9fa;
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
}

.detailed-applications {
    margin: 2rem 0;
}

.application-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--secondary-color);
}

.application-item h5 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.buffett-rules {
    background-color: #e8f5e8;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 2px solid #4caf50;
}

.buffett-rules p {
    margin: 0.5rem 0;
    font-weight: 600;
    color: #2e7d32;
}

.war-story {
    background-color: #fff3e0;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid var(--accent-color);
}

.tech-avoidance, .mrs-b-story {
    background-color: #e3f2fd;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid #2196f3;
}

.tech-avoidance h6, .mrs-b-story h6 {
    color: #1976d2;
    margin-bottom: 0.5rem;
}

.competence-requirements {
    background-color: #fce4ec;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    border: 2px solid #e91e63;
}

.competence-requirements h4 {
    color: #c2185b;
    margin-bottom: 1rem;
}

.formula-detailed {
    background-color: #f5f5f5;
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    text-align: center;
}

.safety-purpose, .flexible-margins {
    margin: 1.5rem 0;
}

.munger-wisdom {
    background-color: #e8eaf6;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.engineering-parallel {
    background-color: #f3e5f5;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.parallel-examples {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.parallel-item {
    background-color: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #9c27b0;
}

.parallel-item h5 {
    color: #7b1fa2;
    margin-bottom: 0.5rem;
}

/* Three pillar synthesis */
.three-pillar-synthesis {
    background-color: var(--primary-color);
    color: white;
    padding: 3rem;
    border-radius: 12px;
    margin-top: 3rem;
}

.three-pillar-synthesis h3 {
    color: white;
    text-align: center;
    margin-bottom: 2rem;
}

.defense-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.defense-step {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 8px;
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.defense-step h4 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.arrow {
    font-size: 2rem;
    color: var(--accent-color);
    font-weight: bold;
}

.munger-conclusion {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 8px;
    margin-top: 2rem;
    text-align: center;
}

.munger-conclusion blockquote {
    border-left: 4px solid var(--accent-color);
    color: white;
    font-size: 1.3rem;
}

/* Enhanced table styles */
.misjudgment-table {
    font-size: 0.95rem;
}

.misjudgment-table td:first-child {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 200px;
}

.misjudgment-table td:nth-child(2) {
    min-width: 250px;
}

.misjudgment-table td:nth-child(3) {
    min-width: 300px;
}

/* Bibliography styles */
.bibliography-content {
    max-width: 1000px;
    margin: 0 auto;
}

.citation-categories {
    display: grid;
    gap: 3rem;
    margin: 3rem 0;
}

.citation-category {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary-color);
}

.citation-category h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 0.5rem;
}

.citations {
    display: grid;
    gap: 1rem;
}

.citation {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
    transition: all 0.3s ease;
}

.citation:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
}

.citation-number {
    background-color: var(--accent-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.citation-text {
    flex: 1;
}

.citation-text strong {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.citation-text a {
    color: var(--secondary-color);
    text-decoration: none;
    word-break: break-word;
    font-size: 0.9rem;
}

.citation-text a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.bibliography-note {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-top: 3rem;
    text-align: center;
}

.bibliography-note h3 {
    color: white;
    margin-bottom: 1rem;
}

.bibliography-note p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* PWA Install Button */
.install-button {
    background: linear-gradient(135deg, var(--accent-color), #ff8f00);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 1rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    box-shadow: 0 2px 10px rgba(255, 111, 0, 0.3);
}

.install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 111, 0, 0.4);
}

/* PWA Mode Adjustments */
.pwa-mode #navbar {
    padding-top: env(safe-area-inset-top);
}

.pwa-mode .hero {
    padding-top: calc(10rem + env(safe-area-inset-top));
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f44336;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    display: none;
    z-index: 9999;
    animation: slideUp 0.3s ease;
}

.offline-indicator.show {
    display: block;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Responsive Design */
/* Small mobile devices */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 2rem;
        text-align: center;
    }
    
    h2 {
        font-size: 1.5rem;
        padding-left: 40px;
    }
    
    h2::before {
        width: 25px;
        height: 25px;
    }
    
    h2::after {
        width: 100px;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    .hero {
        padding: 6rem 1rem 3rem;
        text-align: center;
    }
    
    .search-input {
        padding: 0.8rem 0.8rem 0.8rem 2.5rem;
        font-size: 1rem;
    }
    
    .search-icon {
        left: 0.8rem;
    }
    
    .pillar-card-expanded,
    .toolkit-category,
    .challenge-card {
        padding: 1.5rem;
    }
    
    .misjudgment-table {
        font-size: 0.7rem;
    }
    
    .misjudgment-table th,
    .misjudgment-table td {
        padding: 0.3rem;
    }
    
    .back-to-top {
        bottom: 20px !important;
        right: 20px !important;
        width: 45px !important;
        height: 45px !important;
    }
    
    .nav-brand {
        font-size: 1.1rem;
    }
    
    .lang-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .theme-toggle {
        width: 35px;
        height: 35px;
    }
    
    .social-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Tablet and larger mobile devices */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--nav-bg);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow);
        border-radius: 0 0 10px 10px;
        z-index: 1000;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        margin: 0.5rem 0;
    }
    
    .nav-menu a {
        padding: 1rem;
        display: block;
        text-align: center;
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .nav-menu a:hover {
        background-color: var(--bg-light);
    }
    
    .nav-toggle {
        display: block;
        font-size: 1.5rem;
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
        cursor: pointer;
        user-select: none;
    }
    
    .language-toggle {
        margin-left: 0;
        margin-top: 1rem;
        justify-content: center;
        order: 1;
    }
    
    .theme-toggle {
        margin-left: 0;
        margin-top: 1rem;
        order: 2;
        min-width: 44px;
        min-height: 44px;
    }
    
    .nav-container {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .nav-menu {
        order: 3;
        width: 100%;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    .hero {
        padding: 7rem 1rem 4rem;
    }
    
    .pillar-grid,
    .toolkit-grid,
    .analysis-grid,
    .challenges-grid,
    .disciplines-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        margin: 1rem -1rem;
    }
    
    .misjudgment-table {
        font-size: 0.8rem;
    }
    
    .comparison-box {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .defense-flow {
        flex-direction: column;
        text-align: center;
    }
    
    .arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }
    
    .parallel-examples {
        grid-template-columns: 1fr;
    }
    
    .pillar-card-expanded {
        padding: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .stat {
        min-width: 200px;
    }
    
    .hero-icon img {
        width: 60px;
        height: 60px;
    }
    
    h2 {
        font-size: 2rem;
        padding-left: 50px;
    }
    
    h2::before {
        width: 30px;
        height: 30px;
    }
    
    .cta-button {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
    
    .social-buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }
    
    .social-btn {
        min-width: 200px;
        padding: 1rem 2rem;
        min-height: 44px;
    }
    
    /* Improve search for mobile */
    .search-box {
        max-width: 100%;
        margin: 0 1rem;
    }
    
    .search-results {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .search-result-item {
        margin-bottom: 0.8rem;
        padding: 1rem;
    }
    
    /* Better touch targets */
    .lang-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.8rem 1rem;
    }
    
    .pillar-card,
    .toolkit-category,
    .challenge-card {
        margin-bottom: 1rem;
    }
    
    /* Improved table scrolling on mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    
    /* Better spacing for mobile content */
    .section {
        padding: 3rem 0;
    }
    
    .subsection {
        margin-bottom: 2rem;
    }
    
    /* Mobile-optimized formulas */
    .formula {
        font-size: 0.9rem;
        padding: 0.8rem;
        word-break: break-all;
    }
    
    /* Mobile hero adjustments */
    .hero-content {
        text-align: center;
    }
    
    .cta-button {
        width: 100%;
        max-width: 300px;
        margin: 1rem auto;
        display: block;
    }
}

/* Large mobile and small tablets */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 0 2rem;
    }
    
    h1 {
        font-size: 2.8rem;
    }
    
    h2 {
        font-size: 2.2rem;
    }
    
    .pillar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .disciplines-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .pillar-grid,
    .toolkit-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .disciplines-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .container {
        max-width: 90%;
    }
}