/* Are We Cousins — public site.
 *
 * Built for someone whose sight is deteriorating, so the accessibility choices
 * are structural rather than decorative: a base size in rem that honours the
 * browser setting, contrast well past the minimum, focus rings that are
 * impossible to miss, and a layout that survives being zoomed to 400% because
 * it is set in relative units throughout.
 *
 * Archival without the sepia cliché: cool grey paper, ink that is nearly black
 * but not quite, and a single muted teal that does the linking and nothing else.
 */

:root {
  --paper:     #f5f6f5;
  --card:      #ffffff;
  --sunk:      #eaedec;
  --ink:       #12181a;
  --ink-soft:  #43555a;
  --ink-quiet: #66787d;
  --rule:      #d6dedc;
  --accent:    #0d6a62;
  --accent-in: #0a534d;
  --living:    #6b5b8a;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #0e1315;
    --card:      #161d20;
    --sunk:      #1d2629;
    --ink:       #e9efee;
    --ink-soft:  #a8babe;
    --ink-quiet: #7f9296;
    --rule:      #273336;
    --accent:    #58c3b6;
    --accent-in: #7fd6cb;
    --living:    #a99ad6;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 1.25rem; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-in); }

/* A focus ring you cannot miss, on everything focusable. */
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff;
  padding: 0.75rem 1rem; z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- masthead ---------- */
.masthead {
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  padding: 0.9rem 0;
  margin-bottom: 2.5rem;
}
.masthead-in {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: center; justify-content: space-between;
}
.brand {
  font-family: var(--serif);
  font-size: 1.4rem; font-weight: 600;
  color: var(--ink); text-decoration: none;
}
.find { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.find label { font-size: 0.9rem; color: var(--ink-quiet); }
.find input {
  font: inherit; font-size: 1rem;
  padding: 0.5rem 0.7rem;
  min-height: 2.75rem;              /* a target a shaky hand can hit */
  border: 1px solid var(--rule); border-radius: 5px;
  background: var(--paper); color: var(--ink);
  min-width: 14rem;
}
.find button, .btn {
  font: inherit; font-weight: 500;
  padding: 0.5rem 1rem; min-height: 2.75rem;
  border: 1px solid var(--accent); border-radius: 5px;
  background: var(--accent); color: #fff; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--accent); }

/* ---------- headings ---------- */
h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  line-height: 1.15; margin: 0 0 0.35rem;
  text-wrap: balance;
}
h2 {
  font-family: var(--serif);
  font-size: 1.45rem; font-weight: 600;
  margin: 2.25rem 0 0.75rem;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1rem; margin: 1.25rem 0 0.4rem; color: var(--ink-soft); }
p { margin: 0 0 1rem; max-width: 68ch; }
.lede { font-family: var(--serif); font-size: 1.2rem; color: var(--ink-soft); }
.quiet { color: var(--ink-quiet); font-size: 0.95rem; }

/* ---------- home ---------- */
.hero { margin-bottom: 2.5rem; }
.figures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px; background: var(--rule);
  border: 1px solid var(--rule); border-radius: 8px; overflow: hidden;
  margin: 2rem 0;
}
.fig { background: var(--card); padding: 1.1rem 1.2rem; }
.fig b {
  display: block; font-family: var(--serif);
  font-size: 1.8rem; font-weight: 600; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.fig span { display: block; font-size: 0.9rem; color: var(--ink-quiet); margin-top: 0.2rem; }

/* ---------- person ---------- */
.person-head { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; }
.portrait {
  width: 11rem; height: 13rem; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--rule); background: var(--sunk);
}
.dates { font-family: var(--serif); font-size: 1.25rem; color: var(--ink-soft); }

.facts { border-collapse: collapse; width: 100%; margin-top: 0.5rem; }
.facts th, .facts td {
  text-align: left; padding: 0.6rem 0.8rem 0.6rem 0;
  border-bottom: 1px solid var(--rule); vertical-align: top;
}
.facts th { width: 8.5rem; font-weight: 600; color: var(--ink-soft); font-size: 0.95rem; }

.people { list-style: none; margin: 0; padding: 0; display: flex;
          flex-direction: column; gap: 0.15rem; }
.people li { padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.people li:last-child { border-bottom: none; }
.people .when { color: var(--ink-quiet); font-size: 0.95rem; }
.living { color: var(--living); font-style: italic; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.9rem; }
.gallery img {
  width: 100%; aspect-ratio: 4/5; object-fit: cover;
  border-radius: 5px; border: 1px solid var(--rule); background: var(--sunk);
}
.gallery figcaption { font-size: 0.85rem; color: var(--ink-quiet); margin-top: 0.3rem; }

.card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 8px; padding: 1.1rem 1.25rem; margin-bottom: 1rem;
}

.notice {
  background: var(--sunk); border-left: 4px solid var(--living);
  padding: 0.9rem 1.1rem; border-radius: 4px; margin: 1rem 0;
}

/* ---------- results ---------- */
.results { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.results li { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.results a { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }

.footer {
  margin-top: 4rem; padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule); color: var(--ink-quiet); font-size: 0.95rem;
}
.footer p { max-width: 60ch; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- places ---------- */
.topnav { display: flex; gap: 1rem; }
.topnav a { font-weight: 500; text-decoration: none; }
.topnav a:hover { text-decoration: underline; }

.place-grid {
  list-style: none; margin: 0.5rem 0 1.5rem; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.15rem 1.5rem;
}
.place-grid li {
  padding: 0.5rem 0; border-bottom: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  align-items: baseline; justify-content: space-between;
}
.place-grid a { font-weight: 500; }
.place-grid .quiet { font-size: 0.85rem; }

/* The level table: a shape you can read at a glance, and numbers that line up. */
.levels .num {
  text-align: right; font-variant-numeric: tabular-nums;
  width: 6rem; padding-right: 1rem;
}
.levels .bar-cell { width: 55%; }
.levels .bar {
  height: 0.6rem; background: var(--accent);
  border-radius: 2px; min-width: 2px;
}

/* A place's own strings, shown as the raw text they were. */
code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.92em; background: var(--sunk);
  padding: 0.1rem 0.35rem; border-radius: 3px;
}
