/*
 * whichregistry.ca stylesheet. Hand-written, no framework, system fonts only.
 * Colours are tokens (tests/site/stylesheet.test.ts checks them):
 *   --bg*  backgrounds; --fg* text, AA 4.5:1 on every --bg*; --ui* control edges and focus rings,
 *   3:1 on every --bg*; --line decorative rules only (never the only cue for anything).
 * Light theme only: the site always renders light, whatever the device setting.
 */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-surface: #f3f4f6;
  --bg-confirm: #fdf3d8;
  --fg: #1a1d21;
  --fg-muted: #4b5563;
  --fg-link: #0a58b0;
  --fg-verified: #14692f;
  --fg-confirm: #7a4500;
  --ui-border: #6f7782;
  --ui-focus: #7020c0;
  --line: #d9dde3;
  --measure: 48rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 100%;
  line-height: 1.6;
}

/* Page shell */
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  overflow-wrap: break-word;
}
body > header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line);
}
body > header > nav,
body > [data-breadcrumbs],
main,
body > footer {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1rem;
}
main {
  padding-block: 1rem 2.5rem;
}
body > footer {
  border-top: 1px solid var(--line);
  padding-block: 1rem 2rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* Type */
h1,
h2,
h3 {
  line-height: 1.25;
  margin: 1.6em 0 0.5em;
}
h1 {
  font-size: clamp(1.75rem, 1.35rem + 1.8vw, 2.25rem);
  margin-top: 0.5em;
}
h2 {
  font-size: 1.4rem;
}
h3 {
  font-size: 1.15rem;
}
p,
ul,
ol,
dl,
table {
  margin: 0 0 1rem;
}
li + li {
  margin-top: 0.25rem;
}
small {
  font-size: 0.875em;
}

/* Links */
a {
  color: var(--fg-link);
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration-thickness: 2px;
}

/* Focus: every interactive element, both themes */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Nav bar */
nav[aria-label="Jurisdictions"] ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0.6rem 0;
  list-style: none;
  font-size: 0.95rem;
}
nav[aria-label="Jurisdictions"] li {
  margin: 0;
}
nav[aria-label="Jurisdictions"] a {
  display: inline-block;
  padding: 0.2rem 0;
  font-weight: 500;
  text-decoration: none;
}
nav[aria-label="Jurisdictions"] a:hover,
nav[aria-label="Jurisdictions"] a[aria-current] {
  text-decoration: underline;
}
[data-breadcrumbs] ol {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0.75rem 0 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--fg-muted);
}
[data-breadcrumbs] li {
  margin: 0;
}
[data-breadcrumbs] li + li::before {
  content: "/";
  content: "/" / "";
  padding-inline: 0.5em;
}

/* Controls */
button,
select,
input {
  font: inherit;
  color: inherit;
}
button,
select {
  min-height: 2.5rem;
  padding: 0.45rem 0.9rem;
  background: var(--bg-surface);
  color: var(--fg);
  border: 1px solid var(--ui-border);
  border-radius: 0.4rem;
  max-width: 100%;
}
button {
  cursor: pointer;
  font-weight: 600;
}
button:hover,
select:hover {
  border-color: var(--fg);
}
label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  max-width: 100%;
}
label select {
  min-width: 0;
}
input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  accent-color: var(--fg-link);
}

/* Facts and status markers. Each status differs by glyph, border or style, not colour alone. */
.fact-detail,
.fact-source,
.fact-note {
  margin-left: 0.35em;
}
.fact-source,
.fact-note {
  font-size: 0.85em;
}
.fact-note {
  color: var(--fg-muted);
}
.fact-source {
  color: var(--fg-verified);
  text-decoration-style: solid;
  white-space: nowrap;
}
.fact-source::before {
  content: "\2713\00a0";
  content: "\2713\00a0" / "";
  font-weight: 700;
}
/* "Unconfirmed": a small, quiet tag (the word itself and a dotted underline are the non-colour cue).
 * Its note (reason, "Confirm with the registry", source) stays in the DOM for screen readers and
 * opens below the fact when the tag is clicked, tapped or focused (not on hover: opening pushes the
 * row down, which would move the tag out from under the pointer and make it flicker). Hovering shows
 * the reason as a native tooltip instead, which floats and never shifts the layout. CSS only. */
.badge {
  margin-left: 0.35em;
  color: var(--fg-confirm);
  font-size: 0.75em;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
  cursor: pointer;
  white-space: nowrap;
}
a.badge:hover {
  text-decoration-style: solid;
}
.unconfirmed {
  position: relative;
  border-radius: 0.2em;
}
.unconfirmed .fact-note {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.unconfirmed:focus .fact-note,
.unconfirmed:focus-within .fact-note {
  position: static;
  display: block;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  margin: 0.25em 0 0;
  padding: 0.4em 0.6em;
  border-left: 3px solid var(--ui-border);
  background: var(--bg-surface);
}
[data-why="unknown"] .fact-value {
  font-style: italic;
}

/* Lists of routes, steps and fees */
.routes,
.steps {
  padding-left: 1.25rem;
}
.routes > li,
.steps > li {
  margin-bottom: 0.75rem;
}
.routes dl,
.wizard-fees {
  display: grid;
  grid-template-columns: fit-content(45%) minmax(0, 1fr);
  gap: 0.2rem 0.75rem;
  margin: 0.3rem 0 0;
}
.wizard-fees {
  margin-bottom: 1rem;
}
.wizard-fees [data-total] {
  display: contents;
}
dt {
  font-weight: 600;
}
dd {
  margin: 0;
  min-width: 0;
}
.disclosure {
  margin: 0.2rem 0 0;
  font-size: 0.9em;
  color: var(--fg-muted);
}

/* Home */
.jurisdiction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr));
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}
.jurisdiction-grid li {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--bg-surface);
}
.jurisdiction-grid a {
  display: block;
  font-weight: 600;
}
.registry-name,
.publisher {
  display: block;
  font-size: 0.85em;
  color: var(--fg-muted);
}

/* Tables: contained in a scrolling wrapper so the page never scrolls sideways */
.table-wrap,
.fee-table-wrap,
[data-source-group] {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  font-size: 0.9rem;
}
[data-source-group] table {
  width: 100%;
}
[data-checked-on],
time {
  white-space: nowrap;
}
th,
td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}
thead th {
  background: var(--bg-surface);
  border-bottom: 2px solid var(--ui-border);
}
td ul,
.cost-parts {
  margin: 0.25rem 0 0;
  padding-left: 1rem;
}
.cost-parts {
  font-size: 0.9em;
}

/* Fee comparison: full table on wide screens, the picker below 64rem */
.fee-table-wrap {
  display: none;
}
[data-fee-table] {
  font-size: 0.85rem;
}
[data-fee-table] th,
[data-fee-table] td {
  border: 1px solid var(--line);
  padding: 0.3rem 0.4rem;
}
[data-fee-table] [data-access] {
  min-width: 20rem;
}
.fee-picker [data-fee-ranking] ol {
  padding-left: 1.5rem;
}
.fee-picker label {
  margin-bottom: 0.5rem;
}
@media (min-width: 64rem) {
  .fee-table-wrap {
    display: block;
    width: min(100vw - 2rem, 110rem);
    margin-left: 50%;
    transform: translateX(-50%);
  }
  .fee-picker {
    display: none;
  }
}
[data-footnotes] {
  font-size: 0.9rem;
}

/* Tools */
.wizard-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.plan-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.storage-note {
  padding: 0.5rem 0.75rem;
  border-left: 4px solid var(--fg-confirm);
  background: var(--bg-confirm);
}
.checklist {
  list-style: none;
  padding-left: 0;
}
.checklist li {
  margin-block: 0.75rem;
}
.checklist label {
  display: block;
  padding-left: 1.7rem;
  text-indent: -1.7rem;
}
.checklist input[type="checkbox"] {
  margin-right: 0.5rem;
  vertical-align: -0.2em;
}
.checklist li > p {
  margin: 0.25rem 0 0 1.7rem;
}
.requirement {
  font-size: 0.85em;
  color: var(--fg-muted);
}
.last-verified,
.not-affiliated {
  font-size: 0.9rem;
}

@media print {
  body > header,
  [data-breadcrumbs],
  .fee-picker,
  .plan-picker,
  .wizard-options {
    display: none;
  }
  .fee-table-wrap {
    display: block;
    width: auto;
    margin: 0;
    transform: none;
  }
  a {
    color: inherit;
  }
}
