* {
    box-sizing: border-box;
}
:root {
    --navbar-height: 44px;
}
html, body {
    min-height: 100%;
}
body {
    min-height: 100dvh;
}
body {
    font-family: "Linux Libertine", "Palatino Linotype", Georgia, serif;
    margin: 0;
    background: #f3e9d2;
    color: #3f3326;
}
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) body {
        background: #1c2430;
        color: #ede1c3;
    }
}
:root[data-theme="dark"] body {
    background: #1c2430;
    color: #ede1c3;
}

body.graph-fullscreen {
    overflow: hidden;
}
body.graph-fullscreen .navbar,
body.graph-fullscreen .footer {
    display: none;
}

.navbar {
    position: relative;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1.25rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid #d8c9a3;
    font-family: "Times New Roman", "Palatino Linotype", serif;
    font-style: "bold";
}
.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.navbar a {
    flex: none;
    color: #6b5d47;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
    white-space: nowrap;
}
.navbar a.active {
    color: #2f6690;
    font-weight: 700;
    border-bottom-color: #2f6690;
}
.theme-toggle {
    flex: none;
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
}
.nav-toggle {
    display: none;
    flex: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.25rem;
    height: 2.25rem;
    background: none;
    border: 1px solid #b8935a;
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
}
.nav-toggle-bar {
    display: block;
    height: 2px;
    margin: 0 auto;
    width: 60%;
    background: #b8935a;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle-open .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle-open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle-open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .navbar {
        border-bottom-color: #3a4453;
    }
    :root:where(:not([data-theme="light"])) .navbar a {
        color: #b9ac8c;
    }
    :root:where(:not([data-theme="light"])) .navbar a.active {
        color: #5b9bc9;
        font-weight: 700;
        border-bottom-color: #5b9bc9;
    }
}
:root[data-theme="dark"] .navbar {
    border-bottom-color: #3a4453;
}
:root[data-theme="dark"] .navbar a {
    color: #b9ac8c;
}
:root[data-theme="dark"] .navbar a.active {
    font-weight: 700;
    border-bottom-color: #5b9bc9;
    color: #5b9bc9;
}

@media (max-width: 640px) {
    .navbar {
        border-bottom-width: 2px;
    }
    .nav-toggle {
        display: flex;
        position: fixed;
        right: 1.1rem;
        bottom: 1.1rem;
        z-index: 30;
        width: 3.25rem;
        height: 3.25rem;
        border-radius: 50%;
        border-width: 2px;
        background: #f3e9d2;
        box-shadow: 0 4px 14px rgba(63, 51, 38, 0.35);
    }
    .nav-links {
        position: fixed;
        right: 1.1rem;
        bottom: calc(1.1rem + 3.25rem + 0.6rem);
        left: auto;
        top: auto;
        z-index: 20;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: min(78vw, 260px);
        max-height: 0;
        overflow: hidden;
        border: none;
        border-radius: 14px;
        background: #f3e9d2;
        box-shadow: 0 8px 24px rgba(63, 51, 38, 0.3);
        transition: max-height 0.25s ease, border-color 0.2s ease;
        transform-origin: bottom right;
    }
    .nav-links.nav-open {
        max-height: 70vh;
        overflow-y: auto;
        border: 2px solid rgba(63, 51, 38, 0.16);
    }
    .navbar a {
        padding: 0.9rem 1.25rem;
        border-bottom-width: 2px;
        border-bottom-style: solid;
        border-bottom-color: #e5d7b3;
        width: 100%;
    }
    .navbar a:first-child {
        border-radius: 14px 14px 0 0;
    }
    .navbar a:last-child {
        border-bottom: none;
        border-radius: 0 0 14px 14px;
    }
    .navbar a.active {
        background: rgba(47, 102, 144, 0.08);
    }
    .footer {
        border-top-width: 2px;
    }
    .viz-root .gridline {
        stroke-width: 1.35;
    }
    .viz-root .bubble {
        stroke-width: 2.4;
    }
}
@media (max-width: 640px) and (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .nav-links,
    :root:where(:not([data-theme="light"])) .nav-toggle {
        background: #1c2430;
    }
    :root:where(:not([data-theme="light"])) .navbar a {
        border-bottom-color: #2c3646;
    }
}
:root[data-theme="dark"] .nav-links,
:root[data-theme="dark"] .nav-toggle {
    background: #1c2430;
}
:root[data-theme="dark"] .navbar a {
    border-bottom-color: #2c3646;
}


.footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
    color: #8a7c62;
    border-top: 1px solid #d8c9a3;
    font-style: italic;
    font-family: "Times New Roman", "Palatino Linotype", serif;
}
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .footer {
        border-top-color: #3a4453;
        color: #c9a24a;
    }
}
:root[data-theme="dark"] .footer {
    border-top-color: #3a4453;
    color: #c9a24a;
}
:root {
  color-scheme: light;
  --surface-1:      #f3e9d2;
  --text-primary:   #3f3326;
  --text-secondary: #6b5d47;
  --muted:          #8a7c62;
  --gridline:       #d8c9a3;
  --series-1:       #2f6690;
  --series-1-fill:  rgba(47, 102, 144, 0.28);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1:      #1c2430;
    --text-primary:   #ede1c3;
    --text-secondary: #b9ac8c;
    --muted:          #8b8168;
    --gridline:       #3a4453;
    --series-1:       #5b9bc9;
    --series-1-fill:  rgba(91, 155, 201, 0.28);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1:      #1c2430;
  --text-primary:   #ede1c3;
  --text-secondary: #b9ac8c;
  --muted:          #8b8168;
  --gridline:       #3a4453;
  --series-1:       #5b9bc9;
  --series-1-fill:  rgba(91, 155, 201, 0.28);
}

.viz-root {
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: "Palatino Linotype", "Palatino", Georgia, serif;
  padding: 1.5rem;
  max-width: 780px;
}
.viz-root h1 { font-size: 1.1rem; margin: 0 0 0.1rem; }
.viz-root .subtitle { color: var(--text-secondary); font-size: 0.85rem; margin: 0 0 1rem; }
.viz-root .viz-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.viz-root .table-toggle {
  flex: none;
  background: transparent;
  border: 1px solid var(--gridline);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.viz-root .table-toggle:hover {
  border-color: var(--series-1);
  color: var(--series-1);
}
.viz-root .axis-label {
  fill: var(--muted);
  font-size: 11px;
}
.viz-root .gridline { stroke: var(--gridline); stroke-width: 1; }
.chart-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.chart-scroll svg {
  display: block;
  flex-shrink: 0;
}
.viz-root .bubble {
  fill: var(--series-1-fill);
  stroke: var(--series-1);
  stroke-width: 2;
}
.viz-root a:hover .bubble,
.viz-root .bubble:hover { fill: var(--series-1); cursor: pointer; }
.viz-root .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.viz-root .data-table th,
.viz-root .data-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--gridline);
}
.viz-root .data-table th {
  color: var(--text-secondary);
  font-weight: 600;
}
.viz-root .data-table a {
  color: var(--series-1);
}
#tooltip {
  position: absolute;
  display: none;
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--gridline);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(63, 51, 38, 0.2);
}
#tooltip .t-title { font-weight: 600; }
#tooltip .t-meta { color: var(--text-secondary); }