/* DIT 2026 Assessment — Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #6b7280;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Nav */
.top-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Container */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.25rem 2rem 2rem;
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 0.75rem;
}
.hero h1 {
    font-size: 1.85rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}
.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0 auto 0.3rem;
    white-space: nowrap;
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}
.alert-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
}

/* Mode Cards */
.mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
}
.mode-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}
.mode-card:hover { box-shadow: var(--shadow-lg); }
.mode-card.disabled { opacity: 0.6; }
.mode-icon { font-size: 1.5rem; margin-right: 0.4rem; vertical-align: middle; }
.mode-card h2 { margin-bottom: 0.4rem; font-size: 1.15rem; }
.mode-card p { color: var(--text-muted); margin-bottom: 0.6rem; font-size: 0.9rem; }
.features {
    list-style: none;
    margin-bottom: 1.25rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem 0.75rem;
}
.features li {
    padding: 0.15rem 0;
    padding-left: 1.1rem;
    position: relative;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.features li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}
.hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }

/* Framework Axes (used in overview tab) */
.framework-axes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 1.5rem 0;
}
.axis h3 { margin-bottom: 0.75rem; color: var(--primary); }
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.mini-table td:first-child { font-weight: 600; width: 2.5rem; }

.key-insight {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    padding: 1.25rem 1.5rem;
    margin-top: 1.5rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--text);
}
.key-insight cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: normal;
}
.quick-links {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
}
.quick-links a { color: var(--primary); text-decoration: none; }
.quick-links a:hover { text-decoration: underline; }
.quick-links-sep { color: var(--text-muted); }
.framework-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}
.evolving-note {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem;
    font-style: italic;
}
.evolving-note a { color: var(--primary); }
.framework-preview > p:first-of-type {
    font-size: 1.05rem;
    color: var(--text);
    margin-top: 0.5rem;
}

/* Assessment */
.assessment-container { max-width: 960px; margin: 0 auto; }

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    width: 0%;
}
.progress-text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

#saeStage, #epiasStage {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
    align-items: start;
}
.stage-sidebar {}
.stage-main {}
.stage h2 { margin-bottom: 0.5rem; font-size: 1.15rem; }
.stage-desc { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

.question-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}
.question-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}
.option-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.option-item {
    display: block;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.85rem;
    line-height: 1.35;
}
.option-item:hover { border-color: var(--primary); background: var(--primary-light); }
.option-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    font-weight: 500;
}
.option-item input { display: none; }

.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
}

/* Loading */
.loading-spinner {
    text-align: center;
    padding: 3rem 0;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.results-container { max-width: 800px; margin: 0 auto; overflow-x: hidden; width: 100%; box-sizing: border-box; }

.result-header {
    text-align: center;
    margin-bottom: 2rem;
}
.placement-badge {
    display: inline-flex;
    gap: 0.75rem;
    margin-top: 1rem;
}
.badge-level, .badge-stage {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 1.1rem;
}
.badge-level {
    background: var(--primary);
    color: white;
}
.badge-stage {
    background: var(--success);
    color: white;
}

.result-description {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    font-size: 1.05rem;
    box-shadow: var(--shadow);
}

/* Matrix */
.matrix-section { margin-bottom: 2rem; }
#matrixContainer {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.matrix-table th, .matrix-table td {
    padding: 0.6rem;
    border: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
}
.matrix-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.75rem;
}
.matrix-table td { min-width: 100px; }
.matrix-cell {
    transition: all 0.2s;
    cursor: default;
    position: relative;
    min-height: 40px;
}
.matrix-cell:hover { background: #f1f5f9; }
.matrix-cell.current {
    background: var(--primary-light);
    border: 2px solid var(--primary);
    font-weight: 600;
}
.matrix-cell.current::after {
    content: "\2605";
    position: absolute;
    top: 2px;
    right: 4px;
    color: var(--primary);
}
.matrix-cell.next-step {
    background: #d1fae5;
    border: 2px dashed var(--success);
}

/* Growth Path */
.growth-section { margin-bottom: 2rem; }
.growth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.growth-next {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.growth-signal {
    margin-bottom: 1rem;
}
.growth-signal blockquote {
    background: var(--primary-light);
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--primary);
    margin-top: 0.5rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}
.growth-actions ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
}
.growth-actions li {
    margin-bottom: 0.25rem;
}

/* Insight */
.insight-section { margin-bottom: 2rem; }

/* Related Chunks */
.related-section { margin-bottom: 2rem; }
.chunk-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}
.chunk-source {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.chunk-text { line-height: 1.5; }
.chunk-text p { margin: 0.25rem 0; }
.chunk-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.85rem;
}
.chunk-table th, .chunk-table td {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}
.chunk-table th {
    background: var(--bg);
    font-weight: 600;
}
.chunk-table td { vertical-align: top; }

/* Result Actions */
.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    max-width: 800px;
    margin: 0 auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.chat-header h2 {
    white-space: nowrap;
}
.model-bar {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
}
.model-bar-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.model-bar-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.model-bar-group select {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.model-bar-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.message {
    margin-bottom: 1.25rem;
    display: flex;
}
.message.user { justify-content: flex-end; }
.message-content {
    max-width: 80%;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    line-height: 1.5;
}
.message.user .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}
.message.assistant .message-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 2px;
}
.message-content p { margin-bottom: 0.5rem; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul, .message-content ol { padding-left: 1.5rem; margin: 0.4rem 0 0.5rem; }
.message-content li { margin-bottom: 0.3rem; }

.chat-input-area {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}
.suggested-questions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.suggestion {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 20px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}
.suggestion:hover {
    background: var(--primary);
    color: white;
}

.chat-form {
    display: flex;
    gap: 0.5rem;
}
.chat-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
}
.chat-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.chat-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: right;
}

.sources-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}
.sources-panel h3 { margin-bottom: 0.5rem; font-size: 0.9rem; }

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1.25rem;
}
.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Framework Reader */
.framework-reader { max-width: 800px; margin: 0 auto; overflow-x: hidden; width: 100%; box-sizing: border-box; }

.author-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}
.author-attribution {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.author-attribution strong { font-size: 1.05rem; }
.author-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.author-detail a { color: var(--primary); }
.author-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    font-style: italic;
}

.reader-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 2rem;
}
.reader-tab {
    padding: 0.6rem 1.25rem;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}
.reader-tab:hover { color: var(--text); }
.reader-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.reader-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
    box-shadow: var(--shadow);
    line-height: 1.7;
    font-size: 0.95rem;
    overflow-x: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.reader-content h1 { font-size: 1.8rem; margin: 0 0 1rem; }
.reader-content h2 { font-size: 1.35rem; margin: 1.75rem 0 0.75rem; color: var(--primary); }
.reader-content h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
.reader-content h4 { font-size: 1rem; margin: 1rem 0 0.5rem; }
.reader-content p { margin: 0.6rem 0; }
.reader-content ul, .reader-content ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.reader-content li { margin-bottom: 0.35rem; }
.reader-content blockquote {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}
.reader-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}
.reader-content code {
    background: var(--bg);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
}
.reader-content a { color: var(--primary); }
.reader-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1rem 0;
    display: block;
}
.reader-content .chunk-table {
    margin: 1rem 0;
    width: 100%;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.reader-content .chunk-table th,
.reader-content .chunk-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
    font-size: 0.9rem;
}
.reader-content .chunk-table th {
    background: var(--bg);
    font-weight: 600;
}
.reader-content .chunk-table thead,
.reader-content .chunk-table tbody,
.reader-content .chunk-table tr {
    display: revert;
}

.reader-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding-top: 1rem;
}

/* Settings */
.settings-container { max-width: 700px; margin: 0 auto; }
.settings-container h1 { margin-bottom: 0.25rem; }
.settings-container > .subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }

.key-cards { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.key-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.key-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}
.key-header h3 { font-size: 1.05rem; }
.key-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: var(--border);
    color: var(--text-muted);
    font-weight: 600;
}
.key-badge.active {
    background: #d1fae5;
    color: #065f46;
}
.key-model {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.key-card input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.9rem;
}
.key-card input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.key-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}
.key-hint a { color: var(--primary); }

.settings-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}
.settings-note {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    font-size: 0.9rem;
}
.settings-note h3 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.settings-note code {
    background: var(--surface);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.alert-success {
    background: #d1fae5;
    border: 1px solid var(--success);
    color: #065f46;
}

/* Footer */
/* Chat Demo Notice */
.chat-demo-notice {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
    margin-top: 1rem;
    text-align: left;
    box-shadow: var(--shadow);
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}
/* When demo notice is shown, don't force full-height chat container */
.chat-container:has(.chat-demo-notice) {
    height: auto;
    overflow: visible;
}
.chat-demo-notice h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}
.chat-demo-notice p {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}
.chat-demo-notice pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    text-align: left;
    overflow-x: auto;
    margin: 1rem 0;
    max-width: 500px;
}
.chat-demo-notice code {
    font-size: 0.85rem;
    line-height: 1.6;
}
.chat-demo-notice .btn {
    margin-top: 0.5rem;
    display: inline-block;
}

/* Heatmap */
.heatmap-cell {
    transition: all 0.2s;
    cursor: default;
    min-height: 50px;
    font-weight: 600;
    font-size: 1.1rem;
}
.heatmap-cell:hover {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.heatmap-legend-bar {
    width: 200px;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right, #f8fafc, var(--primary));
    border: 1px solid var(--border);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.site-footer a { color: var(--primary); }

/* Responsive — Tablet */
@media (max-width: 768px) {
    .mode-cards, .framework-axes { grid-template-columns: 1fr; }
    #saeStage, #epiasStage { grid-template-columns: 1fr; }
    .option-list { gap: 0.35rem; }
    .hero h1 { font-size: 1.7rem; }
    .subtitle { white-space: normal; }
    .container { padding: 1rem; }
    .top-nav { padding: 0.75rem 1rem; }
    .reader-content { padding: 1.5rem; }
    .chat-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .model-bar { width: 100%; }
    .matrix-table td { min-width: 75px; }
    .matrix-table th, .matrix-table td { padding: 0.4rem; font-size: 0.75rem; }
    .placement-badge { flex-direction: column; gap: 0.5rem; }
    .result-actions { flex-wrap: wrap; justify-content: center; }
}

/* Responsive — Mobile */
@media (max-width: 480px) {
    /* Global */
    .container { padding: 0.75rem; }
    .top-nav { padding: 0.5rem 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
    .nav-links { gap: 1rem; font-size: 0.85rem; }

    /* Hero */
    .hero h1 { font-size: 1.3rem; }
    .subtitle { font-size: 0.85rem; white-space: normal; }
    .quick-links { font-size: 0.8rem; }

    /* Mode Cards */
    .mode-card { padding: 1rem; }
    .mode-card h2 { font-size: 1.05rem; }
    .mode-card p { font-size: 0.85rem; }
    .features { grid-template-columns: 1fr; gap: 0.1rem; margin-bottom: 1rem; }
    .features li { font-size: 0.8rem; }
    .btn { padding: 0.6rem 1.25rem; font-size: 0.9rem; }

    /* Framework Overview (inside reader) */
    .framework-axes { gap: 1rem; margin: 1rem 0; }
    .mini-table td { padding: 0.3rem 0.5rem; font-size: 0.8rem; }
    .key-insight { padding: 0.75rem 1rem; font-size: 0.9rem; }

    /* Assessment */
    .question-card { padding: 1rem; }
    .question-card h3 { font-size: 0.9rem; }
    .option-item { padding: 0.65rem 0.85rem; font-size: 0.85rem; }
    .nav-buttons { gap: 0.5rem; }
    .nav-buttons .btn { padding: 0.5rem 1rem; font-size: 0.85rem; }
    .stage h2 { font-size: 1.05rem; }
    .stage-desc { font-size: 0.85rem; }

    /* Results */
    .result-header h1 { font-size: 1.2rem; }
    .placement-badge { flex-direction: column; gap: 0.5rem; }
    .badge-level, .badge-stage { font-size: 0.85rem; padding: 0.35rem 0.75rem; }
    .result-description { padding: 0.75rem; font-size: 0.88rem; }
    .matrix-section h2 { font-size: 1.05rem; }
    #matrixContainer { padding: 0.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .matrix-table { font-size: 0.65rem; }
    .matrix-table td { min-width: 50px; }
    .matrix-table th, .matrix-table td { padding: 0.25rem 0.2rem; font-size: 0.6rem; }
    .matrix-table th { font-size: 0.55rem; }
    .matrix-cell { min-height: 28px; }
    .growth-section h2 { font-size: 1.05rem; }
    .growth-card { padding: 0.75rem; font-size: 0.88rem; }
    .growth-next { font-size: 0.95rem; }
    .growth-signal blockquote { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
    .growth-actions ul { padding-left: 1.25rem; }
    .growth-actions li { font-size: 0.85rem; }
    .insight-section .key-insight { font-size: 0.85rem; padding: 0.6rem 0.85rem; }
    .related-section h2 { font-size: 1.05rem; }
    .chunk-card { padding: 0.75rem; font-size: 0.82rem; }
    .chunk-source { font-size: 0.7rem; }
    .chunk-table th, .chunk-table td { padding: 0.25rem 0.4rem; font-size: 0.75rem; }
    .result-actions { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .result-actions .btn { text-align: center; font-size: 0.88rem; }

    /* Chat */
    .chat-container { height: calc(100vh - 100px); }
    .chat-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .chat-header h2 { font-size: 1.1rem; white-space: normal; }
    .model-bar { width: 100%; flex-direction: column; gap: 0.4rem; }
    .model-bar-group { width: 100%; }
    .model-bar-group select { width: 100%; }
    .model-bar-group label { font-size: 0.75rem; }
    .message-content { max-width: 90%; padding: 0.6rem 1rem; font-size: 0.9rem; }
    .suggestion { font-size: 0.75rem; padding: 0.3rem 0.6rem; }
    .chat-form input { padding: 0.6rem 0.75rem; font-size: 0.9rem; }
    .chat-demo-notice { padding: 1rem; }
    .chat-demo-notice h3 { font-size: 1.1rem; }
    .chat-demo-notice p { font-size: 0.85rem; }
    .chat-demo-notice pre { padding: 0.6rem; margin: 0.75rem 0; max-width: 100%; font-size: 0.75rem; }
    .chat-demo-notice code { font-size: 0.75rem; }

    /* Framework Reader */
    .reader-content { padding: 0.75rem; font-size: 0.85rem; }
    .reader-content h1 { font-size: 1.2rem; }
    .reader-content h2 { font-size: 1.05rem; }
    .reader-content h3 { font-size: 0.9rem; }
    .reader-content .chunk-table th,
    .reader-content .chunk-table td { padding: 0.3rem 0.4rem; font-size: 0.75rem; }
    .reader-tab { padding: 0.4rem 0.6rem; font-size: 0.75rem; }
    .reader-tabs { gap: 0; }
    .author-banner { padding: 0.6rem 0.75rem; }
    .author-attribution strong { font-size: 0.9rem; }
    .author-detail { font-size: 0.7rem; }
    .author-note { font-size: 0.75rem; }
    .reader-nav { flex-direction: column; gap: 0.5rem; }
    .reader-nav .btn { text-align: center; }
}

/* Print styles for PDF download */
@media print {
    .top-nav, .site-footer, .result-actions, .nav-buttons { display: none !important; }
    body { background: white; }
    .container { max-width: 100%; padding: 0; }
    .results-container { max-width: 100%; }
    .result-header { margin-bottom: 1rem; }
    .matrix-table { font-size: 0.7rem; }
    .chunk-card { break-inside: avoid; }
    .growth-card { break-inside: avoid; }
}
