/* ── Global ── */
body {
    font-family: 'Raleway', sans-serif;
    font-weight: 300;
    color: #333;
    background: #fff;
    margin: 0;
}

a { color: darkorange; }
a:hover { color: #c77700; text-decoration: none; }

h1, h2, h3, h4 {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
}

/* ── Header ── */
#header {
    background: #2C2C2C;
    color: #fff;
    padding: 50px 0 30px;
}

#header h1 {
    font-size: 48px;
    margin-bottom: 5px;
}

#header h2 {
    font-size: 22px;
    font-weight: 300;
    font-family: 'Raleway', sans-serif;
    color: #ccc;
    margin-top: 0;
}

/* ── Navigation ── */
#nav {
    background: #f8f8f8;
    border-bottom: 1px solid #ddd;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

#nav .nav-link {
    display: inline-block;
    padding: 6px 20px;
    color: #666;
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

#nav .nav-link:hover {
    color: #333;
    border-bottom-color: #ccc;
}

#nav .nav-link.active {
    color: darkorange;
    border-bottom-color: darkorange;
}

/* ── Content Sections ── */
.content-section {
    display: none;
    padding: 40px 0 60px;
}

.content-section.active {
    display: block;
}

.content-section h2 {
    font-size: 32px;
    margin-bottom: 10px;
    border-bottom: 2px solid #333;
    padding-bottom: 8px;
    display: inline-block;
}

.section-desc {
    color: #666;
    font-size: 15px;
    margin-bottom: 25px;
    max-width: 800px;
}

/* ── About ── */
.abstract {
    font-size: 16px;
    line-height: 1.7;
    max-width: 800px;
    margin-bottom: 30px;
}

.authors h3, .method-note h3 {
    font-size: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    margin-top: 30px;
}

.authors p { margin: 5px 0; }

.method-note {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-top: 20px;
}

.method-note p { font-size: 14px; margin: 5px 0; }

/* ── Topic Selector ── */
#topic-selector {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background: #fafafa;
}

.selector-header {
    margin-bottom: 10px;
}

.topic-checkbox {
    display: flex;
    align-items: center;
    padding: 3px 0;
    font-size: 13px;
    cursor: pointer;
}

.topic-checkbox input {
    margin-right: 8px;
}

.topic-checkbox:hover {
    background: #f0f0f0;
}

.topic-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

/* ── Topic Words ── */
#topic-words {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
    min-height: 60px;
}

.word-chip {
    display: inline-block;
    padding: 3px 10px;
    margin: 2px;
    background: #e8e8e8;
    border-radius: 12px;
    font-size: 12px;
}

/* ── Semantic Change ── */
#word-shift-info {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    font-size: 14px;
}

/* ── Data Table ── */
.table th {
    background: #f0f0f0;
    font-weight: 600;
    font-size: 14px;
}

.table td {
    font-size: 14px;
}

/* ── Footnotes ── */
.footnotes {
    margin-top: 30px;
    padding-top: 10px;
}

.footnotes h3 {
    font-size: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    margin-bottom: 15px;
}

.footnotes p {
    font-size: 13px;
    line-height: 1.7;
    color: #555;
    margin-bottom: 18px;
    max-width: 900px;
    text-indent: -1.2em;
    padding-left: 1.2em;
}

.footnotes sup {
    font-weight: 600;
    color: darkorange;
    margin-right: 3px;
}

sup a {
    color: darkorange;
    text-decoration: none;
    font-weight: 600;
}

sup a:hover {
    text-decoration: underline;
}

/* ── Footer ── */
footer {
    background: #2C2C2C;
    color: #999;
    padding: 20px 0;
    font-size: 13px;
}

/* ── Dendrogram ── */
#dendrogram-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 1000px;
    border: 1px solid #eee;
    border-radius: 5px;
    background: #fafafa;
}

#dendrogram .link {
    transition: stroke-width 0.2s;
}

#dendrogram .link:hover {
    stroke-width: 3px !important;
    stroke: darkorange !important;
    opacity: 1 !important;
}

#dendrogram .node text {
    cursor: pointer;
    transition: fill 0.2s;
}

#dendrogram .node text:hover {
    fill: darkorange;
}

/* ── Source Toggle ── */
.source-toggle .btn {
    margin: 0 4px;
    font-size: 13px;
    padding: 4px 14px;
}

.source-toggle .btn.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    #header h1 { font-size: 28px; }
    #header h2 { font-size: 16px; }
    #nav .nav-link { padding: 6px 10px; font-size: 13px; }
}

/* ═══════════════════════════════════════════════════════════════
   New York additions. London's accent is darkorange and Shanghai's
   is #6b1f1f; New York takes a deep blue so the three sites in the
   series read as siblings rather than copies.
   ═══════════════════════════════════════════════════════════════ */

:root { --ny-accent: #1f4e79; --ny-red: #8c1515; }

a { color: var(--ny-accent); }
a:hover { color: #143b5c; }

#nav .nav-link.active { color: var(--ny-accent); border-bottom-color: var(--ny-accent); }
.footnotes sup, sup a { color: var(--ny-accent); }
#dendrogram .link:hover { stroke: var(--ny-accent) !important; }
#dendrogram .node text:hover { fill: var(--ny-accent); }

/* ── Header plate ── */
.header-plate {
    max-width: 130px;
    border: 3px solid #4a4a4a;
    opacity: 0.92;
}

/* ── Figures ── */
.plate {
    margin-top: 10px;
    padding: 14px;
    background: #f9f9f9;
    border: 1px solid #e4e4e4;
    border-radius: 5px;
}

.plate img {
    width: 100%;
    max-width: 300px;
    display: block;
    margin: 0 auto;
    border: 1px solid #d8d8d8;
}

.plate figcaption {
    font-size: 12.5px;
    line-height: 1.55;
    color: #666;
    margin-top: 12px;
}

/* ── Sub-headings inside sections ── */
h3.sub {
    font-size: 19px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    margin-bottom: 14px;
}

/* ── About stats ── */
.stats-table { max-width: 460px; font-size: 14px; }
.stats-table td:first-child { color: #666; width: 55%; }

/* ── Topic words ── */
.topic-word-row { margin-bottom: 8px; }
.topic-word-row strong { display: block; font-size: 13px; margin-bottom: 3px; }

/* ── Historical Recall: episode ranking ── */
#episode-list {
    max-height: 560px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fafafa;
}

.episode-row {
    position: relative;
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

.episode-row:last-child { border-bottom: none; }
.episode-row:hover { background: #f0f0f0; }

.episode-row.selected {
    background: #eaf0f6;
    box-shadow: inset 3px 0 0 var(--ny-accent);
}

.episode-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: rgba(31, 78, 121, 0.10);
    z-index: 0;
}

.episode-name { position: relative; z-index: 1; flex: 1; padding-right: 10px; }

.episode-count {
    position: relative;
    z-index: 1;
    color: #666;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* ── Sources table ── */
.src-note { font-size: 12.5px; color: #666; display: block; margin-top: 3px; }

.src-todo {
    display: inline-block;
    font-size: 11px;
    color: #9a6a00;
    background: #fdf4e0;
    border: 1px solid #f0e0bb;
    border-radius: 3px;
    padding: 1px 6px;
    margin-top: 4px;
}

#sources-table td { vertical-align: top; }

@media (max-width: 768px) {
    .header-plate { display: none; }
}

/* ── Metric selectors (style / narrative) ── */
.selector-box {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background: #fafafa;
    max-height: 460px;
    overflow-y: auto;
}

/* ── Semantic change ── */
.shift-panel {
    background: #f9f9f9;
    border-left: 3px solid var(--ny-accent);
    padding: 14px 16px;
    border-radius: 4px;
}

.shift-panel p { font-size: 14px; margin-bottom: 8px; }

#word-selector { max-width: 320px; }

#neighbor-chart { border: 1px solid #eee; border-radius: 5px; background: #fafafa; }

/* ── Revision note inside a sources-table cell ── */
.revision-note {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fbf7ec;
    border: 1px solid #e6dcc4;
    border-radius: 4px;
    font-size: 12.5px;
    line-height: 1.55;
    color: #5c5344;
}
.revision-note strong { color: #7a1414; }
.revision-note ul { margin: 7px 0 7px 0; padding-left: 18px; }
.revision-note li { margin-bottom: 7px; }
.revision-note code {
    font-size: 11.5px;
    background: #f0e9d8;
    padding: 1px 4px;
    border-radius: 3px;
    color: #5c5344;
}
