:root {
  --paper: #f2f4f3;
  --surface: #ffffff;
  --ink: #1c262d;
  --muted: #5b6970;
  --line: #d3dad9;
  --accent: #0e7566;
  --accent-soft: #dcefeb;
  --rating: #8b5a14;
  --error: #b03a2e;
  --hover: #edf5f2;
  --transparent: transparent;
  --topo-canvas: #ffffff;
  --dropdown-shadow: #00000014;
  /* The image gallery keeps its dark palette in both themes. */
  --gallery-background: #101416;
  --gallery-ink: #edf0ee;
  --gallery-line: color-mix(in srgb, var(--gallery-ink) 15%, var(--transparent));
  --gallery-backdrop: var(--gallery-background);
  --gallery-button-line: color-mix(in srgb, var(--gallery-ink) 14%, var(--transparent));
  --gallery-muted: #9ca8aa;
  --gallery-hover: color-mix(in srgb, var(--gallery-ink) 7%, var(--transparent));
  --gallery-accent: #aacbb1;
  --radius: 8px;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color-scheme: light;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11171a;
    --surface: #182024;
    --ink: #dbe3e4;
    --muted: #94a3a8;
    --line: #2b373c;
    --accent: #4cc0ab;
    --accent-soft: #163a35;
    --rating: #e2b46d;
    --error: #f0877b;
    --hover: #1c2c2c;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #11171a;
  --surface: #182024;
  --ink: #dbe3e4;
  --muted: #94a3a8;
  --line: #2b373c;
  --accent: #4cc0ab;
  --accent-soft: #163a35;
  --rating: #e2b46d;
  --error: #f0877b;
  --hover: #1c2c2c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body { margin: 0; }

a { color: inherit; text-underline-offset: 4px; overflow-wrap: anywhere; }

button, input, select { font: inherit; color: inherit; }

button, a, input, select, summary { -webkit-tap-highlight-color: var(--transparent); }

button, a { touch-action: manipulation; }

button { cursor: pointer; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

h1, h2, h3, p, figure { margin: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  text-wrap: balance;
}

.muted { color: var(--muted); }

.small { font-size: 13px; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .01em;

  & svg { width: 36px; height: 36px; color: var(--accent); }
}

.brand-caption {
  display: block;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: .015em;
  color: var(--muted);
  font-weight: 400;
  margin-top: 5px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 16px;
  background: var(--surface);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  transition: background .15s;

  &:hover { background: var(--accent-soft); }

  &.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }

  &.primary:hover { filter: brightness(.9); }

  &.quiet { border-color: var(--transparent); background: var(--transparent); padding-inline: 10px; color: var(--muted); }

  &.quiet:hover { background: var(--accent-soft); color: var(--accent); }
}

.intro { color: var(--muted); font-size: 18px; line-height: 1.65; }

.filters label, .filter-label, .login-form label {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
}

input, select { font-size: 15px; }

input::placeholder { color: var(--muted); opacity: .85; }

.grade-badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-width: 48px;
  min-height: 34px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  border-radius: 4px;
  padding: 5px 9px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.theme-control {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);

  & button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: var(--transparent);
    color: inherit;
  }

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

  & button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

  & button:focus-visible { outline-offset: 1px; }

  & svg { flex-shrink: 0; }
}

.skip-link {
  position: absolute; z-index: 30; top: -100px; left: 20px; padding: 10px 16px; background: var(--surface); color: var(--accent);

  &:focus { top: 12px; }
}

html { scroll-behavior: smooth; }

@media (max-width: 720px) {
  :root { font-size: 16px; }

  .brand {
    font-size: 25px; gap: 7px;

    & svg { width: 30px; height: 30px; }
  }

  .brand-caption { font-size: 10px; }

  .intro { font-size: 16px; }

  input, select { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.icon {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

a:not(.button):has(> .icon),
span:has(> .icon) {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rating {
  color: var(--rating);

  &:has(> .icon) { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
}
