:root {
  color-scheme: light dark;
  --bg: #fbfbfa;
  --fg: #16161a;
  --muted: #6b6b73;
  --card: #ffffff;
  --line: #e4e4e2;
  --accent: #2f6f4f;
  --accent-fg: #ffffff;
  --danger: #b3261e;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14141a;
    --fg: #f2f2f0;
    --muted: #9a9aa4;
    --card: #1e1e26;
    --line: #32323c;
    --accent: #5fbf8e;
    --accent-fg: #10231a;
    --danger: #f2857c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  width: 100%;
  max-width: 30rem;
}

h1 {
  margin: 0 0 .35rem;
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  letter-spacing: -.02em;
}

.sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: .95rem;
}

/* Crest stands in for the page heading on the login screen. The artwork
   keeps its own white ground, framed as a plaque so it reads as deliberate
   on the dark theme instead of looking like a stray white rectangle. */
h1:has(.crest) {
  margin: 0 0 1.5rem;
  text-align: center;
}

h1:has(.crest) + .sub { text-align: center; }

.crest {
  width: 100%;
  max-width: 19rem;
  height: auto;
}

/* --- login screen: black ground + doodle pattern --- */

/* Committed to one look regardless of the viewer's colour scheme, so these
   override the inherited light-theme tokens unconditionally. */
body.login {
  --bg: #08080a;
  --card: #17171c;
  --line: #2c2c34;
  --fg: #f4f4f2;
  --muted: #9b9ba4;
  --accent: #c8a24a;
  --accent-fg: #0b0b0d;
}

/* Out of flow, so it never becomes a grid item of the centring body.
   The tile's strokes are dark, so it is always inverted here. */
body.login::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("pattern.svg") repeat;
  background-size: 660px auto;
  filter: invert(1);
  opacity: .12;
  pointer-events: none;
}

body.login main {
  position: relative;
  z-index: 1;
}

/* --- login --- */

form {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

input[type="password"] {
  width: 100%;
  padding: .8rem .95rem;
  font: inherit;
  font-size: 1.05rem;
  letter-spacing: .08em;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

input[type="password"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

button {
  padding: .8rem 1rem;
  font: inherit;
  font-weight: 550;
  color: var(--accent-fg);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

button:hover { filter: brightness(1.07); }
button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.error {
  min-height: 1.4rem;
  margin: 0;
  color: var(--danger);
  font-size: .9rem;
}

/* --- family grid --- */

/* One row of four, sized off a single knob so the page never scrolls.
   --tile is half the previous ~9.5rem width, i.e. a quarter of the area.
   Raise it to enlarge the tiles. */
.people {
  --tile: 4.7rem;

  display: grid;
  grid-template-columns: repeat(4, var(--tile));
  justify-content: center;
  gap: .5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

/* The square photo IS the button. The name is a caption outside it, so the
   button stays square instead of growing a text strip inside its border. */
.people a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.people img {
  display: block;
  width: 100%;
  /* height:auto is load-bearing. The <img> carries height="512"; without this
     that presentational hint makes the height definite, aspect-ratio is
     ignored, and the tile renders as a tall strip. */
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  /* Faces sit high in these portraits — bias the crop upward. */
  object-position: 50% 22%;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .12s ease, border-color .12s ease;
}

.people a:hover img {
  transform: translateY(-2px);
  border-color: var(--accent);
}

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

.people .name {
  display: block;
  margin-top: .35rem;
  font-weight: 550;
  font-size: .72rem;
  text-align: center;
  line-height: 1.2;
  text-wrap: balance;
}

/* The hub needs more room than the narrow login column, and its heading
   should line up with the centred tile row. */
body.hub main {
  max-width: 40rem;
  text-align: center;
}

/* --- wordmark (hub heading) --- */

.wordmark {
  margin: .5rem 0 2rem;
  /* currentColor drives the rules and sub-line inside the SVG. */
  color: var(--fg);
}

.wm-svg {
  display: block;
  width: 100%;
  max-width: 27rem;
  height: auto;
  margin: 0 auto;
}

/* Portrait on an individual member page. Same height:auto requirement as
   .people img - the tag's height attribute would otherwise win. */
.portrait {
  display: block;
  width: 6rem;
  height: auto;
  aspect-ratio: 1;
  margin: 0 0 1.1rem;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 22%;
  border: 1px solid var(--line);
}

/* --- shared bits --- */

.link {
  display: inline-block;
  color: var(--muted);
  font-size: .9rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.link:hover { color: var(--fg); }

.hidden { display: none !important; }
