/* Dataviz Dictionary theme: tokens and base elements.
   This is the only place where colors are defined. site.css and chart SVG refer to these variables. */

:root {
  color-scheme: light;

  /* Surfaces and ink: danielpradilla-app-style tokens */
  --page: #fffdf9;
  --paper: #fffdf9;
  --paper-soft: #f7f7f5;
  --plate: #ffffff;
  --ink: #000000;
  --ink-soft: #28303d;
  --muted: #39414d;
  --secondary: #6d6d6d;
  --rule: #d1d1d1;
  --rule-soft: #e5e5e5;
  --blue: #2f5f7f;
  --blue-soft: #d1dfe4;
  --gray-blue: #abb8c3;
  --danger: #a12a2a;

  /* Categorical palette: separate hues, house blue first. Every series also needs a direct label. */
  --chart-1: #2f5f7f;
  --chart-2: #d48a2a;
  --chart-3: #2e8a70;
  --chart-4: #c0532e;
  --chart-5: #a8689a;

  /* Sequential blue ramp, light to dark */
  --seq-1: #dce7ee;
  --seq-2: #a9c4d6;
  --seq-3: #6f9cba;
  --seq-4: #3f7095;
  --seq-5: #1d4260;

  /* Diverging: negative (clay) to positive (blue) around a pale reference */
  --div-1: #a8432f;
  --div-2: #e2a893;
  --div-3: #ece7df;
  --div-4: #9dbcd1;
  --div-5: #2f5f7f;

  --chart-muted: #bcb8b0;
  --chart-grid: #e6e2da;
  --chart-ink: #1f1f1f;
  --chart-positive: #2f5f7f;
  --chart-negative: #b04a2f;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.4rem;
  --text-display: clamp(1.9rem, 4vw, 3rem);
  --measure: 65ch;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --gutter: clamp(1rem, 3vw, 2rem);
  --shell-max: 90rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--space-4);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: 300;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--blue);
  accent-color: var(--blue);
}

::selection {
  color: var(--ink);
  background: var(--blue-soft);
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-2);
  font-weight: 300;
  letter-spacing: 0;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-display);
  line-height: 1;
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-md);
  font-weight: 300;
}

p,
ul,
ol,
dl {
  margin: 0 0 var(--space-4);
}

p,
li,
dd {
  color: var(--muted);
  text-wrap: pretty;
}

p,
li {
  font-size: 0.93rem;
  line-height: 1.58;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--gray-blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

code {
  padding: 1px 5px;
  color: var(--ink-soft);
  background: var(--paper-soft);
  border: 1px solid var(--rule-soft);
  font-family: var(--font-mono);
  font-size: 0.82em;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Skip-link target: focusing the whole page region needs no ring */
main[tabindex="-1"]:focus {
  outline: none;
}

/* Controls */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

input[type="search"],
input[type="text"],
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: 0;
  font-weight: 300;
  -webkit-appearance: none;
  appearance: none;
}

input[type="search"]:hover,
input[type="text"]:hover,
select:hover,
textarea:hover {
  border-color: var(--muted);
}

input::placeholder,
textarea::placeholder {
  color: var(--secondary);
  opacity: 1;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.82rem;
}

button {
  min-height: 40px;
  padding: 7px 12px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--ink);
  border-radius: 0;
  font-weight: 500;
  cursor: pointer;
}

button:hover:not(:disabled) {
  color: var(--page);
  background: var(--ink);
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

/* Tables: unframed, ink header rule, tabular figures */
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

caption {
  padding: 0 0 var(--space-2);
  color: var(--secondary);
  font-size: 0.8rem;
  text-align: left;
  caption-side: top;
}

th,
td {
  padding: 8px 10px;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  font-size: 0.86rem;
  text-align: left;
  vertical-align: top;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

thead th {
  border-bottom-color: var(--ink);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody th {
  font-weight: 400;
}

td {
  color: var(--muted);
}

/* Disclosure: square chevron drawn in CSS, no glyphs */
summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  list-style: none;
  color: var(--ink);
  font-weight: 400;
  cursor: pointer;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 160ms var(--ease-out);
}

details[open] > summary::before {
  transform: translateY(-2px) rotate(45deg);
}

@media (hover: hover) {
  summary:hover {
    color: var(--blue);
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Chart marks. Text uses currentColor, so the same classes work in SVG and in HTML samples. */
.plot {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  color: var(--chart-ink);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.plot text {
  fill: currentColor;
}

.plot .axis,
.plot .grid {
  fill: none;
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.plot .axis {
  stroke: var(--chart-ink);
}

.plot .grid {
  stroke: var(--chart-grid);
}

.plot :is(.axis, .grid) text {
  stroke: none;
}

.tick {
  color: var(--secondary);
}

.mark-label {
  color: var(--chart-ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.mark-label.inverse,
.plot .inverse {
  color: #ffffff;
}

@media (max-width: 30rem) {
  .plot {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
