/* nidata.fyi — shared styles
   Colour pairs are chosen to meet WCAG 2.2 AA (most meet AAA) in both themes. */

:root {
  color-scheme: light dark;

  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-alt: #f1efe9;
  --text: #1b1f24;
  --text-muted: #4a5159;
  --border: #d6d2c8;
  --accent: #0b5d66;
  --accent-strong: #08464d;
  --accent-soft: #e2f0f1;
  --focus: #b3410e;

  --radius: 0.75rem;
  --measure: 68ch;
  --page: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 100%;
  line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161a;
    --surface: #182026;
    --surface-alt: #1e272e;
    --text: #e9edf0;
    --text-muted: #b4bec6;
    --border: #34414b;
    --accent: #7fd3db;
    --accent-strong: #a9e4ea;
    --accent-soft: #1b3438;
    --focus: #ffb07a;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.15rem;
}

p,
ul,
ol {
  margin: 0 0 1em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-strong);
  text-decoration-thickness: 0.15em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  border-radius: 0 0 var(--radius) var(--radius);
}

.skip-link:focus {
  top: 0;
  color: var(--bg);
}

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

/* Layout */
.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand span {
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-block;
  padding-block: 0.4rem;
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

main {
  display: block;
}

section {
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

section + section {
  border-top: 1px solid var(--border);
}

.section-intro {
  max-width: var(--measure);
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Hero / about */
.hero {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}

@media (min-width: 48rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.hero-text {
  max-width: var(--measure);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.2rem 0.65rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 999px;
}

.lede {
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  color: var(--text);
}

.portrait {
  margin: 0;
  justify-self: center;
}

/* On narrow screens show the photo above the introduction */
@media (max-width: 47.99rem) {
  .portrait {
    order: -1;
    justify-self: start;
  }

  .portrait img {
    width: 8rem;
  }
}

.portrait img {
  width: clamp(10rem, 30vw, 15rem);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 10px 30px rgb(0 0 0 / 0.12);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  border: 2px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: var(--accent);
  color: var(--bg);
}

.button.primary {
  background: var(--accent);
  color: var(--bg);
}

.button.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

/* Cards */
.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.25rem 1.25rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card:hover,
.card:focus-within {
  border-color: var(--accent);
}

.card h3 {
  margin-bottom: 0.35rem;
}

/* Make the whole card clickable while keeping one link per card */
.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.card h3 a:focus-visible {
  outline: none;
}

.card:has(a:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.card p {
  margin: 0;
  color: var(--text-muted);
}

.card .url {
  margin-top: auto;
  padding-top: 0.75rem;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-muted);
}

/* MLA list */
.mla-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.mla-grid a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  height: 100%;
  min-height: 2.75rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.mla-grid a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mla-grid .name {
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.mla-grid .domain {
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-muted);
}

.note {
  max-width: var(--measure);
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Prose pages (accessibility, privacy) */
.prose {
  max-width: var(--measure);
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.prose h2 {
  margin-top: 2em;
}

.prose h3 {
  margin-top: 1.5em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose .updated {
  color: var(--text-muted);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  font-size: 0.95rem;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
}

.prose th {
  background: var(--surface-alt);
}

.table-scroll {
  overflow-x: auto;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 0.95rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 2rem;
}

.site-footer p {
  margin: 0;
  color: var(--text-muted);
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer a {
  display: inline-block;
  padding-block: 0.25rem;
}

@media (prefers-reduced-motion: no-preference) {
  .card,
  .mla-grid a,
  .button {
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
  }
}

@media (forced-colors: active) {
  .card,
  .mla-grid a,
  .button {
    border: 1px solid CanvasText;
  }
}

@media print {
  .skip-link,
  .site-nav {
    display: none;
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }

  .card h3 a::after {
    position: static;
    content: " (" attr(href) ")";
  }
}
