/* ============================================================================
   VARSITY SHIFTS - Newspaper-style Visualization Website
   ============================================================================ */

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #444;
    --accent-color: #8b0000;
    /* Darker red for vintage feel */
    --background-color: #fdf6e3;
    /* Aged paper */
    --text-light: #666;
    --border-color: #2c2c2c;
    --pre-nil-color: #5cb85c;
    --post-nil-color: #d9534f;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Old Standard TT', serif;
    --font-masthead: 'UnifrakturMaguntia', cursive;
}

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

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--primary-color);
    background-color: #e6e0d4;
    /* Desk background */
    font-size: 18px;
}

/* ============================================================================
   HEADER
   ============================================================================ */

/* ============================================================================
   HEADER & MASTHEAD
   ============================================================================ */

header {
    background: var(--background-color);
    color: var(--primary-color);
    padding: 3rem 1rem 2rem;
    text-align: center;
    border-bottom: 5px double var(--primary-color);
    border-top: 1px solid var(--primary-color);
    margin-bottom: 2rem;
    position: relative;
}

header h1 {
    font-family: var(--font-masthead);
    font-size: 6rem;
    margin-bottom: 1rem;
    font-weight: normal;
    letter-spacing: 0.02em;
    text-transform: none;
    /* Blackletter is usually mixed case or specific casing */
    line-height: 1;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.1);
}

.masthead-bar {
    border-top: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding: 0.5rem 0;
    margin: 1rem auto;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-family: var(--font-heading);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    max-width: 800px;
}

.subtitle {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-style: italic;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.team {
    font-family: var(--font-body);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 1rem;
    font-weight: bold;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 3rem 1rem;
    /* Reduced bottom padding */
    background: var(--background-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   STORY SECTIONS
   ============================================================================ */

.story-section {
    margin-bottom: 4rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
}

.story-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    /* Remove margin from last section */
    padding-bottom: 1rem;
    /* Reduce padding from last section */
}

h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: bold;
    font-style: italic;
}

h4 {
    font-family: var(--font-body);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: bold;
}

.narrative-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-align: justify;
}

/* Newspaper Columns */
@media (min-width: 768px) {
    .narrative-text {
        column-count: 2;
        column-gap: 2rem;
        column-rule: 1px solid #ccc;
    }

    /* Span columns for emphasis or intro */
    .narrative-text.intro,
    .narrative-text.emphasis {
        column-count: 1;
        font-size: 1.3rem;
        font-weight: normal;
        font-style: italic;
        border-bottom: none;
        padding-bottom: 1.5rem;
        margin-bottom: 2rem;
        text-align: center;
    }
}

.drop-cap::first-letter {
    float: left;
    font-family: var(--font-heading);
    font-size: 4.5rem;
    line-height: 0.8;
    padding-right: 0.5rem;
    padding-top: 0.2rem;
    font-weight: 900;
    color: var(--primary-color);
}

.newspaper-article {
    column-count: 2;
    column-gap: 2rem;
    column-rule: 1px solid #ccc;
    text-align: justify;
    margin-bottom: 1.5rem;
}

.newspaper-article .narrative-text {
    column-count: auto;
    column-gap: normal;
    column-rule: none;
    margin-bottom: 0;
}

.newspaper-filler-container {
    position: relative;
    display: inline;
}

.newspaper-filler {
    font-family: var(--font-body);
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--secondary-color);
    text-align: justify;
    filter: blur(3.5px);
    opacity: 0.3;
    user-select: none;
    display: inline;
    transition: all 0.5s ease;
}

.newspaper-filler-container.revealed .newspaper-filler {
    filter: blur(0);
    opacity: 1;
    user-select: text;
    font-size: 0.95rem;
    /* readable size */
    color: var(--primary-color);
    cursor: default;
}

.read-more-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #8b0000;
    /* Accent color */
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
    transition: opacity 0.3s ease;
}

.read-more-btn:hover {
    background: #a00000;
}

.newspaper-filler-container.revealed .read-more-btn {
    opacity: 0;
    pointer-events: none;
}

/* ============================================================================
   NEWSPAPER LAYOUT FOR HOOK VISUALIZATION
   ============================================================================ */

#hook .newspaper-layout {
    background: #f6f1e7;
    border: 1px solid #d0c8b9;
    padding: 2rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.newspaper-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .newspaper-layout {
        grid-template-columns: 1fr;
    }
}

.timeline-chart {
    border: 1px solid #c8c2b8;
    padding: 1.5rem;
    background-color: #fffdf5;
    border-radius: 0;
    box-shadow: none;
    position: relative;
    background-image: repeating-linear-gradient(to bottom,
            rgba(0, 0, 0, 0.04) 0px,
            rgba(0, 0, 0, 0.04) 1px,
            transparent 1px,
            transparent 24px);
    font-family: 'Georgia', serif;
}

#hook .timeline-chart {
    background-image: repeating-linear-gradient(to bottom,
            rgba(0, 0, 0, 0.05) 0px,
            rgba(0, 0, 0, 0.05) 1px,
            transparent 1px,
            transparent 22px);
}

.timeline-chart h3 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    text-align: center;
    border-bottom: 1px solid #c8c2b8;
    padding-bottom: 0.75rem;
    background: transparent;
    margin-top: 0;
    font-weight: bold;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ============================================================================
   D3 CHART STYLING
   ============================================================================ */

.axis {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 11px;
    color: var(--secondary-color);
}

.axis-label {
    font-weight: bold;
    font-size: 12px;
    fill: var(--primary-color);
}

.axis path,
.axis line {
    fill: none;
    stroke: var(--border-color);
    shape-rendering: crispEdges;
}

.line {
    fill: none;
    stroke-width: 2px;
}

.pre-nil-line {
    stroke: var(--pre-nil-color);
}

.post-nil-line {
    stroke: var(--post-nil-color);
}

.nil-policy-line {
    stroke: var(--accent-color);
    stroke-width: 2px;
    stroke-dasharray: 5, 5;
}

.nil-policy-label {
    font-size: 11px;
    fill: var(--accent-color);
    font-weight: bold;
}

.tooltip {
    position: absolute;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Class Year Tooltip (similar style to stoplight tooltip) */
.class-year-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.6;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 280px;
}

.class-year-tooltip.visible {
    opacity: 1;
}

.class-year-tooltip strong {
    color: #C9A66B;
    font-size: 1rem;
}

.class-year-tooltip .change-positive {
    color: #28a745;
    font-weight: 600;
}

.class-year-tooltip .change-negative {
    color: #dc3545;
    font-weight: 600;
}

/* Volume Chart Tooltip */
.volume-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.6;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 300px;
}

.volume-tooltip.visible {
    opacity: 1;
}

.volume-tooltip strong {
    color: #5cb85c;
    font-size: 1rem;
}

/* ============================================================================
   VISUALIZATION PLACEHOLDERS
   ============================================================================ */



.viz-placeholder {
    border: 3px dashed var(--border-color);
    padding: 2rem;
    margin: 2rem 0;
    background-color: #f9f9f9;
    text-align: center;
}

.viz-placeholder h3 {
    color: var(--secondary-color);
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.viz-placeholder p {
    color: var(--text-light);
    font-style: italic;
}

/* ============================================================================
   CLASS YEAR VISUALIZATION CONTAINER
   ============================================================================ */

.viz-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f6f1e7;
    border: 1px solid #c8c2b8;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
    position: relative;
    font-family: 'Georgia', serif;
}

#class-year-chart-area {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: #fdf7ec;
    padding: 10px 10px 12px;
    background-image: repeating-linear-gradient(to bottom,
            rgba(0, 0, 0, 0.05) 0px,
            rgba(0, 0, 0, 0.05) 1px,
            transparent 1px,
            transparent 22px);
    border: 1px solid #111;
    position: relative;
}

#class-year-chart-area::before {
    content: "FIGURE";
    position: absolute;
    top: -11px;
    left: 10px;
    background: #f6f1e7;
    padding: 0 6px;
    font-size: 0.65rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    z-index: 10;
}

#class-year-chart-area h3 {
    font-family: "Old Standard TT", Georgia, "Times New Roman", serif;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-align: center;
    margin: 4px 0 8px;
    width: 100%;
    padding-bottom: 8px;
    border-bottom: 1px solid #c8c2b8;
}

#class-year-chart-area svg {
    border: 1px dashed #777;
    background: repeating-linear-gradient(45deg,
            #f9f2e6,
            #f9f2e6 4px,
            #f3e6d3 4px,
            #f3e6d3 8px);
    padding: 10px;
}

#class-year-chart-area .figure-caption {
    font-size: 0.75rem;
    margin-top: 6px;
    line-height: 1.3;
    padding: 0 10px;
    text-align: left;
    width: 100%;
    max-width: 460px;
}

.chart-empty-state {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
}

/* ============================================================================
   D3 CHART STYLING - Enhanced for Class Year Chart
   ============================================================================ */

#class-year-chart-area svg {
    overflow: visible;
}

#class-year-chart-area .axis text {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 11px;
    fill: var(--secondary-color);
}

#class-year-chart-area .bar-label {
    user-select: none;
}

#class-year-chart-area .legend text {
    fill: var(--primary-color);
}

/* Volume Chart Area - Newspaper Styling */
#volume-chart-area {
    min-height: 380px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: #fdf7ec;
    padding: 10px 10px 12px;
    background-image: repeating-linear-gradient(to bottom,
            rgba(0, 0, 0, 0.05) 0px,
            rgba(0, 0, 0, 0.05) 1px,
            transparent 1px,
            transparent 22px);
    border: 1px solid #111;
    position: relative;
}

#volume-chart-area::before {
    content: "FIGURE";
    position: absolute;
    top: -11px;
    left: 10px;
    background: #f6f1e7;
    padding: 0 6px;
    font-size: 0.65rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    z-index: 10;
}

#volume-chart-area h3 {
    font-family: "Old Standard TT", Georgia, "Times New Roman", serif;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-align: center;
    margin: 4px 0 8px;
    width: 100%;
    padding-bottom: 8px;
    border-bottom: 1px solid #c8c2b8;
}

#volume-chart-area svg {
    border: 1px dashed #777;
    background: repeating-linear-gradient(45deg,
            #f9f2e6,
            #f9f2e6 4px,
            #f3e6d3 4px,
            #f3e6d3 8px);
    padding: 10px;
    overflow: visible;
}

#volume-chart-area .figure-caption {
    font-size: 0.75rem;
    margin-top: 6px;
    line-height: 1.3;
    padding: 0 10px;
    text-align: left;
    width: 100%;
    max-width: 600px;
}

#volume-chart-area .axis text {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 11px;
    fill: var(--secondary-color);
}

#volume-chart-area .cumulative-line {
    filter: drop-shadow(0px 2px 3px rgba(0, 0, 0, 0.2));
}

#volume-chart-area .rate-annotation {
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

.placeholder-content {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    justify-content: space-around;
}

@media (max-width: 768px) {
    .placeholder-content {
        flex-direction: column;
        gap: 1rem;
    }
}

.stoplight-box,
.playbook-box {
    flex: 1;
    padding: 1.5rem;
    background-color: #fffdf5;
    /* Vintage off-white */
    border: 2px solid #d0c8b9;
    /* Eggshell border */
}

.stoplight-box {
    border-left: 4px solid var(--pre-nil-color);
}

.stoplight-box+.stoplight-box {
    border-left-color: var(--post-nil-color);
}

.playbook-box {
    border-left: 4px solid var(--primary-color);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

footer {
    background: #f6f1e7;
    /* Match paper shell background */
    border-top: 3px double #d0c8b9;
    /* Vintage double border */
    padding: 2rem 0;
    text-align: center;
    color: #444;
    font-family: "Old Standard TT", Georgia, serif;
    font-size: 0.9rem;
    margin-top: 0;
    box-shadow: none;
}

footer p {
    margin: 0.5rem 0;
}

/* ============================================================================
   RESPONSIVE UTILITIES
   ============================================================================ */

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    main {
        padding: 1rem;
    }

    .story-section {
        margin-bottom: 2rem;
        padding-bottom: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .narrative-text {
        font-size: 1rem;
    }

    .narrative-text.emphasis {
        font-size: 1.1rem;
    }
}