/* FRACTURED CROWN TEXTBOOK - LIGHT MODE (DEFAULT/PRINTABLE) */
/* Based on working 419-page PDF source */

@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;600;700&family=Nunito:wght@400;600;700&family=Kalam:wght@400;700&display=swap');

/* ==================== PRINT SETTINGS ==================== */
@page {
    size: 8.5in 11in;
    margin: 1in;
    @bottom-center {
        content: counter(page);
        font-family: 'Comfortaa', sans-serif;
        font-size: 10pt;
        color: #666;
    }
}

@page:first {
    @bottom-center {
        content: none;
    }
}

/* ALWAYS print in light mode */
@media print {
    body {
        background: white !important;
        color: #2a2a2a !important;
    }
    .textbook-page {
        background: white !important;
        color: #2a2a2a !important;
    }
    .no-print {
        display: none !important;
    }
    .statutory-text {
        background: white !important;
        color: #2a2a2a !important;
    }
}

/* ==================== LIGHT MODE (DEFAULT) ==================== */
body {
    font-family: 'Comfortaa', 'Nunito', sans-serif;
    font-size: 15pt;
    line-height: 1.15;
    color: #2a2a2a;
    background: white;
    text-align: justify;
    hyphens: auto;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

.textbook-page {
    max-width: 8.5in;
    margin: 0 auto;
    padding: 1in;
    background: white;
    color: #2a2a2a;
}

/* ==================== DARK MODE OVERRIDE ==================== */
body.dark-mode {
    background: #0d0d0d;
    color: #e0e0e0;
}

body.dark-mode .textbook-page {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .story-text {
    color: #e0e0e0;
}

body.dark-mode .chapter-title {
    color: #c896ff;
    border-bottom-color: #c896ff;
}

body.dark-mode .chapter-subtitle {
    color: #9d8ab8;
}

body.dark-mode .ancient-text {
    background: rgba(200, 150, 255, 0.1);
    border-left-color: #c896ff;
    color: #d4c5f9;
}

body.dark-mode .analysis-block {
    background: rgba(200, 150, 255, 0.05);
    border-left-color: #c896ff;
    color: #e0e0e0;
}

body.dark-mode .margin-note {
    background: rgba(255, 215, 0, 0.1);
    color: #ffd700;
}

body.dark-mode .statute {
    color: #ffd700;
}

body.dark-mode .statutory-text {
    background: #1a1a1a;
    color: #e0e0e0;
    border-color: #c896ff;
}

body.dark-mode .statutory-index {
    color: #e0e0e0;
}

body.dark-mode h3 {
    color: #c896ff;
}

body.dark-mode hr {
    border-color: #444;
}

/* ==================== NAVIGATION ==================== */
.textbook-nav {
    background: #f5f5f5;
    padding: 15px;
    text-align: center;
    border-bottom: 2px solid #8b0000;
    position: sticky;
    top: 0;
    z-index: 100;
}

body.dark-mode .textbook-nav {
    background: #2a2a2a;
    border-bottom-color: #c896ff;
}

.textbook-nav a {
    color: #8b0000;
    text-decoration: none;
    margin: 0 20px;
    font-family: 'Comfortaa', sans-serif;
    font-weight: 600;
}

body.dark-mode .textbook-nav a {
    color: #c896ff;
}

.textbook-nav a:hover {
    text-decoration: underline;
}

/* ==================== DARK MODE TOGGLE BUTTON ==================== */
.dark-mode-toggle {
    position: fixed;
    top: 80px;
    right: 20px;
    background: #8b0000;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-family: 'Comfortaa', sans-serif;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: all 0.3s;
}

body.dark-mode .dark-mode-toggle {
    background: #c896ff;
    color: #1a1a1a;
}

.dark-mode-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 8px rgba(0,0,0,0.4);
}

/* ==================== CHAPTER ELEMENTS ==================== */
.chapter-title {
    font-family: 'Comfortaa', sans-serif;
    font-size: 24pt;
    font-weight: 700;
    color: #8b0000;
    border-bottom: 3pt solid #8b0000;
    padding-bottom: 8pt;
    margin-top: 0;
    margin-bottom: 0.25in;
    page-break-after: avoid;
}

.chapter-subtitle {
    font-family: 'Comfortaa', sans-serif;
    font-size: 14pt;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.2in;
}

body.dark-mode .chapter-subtitle {
    color: #9d8ab8;
}

.story-text {
    font-family: 'Nunito', sans-serif;
    font-size: 15pt;
    line-height: 1.6;
    margin-bottom: 0.15in;
    color: #2a2a2a;
}

.ancient-text {
    font-family: 'Comfortaa', sans-serif;
    font-size: 15pt;
    font-style: italic;
    background: rgba(139, 0, 0, 0.05);
    border-left: 4px solid #8b0000;
    padding: 12pt;
    margin: 0.15in 0;
    color: #555;
}

.analysis-block {
    font-family: 'Kalam', cursive;
    font-size: 15pt;
    line-height: 1.8;
    background: rgba(139, 0, 0, 0.02);
    border-left: 3px solid #8b0000;
    padding: 10pt;
    margin: 0.15in 0;
    color: #2a2a2a;
}

.margin-note {
    font-size: 15pt;
    background: rgba(255, 215, 0, 0.15);
    border-left: 3px solid #ffd700;
    padding: 8pt;
    margin: 0.1in 0;
    color: #2a2a2a;
}

.statute {
    font-weight: 700;
    color: #8b0000;
}

body.dark-mode .margin-note .statute {
    color: #ffd700;
}

/* ==================== STATUTORY TEXT SECTION ==================== */
.statutory-text {
    background: white;
    border: 2px solid #8b0000;
    padding: 20pt;
    margin-top: 0.5in;
    page-break-before: always;
    color: #2a2a2a;
}

.statutory-index {
    margin-bottom: 0.3in;
    page-break-before: always;
}

body.dark-mode .statutory-index h2 {
    color: #c896ff;
}

h3 {
    font-family: 'Comfortaa', sans-serif;
    font-size: 14pt;
    font-weight: 700;
    color: #8b0000;
    margin-top: 0.2in;
    margin-bottom: 0.1in;
}

hr {
    border: none;
    border-top: 1px solid #ccc;
    margin: 0.2in 0;
}

/* ==================== SPECIAL CONTENT BLOCKS ==================== */

/* Binary code styling */
.binary-code {
    font-family: 'Courier New', monospace;
    background: #f5f5f5;
    padding: 10pt;
    margin: 10pt 0;
    color: #2a2a2a;
    font-size: 15pt;
    line-height: 1.4;
    border-left: 3px solid #8b0000;
}

body.dark-mode .binary-code {
    background: #2a2a2a;
    color: #00ff00;
    border-left-color: #00ff00;
}

/* Patent claims styling */
.patent-claims {
    background: #f5f5f5;
    border: 2px solid #8b0000;
    padding: 20pt;
    margin: 20pt 0;
    font-family: 'Courier New', monospace;
    color: #2a2a2a;
    font-size: 14pt;
    line-height: 1.6;
}

body.dark-mode .patent-claims {
    background: #2a1a2a;
    border-color: #c896ff;
    color: #e0e0e0;
}

.patent-claims h4 {
    color: #8b0000;
    margin-top: 0;
    font-size: 16pt;
}

body.dark-mode .patent-claims h4 {
    color: #c896ff;
}

/* Syntax tree styling */
.syntax-tree {
    font-family: 'Courier New', monospace;
    padding: 15pt 0;
    margin: 15pt 0;
    color: #2a2a2a;
    font-size: 15pt;
    line-height: 1.6;
}

body.dark-mode .syntax-tree {
    color: #00ff00;
}

.syntax-tree pre {
    margin: 0;
    color: #2a2a2a;
    font-size: 15pt;
    white-space: pre;
}

body.dark-mode .syntax-tree pre {
    color: #00ff00;
}

/* Malacar notification styling */
.malacar-notice {
    background: rgba(139, 0, 0, 0.1);
    border: 2px solid #8b0000;
    padding: 15pt;
    margin: 15pt 0;
    font-family: 'Courier New', monospace;
    color: #8b0000;
    font-size: 15pt;
}

body.dark-mode .malacar-notice {
    background: #3a1a1a;
    border-color: #c896ff;
    color: #c896ff;
}

/* Email styling */
.email-notice {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #ffd700;
    padding: 15pt;
    margin: 15pt 0;
    font-family: 'Courier New', monospace;
    color: #2a2a2a;
    font-size: 15pt;
}

body.dark-mode .email-notice {
    background: #1a1a2a;
    border-color: #ffd700;
    color: #ffd700;
}

/* Comparison table styling */
.comparison-table {
    background: #f5f5f5;
    padding: 15pt;
    margin: 15pt 0;
    border: 1px solid #8b0000;
}

body.dark-mode .comparison-table {
    background: #2a2a2a;
    border-color: #c896ff;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th {
    background: rgba(139, 0, 0, 0.1);
    color: #8b0000;
    padding: 8pt;
    text-align: left;
    border-bottom: 2px solid #8b0000;
}

body.dark-mode .comparison-table th {
    background: #3a1a3a;
    color: #c896ff;
    border-bottom-color: #c896ff;
}

.comparison-table td {
    padding: 8pt;
    border-bottom: 1px solid #ccc;
    vertical-align: top;
    color: #2a2a2a;
}

body.dark-mode .comparison-table td {
    border-bottom-color: #444;
    color: #e0e0e0;
}

/* ==================== FOOTER ==================== */
.chapter-footer {
    margin-top: 0.5in;
    padding-top: 0.2in;
    border-top: 2px solid #8b0000;
    text-align: center;
    color: #666;
    font-size: 15pt;
}

body.dark-mode .chapter-footer {
    border-top-color: #c896ff;
    color: #999;
}
