:root {
  --paper: #f3f0e8;
  --ink: #1c1917;
  --muted: #5c564e;
  --line: #e2ddd3;
  --card: #fffcf7;
  --header: #1b2430;
  --focus: #1b2430;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 1.05rem;
  line-height: 1.45;
}

a { color: inherit; }

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: #fff;
  color: var(--ink);
  padding: 0.4rem 0.7rem;
  z-index: 30;
}

.skip:focus { top: 0.75rem; }

.site-header {
  background: var(--header);
  color: #f7f4ef;
  padding: 1.15rem 1.25rem 0;
}

.brand { max-width: 72rem; }

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  color: #c8c2b8;
}

.site-header h1 {
  margin: 0.15rem 0 0.85rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 680;
  line-height: 1.05;
}

.site-header h1 a { text-decoration: none; }

.stripe { display: flex; height: 7px; margin: 0 -1.25rem; }
.stripe span { flex: 1; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  padding: 0.75rem 1.25rem;
  background: rgba(243, 240, 232, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.field { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.field input, .field select {
  font: 600 1rem/1.2 "Source Sans 3", sans-serif;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d4cec3;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  min-width: 12rem;
}

.field input { min-width: min(22rem, 70vw); }

.count { margin: 0 0 0.35rem auto; color: var(--muted); font-size: 0.95rem; }

main {
  display: block;
  overflow-x: clip;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.85rem 1.25rem 2.5rem;
}

.lede { margin: 0 0 0.75rem; max-width: none; width: 100%; color: var(--muted); }
.lede a { color: var(--ink); }
.lede-box {
  margin: 0 0 0.75rem;
  width: 100%;
  background: var(--card);
  border-left: 3px solid var(--header);
  border-radius: 0 6px 6px 0;
  padding: 0.65rem 0.9rem 0.75rem;
}
.lede-title {
  margin: 0 0 0.1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.legend-swatch {
  display: inline-block;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.legend-demo-cert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  font: 700 0.78rem/1.3 "Source Sans 3", sans-serif;
  flex-shrink: 0;
  cursor: default;
}

.board {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
}
.board::-webkit-scrollbar { height: 0; width: 0; }

.board-pager { display: none; }

.hscroll {
  flex: 1 0 100%;
  height: 16px;
  margin: 0.15rem 0 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #5c564e #e6e1d6;
  scrollbar-width: auto;
}
.hscroll[hidden] { display: none; }
#hscroll-inner { height: 1px; }
.hscroll::-webkit-scrollbar { height: 14px; }
.hscroll::-webkit-scrollbar-track { background: #e6e1d6; }
.hscroll::-webkit-scrollbar-thumb {
  background: #5c564e;
  border: 3px solid #e6e1d6;
  border-radius: 8px;
}

.column {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 24rem;
  width: 24rem;
  background: transparent;
  padding: 0;
}

.column-title {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
  line-height: 1.2;
  text-align: center;
}
.column-title a { color: var(--bar); text-decoration: none; }
.column-title a:hover { text-decoration: underline; }

.level { margin: 0 0 0.85rem; }
.level h3, .level h4, .section-col h4, .section-col h5 {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-col h4.subsection-title {
  margin: 0.85rem 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.chips, .cards { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.chip, .card {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.chip {
  border-radius: 5px;
  padding: 0.28rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}

.chip.is-cross, .card.is-cross, .legend-demo-cert.is-cross {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72), inset 0 0 0 3.5px rgba(0, 0, 0, 0.38);
}

@media (hover: hover) {
  [data-cert] { transition: opacity 0.15s; }
  .column { transition: opacity 0.15s; }
  main[data-cross-hl] [data-cert]:not(.is-hl) { opacity: 0.15; }
  main[data-cross-hl] [data-cert].is-hl {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
  }
  main[data-cross-hl] .column:not(.is-col-hl) { opacity: 0.15; }
  main[data-cross-hl] .column:not(.is-col-hl) [data-cert] { opacity: 1; }
}

.chip[aria-pressed="true"], .card[aria-pressed="true"], .chip:focus-visible, .card:focus-visible, .tab:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.empty { margin: 0; color: var(--muted); font-size: 0.92rem; }

.area { max-width: none; }
.area-band {
  width: 100%;
}
.area-band-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.area-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bar);
}
.area h2 {
  margin: 0.15rem 0 0.7rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.1;
  text-align: center;
}
.area > .description { margin: 0 0 1.2rem; max-width: 42rem; }

.domain-row-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}
.section-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
  align-items: start;
  width: 100%;
  min-width: 0;
}
.section-row--fixed {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.section-col--also {}
.section-col {
  min-width: 0;
  background: var(--card);
  border-radius: 12px;
  border-top: 6px solid var(--bar);
  padding: 0.8rem 0.85rem 1rem;
  box-shadow: 0 1px 0 rgba(28, 25, 23, 0.06);
}

.section-col--also-gradient {
  border-top: none;
  padding-top: 0;
}
.section-col--also-gradient::before {
  content: "";
  display: block;
  height: 9px;
  margin: 0 -0.85rem 0.8rem;
  border-radius: 12px 12px 0 0;
  background:
    var(--also-gradient) 0 100% / 100% 3px no-repeat,
    linear-gradient(var(--bar), var(--bar)) 0 0 / 100% 6px no-repeat;
}

.section-col h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.section-col .cards { grid-template-columns: 1fr; }
.section-note { margin: 0.15rem 0 0.55rem; color: var(--muted); font-size: 0.92rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr)); gap: 0.45rem; }
.card {
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-height: 3.2rem;
}
.card-abbr { font-weight: 700; }
.card-name { font-weight: 400; font-size: 0.92rem; }

.legend { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.9rem; }

.site-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer a { color: var(--ink); }
.site-footer p { margin: 0; font-size: 1rem; }
.site-footer p + p { margin-top: 0.5rem; }
.site-footer a.footer-contribute { font-weight: 700; display: inline-flex; align-items: center; gap: 0.4rem; }
.footer-gh-icon { flex-shrink: 0; }

.cert-tooltip {
  position: fixed;
  z-index: 15;
  background: var(--header);
  color: #f0ece4;
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  pointer-events: none;
}
.tip-name { display: block; font-weight: 600; font-size: 0.85rem; line-height: 1.35; margin-bottom: 0.3rem; }
.tip-issuer { display: block; font-size: 0.78rem; color: #9e97a0; margin-bottom: 0.2rem; }
.tip-price { display: block; font-size: 0.8rem; color: #c0bab4; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 36, 48, 0.35);
  z-index: 20;
}
.tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.75rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--bar, #888) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bar, #888) 12%, var(--card));
  color: var(--ink);
  font: 700 0.9rem/1 "Source Sans 3", sans-serif;
  padding: 0.5rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab:hover {
  background: color-mix(in srgb, var(--bar, #888) 22%, var(--card));
}

.tab[aria-selected="true"] {
  background: var(--bar, #1b2430);
  color: #fff;
  border-color: transparent;
}

.backdrop[hidden], .detail[hidden], .tabs[hidden], .field[hidden] { display: none; }

.toolbar-top { display: contents; }

.filter-toggle { display: none; }

.view-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--card);
  border: 1px solid #d4cec3;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
.view-toggle.is-active {
  background: var(--header);
  border-color: var(--header);
  color: #fff;
}

.column-area-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin: -0.4rem 0 0.75rem;
  text-align: center;
}

.filter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--header);
  border: 2px solid var(--paper);
  padding: 0;
}

.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(26rem, 100%);
  background: #fffcf7;
  z-index: 21;
  overflow: auto;
  padding: 0;
  box-shadow: -12px 0 40px rgba(28, 25, 23, 0.18);
}
.detail-header {
  background: var(--bar, var(--header));
  color: #fff;
  padding: 1rem 1.25rem 1.6rem;
}
.detail-bar { display: flex; justify-content: flex-end; margin-bottom: 0.5rem; }
.detail-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.detail-bar button:hover { background: rgba(255,255,255,0.28); }
.text-button {
  background: transparent;
  border: 1px solid #d4cec3;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font: 600 0.9rem/1.2 "Source Sans 3", sans-serif;
  cursor: pointer;
}
.filter-reset:not([hidden]) {
  display: inline-flex;
  align-items: center;
  background: var(--card);
  border: 1px solid #d4cec3;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font: 700 1rem/1.2 "Source Sans 3", sans-serif;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: normal;
  text-transform: none;
  transition: background 0.15s, border-color 0.15s;
}
.filter-reset:not([hidden]):hover {
  background: color-mix(in srgb, #888 12%, var(--card));
  border-color: #bbb;
}
.detail-kicker {
  display: inline-block;
  margin: 0 0 0.55rem;
  padding: 0.2rem 0.6rem;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
}
.detail h2 {
  margin: 0 0 0.2rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 2rem;
  line-height: 1.05;
  color: #fff;
}
.detail-name { margin: 0; font-size: 0.95rem; color: rgba(255,255,255,0.75); }
.detail-body { padding: 1.25rem 1.25rem 2rem; }
.detail-desc { margin: 0 0 1rem; font-size: 0.95rem; color: var(--muted); line-height: 1.6; }
.detail-meta {
  margin: 0 0 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.4rem 0.6rem;
}
.detail-meta dt { color: var(--muted); font-weight: 700; font-size: 0.88rem; }
.detail-meta dd { margin: 0; }
.detail-lines {
  margin: 0;
  padding: 0.9rem 0 0 1.1rem;
  border-top: 1px solid var(--line);
}
.detail-lines:empty { display: none; }
.detail-paths {
  margin: 0.9rem 0 0;
  padding: 0.9rem 0 0.9rem;
  border-top: 1px solid var(--line);
}
.detail-paths-label {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-paths-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.path-chip {
  border: 0;
  border-radius: 5px;
  padding: 0.28rem 0.5rem;
  font: 700 0.78rem/1.2 "Source Sans 3", sans-serif;
  cursor: pointer;
  transition: opacity 0.15s;
}
.path-chip:hover { opacity: 0.8; }
.detail-link {
  margin: 1.1rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.detail-link a.detail-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  background: var(--bar, var(--header));
  color: #fff;
  border-radius: 10px;
  font: 700 0.95rem/1.2 "Source Sans 3", sans-serif;
  text-decoration: none;
}
.detail-link a.detail-cta:hover { opacity: 0.88; }
.detail-link a.detail-area {
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
}
.detail-link a.detail-area:hover { text-decoration: underline; color: var(--ink); }

.loading, .noscript { padding: 1rem 1.25rem; }

/* ── Phablet ──────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .count { margin-left: 0; width: 100%; }
  .detail { width: 100%; }
}

/* ── Phone ────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .site-header { padding: 0.9rem 1rem 0; }
  .stripe { margin: 0 -1rem; }
  .tabs { padding: 0.5rem 1rem; }

  .toolbar { padding: 0.6rem 1rem; gap: 0.5rem 0.75rem; }
  .field { width: 100%; }
  .field input,
  .field select { min-width: 0; width: 100%; }

  .toolbar-top {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    width: 100%;
  }
  .toolbar-top .field { flex: 1 1 0; width: auto; }
  .filter-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    background: var(--card);
    border: 1px solid #d4cec3;
    border-radius: 10px;
    color: var(--ink);
    cursor: pointer;
    padding: 0;
  }
  .filter-toggle[aria-expanded="true"] {
    background: var(--header);
    border-color: var(--header);
    color: #fff;
  }
  .filter-toggle[aria-expanded="true"] .filter-badge {
    background: #e4ac03;
    border-color: var(--header);
  }
  .filter-field { display: none; }
  .toolbar.filters-open label.filter-field:not([hidden]) { display: flex; flex-direction: column; }
  .filter-reset { display: none; }
  .toolbar.filters-open .filter-reset:not([hidden]) {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid #d4cec3;
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font: 700 0.9rem/1 "Source Sans 3", sans-serif;
    color: var(--ink);
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
  }
  .toolbar.filters-open .filter-reset:not([hidden]):hover {
    background: color-mix(in srgb, #888 12%, var(--card));
    border-color: #bbb;
  }

  main { padding: 0.75rem 1rem 2rem; }

  /* hide the custom scrollbar — snap pager replaces it */
  #hscroll { display: none !important; }

  /* snap board: each column peeks the next one */
  .board { scroll-snap-type: x mandatory; }
  .column {
    flex: 0 0 calc(100vw - 4rem);
    width: calc(100vw - 4rem);
    scroll-snap-align: start;
  }

  /* pager (prev / N of M / next) shown only on mobile */
  .board-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0.75rem 0 0;
  }
  .pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid #d4cec3;
    border-radius: 50%;
    background: var(--card);
    color: var(--ink);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
  }
  .pager-btn:disabled { opacity: 0.3; cursor: default; }
  .pager-label {
    font: 600 0.85rem/1 "Source Sans 3", sans-serif;
    color: var(--muted);
    min-width: 3.5rem;
    text-align: center;
  }

  /* single-column sections on small phones */
  .section-row, .section-row--fixed { grid-template-columns: 1fr !important; overflow-x: visible; }

  /* cards: single column */
  .cards { grid-template-columns: 1fr; }

  /* detail meta: stack term above value */
  .detail-meta { grid-template-columns: 1fr; gap: 0; }
  .detail-meta dt { margin-top: 0.65rem; }
  .detail-meta dt:first-child { margin-top: 0; }
  .detail-meta dd { margin: 0; }

  .site-footer { padding: 1rem; }
}

/* ── Safe-area insets (iPhone notch / home indicator) ─────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .detail-body {
    padding-bottom: max(2rem, calc(env(safe-area-inset-bottom) + 1rem));
  }
}
