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

body {
    font-size: 20px;
    font-family: Georgia, 'Times New Roman', Times, serif;
    text-rendering: optimizeLegibility;

    /* ── Grid paper background ── */
    background-color: #f8f8f4;
    background-image:
        linear-gradient(rgba(140, 170, 205, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(140, 170, 205, 0.5) 1px, transparent 1px),
        linear-gradient(rgba(140, 170, 205, 0.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(140, 170, 205, 0.18) 1px, transparent 1px);
    background-size: 80px 80px, 80px 80px, 20px 20px, 20px 20px;
    background-position: 0 0, 0 0, 0 0, 0 0;
}

.content {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1.5em;
}

.header {
    padding: 3em 0;
}

a {
    color: #f05349;
}

.footer {
    background: #f0f0eb;
    color: #555;
    text-align: center;
    font-size: 0.8em;
    margin-top: 4em;
    padding: 4em 1.5em;
    /* ensure it spans the full viewport width regardless of parent */
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
}

.footer p { padding-bottom: 0.4em; }
.footer p:last-child { padding-bottom: 0; }
.footer a { color: #f05349; }

figure {
    margin: 0;
    padding-bottom: 1.2em;
}

figcaption {
    font-size: 0.8em;
    text-align: center;
    margin-top: 0.5em;
    color: #666;
}

h1 {
    font-family: 'Lora', Georgia, serif;
    font-weight: bold;
    font-size: 3em;
    line-height: 1.1;
}

.subhead {
    font-family: 'Lora', Georgia, serif;
    margin-top: 0.75em;
}

iframe, img, video { max-width: 100%; }

p {
    line-height: 1.6;
    margin: 0;
    padding-bottom: 1.2em;
}

ul {
    margin: 0;
    padding-bottom: 1em;
    line-height: 1.6;
}

code {
    font-family: 'Courier New', monospace;
    background: #fff880;
}

@media (max-width: 640px) {
    body { font-size: 18px; }
    .content { padding-left: 0.5em; padding-right: 0.5em; }
}

/* ─────────────────────────────────────────────────────────────
   Byline
   ───────────────────────────────────────────────────────────── */
.byline {
    font-size: 1.1em;
    color: #666;
    padding-bottom: 1.2em;
}

.byline a { color: #f05349; }

/* ─────────────────────────────────────────────────────────────
   Hero
   ───────────────────────────────────────────────────────────── */
#hero {
    width: 100%;
    height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#hero-chart {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

/* ─────────────────────────────────────────────────────────────
   Intro text box
   ───────────────────────────────────────────────────────────── */
.intro-box {
    max-width: 800px;
    margin: 0.75em auto;
    padding: 1.5em 2em;
    background: rgba(255, 255, 255, 0.75);
    border-left: 3px solid #ffc3be;
    font-family: 'Lora', Georgia, serif;
    font-size: 0.95em;
    line-height: 1.7;
    color: #333;
}

/* ─────────────────────────────────────────────────────────────
   Photo block — between intro and scrolly
   ───────────────────────────────────────────────────────────── */
.photo-block {
    max-width: 900px;
    margin: 3em auto;
    padding: 0 1.5em;
}

.photo-block img {
    width: 100%;
    display: block;
    border-radius: 2px;
}

.photo-block figcaption {
    margin-top: 0.6em;
    font-size: 0.78em;
    color: #888;
    text-align: left;
    font-style: italic;
}

/* ─────────────────────────────────────────────────────────────
   Scrollytelling layout — left sticky chart, right text
   ───────────────────────────────────────────────────────────── */
#scrolly {
    position: relative;
    display: flex;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1em;
}

/* Sticky chart — left */
#chart-container {
    position: sticky;
    top: 0;
    height: 100svh;
    width: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    z-index: 1;
}

#chart {
    width: 100%;
    height: 96svh;
    display: block;
    overflow: visible;
}

/* Scrolling steps — right */
#steps {
    width: 30%;
    padding-left: 2em;
    padding-bottom: 4em;
    position: relative;
    z-index: 10;
}

.step {
    color: black;
    display: flex;
    align-items: center;
    margin-bottom: 50svh;
}

.step:first-child {
    padding-top: 40vh;
}

.step p {
    text-align: left;
    padding-bottom: 0;
}

.step p:last-child { padding: 0; }

/* Step card */
.step-content {
    padding: 1.5em;
    background-color: #ffa880cc;
    width: 100%;
    max-width: 100%;
    opacity: 0.55;
    transition: opacity 0.3s;
}

.step.is-active .step-content {
    opacity: 1;
}

.step-content h3 {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0 0 0.6em 0;
    padding: 0;
}

.step-content p {
    font-size: 0.95rem;
    padding: 0;
    line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────────
   Tooltip
   ───────────────────────────────────────────────────────────── */
#tooltip {
    position: fixed;
    background: #ffffffee;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 12px 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    max-width: 240px;
    pointer-events: none;
    z-index: 200;
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 0.78em;
    transition: opacity 0.1s;
}

#tooltip.hidden { opacity: 0; }

#tooltip img {
    width: 100%;
    border-radius: 2px;
    margin-bottom: 8px;
    display: block;
    object-fit: cover;
    max-height: 160px;
}

.tt-title {
    font-family: 'Lora', Georgia, serif;
    font-weight: bold;
    line-height: 1.4;
    margin-bottom: 3px;
}

.tt-artist { color: #555; }

.tt-meta {
    color: #999;
    margin-top: 4px;
    font-size: 0.9em;
}

/* ─────────────────────────────────────────────────────────────
   SVG chart text
   ───────────────────────────────────────────────────────────── */
.axis-label {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 13px;
    fill: #333;
    text-anchor: middle;
    letter-spacing: 0.05em;
}

.cat-count {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 12px;
    fill: #888;
    text-anchor: middle;
}

.axis-line {
    stroke: #333;
    stroke-width: 1.5;
    fill: none;
}

.tick-line {
    stroke: #aaa;
    stroke-width: 0.75;
}

/* Dot states */
.dot {
    cursor: pointer;
    transition: transform 0.1
    s ease, opacity 0.25s ease;
    transform-box: fill-box;       /* scale relative to the element's own bounding box */
    transform-origin: center;      /* from its center, not the SVG origin */
}

.dot:hover { transform: scale(1.6); }
.dot.dimmed { opacity: 0.07; }

/* ─────────────────────────────────────────────────────────────
   Borough map
   ───────────────────────────────────────────────────────────── */
#borough-section {
    margin: 4em 0 0;
}

#borough-section h2 {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 0.4em;
    padding-top: 0.5em;
}

#borough-map-container {
    position: relative;
    max-width: 860px;
    margin: 2em auto 0;
    padding: 0 1.5em;
}

#borough-map-svg {
    width: 100%;
    aspect-ratio: 960 / 680;
    display: block;
}

.borough-path {
    stroke: #fff;
    stroke-width: 1.5;
    cursor: pointer;
    transition: opacity 0.15s;
}

.borough-path:hover {
    opacity: 0.8;
}

.borough-label {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 13px;
    fill: #fff;
    text-anchor: middle;
    pointer-events: none;
}

.borough-count {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 11px;
    fill: rgba(255,255,255,0.85);
    text-anchor: middle;
    pointer-events: none;
}

#borough-tooltip {
    position: fixed;
    background: #ffffffee;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 10px 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    pointer-events: none;
    z-index: 200;
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 0.8em;
    transition: opacity 0.1s;
    min-width: 140px;
}

#borough-tooltip.hidden { opacity: 0; }

.bt-name {
    font-family: 'Lora', Georgia, serif;
    font-weight: bold;
    font-size: 1.05em;
    margin-bottom: 4px;
}

.bt-count { color: #555; }

/* ─────────────────────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #hero { height: 50vh; }

    #scrolly {
        flex-direction: column;
        padding: 0 0.5em;
    }

    #chart-container {
        position: relative;
        width: 100%;
        height: 55svh;
    }

    #chart { height: 55svh; }

    #steps {
        width: 100%;
        padding-left: 0;
    }

    .step-content { max-width: 100%; }
}