/* 0.16.15: clear navigation, resilient reading and operable controls. */
body.crg-site :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid oklch(25% .06 250);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px oklch(98% .006 244);
}

body.crg-site :where(a, button, input, select, textarea, [tabindex]) {
  scroll-margin-block: 150px 100px;
}

.crg-main:focus { outline: none; }
.crg-main p { max-width: 70ch; }
body.crg-site :is(main, footer) :is(div, section, header, article, li, figure, a, h1, h2, h3, p, strong) {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}
.crg-main :is(.crg-button, .crg-inline-link, .crg-text-link) { white-space: normal; }
.crg-main p a { text-decoration: underline; text-underline-offset: .2em; }
.crg-wp-page--front :is(h1, h2, h3) { text-wrap: balance; }
.crg-wp-page--front :is(.crg-content-heading, .crg-home-channel__header, .crg-atlas__header) h2 {
  font-size: clamp(2rem, 3.8vw, 3.6rem);
  line-height: 1.14;
  letter-spacing: -.035em;
}
.crg-wp-page--front .crg-section-index { font-size: .875rem; line-height: 1.5; }
.crg-home-stage h1 { max-width: 18ch; line-height: 1.07; }
.crg-home-stage__lead { max-width: 59ch; }
.crg-home-stage__veil {
  background: linear-gradient(90deg, oklch(16% .03 250 / .86), oklch(16% .03 250 / .68) 58%, oklch(16% .03 250 / .32));
}
.crg-home-compass { overflow: visible; }
.crg-home-compass__inner {
  width: var(--crg-wrap);
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: visible;
}
.crg-home-compass__label { grid-column: 1 / -1; min-height: 0; padding: 22px 0 10px; }
.crg-home-compass a { min-height: 64px; font-size: .9rem; padding: 16px; }
.crg-home-compass a:first-of-type { border-left: 0; }
.crg-home-compass a strong { font-size: .9rem; }
.crg-motion-toggle {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-size: .8rem;
  line-height: 1.3;
  cursor: pointer;
}
.crg-motion-toggle[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 4px; }
.crg-motion-toggle:disabled { opacity: 1; cursor: default; }

/* Submenus have an explicit disclosure button on every viewport. */
@media (min-width: 1281px) {
  .has-crg-mobile-submenu { display: flex; align-items: center; }
  .crg-submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
  }
  .has-crg-mobile-submenu > a > span[aria-hidden] { display: none; }
  .crg-nav :is(.sub-menu, .crg-submenu) { visibility: hidden; }
  .crg-nav .crg-submenu-shell.is-expanded :is(.sub-menu, .crg-submenu) {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
  .crg-nav .crg-submenu-shell:not(.is-expanded) :is(.sub-menu, .crg-submenu) {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

.crg-atlas__register {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(430px, auto);
  align-content: start;
}
.crg-atlas__select-label { grid-row: 1; font-size: .9rem; font-weight: 700; margin-bottom: 10px; }
.crg-atlas__select {
  grid-row: 2;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 32px 10px 12px;
  margin-bottom: 28px;
  border: 1px solid var(--crg-ink-soft);
  border-radius: 0;
  background: var(--crg-paper);
  color: var(--crg-ink);
}
.crg-atlas__register-label { grid-row: 3; margin-bottom: 28px; }
.crg-atlas__panel { grid-area: 4 / 1; min-width: 0; min-height: 0; }
/* Reserve every territory's intrinsic height in the same grid cell. Hidden
   panels must use the same flex layout as the active one to prevent jumps. */
.js .crg-main .crg-atlas__panel[hidden] { display: flex !important; flex-direction: column; visibility: hidden; pointer-events: none; }
.crg-atlas__tabs { display: none; }
.crg-atlas__map--chile .crg-atlas__marker { min-width: 28px; min-height: 28px; }
.crg-atlas__map--chile .crg-atlas__marker > b { pointer-events: none; }
.crg-atlas__observation { grid-template-columns: 1fr; gap: 8px; }
.crg-atlas__region, .crg-atlas__register-label, .crg-atlas__observation span { font-size: .875rem; }
.crg-atlas__panel h3 { line-height: 1.15; white-space: normal; overflow-wrap: anywhere; }

/* Native inputs keep their own focus treatment on the visible control. */
.crg-segmented input:focus-visible + span,
.crg-a11y-toggle input:focus-visible + .crg-a11y-toggle__control {
  outline: 3px solid oklch(25% .06 250);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px oklch(98% .006 244);
}
.crg-a11y-dialog form { scroll-padding-block: 16px 100px; }
.crg-a11y-dialog :is(input, button) { scroll-margin-block: 16px 100px; }
html.crg-reduced-motion *, html.crg-reduced-motion *::before, html.crg-reduced-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
.js [data-reveal]:focus-within { opacity: 1; transform: none; visibility: visible; }

@media (max-width: 1280px) {
  .crg-utility-bar__identity { display: none; }
  .crg-utility-bar__inner { justify-content: flex-end; }
  .crg-home-compass__inner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .crg-evidence-ledger .crg-evidence-ledger__reading strong,
  .crg-evidence-ledger .crg-evidence-ledger__grid li:nth-child(n + 3) .crg-evidence-ledger__reading strong {
    font-size: clamp(2.5rem, 15vw, 4rem);
  }
  .crg-evidence-ledger .crg-evidence-ledger__reading { grid-template-columns: minmax(0, 1fr); }
  .crg-header { height: auto; }
  .crg-utility-bar__actions { flex-wrap: wrap; }
  .crg-utility-bar__inner { height: auto; }
  .crg-home-stage__content { width: 100%; }
  .crg-history-line li { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .crg-history-line time { font-size: 1.5rem; }
  .crg-home-compass__inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crg-home-compass a { border-bottom: 1px solid var(--crg-line); }
  .crg-home-compass a:nth-of-type(odd) { border-left: 0; }
  .crg-home-stage h1 { font-size: clamp(2.25rem, 8vw, 3.5rem); }
  .crg-home-stage__veil { background: oklch(16% .03 250 / .76); }
  .crg-utility-bar__actions { width: 100%; justify-content: space-between; gap: 6px; }
  .crg-motion-toggle { font-size: .75rem; padding: 8px; }
  .crg-atlas__register { padding: 28px 20px; }
  .crg-atlas__panel h3 { font-size: clamp(1.4rem, 6.5vw, 2.4rem); }
}
@media (max-width: 360px) {
  .crg-home-compass a { padding-inline: 10px; grid-template-columns: minmax(0, 1fr); }
  .crg-home-compass a > b { display: none; }
  .crg-home-compass a strong { overflow-wrap: anywhere; }
  .crg-atlas__panel h3 { white-space: normal; overflow-wrap: anywhere; }
  .crg-atlas__map--chile .crg-atlas__marker > b { font-size: .625rem; padding: 4px; }
}

/* Content and site navigation remain available without JavaScript. */
html:not(.js) :is(.crg-motion-toggle, .crg-a11y-shortcut, .crg-search-open, .crg-menu-toggle, .crg-atlas__markers, .crg-atlas__select, .crg-atlas__select-label) { display: none; }
html:not(.js) .crg-header { position: relative; height: auto; }
html:not(.js) .crg-header__inner { flex-wrap: wrap; }
html:not(.js) .crg-nav { position: static; display: block; opacity: 1; visibility: visible; width: 100%; transform: none; max-height: none; }
html:not(.js) .crg-nav :is(.sub-menu, .crg-submenu) { position: static; visibility: visible; opacity: 1; pointer-events: auto; transform: none; }
html:not(.js) .crg-atlas__register { display: block; }
html:not(.js) .crg-main .crg-atlas__panel[hidden] { display: block !important; }
html:not(.js) .crg-atlas__panel { margin-block: 30px; }

@media (forced-colors: active) {
  body.crg-site :focus-visible { outline: 3px solid Highlight; box-shadow: none; }
  .crg-atlas__map--chile .crg-atlas__marker > span { forced-color-adjust: none; background: Canvas; border-color: CanvasText; }
  .crg-atlas__map--chile .crg-atlas__marker.is-active > span { background: Highlight; border-color: HighlightText; }
  .crg-atlas__map--chile .crg-atlas__marker.is-active > b { outline: 2px solid Highlight; }
}
