html[data-editorial] {
  color-scheme: light dark;

  --bg-primary: light-dark(#f9f6f0, #0c0a09);
  --bg-secondary: light-dark(#f0e8d9, #211b17);
  --bg-tertiary: light-dark(#e7ddca, #2b221c);
  --text-primary: light-dark(#1c1917, #e7e5e4);
  --text-secondary: light-dark(#575047, #cdc2b5);
  --text-muted: light-dark(#685d4d, #bcafa4);
  --accent-primary: light-dark(#8c3c1b, #fdba74);
  --accent-secondary: light-dark(#0f655d, #8ee3d6);
  --border-color: light-dark(#d6cbbd, #534439);
  --card-bg: var(--bg-secondary);
  --card-border: var(--border-color);
}

html[data-editorial][data-theme='light'] { color-scheme: light; }
html[data-editorial][data-theme='dark'] { color-scheme: dark; }
html[data-editorial] .desktop-nav { background: var(--bg-primary); }
html[data-editorial] .article-header h1,
html[data-editorial] .article-meta,
html[data-editorial] .article-content { animation: none; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html[data-editorial] { scroll-behavior: auto; }
  html[data-editorial]::view-transition-old(*),
  html[data-editorial]::view-transition-new(*) { animation: none; }
}

editorial-palette {
  --palette-paper: var(--ia-bg, var(--bg-primary, #f9f6f0));
  --palette-ink: var(--ia-ink, var(--text-primary, #1c1917));
  --palette-muted: var(--ia-muted, var(--text-secondary, #57534e));
  --palette-rule: var(--ia-rule, var(--border-color, #d6cbbd));
  --palette-accent: var(--ia-link, var(--accent-primary, #9a3412));
  --palette-sans: var(--ia-sans, var(--font-body, system-ui));
  --palette-serif: var(--ia-serif, var(--font-heading, Georgia));
}

[data-palette-open] {
  padding: .35rem .65rem;
  min-height: 2.5rem;
  color: var(--palette-ink);
  background: var(--palette-paper);
  border: 1px solid var(--palette-rule);
  border-radius: .35rem;
  font: 600 .875rem/1.4 var(--palette-sans);
  cursor: pointer;
}
[data-palette-open] kbd { margin-inline-start: .35rem; color: var(--palette-muted); font-size: .7rem; }
[data-editorial] .desktop-nav, html[data-editorial] .mobile-nav { padding-inline-end: 4.4rem; }
[data-editorial] editorial-palette { position: fixed; z-index: 1101; top: .25rem; right: .75rem; }
[data-editorial] .nav-open editorial-palette { z-index: 199; }
[data-editorial] [data-palette-open] { min-height: 1.875rem; }
[data-editorial] [data-palette-open] kbd { display: none; }

.editorial-palette-dialog {
  position: fixed;
  inset: min(13svh, 7rem) 0 auto;
  width: min(37rem, calc(100vw - 2rem));
  max-height: min(74svh, 42rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(.85rem, 3vw, 1.5rem);
  color: var(--palette-ink);
  background: var(--palette-paper);
  border: 1px solid var(--palette-rule);
  border-radius: .65rem;
  box-shadow: 0 1.25rem 4rem rgb(15 10 6 / .3);
  font: 400 .95rem/1.5 var(--palette-sans);
}
.editorial-palette-dialog::backdrop { background: rgb(22 17 13 / .54); }
.editorial-palette-dialog header { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.editorial-palette-dialog h2 { margin: 0; color: var(--palette-ink); font: 600 clamp(1.3rem, 4vw, 1.65rem)/1.2 var(--palette-serif); }
.editorial-palette-dialog button { min-width: 2.5rem; min-height: 2.5rem; cursor: pointer; }
.editorial-palette-dialog input, .editorial-palette-dialog select, .editorial-palette-dialog button {
  color: var(--palette-ink);
  background: var(--palette-paper);
  border: 1px solid var(--palette-rule);
  border-radius: .3rem;
  font: inherit;
}
.editorial-palette-dialog input { display: block; width: 100%; min-height: 2.75rem; margin-top: .8rem; padding: .5rem .65rem; }
.editorial-palette-dialog input::-webkit-search-cancel-button { display: none; }
.editorial-palette-dialog .palette-hint, .editorial-palette-dialog [data-status] { margin: .45rem 0; color: var(--palette-muted); font-size: .82rem; }
.palette-filters { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-block: .75rem; }
.palette-filters select { min-height: 2.25rem; padding-inline: .3rem; }
.editorial-palette-dialog ul { list-style: none; padding: 0; margin: 0; }
.editorial-palette-dialog [data-results] h3 {
  margin: .65rem 0 .15rem;
  color: var(--palette-muted);
  font: 600 .73rem/1.4 var(--ia-mono, var(--font-mono, ui-monospace, monospace));
  letter-spacing: .05em;
  text-transform: uppercase;
}
.editorial-palette-dialog li + li { border-block-start: 1px solid var(--palette-rule); }
.editorial-palette-dialog li a {
  display: grid;
  gap: .2rem;
  padding: .65rem .55rem;
  border-inline-start: 2px solid transparent;
  border-radius: .35rem;
  color: var(--palette-accent);
  text-decoration: none;
}
.editorial-palette-dialog li a:is(:hover, :focus-visible, [data-default-active]) {
  background: color-mix(in srgb, var(--palette-accent) 8%, transparent);
}
.editorial-palette-dialog li a:is(:hover, :focus-visible) strong { text-decoration: underline; }
.editorial-palette-dialog li a[data-default-active] { border-inline-start-color: var(--palette-accent); }
.editorial-palette-dialog li span { color: var(--palette-muted); font-size: .87rem; }
.editorial-palette-dialog :focus-visible { outline: 2px solid var(--palette-accent); outline-offset: 2px; }
.palette-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .85rem;
  margin-block-start: .85rem;
  padding-block-start: .65rem;
  border-block-start: 1px solid var(--palette-rule);
  color: var(--palette-muted);
  font-size: .75rem;
}
.palette-shortcuts kbd { color: var(--palette-ink); }
.palette-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 42rem) { [data-palette-open] kbd { display: none; } }
