/* Honey & ink revision — values now flow from tokens.css (load it before this file). */
/* ============================================
   Explorable Explanations - Main Stylesheet
   Common styles for all pages
   ============================================ */

/* CSS Variables */
:root {
    /* Legacy aliases — kept so every existing page and inline style keeps
       working. Values now come from tokens.css; change them THERE. */
    --primary-color: var(--gold-400);
    --secondary-color: var(--gold-500);
    --text-color: var(--ink-800);
    --background-color: var(--surface-page);
    --link-color: var(--link);
    --link-hover-color: var(--link-hover);
    --section-bg: var(--surface-card);
    --border-radius: var(--radius-lg);
    --box-shadow: var(--shadow-card);
    --transition-speed: var(--transition);
}

/* Global Reset & Box-Sizing */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Body & Layout */
body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-color);
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--background-color);
}

/* Header */
header {
    background-color: var(--primary-color);
    color: var(--text-color);
    text-align: center;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

/* Breadcrumb Navigation */
.breadcrumb {
    font-size: 0.85em;
    margin-bottom: 8px;
    padding: 5px 12px;
    background-color: rgba(242, 196, 25, 0.15);
    border-radius: var(--border-radius);
    color: var(--ink-400);
}

.breadcrumb a {
    color: var(--link-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    margin: 0 5px;
    color: var(--ink-200);
}

.breadcrumb-current {
    color: var(--text-color);
}

/* Typography */
h1 {
    font-size: 2.5em;
    font-variant: small-caps;
    margin-bottom: 10px;
}

h2 {
    color: var(--gold-700);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

h3 {
    color: var(--text-color);
    margin: 15px 0 10px 0;
}

h4 {
    color: var(--gold-700);
    margin: 10px 0;
}

.subtitle {
    font-style: italic;
    font-size: 1.2em;
    margin-bottom: 2px;
}

.subtitle-desc {
    font-style: italic;
    font-size: 1em;
    color: var(--ink-600);
    margin-top: 0;
    margin-bottom: 2px;
}

.subtitle-attribution {
    font-size: 0.8em;
    color: var(--ink-300);
    margin-top: 0;
    margin-bottom: 2px;
}

p, ul, ol {
    margin-bottom: 15px;
}

ul, ol {
    padding-left: 25px;
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover, a:focus {
    color: var(--link-hover-color);
    text-decoration: underline;
}

/* Main Container & Grid */
.container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Content Sections */
.content-section, .simulation-section {
    background-color: var(--section-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

/* Special Content Boxes */
.equation-box {
    background-color: var(--surface-sunken);
    border-left: var(--rule-bar) solid var(--primary-color);
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.equation-box ol, .equation-box ul {
    margin-bottom: 10px;
}

.key-point {
    background-color: var(--gold-200);
    border-left: var(--rule-bar) solid var(--warning);
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.key-point ol, .key-point li {
    padding-left: 25px;
    margin-left: 15px;
    margin-bottom: 8px;
}

/* Buttons */
button, .control-button, #submit-quiz {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: none;
    padding: 10px 20px;
    margin: 5px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: background-color var(--transition-speed);
}

button:hover, .control-button:hover, #submit-quiz:hover {
    background-color: var(--secondary-color);
}

button:active, .control-button:active {
    transform: scale(0.98);
}

#button-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
    flex-wrap: wrap;
}

/* Canvas & Sketch Holders */
#sketch-holder, #react-visualizer {
    width: 100%;
    height: fit-content;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background-color: var(--surface-sunken);
    margin: 10px 0;
}

#react-visualizer {
    padding: 20px;
    background-color: var(--section-bg);
    box-shadow: var(--box-shadow);
    margin: 20px auto;
}

/* Tables */
.equation-table {
    overflow-x: auto;
    margin: 20px 0;
}

.equation-table table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background-color: var(--surface-card);
}

.equation-table th, .equation-table td {
    text-align: left;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-default);
}

.equation-table th {
    background-color: var(--primary-color);
    color: var(--text-color);
    font-weight: bold;
}

.equation-table tr:nth-child(even) {
    background-color: var(--surface-sunken);
}

.equation-table tr:hover {
    background-color: var(--surface-muted);
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--text-color);
    text-align: center;
    padding: 15px;
    margin-top: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-footer);
    font-family: var(--font-body);
    line-height: 1.6;
}

footer p {
    margin: 5px 0;
}

footer .small-caps {
    font-variant: small-caps;
    font-size: 0.9em;
    color: var(--ink-600);
}

footer .footer-links {
    margin-top: 10px;
}

footer a {
    color: var(--gold-600);
    text-decoration: none;
    transition: color var(--transition-speed);
}

footer a:hover, footer a:focus {
    color: var(--link-hover);
    text-decoration: underline;
}

footer .footer-last-updated {
    margin-top: 10px;
    font-size: 0.8em;
    opacity: 0.7;
}

footer .back-link {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 10px;
    background-color: var(--secondary-color);
    border-radius: var(--radius-xs);
    color: var(--text-color);
    font-weight: bold;
}

footer .back-link:hover {
    background-color: var(--gold-600);
    color: #fff;
}

/* Responsive Design */
@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2em;
    }

    .equation-table {
        font-size: 0.9em;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 1rem;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.5em;
    }

    h3 {
        font-size: 1.2em;
    }

    .content-section, .simulation-section {
        padding: 15px;
    }

    .equation-box, .key-point {
        padding: 10px;
    }

    button, .control-button {
        padding: 8px 15px;
    }

    footer {
        padding: 10px;
    }
}

@media (max-width: 576px) {
    h1 {
        font-size: 1.6em;
    }

    .equation-table td, .equation-table th {
        padding: 8px 10px;
    }

    .equation-table {
        font-size: 0.8em;
    }

    footer {
        padding: 10px;
        font-size: 0.9em;
    }
}

@media (max-width: 320px) {
    body {
        padding: 5px;
    }

    header {
        padding: 0.8rem;
    }

    h1 {
        font-size: 1.4em;
    }

    .content-section, .simulation-section {
        padding: 10px;
    }
}
