/* ============================================
   KNOW YOUR NUMBERS — Sexual Health Risk Calculator
   A dark, clinical aesthetic with warm accents
   ============================================ */

/* CSS Variables */
:root {
    /* Colors - Dark clinical theme with amber accents */
    --bg-primary: #0a0b0d;
    --bg-secondary: #12141a;
    --bg-tertiary: #1a1d26;
    --bg-card: #161922;
    --bg-card-hover: #1c2029;
    
    --text-primary: #e8e9ec;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-primary: #f59e0b;
    --accent-secondary: #fbbf24;
    --accent-glow: rgba(245, 158, 11, 0.15);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    
    /* Typography */
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --section-padding: clamp(4rem, 10vw, 8rem);
    --container-max: 1200px;
    
    /* Borders & Shadows */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: var(--font-display);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Grain Overlay for texture */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    z-index: 1000;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Typography */
h1, h2, h3, h4, h5 {
    font-weight: 600;
    line-height: 1.2;
}

h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    color: var(--text-secondary);
}

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

a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 11, 13, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

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

.nav-links a:hover {
    color: var(--accent-primary);
    text-decoration: none;
}

/* Mobile Navigation Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 102;
}

.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.active .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(10, 11, 13, 0.98);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 1.5rem;
        z-index: 101;
        padding: 2rem;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links a {
        font-size: 1.25rem;
        padding: 0.75rem 1rem;
    }
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: calc(var(--section-padding) + 60px) 1.5rem var(--section-padding);
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(245, 158, 11, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(59, 130, 246, 0.05), transparent),
        var(--bg-primary);
}

.hero-content {
    max-width: 700px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.hero-title-line {
    display: block;
}

.hero-title-line.accent {
    color: var(--accent-primary);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 600px;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: #0a0b0d;
}

.btn-primary:hover {
    background: var(--accent-secondary);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
    text-decoration: none;
}

/* Hero Stats Preview */
.hero-visual {
    display: none;
}

@media (min-width: 1024px) {
    .hero {
        display: grid;
        grid-template-columns: 1.2fr 1fr;
        gap: 4rem;
        align-items: center;
    }
    
    .hero-visual {
        display: block;
    }
}

.stat-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

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

.stat-label {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Sections */
.section {
    padding: var(--section-padding) 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-tag {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.section-desc {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Mission Section */
.mission-section {
    background: var(--bg-secondary);
}

.mission-content {
    display: grid;
    gap: 3rem;
}

@media (min-width: 900px) {
    .mission-content {
        grid-template-columns: 1.5fr 1fr;
        gap: 4rem;
    }
}

.mission-text {
    max-width: 700px;
}

.mission-text .lead {
    font-size: 1.35rem;
    color: var(--text-primary);
    font-weight: 400;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.mission-text p {
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
}

.mission-text em {
    color: var(--accent-primary);
    font-style: normal;
    font-weight: 500;
}

.mission-text .disclaimer {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--danger);
    padding: 1rem 1.25rem;
    margin-top: 2rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.95rem;
}

.mission-principles {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.mission-principles h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.principles-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.principles-list li {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

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

.principles-list strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.25rem;
}

.principles-list p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* Calculator Section */
.calculator-section {
    background: 
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(245, 158, 11, 0.05), transparent),
        var(--bg-primary);
}

.calculator-grid {
    display: grid;
    gap: 2rem;
}

@media (min-width: 900px) {
    .calculator-grid {
        grid-template-columns: 380px 1fr;
        gap: 3rem;
    }
}

.calculator-inputs {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.input-group {
    margin-bottom: 1.75rem;
}

.input-group:last-of-type {
    margin-bottom: 2rem;
}

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

.input-group select,
.input-group input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.input-group select:hover,
.input-group select:focus,
.input-group input:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.input-group select option {
    background: var(--bg-tertiary);
}

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    margin-top: 0.5rem;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

#frequency-value,
#duration-value {
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Preventative Toggle Checkboxes */
.preventative-toggle {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(6, 182, 212, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-bottom: 1.5rem;
}

/* Preventative Select Groups (compact) */
.preventative-select-group {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(6, 182, 212, 0.04));
    border: 1px solid rgba(139, 92, 246, 0.18);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.preventative-select {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-medium);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.preventative-detail {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.preventative-detail-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--text-primary);
    font-weight: 600;
}

.preventative-selected {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.preventative-note {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.preventative-none {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.preventative-detail-main .reduction-badge {
    margin-left: 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    gap: 0.75rem;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    min-width: 20px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
    margin-top: 2px;
}

.checkbox-custom::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s ease;
}

.checkbox-label:hover .checkbox-custom {
    border-color: #8b5cf6;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    border-color: #8b5cf6;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    transform: rotate(45deg) scale(1);
}

.checkbox-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.reduction-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
    color: #06b6d4;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
    cursor: help;
    position: relative;
}

.reduction-badge.citable:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(6, 182, 212, 0.35));
}

.reduction-badge .cite-tooltip {
    width: 320px;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 8px);
}
/* Current Rate Display */
.current-rate-display {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border-subtle);
}

.rate-section-title {
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.rate-comparison {
    margin-bottom: 0.5rem;
}

.rate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

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

.rate-value {
    font-family: var(--font-mono);
}

.rate-value-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rate-reduction {
    font-size: 0.75rem;
    color: #10b981;
    font-weight: 500;
}

.rate-reduction.unverified {
    color: #f59e0b;
}

.rate-no-data {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    font-weight: 600;
    color: var(--accent-primary);
}

.rate-item.source .rate-label {
    font-size: 0.8rem;
}

.rate-item.source a {
    font-size: 0.8rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Calculator Output */
.calculator-output {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    min-height: 350px;
}

.result-summary {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.result-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.result-label {
    color: var(--text-secondary);
    font-size: 1rem;
}

#result-duration {
    color: var(--accent-primary);
    font-weight: 600;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.risk-unprotected {
    color: #ef4444;
}

.risk-protected {
    color: #10b981;
}

.risk-antiviral {
    color: #06b6d4;
    font-weight: 700;
}

.risk-arrow {
    color: var(--text-muted);
    font-size: 1.5rem;
}

.result-explanation {
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.result-explanation p {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* STI Section */
.stis-section {
    background: var(--bg-secondary);
}

.sti-grid {
    display: grid;
    gap: 2rem;
}

@media (min-width: 768px) {
    .sti-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1100px) {
    .sti-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* STI Cards */
.sti-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.sti-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
}

.sti-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sti-header h3 {
    color: var(--text-primary);
}

.sti-severity {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sti-severity.severe {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.sti-severity.moderate {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.sti-severity.curable {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.sti-severity.variable {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* Classification Legend */
.classification-legend {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    margin-bottom: 2.5rem;
}

.legend-intro {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.legend-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 700px) {
    .legend-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

.legend-col h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.legend-col ul {
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-col li {
    margin-bottom: 0.4rem;
}

.legend-col strong {
    color: var(--text-primary);
}

/* New Tag System */
.sti-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* Duration tags */
.tag-curable {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-clears {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.tag-chronic {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Risk tags */
.tag-low {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.tag-moderate {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.tag-serious {
    background: rgba(249, 115, 22, 0.12);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.tag-critical {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* STI Outlook List (label: value rows) */
.sti-outlook {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.outlook-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

.outlook-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 1rem;
}

.outlook-value {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: right;
    line-height: 1.4;
}

/* Outlook value colors */
.outlook-value.curable {
    color: #34d399;
}

.outlook-value.clears {
    color: #60a5fa;
}

.outlook-value.chronic {
    color: #a78bfa;
}

.outlook-value.low {
    color: #6ee7b7;
}

.outlook-value.moderate {
    color: #fbbf24;
}

.outlook-value.serious {
    color: #fb923c;
}

.outlook-value.critical {
    color: #f87171;
}

.outlook-value.positive {
    color: #34d399;
}

.sti-quick-facts {
    margin-bottom: 1.5rem;
}

.sti-quick-facts ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.sti-quick-facts li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.sti-rates {
    margin-bottom: 1rem;
}

.sti-rates h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.rates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.rates-table th,
.rates-table td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.rates-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
}

.rates-table td {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.rates-table td:first-child {
    font-family: var(--font-display);
    color: var(--text-secondary);
}

.rate-note {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.rate-source {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.rate-source a {
    font-size: 0.8rem;
}

/* STI Details (Expandable) */
.sti-details {
    margin-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    padding-top: 1rem;
}

.sti-details summary {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent-primary);
    padding: 0.5rem 0;
    transition: color 0.2s ease;
}

.sti-details summary:hover {
    color: var(--accent-secondary);
}

.sti-details[open] summary {
    margin-bottom: 1rem;
}

.details-content h5 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 1.25rem 0 0.5rem;
}

.details-content h5:first-child {
    margin-top: 0;
}

.details-content p {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

/* Info Callout Box */
.info-callout {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-left: 3px solid var(--info);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
}

.info-callout h5 {
    color: var(--info);
    font-size: 0.95rem;
    margin: 0 0 0.75rem 0;
}

.info-callout p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.info-callout p:last-child {
    margin-bottom: 0;
}

.info-callout em {
    color: var(--text-primary);
    font-style: italic;
}

/* Math and Code Blocks */
.math-block {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.math-block.large {
    text-align: center;
    padding: 1.5rem;
}

.math-block.large p {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.math-block p {
    margin-bottom: 0.5rem;
}

.math-block p:last-child {
    margin-bottom: 0;
}

.code-block {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.code-block h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.code-block pre {
    margin: 0;
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Testing Guide Section */
.testing-section {
    background: var(--bg-secondary);
}

.testing-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.testing-block {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 2rem;
}

.testing-block h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.testing-intro {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.testing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.testing-table th,
.testing-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.testing-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.testing-table td {
    color: var(--text-secondary);
}

.testing-table td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

.testing-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.testing-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.testing-warning strong {
    color: var(--warning);
}

.unverified-number {
    color: var(--warning);
    font-style: italic;
}

/* Methodology Section */
.methodology-section {
    background: var(--bg-primary);
}

.methodology-content {
    max-width: 800px;
    margin: 0 auto;
}

.method-block {
    margin-bottom: 3rem;
}

.method-block h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.method-block > p {
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

/* Caveats Grid */
.caveats-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 600px) {
    .caveats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.caveat {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.caveat h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.caveat p {
    font-size: 0.9rem;
    margin: 0;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: 4rem 0 2rem;
}

.footer-content {
    display: grid;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 3rem;
    }
}

.footer-main h3 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.footer-main p {
    font-size: 0.95rem;
}

.footer-disclaimer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem !important;
    color: var(--text-muted) !important;
}

.footer-links h4 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-links ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-links a {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
}

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

/* MathJax Override */
mjx-container {
    color: var(--text-primary) !important;
}

/* ===========================================
   CITABLE NUMBERS WITH TOOLTIPS
   =========================================== */

/* Numbers that have sources */
.citable {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--accent-primary);
    transition: color 0.2s ease;
    display: inline-block;
}

/* Invisible hover bridge above the citable element to connect to tooltip */
.citable::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: -10px;
    right: -10px;
    height: 20px;
    background: transparent;
}

.citable:hover {
    color: var(--accent-secondary);
}

/* Tooltip container */
.cite-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: 380px;
    max-width: calc(100vw - 2rem);
    max-height: 450px;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

/* Mobile tooltip - use fixed position to prevent overflow */
@media (max-width: 768px) {
    .cite-tooltip {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%);
        width: calc(100vw - 2rem);
        max-width: calc(100vw - 2rem);
        max-height: 70vh;
        /* Force all content to wrap */
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .cite-tooltip::after {
        display: none;
    }
    
    .cite-tooltip::before {
        display: none;
    }
    
    /* Force text wrapping in tooltip content - be specific to avoid inheritance issues */
    .cite-tooltip-source,
    .cite-tooltip-quote,
    .cite-tooltip-link,
    .cite-tooltip-meta,
    .cite-tooltip-derivation,
    .cite-tooltip-warning {
        white-space: normal;
        word-break: break-word;
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
    
    /* Hide tooltips completely when not active - prevent overflow */
    .citable:not(:hover):not(.tooltip-active) .cite-tooltip {
        display: none;
    }
}

/* Invisible extension at bottom of tooltip to bridge to trigger element */
.cite-tooltip::before {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    right: 0;
    height: 20px;
    background: transparent;
    pointer-events: auto;
}

.citable:hover .cite-tooltip,
.citable.tooltip-active .cite-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Keep tooltip open when hovering over it */
.cite-tooltip:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Tooltip arrow */
.cite-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--bg-tertiary);
    pointer-events: none;
}

/* Tooltip content */
.cite-tooltip-source {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    display: block;
}

.cite-tooltip-quote {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 2;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-left: 2px solid var(--accent-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    /* Force text wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.cite-tooltip-link {
    display: block;
    font-size: 0.75rem;
    color: var(--accent-primary);
    word-break: break-all;
    margin-top: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    text-align: center;
    /* Ensure clickable on touch devices */
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    touch-action: manipulation;
}

.cite-tooltip-link:hover,
.cite-tooltip-link:active {
    text-decoration: underline;
    background: var(--bg-tertiary);
}

.cite-tooltip-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Derivation block for calculated numbers */
.cite-tooltip-derivation {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
    font-family: var(--font-mono);
}

.cite-tooltip-derivation-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: block;
    font-family: var(--font-display);
}

.cite-tooltip-type {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.5rem;
}

.cite-tooltip-type.direct {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.cite-tooltip-type.derived {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

/* Quote highlighting for extracted variables */
.quote-ellipsis {
    color: var(--text-muted);
    padding: 0 0.25rem;
    white-space: normal;
}

.quote-highlight {
    background: rgba(245, 158, 11, 0.25);
    color: var(--accent-secondary);
    padding: 0.15rem 0.25rem;
    border-radius: 2px;
    cursor: help;
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* Ensure highlights don't cause vertical overlap */
    display: inline;
    line-height: inherit;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Unverified number styling */
.citable-unverified {
    color: var(--warning);
    border-bottom: 1px dashed var(--warning);
    cursor: help;
    position: relative;
}

.citable-unverified::before {
    content: '⚠️';
    margin-right: 0.25rem;
    font-size: 0.8em;
}

.citable-unverified .unverified-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    border: 1px solid var(--warning);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    color: var(--text-secondary);
}

.citable-unverified:hover .unverified-tooltip,
.citable-unverified.tooltip-active .unverified-tooltip {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    .citable-unverified .unverified-tooltip {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%);
        white-space: normal;
        text-align: center;
        width: calc(100vw - 3rem);
        max-width: calc(100vw - 3rem);
    }
    
    /* Hide when not active */
    .citable-unverified:not(:hover):not(.tooltip-active) .unverified-tooltip {
        display: none;
    }
}

/* Step-by-step derivation display */
.derive-variables,
.derive-steps {
    margin: 0.75rem 0;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.derive-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.derive-var {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 0.25rem 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem;
}

.derive-var-icon {
    flex-shrink: 0;
}

.derive-var-name {
    color: var(--accent-primary);
    font-weight: 500;
}

.derive-var-value {
    color: var(--text-primary);
}

.derive-var-note {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-style: italic;
    width: 100%;
    padding-left: 1.5rem;
}

.derive-var.var-from-quote .derive-var-name {
    color: #34d399; /* Green for sourced values */
}

.derive-var.var-assumed .derive-var-name {
    color: #fbbf24; /* Amber for assumptions */
}

.derive-var.var-calculated .derive-var-name {
    color: #60a5fa; /* Blue for calculated */
}

.derive-step {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    padding: 0.2rem 0;
    border-left: 2px solid var(--border-subtle);
    padding-left: 0.5rem;
    margin: 0.15rem 0;
}

.derive-step.step-warning {
    border-left-color: var(--warning);
    color: var(--warning);
}

.derive-result {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

.derive-result-name {
    color: var(--accent-primary);
    font-weight: 600;
}

.derive-result-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1em;
}

.derive-warnings {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--warning);
}

.derive-warning {
    font-size: 0.7rem;
    color: var(--warning);
}

/* Ensure scrollbar is visible when needed */
.cite-tooltip::-webkit-scrollbar {
    width: 6px;
}

.cite-tooltip::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.cite-tooltip::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

/* Adjust tooltip position for elements near edges - DESKTOP ONLY */
@media (min-width: 769px) {
    .citable.tooltip-left .cite-tooltip {
        left: 0;
        transform: translateX(0);
    }

    .citable.tooltip-left .cite-tooltip::after {
        left: 20px;
    }

    .citable.tooltip-right .cite-tooltip {
        left: auto;
        right: 0;
        transform: translateX(0);
    }

    .citable.tooltip-right .cite-tooltip::after {
        left: auto;
        right: 20px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: rgba(245, 158, 11, 0.3);
    color: var(--text-primary);
}

/* ===========================================
   MOBILE OPTIMIZATIONS
   =========================================== */

/* Prevent horizontal overflow on mobile */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    .nav,
    .hero,
    .section,
    .footer,
    .container,
    .sti-card,
    .testing-block,
    .calculator-inputs,
    .calculator-output,
    .mission-content,
    .methodology-content {
        max-width: 100vw;
        overflow-x: hidden;
    }
}

/* Mobile Navigation - Add hamburger menu functionality via CSS */
@media (max-width: 768px) {
    .nav {
        padding: 0.75rem 1rem;
    }
    
    .nav-brand {
        gap: 0.5rem;
    }
    
    .nav-icon {
        font-size: 1.25rem;
    }
    
    .nav-title {
        font-size: 1rem;
    }
    
    /* Hero adjustments */
    .hero {
        padding: calc(var(--section-padding) + 50px) 1rem var(--section-padding);
        min-height: auto;
    }
    
    .hero-title {
        font-size: clamp(1.75rem, 7vw, 2.5rem);
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .hero-cta {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .hero-cta .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Section padding */
    .section {
        padding: clamp(2.5rem, 8vw, 4rem) 0;
    }
    
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-header h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }
    
    /* Mission section */
    .mission-text .lead {
        font-size: 1.1rem;
    }
    
    .mission-text p {
        font-size: 0.95rem;
    }
    
    .mission-principles {
        padding: 1.25rem;
    }
    
    /* Calculator section */
    .calculator-inputs {
        padding: 1.25rem;
    }
    
    .input-group {
        margin-bottom: 1.25rem;
    }
    
    .chart-container {
        padding: 1rem;
        min-height: 280px;
    }
    
    .result-summary {
        padding: 1rem;
    }
    
    .result-main {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .result-value {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .risk-arrow {
        transform: rotate(90deg);
    }
    
    /* Rate display */
    .current-rate-display {
        padding: 1rem;
    }
    
    /* STI cards */
    .sti-card {
        padding: 1.25rem;
    }
    
    .sti-header h3 {
        font-size: 1.25rem;
    }
    
    /* Tables - make responsive with proper containment */
    .rates-table,
    .testing-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        max-width: 100%;
    }
    
    .rates-table th,
    .rates-table td,
    .testing-table th,
    .testing-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.75rem;
        /* Allow text to wrap in table cells on mobile */
        white-space: normal;
        min-width: 60px;
    }
    
    /* Keep first column (STI name) from wrapping */
    .testing-table td:first-child,
    .rates-table td:first-child {
        white-space: nowrap;
    }
    
    .testing-block {
        padding: 1.25rem;
        overflow-x: hidden;
    }
    
    .testing-block h3 {
        font-size: 1.1rem;
    }
    
    /* Ensure citable elements in tables don't cause overflow */
    .testing-table .citable,
    .rates-table .citable {
        display: inline;
        word-break: break-word;
    }
    
    /* Tooltips within tables should use fixed positioning */
    .testing-table .cite-tooltip,
    .rates-table .cite-tooltip {
        position: fixed;
        max-width: calc(100vw - 2rem);
        width: calc(100vw - 2rem);
        left: 50% !important;
        transform: translate(-50%, -50%);
    }
    
    /* Classification legend */
    .classification-legend {
        padding: 1.25rem;
    }
    
    .legend-intro {
        font-size: 0.9rem;
    }
    
    /* STI details */
    .sti-details summary {
        font-size: 0.85rem;
    }
    
    .details-content p {
        font-size: 0.85rem;
    }
    
    .info-callout {
        padding: 0.875rem 1rem;
    }
    
    .info-callout h5 {
        font-size: 0.85rem;
    }
    
    .info-callout p {
        font-size: 0.8rem;
    }
    
    /* Methodology section */
    .method-block > p {
        font-size: 0.95rem;
    }
    
    .math-block {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .code-block {
        padding: 0.75rem;
    }
    
    .code-block code {
        font-size: 0.75rem;
    }
    
    .caveat {
        padding: 1rem;
    }
    
    .caveat h4 {
        font-size: 0.9rem;
    }
    
    .caveat p {
        font-size: 0.8rem;
    }
    
    /* Footer */
    .footer {
        padding: 2.5rem 0 1.5rem;
    }
    
    .footer-content {
        gap: 1.5rem;
    }
    
    .footer-main h3 {
        font-size: 1.1rem;
    }
    
    .footer-main p {
        font-size: 0.85rem;
    }
}

/* Extra small screens */
@media (max-width: 375px) {
    .container {
        padding: 0 1rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .stat-card {
        padding: 1rem 1.25rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.9rem;
    }
    
    /* Make tables scroll horizontally with visual indicator */
    .rates-table,
    .testing-table {
        position: relative;
    }
    
    /* Smaller tooltip quote text with proper line spacing */
    .cite-tooltip-quote {
        display: block;
        font-size: 0.9rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 2.2;
        padding: 1rem;
    }
    
    .derive-var {
        font-size: 0.7rem;
        flex-wrap: wrap;
    }
    
    .derive-step {
        font-size: 0.65rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .derive-var-value {
        word-break: break-word;
    }
    
    .derive-variables,
    .derive-steps {
        overflow-x: hidden;
        max-width: 100%;
    }
}

/* Touch-friendly targets */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }
    
    .nav-links a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }
    
    .sti-details summary {
        padding: 0.75rem 0;
    }
    
    /* On touch devices, make citable elements tap-to-open */
    .citable {
        cursor: pointer;
    }
}
