/* --- Styles --- */
body {
    font-family: 'Lato', sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    line-height: 1.8;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
}

main {
    max-width: 900px;
    width: 100%;
    padding: 2rem;
    box-sizing: border-box;
}

h1,
h2,
h3,
h4 {
    font-family: 'Lato', sans-serif;
    color: #2c3e50;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 2.6rem;
    text-align: center;
    border-bottom: 3px solid #ced4da;
    padding-bottom: 1.5rem;
    margin-top: 1rem;
    font-weight: 700;
}

h2 {
    font-size: 1.8rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.5rem;
    color: #34495e;
    margin-top: 4rem;
}

h3 {
    font-size: 1.4rem;
    color: #555;
    font-weight: 600;
    margin-top: 2.5rem;
}

h4 {
    font-size: 1.2rem;
    color: #666;
    font-weight: 600;
    font-style: italic;
    margin-bottom: 0.5rem;
}

p,
li {
    font-size: 1.15rem;
    margin-bottom: 1.2rem;
    text-align: justify;
    color: #333;
}

ul {
    margin-bottom: 1.5rem;
}

li {
    margin-bottom: 0.8rem;
}

blockquote {
    border-left: 5px solid #007bff;
    margin: 2.5rem 0;
    background-color: #f1f3f5;
    padding: 1.5rem 2.5rem;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.term {
    font-weight: bold;
    color: #c0392b;
}

/* Equation Style */
.equation {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    background: #e8f4fd;
    padding: 0 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.equation-block {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    background: #e8f4fd;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    margin: 2rem 0;
    border: 1px solid #d0e3f0;
    font-size: 1.4rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

pre {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
}

/* --- Table Styles --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 3rem 0;
    background-color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    font-size: 1rem;
}

th,
td {
    padding: 1.2rem;
    border: 1px solid #dee2e6;
    text-align: left;
    vertical-align: top;
}

th {
    background-color: #f8f9fa;
    font-weight: 700;
    color: #2c3e50;
}

tr:nth-child(even) {
    background-color: #f8fcfd;
}

/* --- Simulation UI --- */
.simulation-wrapper {
    background-color: #1a1a1a;
    color: #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 12px;
    margin: 4rem 0;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid #333;
    touch-action: pan-y;
}

.canvas-holder {
    width: 100%;
    max-width: 800px;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
    touch-action: none;
}

.controls {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    background-color: #2d2d2d;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: center;
    box-sizing: border-box;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.controls label {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 5px;
}

/* Custom Range Slider */
.controls input[type="range"] {
    width: 100%;
    cursor: pointer;
    accent-color: #007bff;
}

button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    background-color: #0056b3;
}

/* Highlighting for Key Sections */
.highlight-section {
    background: #fdfdfe;
    border-left: 6px solid #2ecc71;
    padding: 2rem;
    margin: 3rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.technical-note {
    background-color: #fffcf0;
    border: 1px solid #f0e0c0;
    color: #705000;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    font-size: 1rem;
}

.fraction {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    font-size: 0.9em;
}

.fraction>span {
    display: block;
    padding: 0 5px;
}

.fraction span.numerator {
    border-bottom: 1px solid #2c3e50;
    /* Dark blue to match CMFT theme */
}

.fraction span.denominator {
    display: block;
}

/* Helper classes from the source content */
.vector {
    font-weight: bold;
    font-style: normal;
}

.variable {
    font-style: italic;
}

/* Table of Contents */
.toc-container {
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.toc-title {
    font-family: 'Lato', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid #f39c12;
    display: inline-block;
    padding-bottom: 5px;
}

.toc-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.6rem;
    font-size: 1rem;
}

.toc-list a {
    text-decoration: none;
    color: #007bff;
    transition: color 0.2s;
}

.toc-list a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.toc-number {
    display: inline-block;
    width: 30px;
    font-weight: bold;
    color: #555;
}

footer {
    margin-top: 5rem;
    text-align: center;
    border-top: 1px solid #dee2e6;
    padding-top: 2rem;
    color: #6c757d;
}

/* --- Section 12 Simulation Styles --- */
.sim-container {
    background-color: #111;
    color: #eee;
    padding: 20px;
    border-radius: 8px;
    margin: 30px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-family: "Helvetica Neue", "Arial", sans-serif;
}

.sim-title {
    color: #e74c3c;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sim-container canvas {
    width: 100%;
    height: 300px;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    display: block;
}

.stat-box {
    background: #1a1a1a;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #e74c3c;
    text-align: center;
}

.stat-val {
    font-size: 1.4rem;
    font-weight: bold;
    font-family: "Courier New", monospace;
}

.stat-lbl {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
}

.sim-note {
    font-size: 0.85rem;
    color: #aaa;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}