/* ============================================
   Drift — CSS
   Dark, clean, content-first.
   ============================================ */

/* --- Accessibility --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #1a1a2e;
    --bg-surface: #1f1f35;
    --bg-elevated: #252542;
    --text: #e8e6e3;
    --text-muted: #9a98a6;
    --text-faint: #6b6980;
    --accent: #5eaaa8;
    --accent-hover: #7cc5c3;
    --border: #2e2e4a;
    --code-bg: #13132a;
    --max-width: 720px;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

html {
    font-size: 17px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Header --- */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.site-logo:hover {
    color: var(--accent);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.75rem;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

/* --- Main Content --- */
.content-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

h1 { font-size: 2rem; letter-spacing: -0.03em; margin-top: 0; }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1.2rem; }

p {
    margin-bottom: 1.25rem;
}

strong {
    font-weight: 600;
}

blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-radius: 0 4px 4px 0;
}

blockquote p {
    margin-bottom: 0;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

/* --- Code --- */
code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--accent);
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    line-height: 1.5;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text);
    font-size: 0.85rem;
}

/* Prism.js overrides — match our theme */
code[class*="language-"],
pre[class*="language-"] {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--code-bg);
    line-height: 1.5;
}

pre[class*="language-"] {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

:not(pre) > code[class*="language-"] {
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

/* --- Lists --- */
ul, ol {
    margin: 1rem 0 1.25rem 1.5rem;
}

li {
    margin-bottom: 0.4rem;
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 2.5rem;
}

.page-header h1 {
    margin-bottom: 0.5rem;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* --- Post/Article --- */
.post-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.post-meta .separator {
    margin: 0 0.4rem;
    color: var(--text-faint);
}

.article-body {
    margin-top: 1.5rem;
}

.article-body h2:first-child,
.article-body h3:first-child {
    margin-top: 0;
}

/* Pull quotes — large, visually distinct callouts */
.pull-quote {
    margin: 2.5rem -1rem;
    padding: 1.75rem 2rem;
    border-left: 3px solid var(--accent);
    border-right: 3px solid var(--accent);
    background: linear-gradient(135deg, rgba(94, 170, 168, 0.04) 0%, rgba(94, 170, 168, 0.08) 100%);
    border-radius: 4px;
    position: relative;
}

.pull-quote p {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text);
    font-weight: 500;
    margin: 0;
    font-style: italic;
}

.pull-quote::before {
    content: "\201C";
    position: absolute;
    top: -0.2rem;
    left: 0.75rem;
    font-size: 3rem;
    color: var(--accent);
    opacity: 0.3;
    line-height: 1;
    font-family: Georgia, serif;
}

/* Article section divider — subtle visual break */
.article-body hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.3;
    margin: 3rem 0;
}

/* Inline figure / diagram container */
.figure {
    margin: 2rem 0;
    text-align: center;
}

.figure img {
    max-width: 100%;
    margin: 0 auto;
    border-radius: 6px;
}

.figure-caption {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-faint);
    font-style: italic;
}

/* Stat highlight inline */
.stat-highlight {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.15em 0.5em;
    background: rgba(94, 170, 168, 0.1);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.95em;
    color: var(--accent);
    font-weight: 600;
}

/* --- Content Lists --- */
.content-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.content-list-item {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
}

.content-list-item:first-child {
    padding-top: 0;
}

.content-list-item:last-child {
    border-bottom: none;
}

.content-list-item h2 {
    font-size: 1.2rem;
    margin: 0 0 0.35rem 0;
}

.content-list-item h2 a {
    color: var(--text);
}

.content-list-item h2 a:hover {
    color: var(--accent);
}

.content-list-item .excerpt {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

/* --- Home Page --- */
.home-intro {
    margin-bottom: 1.5rem;
}

.home-intro h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

.home-intro p {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Hero visual */
.home-hero-visual {
    margin-bottom: 2.5rem;
    line-height: 0;
    opacity: 0.85;
}

.home-hero-visual img {
    width: 100%;
    height: auto;
}

/* Sections */
.home-section {
    margin-bottom: 3rem;
}

.home-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.home-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-icon {
    width: 20px;
    height: 20px;
    color: var(--accent);
    opacity: 0.7;
    flex-shrink: 0;
}

.home-section-header h2 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.home-section-header a {
    font-size: 0.85rem;
    color: var(--text-faint);
}

.home-section-header a:hover {
    color: var(--accent);
}

/* --- Home Experiment Card --- */
.home-experiments-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.home-experiment-card {
    display: block;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.2s, transform 0.2s;
}

.home-experiment-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.home-experiment-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
}

.home-experiment-title {
    display: block;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.home-experiment-desc {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Featured experiment highlight */
.home-experiment-featured {
    border-color: rgba(94, 170, 168, 0.3);
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(94, 170, 168, 0.06) 100%);
    position: relative;
}

.home-experiment-featured .home-experiment-label {
    color: var(--accent-hover);
}

.home-experiment-cta {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s, transform 0.2s;
}

.home-experiment-card:hover .home-experiment-cta {
    opacity: 1;
    transform: translateX(0);
}

/* --- Home Tools Grid --- */
.home-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.home-tool-card {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.15rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
}

.home-tool-card:hover {
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.home-tool-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.home-tool-card:hover .home-tool-name {
    color: var(--accent);
}

.home-tool-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* --- Tags/Labels --- */
.tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.15em 0.6em;
    border-radius: 3px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* --- 404 --- */
.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-page h1 {
    font-size: 5rem;
    color: var(--text-faint);
    letter-spacing: -0.04em;
    margin-bottom: 0.5rem;
}

.error-page p {
    color: var(--text-muted);
}

.error-sub {
    font-size: 0.85rem;
    color: var(--text-faint);
    margin-top: 0.25rem;
}

.error-suggestions {
    margin-top: 2.5rem;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.error-suggestions p {
    font-size: 0.9rem;
    color: var(--text-faint);
    margin-bottom: 0.5rem;
}

.error-suggestions ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.error-suggestions li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}

.error-suggestions li:last-child {
    border-bottom: none;
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
    margin-top: auto;
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.footer-links a {
    color: var(--text-faint);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.footer-meta {
    color: var(--text-faint);
    font-size: 0.8rem;
}

/* --- Back Link --- */
.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--text-faint);
    font-size: 0.85rem;
}

.back-link:hover {
    color: var(--accent);
}

/* --- Tool Pages --- */
.contrast-inputs {
    display: flex;
    align-items: end;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.color-input-group {
    flex: 1;
    min-width: 160px;
}

.color-input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.color-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
}

.color-field input[type="color"] {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; }
.color-field input[type="color"]::-moz-color-swatch { border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; }

.color-field input[type="text"] {
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 1rem;
    width: 100%;
    outline: none;
}

.swap-button {
    background: var(--code-bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s;
    margin-bottom: 0.1rem;
}

.swap-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.contrast-results {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.ratio-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 1.2rem 1.5rem;
    background: var(--code-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.ratio-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ratio-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.wcag-grades {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.grade {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: var(--code-bg);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.grade-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.grade-status {
    font-weight: 700;
    font-size: 0.85rem;
}

.grade-status.pass { color: #4caf50; }
.grade-status.fail { color: #e57373; }

.contrast-preview {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.preview-block {
    padding: 1.5rem;
}

.preview-block p {
    margin: 0;
}

.tool-info {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* --- Analytics Dashboard --- */
.analytics-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.2rem 1rem;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.3rem;
}

.analytics-section {
    margin-bottom: 2.5rem;
}

.analytics-section h2 {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

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

.analytics-table th {
    text-align: left;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.analytics-table td {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.analytics-table td.num {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
}

.analytics-table th:last-child {
    text-align: right;
}

.chart-bar-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chart-bar-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 4rem;
    text-align: right;
}

.chart-bar-track {
    flex: 1;
    height: 20px;
    background: var(--code-bg);
    border-radius: 3px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    min-width: 2px;
    transition: width 0.3s ease;
}

.chart-bar-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 2.5rem;
    text-align: right;
}

.analytics-note {
    color: var(--text-faint);
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* --- JSON Formatter Tool --- */
.json-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tool-btn {
    background: var(--code-bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.tool-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tool-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.tool-btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--bg);
}

.json-status {
    margin-left: auto;
    font-size: 0.85rem;
    font-weight: 500;
}

.json-status-valid {
    color: #4caf50;
}

.json-status-invalid {
    color: #e57373;
}

.json-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.json-panel label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.json-textarea {
    width: 100%;
    min-height: 320px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.json-textarea:focus {
    border-color: var(--accent);
}

.json-textarea[readonly] {
    color: var(--text-muted);
}

.json-error {
    background: rgba(229, 115, 115, 0.1);
    border: 1px solid rgba(229, 115, 115, 0.3);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    color: #e57373;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.json-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

/* --- Regex Tester Tool --- */
.regex-input-row {
    margin-bottom: 1rem;
}

.regex-pattern-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.regex-field {
    display: flex;
    align-items: center;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    gap: 0.25rem;
}

.regex-field:focus-within {
    border-color: var(--accent);
}

.regex-delimiter {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--text-faint);
    user-select: none;
}

.regex-field input[type="text"] {
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 1rem;
    outline: none;
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0;
}

.regex-flags-input {
    max-width: 4rem;
    text-align: center;
    flex: none !important;
    color: var(--accent) !important;
}

.regex-status {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
    min-height: 1.3em;
}

.regex-status-ok { color: #4caf50; }
.regex-status-error { color: #e57373; }
.regex-status-warn { color: #ffb74d; }
.regex-status-none { color: var(--text-muted); }

.regex-test-area {
    margin-bottom: 1.5rem;
}

.regex-test-area label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.regex-textarea {
    width: 100%;
    min-height: 160px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.regex-textarea:focus {
    border-color: var(--accent);
}

.regex-output-row {
    margin-bottom: 2rem;
}

.regex-match-summary {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    min-height: 3rem;
    overflow-x: auto;
}

.regex-highlighted-text {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.regex-highlight {
    background: rgba(94, 170, 168, 0.25);
    color: var(--accent);
    border-radius: 2px;
    padding: 0.05em 0;
    border-bottom: 2px solid var(--accent);
}

.regex-placeholder {
    color: var(--text-faint);
    font-size: 0.9rem;
}

.regex-match-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.regex-match-table th {
    text-align: left;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.regex-match-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.regex-match-table td.num {
    text-align: right;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.regex-match-table code {
    font-size: 0.85em;
}

.regex-reference {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.ref-group h3 {
    font-size: 0.95rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ref-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.ref-table td:first-child {
    width: 5rem;
    white-space: nowrap;
}

/* --- Base64 Tool --- */
.base64-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.base64-direction {
    display: flex;
    gap: 0.25rem;
}

.base64-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.base64-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.base64-panel label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.tool-textarea {
    width: 100%;
    min-height: 240px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.tool-textarea:focus {
    border-color: var(--accent);
}

.tool-textarea[readonly] {
    color: var(--text-muted);
}

.tool-error {
    background: rgba(229, 115, 115, 0.1);
    border: 1px solid rgba(229, 115, 115, 0.3);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    color: #e57373;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.base64-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

/* --- Text Analyzer Tool --- */
.analyzer-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.analyzer-input {
    margin-bottom: 1.5rem;
}

.analyzer-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

/* --- Experiments --- */
.experiment-page {
    max-width: none;
    margin: 0 -1.5rem;
}

.experiment-header {
    text-align: center;
    padding: 0 1.5rem 1.5rem;
}

.experiment-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.experiment-header .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.canvas-container {
    width: 100%;
    height: 65vh;
    min-height: 400px;
    position: relative;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.canvas-container canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.experiment-note {
    text-align: center;
    color: var(--text-faint);
    font-size: 0.85rem;
    font-style: italic;
    padding: 1.5rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* --- Experiments Listing --- */
.experiments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.experiment-card {
    display: block;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.experiment-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.experiment-card-preview {
    display: block;
    line-height: 0;
    overflow: hidden;
}

.experiment-card-preview img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease, opacity 0.4s ease;
    opacity: 0.85;
}

.experiment-card:hover .experiment-card-preview img {
    transform: scale(1.03);
    opacity: 1;
}

.experiment-card-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.experiment-card h2 {
    font-size: 1.15rem;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.experiment-card p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.6rem;
}

.experiment-card-label {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
}

.experiment-card-type {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--text-faint);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.15rem 0.5rem;
    letter-spacing: 0.03em;
}

/* Per-experiment border accent on hover */
.experiment-card--void:hover { border-color: #444; }
.experiment-card--fragments:hover { border-color: #666; }
.experiment-card--echoes:hover { border-color: #5eaaa8; }
.experiment-card--perspectives:hover { border-color: #7cc5c3; }
.experiment-card--drift:hover { border-color: #5eaaa8; }
.experiment-card--pulse:hover { border-color: #888; }

/* --- Perspectives Experiment --- */
.perspectives-page .experiment-header {
    padding-bottom: 2rem;
}

.perspectives-container {
    position: relative;
    min-height: 300px;
    padding: 2rem 1.5rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.perspective-node {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.perspective-node.active {
    opacity: 1;
    transform: translateY(0);
}

.perspective-node.exiting {
    opacity: 0;
    transform: translateY(-20px);
    position: absolute;
    top: 2rem;
    left: 1.5rem;
    right: 1.5rem;
}

.perspective-text {
    margin-bottom: 2rem;
}

.perspective-text p {
    margin-bottom: 1rem;
    line-height: 1.8;
    font-size: 1.05rem;
}

.perspective-text p:last-child {
    margin-bottom: 0;
}

.perspective-text em {
    color: var(--accent);
    font-style: italic;
}

.perspective-choices {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.perspective-choice {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.perspective-choice:hover {
    border-color: var(--accent);
    background: var(--bg-elevated);
    transform: translateX(4px);
}

.perspective-choice:active {
    transform: translateX(2px);
}

.perspective-end-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.perspective-path-label {
    color: var(--text-faint);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.ending-note {
    color: var(--accent);
    font-style: italic;
    margin-top: 1.5rem;
    font-size: 1.05rem;
}

.perspective-restart {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.perspective-restart:hover {
    background: var(--accent);
    color: var(--bg);
}

.perspective-back {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.4rem 0;
    background: none;
    border: none;
    color: var(--text-faint);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
}

.perspective-back:hover {
    color: var(--accent);
}

/* --- Void Experiment --- */
.void-page {
    background: #000;
}

.void-container {
    background: #000;
    border-color: transparent;
    height: 70vh;
    min-height: 450px;
}

.void-container canvas {
    cursor: default;
}

/* --- Echoes Experiment --- */
.echoes-page {
    background: #0a0a1a;
}

.echoes-container {
    background: #0a0a1a;
    border-color: transparent;
    height: 60vh;
    min-height: 350px;
}

.echoes-container canvas {
    cursor: default;
}

.echoes-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-faint);
    font-style: italic;
    font-size: 0.9rem;
    pointer-events: none;
}

.echoes-input-area {
    padding: 1.5rem;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.echoes-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    transition: border-color 0.2s ease;
}

.echoes-input-wrapper:focus-within {
    border-color: var(--accent);
}

#echoInput {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.4rem;
    outline: none;
}

#echoInput::placeholder {
    color: var(--text-faint);
}

.echo-char-count {
    font-size: 0.75rem;
    color: var(--text-faint);
    white-space: nowrap;
    font-family: var(--font-mono);
}

.echo-submit-btn {
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 5px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}

.echo-submit-btn:hover {
    background: var(--accent-hover);
}

.echo-submit-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.echoes-hint {
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: var(--text-faint);
    font-style: italic;
    transition: color 0.2s ease;
}

.echoes-count {
    text-align: center;
    color: var(--text-faint);
    font-size: 0.8rem;
    padding: 0 0 1.5rem;
}

/* --- Fragments Experiment --- */
.fragments-page {
    background: #08080f;
}

.fragments-container {
    width: 100%;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}

.fragment-text {
    font-size: 1.4rem;
    line-height: 1.7;
    color: #e8e8ec;
    text-align: center;
    max-width: 600px;
    min-height: 3em;
    opacity: 0;
    transition: opacity 1.2s ease;
    font-style: italic;
    letter-spacing: 0.01em;
}

.fragment-text.visible {
    opacity: 1;
}

.fragment-text.fade-out {
    opacity: 0;
    transition: opacity 1.2s ease;
}

.fragment-source {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.5s ease;
    text-align: center;
}

.fragment-source.visible {
    opacity: 0.7;
}

.fragment-source a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.fragment-source a:hover {
    border-bottom-color: var(--accent);
}

@media (max-width: 600px) {
    .fragment-text {
        font-size: 1.15rem;
        padding: 0 0.5rem;
    }

    .fragments-container {
        min-height: 40vh;
        padding: 2rem 1rem;
    }
}

/* --- Related Posts --- */
.related-posts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-posts h2 {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0;
    margin-bottom: 1rem;
}

/* --- Diff Viewer Tool --- */
.diff-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.diff-actions {
    display: flex;
    gap: 0.25rem;
}

.diff-view-toggle {
    display: flex;
    gap: 0.25rem;
}

.diff-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.diff-panel label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.diff-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.diff-stat-added { color: #4caf50; }
.diff-stat-removed { color: #e57373; }

.diff-output {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow-x: auto;
    min-height: 80px;
}

.diff-placeholder,
.diff-empty,
.diff-error {
    padding: 1.5rem;
    color: var(--text-faint);
    font-size: 0.9rem;
    text-align: center;
}

.diff-error {
    color: #e57373;
}

.diff-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
}

.diff-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.diff-line-num {
    padding: 0 0.5rem;
    color: var(--text-faint);
    text-align: right;
    user-select: none;
    white-space: nowrap;
    min-width: 2.5rem;
    vertical-align: top;
}

.diff-line-prefix {
    padding: 0 0.25rem;
    color: var(--text-faint);
    user-select: none;
    white-space: nowrap;
    vertical-align: top;
}

.diff-line-content {
    padding: 0 0.75rem 0 0.25rem;
    white-space: pre-wrap;
    word-break: break-all;
    width: 100%;
}

.diff-line-add {
    background: rgba(76, 175, 80, 0.1);
}

.diff-line-add .diff-line-prefix,
.diff-line-add .diff-line-num {
    color: #4caf50;
}

.diff-line-remove {
    background: rgba(229, 115, 115, 0.1);
}

.diff-line-remove .diff-line-prefix,
.diff-line-remove .diff-line-num {
    color: #e57373;
}

.diff-line-empty {
    background: var(--bg-surface);
}

.diff-split td {
    border-right: 1px solid var(--border);
}

.diff-split td:last-child {
    border-right: none;
}

/* --- Table of Contents --- */
.toc {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}

.toc-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

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

.toc li {
    margin-bottom: 0.3rem;
}

.toc li li {
    margin-left: 1.25rem;
}

.toc a {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

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

/* --- Search --- */
.search-form {
    margin-bottom: 2rem;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
}

.search-input-group input[type="text"] {
    flex: 1;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.65rem 1rem;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
}

.search-input-group input[type="text"]:focus {
    border-color: var(--accent);
}

.search-input-group input[type="text"]::placeholder {
    color: var(--text-faint);
}

.search-result-count {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.nav-search-link {
    color: var(--text-faint);
    font-size: 0.85rem;
    transition: color 0.15s ease;
}

.nav-search-link:hover {
    color: var(--accent);
}

/* --- Reactions --- */
.reactions {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.reactions-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.reactions-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 2rem;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    user-select: none;
}

.reaction-btn:hover {
    border-color: var(--accent);
    color: var(--text);
    background: var(--bg-elevated);
}

.reaction-btn.reaction-sent {
    border-color: var(--accent);
    color: var(--accent);
}

.reaction-icon {
    font-size: 1rem;
    line-height: 1;
}

.reaction-count {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-faint);
    min-width: 1rem;
    text-align: center;
}

.reaction-btn.reaction-sent .reaction-count {
    color: var(--accent);
}

/* --- Comments --- */
.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.comments-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.comment-count:not(:empty)::before {
    content: '(';
}
.comment-count:not(:empty)::after {
    content: ')';
}
.comment-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.comments-list {
    margin-bottom: 2rem;
}

.comments-empty {
    color: var(--text-faint);
    font-style: italic;
    font-size: 0.9rem;
}

.comment {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.comment:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.comment-author {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
}

.comment-date {
    font-size: 0.8rem;
    color: var(--text-faint);
}

.comment-body {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comment-form {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.25rem;
}

.comment-form-row {
    margin-bottom: 0.75rem;
    position: relative;
}

.comment-form input[type="text"],
.comment-form textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.comment-form input[type="text"]:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-form textarea {
    resize: vertical;
    min-height: 4rem;
}

.comment-char-count {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-faint);
    margin-top: 0.25rem;
}

.comment-char-count.over-limit {
    color: #e74c3c;
}

.comment-form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-comment {
    padding: 0.5rem 1.2rem;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 0.3rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-comment:hover {
    opacity: 0.85;
}

.btn-comment:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.comment-status {
    font-size: 0.85rem;
}

.comment-status--success {
    color: var(--accent);
}

.comment-status--error {
    color: #e74c3c;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    html {
        font-size: 16px;
    }

    .nav-container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-links {
        gap: 1.25rem;
    }

    .content-container {
        padding: 1.5rem 1rem;
    }

    .home-intro h1 {
        font-size: 1.75rem;
    }

    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.3rem; }

    .contrast-inputs { flex-direction: column; align-items: stretch; }
    .swap-button { align-self: center; transform: rotate(90deg); }
    .contrast-results { flex-direction: column; }
    .wcag-grades { grid-template-columns: 1fr; }

    .json-panels { grid-template-columns: 1fr; }
    .json-textarea { min-height: 200px; }

    .analytics-summary { grid-template-columns: repeat(2, 1fr); }
    .chart-bar-label { min-width: 3rem; font-size: 0.7rem; }

    .regex-reference { grid-template-columns: 1fr; }
    .regex-textarea { min-height: 120px; }

    .base64-panels { grid-template-columns: 1fr; }
    .base64-controls { flex-direction: column; align-items: stretch; }
    .base64-options { margin-left: 0; }
    .tool-textarea { min-height: 160px; }

    .analyzer-stats { grid-template-columns: repeat(2, 1fr); }

    .home-tools-grid { grid-template-columns: 1fr 1fr; }

    .home-hero-visual { margin-bottom: 1.5rem; }
    .about-hero-visual { margin-bottom: 1.5rem; }

    .about-sections-grid { grid-template-columns: 1fr; }

    .about-stats { grid-template-columns: repeat(3, 1fr); }

    .section-icon { width: 16px; height: 16px; }

    .diff-panels { grid-template-columns: 1fr; }
    .diff-controls { flex-direction: column; align-items: stretch; }
    .diff-view-toggle { justify-content: center; }
    .diff-split td { font-size: 0.75rem; }
}

/* --- Timeline --- */
.timeline-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

.timeline-header {
    text-align: center;
    margin-bottom: 2rem;
}

.timeline-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.timeline-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.timeline-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.75rem 1rem;
    margin-bottom: 2.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s ease;
    z-index: 10;
}

.tl-stats-sticky {
    position: sticky;
    top: 0;
    background: rgba(31, 31, 53, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.timeline-stat {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.timeline-stat-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.timeline-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: lowercase;
}

/* Timeline stem */
.timeline {
    position: relative;
    padding: 1rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--accent) 5%,
        var(--accent) 95%,
        transparent
    );
    transform: translateX(-50%);
}

/* Nodes */
.timeline-node {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.timeline-node.tl-visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-node.tl-left {
    flex-direction: row-reverse;
    text-align: right;
}

.timeline-node.tl-right {
    flex-direction: row;
}

/* Dot on the line */
.timeline-dot {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    flex-shrink: 0;
}

.timeline-dot-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
}

.timeline-dot-milestone {
    border-color: var(--accent);
    background: var(--accent);
}

.timeline-dot-milestone .timeline-dot-num {
    color: var(--bg);
}

.timeline-dot-pulse {
    animation: tl-pulse 2s ease-in-out infinite;
    border-color: var(--accent);
    background: var(--accent);
}

.timeline-dot-pulse .timeline-dot-num {
    color: var(--bg);
}

@keyframes tl-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(94, 170, 168, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(94, 170, 168, 0); }
}

/* Card */
.timeline-card {
    width: calc(50% - 36px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.timeline-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 16px rgba(94, 170, 168, 0.08);
}

.tl-left .timeline-card {
    margin-right: 18px;
}

.tl-right .timeline-card {
    margin-left: calc(50% + 18px);
}

.timeline-now .timeline-card {
    margin-left: calc(50% + 18px);
}

.timeline-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.tl-left .timeline-card-head {
    flex-direction: row-reverse;
}

.timeline-session-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-faint);
}

.timeline-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.timeline-milestone {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 0.6rem;
    padding: 0.25rem 0.6rem;
    background: rgba(94, 170, 168, 0.1);
    border-radius: 4px;
    display: inline-block;
}

.tl-left .timeline-milestone {
    float: right;
}

/* Items */
.timeline-items {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.tl-left .timeline-item {
    flex-direction: row-reverse;
}

.tl-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.tl-badge-tool { background: rgba(94, 170, 168, 0.15); color: #5eaaa8; }
.tl-badge-post { background: rgba(107, 141, 214, 0.15); color: #6b8dd6; }
.tl-badge-feature { background: rgba(212, 168, 67, 0.15); color: #d4a843; }
.tl-badge-essay { background: rgba(201, 105, 126, 0.15); color: #c9697e; }
.tl-badge-experiment { background: rgba(155, 107, 189, 0.15); color: #9b6bbd; }

.tl-item-text {
    flex: 1;
    min-width: 0;
}

/* Insight — hidden by default, expand on click */
.timeline-insight {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    opacity: 0;
    border-top: 1px solid transparent;
}

.tl-card-open .timeline-insight {
    max-height: 200px;
    opacity: 1;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top-color: var(--border);
}

.timeline-insight p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
}

/* Now card */
.timeline-card-now {
    border-color: var(--accent);
    background: rgba(94, 170, 168, 0.05);
}

.timeline-now-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Footer */
.timeline-footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Mobile: single column, line on left */
@media (max-width: 700px) {
    .timeline-page { padding: 1.5rem 1rem 3rem; }

    .timeline-header h1 { font-size: 1.6rem; }

    .timeline-stats { gap: 1.2rem; padding: 0.6rem 0.75rem; }
    .timeline-stat-num { font-size: 1.3rem; }

    .timeline::before {
        left: 18px;
    }

    .timeline-dot {
        left: 18px;
        width: 32px;
        height: 32px;
    }

    .timeline-node.tl-left,
    .timeline-node.tl-right {
        flex-direction: row;
        text-align: left;
    }

    .timeline-card {
        width: calc(100% - 52px);
        margin-left: 52px !important;
        margin-right: 0 !important;
    }

    .timeline-now .timeline-card {
        margin-left: 52px !important;
    }

    .tl-left .timeline-card-head {
        flex-direction: row;
    }

    .tl-left .timeline-item {
        flex-direction: row;
    }

    .tl-left .timeline-milestone {
        float: none;
    }

    .timeline-card-title { font-size: 1.05rem; }
}

/* --- Now Page --- */
.now-context {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.now-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}

.now-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.now-stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
}

.now-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.now-updated {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* --- About Page --- */
.about-hero-visual {
    margin-bottom: 2rem;
    line-height: 0;
    opacity: 0.85;
}

.about-hero-visual img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin: 2rem 0;
}

.about-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.3s;
}

.about-stat:hover {
    border-color: var(--accent);
}

.about-stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
}

.about-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

.about-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}

.about-section-card {
    display: block;
    padding: 1.25rem 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.about-section-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.about-section-card--journal:hover { border-color: #5eaaa8; }
.about-section-card--writing:hover { border-color: #7cc5c3; }
.about-section-card--experiments:hover { border-color: #c49b5e; }
.about-section-card--tools:hover { border-color: #8a8a8a; }
.about-section-card--transparency:hover { border-color: #6b9eda; }
.about-section-card--timeline:hover { border-color: #a87ccf; }

.about-section-icon {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.about-section-name {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.about-section-desc {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.about-link-hint {
    color: var(--accent);
}

.about-echoes-cta {
    margin-top: 2.5rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, rgba(94, 170, 168, 0.06) 0%, rgba(94, 170, 168, 0.12) 100%);
    border: 1px solid rgba(94, 170, 168, 0.2);
    border-radius: 10px;
    text-align: center;
}

.about-echoes-cta p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.about-echoes-cta a {
    color: var(--accent);
    font-weight: 600;
}

/* --- Games --- */
.game-page {
    max-width: 100%;
    padding: 0;
}

.game-header {
    text-align: center;
    padding: 2rem var(--side-padding) 1rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.game-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.game-container {
    width: 100%;
    height: 70vh;
    min-height: 450px;
    max-height: 700px;
    position: relative;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.game-container canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.signal-hud {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    pointer-events: none;
    z-index: 2;
}

.signal-score-label,
.signal-best-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.3);
    font-family: 'Inter', system-ui, sans-serif;
}

.signal-score-label strong,
.signal-best-label strong {
    color: rgba(255, 255, 255, 0.6);
}

.game-info {
    text-align: center;
    padding: 1.2rem var(--side-padding);
    max-width: var(--max-width);
    margin: 0 auto;
}

.game-info p {
    color: var(--text-faint);
    font-size: 0.85rem;
    margin: 0;
}

.teal-text { color: var(--accent); }
.danger-text { color: #c85050; }

/* Games listing */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.game-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.game-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.game-card-preview {
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.game-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.game-card:hover .game-card-preview img {
    transform: scale(1.05);
}

.game-card-content {
    padding: 1rem 1.2rem 1.2rem;
}

.game-card-type {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.5rem;
    background: rgba(200, 80, 80, 0.15);
    color: #c85050;
    border-radius: 3px;
    margin-bottom: 0.5rem;
}

.game-card h2 {
    font-size: 1.2rem;
    margin: 0.3rem 0 0.5rem;
}

.game-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.5;
}

/* Signal Leaderboard */
.signal-leaderboard {
    max-width: 500px;
    margin: 2rem auto;
    padding: 0 var(--side-padding);
}

.signal-leaderboard h2 {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.leaderboard-table thead th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-faint);
    font-weight: 400;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.leaderboard-table thead th:first-child {
    width: 2.5rem;
    text-align: center;
}

.leaderboard-table thead th:last-child {
    text-align: right;
    width: 4rem;
}

.leaderboard-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.leaderboard-table tbody td:first-child {
    text-align: center;
    color: var(--text-faint);
}

.leaderboard-table tbody td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.leaderboard-table tr.top-1 td:first-child { color: #f0c040; }
.leaderboard-table tr.top-2 td:first-child { color: #b0b8c0; }
.leaderboard-table tr.top-3 td:first-child { color: #c08050; }

.leaderboard-empty,
.leaderboard-loading {
    text-align: center;
    color: var(--text-faint);
    font-size: 0.85rem;
    padding: 1rem 0;
}

.leaderboard-submit {
    margin-top: 1.2rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
}

.submit-prompt {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.8rem;
}

.submit-form {
    display: flex;
    gap: 0.5rem;
}

.submit-form input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
}

.submit-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.submit-form button {
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    transition: opacity 0.2s;
}

.submit-form button:hover {
    opacity: 0.9;
}

.submit-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-status {
    text-align: center;
    font-size: 0.8rem;
    color: var(--accent);
    margin: 0.5rem 0 0;
    min-height: 1.2em;
}

@media (max-width: 600px) {
    .game-container {
        height: 60vh;
        min-height: 350px;
    }

    .signal-hud {
        gap: 1rem;
    }

    .signal-leaderboard {
        padding: 0 1rem;
    }
}
