/* =========================================================================
   Eziafor-Ohafia Youth Forum — design system
   -------------------------------------------------------------------------
   Everything here is drawn from the union crest: the green ring, the cream
   field, the blue swallowtail banner, and the pink/orange/blue dancing
   figures over their ribbon of water.

   Colour has one job each, so a polychrome crest does not become a noisy UI:
     green  -> action        (buttons, links, active nav)
     blue   -> identity      (the page banner, the focus ring)
     red    -> danger        (destructive actions, errors)
     cream  -> chrome        (header, footer, banded sections)
     accents-> categories    (interest tags, the wave rule)

   Built mobile-first at 360px. No horizontal page scroll at 320px.
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Tokens
   ---------------------------------------------------------------------- */
:root {
  /* Crest */
  --green: #1b7a3d;
  --green-dark: #12572b;
  --cream: #fdf6e3;
  --red: #c62828;
  --blue: #1e4fa3;
  --ink: #1c2321;
  --muted: #5a6663;

  /* The three figures */
  --pink: #d81b60;
  --orange: #f57c00;
  --sky: #1976d2;

  /* Derived surfaces */
  --paper: #ffffff;
  --cream-deep: #f7edd4;
  --line: #e3dccb;
  --line-strong: #cdc4ab;
  --blue-deep: #163a78;

  /* Tints — backgrounds for alerts and badges */
  --tint-green: #e7f4eb;
  --tint-red: #fdeceb;
  --tint-blue: #e9effa;
  --tint-amber: #fdf0dd;
  --tint-grey: #f1f0ec;

  /* Ink on tints, all >= 4.5:1 */
  --on-green: #10502a;
  --on-red: #8c1d18;
  --on-blue: #17376f;
  --on-amber: #7a3e00;
  --on-grey: #4b524f;

  /* Type — 17px base, 1.6 leading */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --step--1: 0.8235rem; /* 14px */
  --step-0: 1rem;       /* 17px */
  --step-1: 1.176rem;   /* 20px */
  --step-2: 1.412rem;   /* 24px */
  --step-3: 1.706rem;   /* 29px */

  /* Space */
  --gap: 1rem;
  --pad: 1rem;
  --radius: 12px;
  --radius-sm: 8px;

  /* Focus. Sits outside the control, against the page ground, so blue is
     always high-contrast. Dark surfaces override it to cream. */
  --focus: var(--blue);

  --shadow: 0 1px 2px rgba(28, 35, 33, 0.06), 0 4px 14px rgba(28, 35, 33, 0.06);

  color-scheme: light;
}

/* -------------------------------------------------------------------------
   2. Reset
   ---------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  font-size: 106.25%; /* 17px from a 16px default, still honours user scaling */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  /* Long member codes, emails and URLs must never push the page sideways. */
  overflow-wrap: break-word;
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  cursor: pointer;
}

pre,
code,
kbd,
samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

pre {
  overflow-x: auto;
}

ul,
ol {
  padding-left: 1.25rem;
}

/* Flex and grid children default to min-width:auto, which is the usual
   cause of a page that scrolls sideways. */
.stack > *,
.row > *,
.admin-shell > * {
  min-width: 0;
}

/* -------------------------------------------------------------------------
   3. Typography
   ---------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  line-height: 1.22;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--ink);
}

h1 {
  font-size: clamp(1.588rem, 1.3rem + 1.6vw, 2.176rem);
}
h2 {
  font-size: var(--step-3);
}
h3 {
  font-size: var(--step-2);
}
h4 {
  font-size: var(--step-1);
}

p,
li,
dd {
  text-wrap: pretty;
}

a {
  color: var(--green-dark);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--green);
}

.lead {
  font-size: var(--step-1);
  color: var(--muted);
}

/* The crest sets its ring text in wide caps. That treatment carries the
   small labels throughout the site. */
.eyebrow {
  font-size: var(--step--1);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--green);
}

/* "Development | Planning | Teamwork | Accountability | Progress" —
   lifted straight off the crest, red rules and all. */
.pipe-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  padding: 0;
  list-style: none;
  font-weight: 600;
}

.pipe-list > li + li::before {
  content: "|";
  color: var(--red);
  font-weight: 800;
  margin-right: 0.5rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The `hidden` attribute must always win over any author `display` rule.
   Without `!important` here, a class like `.btn` (display: inline-flex) or
   `.step` (display: flex) has the same specificity as the browser's own
   `[hidden] { display: none }` UA rule, and author styles beat UA styles —
   so `el.hidden = true` from script would be silently overridden and the
   element would stay visible. This is what lets `form.js` show one step of
   the join form at a time. */
[hidden] {
  display: none !important;
}

/* -------------------------------------------------------------------------
   4. Focus — every interactive thing, one visible ring
   ---------------------------------------------------------------------- */
:where(a, button, input, select, textarea, summary, label, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   5. Layout
   ---------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 40rem;
  margin-inline: auto;
  padding-inline: var(--pad);
}

.container--wide {
  max-width: 72rem;
}

.page {
  flex: 1 0 auto;
  padding-block: 1.5rem 3rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.stack--lg {
  gap: 2rem;
}

.stack--sm {
  gap: 0.5rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.band {
  background: var(--cream);
  border-block: 1px solid var(--line);
  padding-block: 2rem;
}

/* The crest's ribbon of water, flattened into a 3px rule. Used only twice:
   closing the header and opening the footer. */
.wave-rule {
  height: 3px;
  border: 0;
  flex: none;
  background: linear-gradient(
    90deg,
    var(--pink) 0 33.34%,
    var(--orange) 33.34% 66.67%,
    var(--sky) 66.67% 100%
  );
}

/* -------------------------------------------------------------------------
   6. Skip link
   ---------------------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  transform: translateY(-250%);
  background: var(--green-dark);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.skip-link:focus {
  transform: none;
  color: #fff;
}

/* -------------------------------------------------------------------------
   7. Header

   No hamburger. Six destinations do not need a disclosure widget, and
   hiding "Join" behind an icon buries the one action this site exists for.
   The brand bar is sticky so Join is always one tap away; the nav wraps
   onto as many rows as it needs, so nothing is ever off-screen and no
   swipe gesture has to be discovered.
   ---------------------------------------------------------------------- */
/* The brand bar is the sticky element and is a direct child of <body>, so it
   stays put for the whole page. A sticky element only sticks inside its own
   parent's box, so nesting it in a short wrapper would scroll it straight
   off-screen. The nav sits outside it, as its own landmark, and is allowed
   to scroll away — Join is what has to stay reachable. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  flex: none;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(28, 35, 33, 0.04);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 60px;
  padding-block: 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1 1 auto;
  text-decoration: none;
  color: var(--green-dark);
}

.brand:hover {
  color: var(--green-dark);
}

/* Square, not rounded: the forum's crest sits inside a circle that does not
   quite reach the edges of its square artwork — the motto beneath it runs
   right out to those edges, so a border-radius that rounds off the square
   would crop that text. Better a small square badge than a cropped logo. */
.brand__crest {
  width: 44px;
  height: 44px;
  flex: none;
}

.brand__name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.14;
  letter-spacing: 0.045em;
}

.brand__name > span:first-child {
  font-size: 0.8235rem;
}

.brand__name > span:last-child {
  font-size: 0.706rem;
  color: var(--red);
  letter-spacing: 0.09em;
}

.site-header__action {
  flex: none;
}

/* The avatar is 38px, so the link around it is padded out to a full 44px
   tap target. */
.avatar-link {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
}

/* Nav */
.site-nav {
  flex: none;
  background: var(--cream);
  padding-block: 0.15rem 0.5rem;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Shared by the <a> destinations and the "Sign out" <button>, so the button
   needs its chrome stripped here rather than in a separate element rule. */
.site-nav__link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit;
  font-size: 0.9412rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__link:hover {
  color: var(--green-dark);
  background: var(--cream-deep);
}

.site-nav__link[aria-current="page"] {
  color: var(--green-dark);
  box-shadow: inset 0 -3px 0 var(--green);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* On a phone the list wraps, so letting the session link flow naturally
   after the destinations reads better than stranding it alone on a row.
   It only gets pushed to the trailing edge once the nav is a single line. */
.site-nav__item--tail .site-nav__link {
  color: var(--green-dark);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

@media (min-width: 56rem) {
  .site-nav__item--tail {
    margin-left: auto;
  }
  .site-header__inner {
    min-height: 72px;
  }
  .brand__crest {
    width: 52px;
    height: 52px;
  }
  .brand__name > span:first-child {
    font-size: 1rem;
  }
  .brand__name > span:last-child {
    font-size: 0.8235rem;
  }
}

/* -------------------------------------------------------------------------
   8. Ribbon — the signature

   The crest carries its most important words on a blue swallowtail banner.
   Every page title on this site sits on the same banner, so a member always
   knows which room of the building they are standing in.
   ---------------------------------------------------------------------- */
.ribbon {
  --focus: var(--cream);
  position: relative;
  display: block;
  margin: 0 0 1.25rem;
  padding: 0.65rem 2rem 0.75rem;
  background: var(--blue);
  border-bottom: 3px solid var(--blue-deep);
  color: #fff;
  font-size: clamp(1.235rem, 1.05rem + 1.1vw, 1.706rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
  clip-path: polygon(
    0 0,
    100% 0,
    calc(100% - 0.9rem) 50%,
    100% 100%,
    0 100%,
    0.9rem 50%
  );
  filter: drop-shadow(0 2px 0 rgba(28, 35, 33, 0.16));
}

.ribbon > .ribbon__kicker {
  display: block;
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.85;
  margin-bottom: 0.15rem;
}

/* -------------------------------------------------------------------------
   9. Card
   ---------------------------------------------------------------------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.125rem;
}

.card__title {
  font-size: var(--step-1);
  margin-bottom: 0.5rem;
}

.card__footer {
  margin-top: 1rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--line);
}

.card--accent {
  border-top: 4px solid var(--green);
}

/* A project card's image (or coloured placeholder) sits inside the card's
   own padding rather than bleeding to its edges, so it reuses .card as-is. */
.project-card__media {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}

.project-card__media--placeholder {
  /* No image yet — a flat tint stands in, never a broken-image icon. */
}

/* -------------------------------------------------------------------------
   10. Buttons
   ---------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--step-0);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  background: var(--green);
  color: #fff;
}

.btn:hover {
  background: var(--green-dark);
  color: #fff;
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--secondary {
  background: var(--paper);
  color: var(--green-dark);
  border-color: var(--green);
}

.btn--secondary:hover {
  background: var(--tint-green);
  color: var(--green-dark);
}

.btn--danger {
  background: var(--red);
  color: #fff;
}

.btn--danger:hover {
  background: #a01f1f;
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--green-dark);
  border-color: transparent;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.btn--ghost:hover {
  background: var(--tint-green);
  color: var(--green-dark);
}

.btn--sm {
  min-height: 44px;
  padding: 0.4rem 0.85rem;
  font-size: 0.9412rem;
}

@media (min-width: 34rem) {
  .btn {
    width: auto;
  }
}

/* Declared last so it also wins on mobile: header and table-row actions
   that must not span the line. align-self stops a column flex container
   such as .form-actions stretching it back to full width. */
.btn--inline {
  width: auto;
  align-self: flex-start;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 0.5rem;
}

@media (min-width: 34rem) {
  .form-actions {
    flex-direction: row;
    align-items: center;
  }
}

/* -------------------------------------------------------------------------
   11. Forms
   ---------------------------------------------------------------------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field__label {
  font-weight: 700;
  font-size: 0.9412rem;
  line-height: 1.35;
}

.field__req {
  color: var(--red);
  font-weight: 800;
  margin-left: 0.15rem;
}

.field__optional {
  color: var(--muted);
  font-weight: 600;
  margin-left: 0.3rem;
  font-size: 0.8235rem;
}

.field__help {
  font-size: 0.8824rem;
  color: var(--muted);
  line-height: 1.45;
}

.field__error {
  display: flex;
  gap: 0.35rem;
  font-size: 0.8824rem;
  font-weight: 700;
  color: var(--on-red);
}

.field__error::before {
  content: "!";
  flex: none;
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.75rem;
  /* max() keeps this at or above 16px even if the user has shrunk their
     default, which is what stops iOS Safari zooming on focus. */
  font-size: max(1rem, 16px);
  line-height: 1.4;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.input::placeholder,
.textarea::placeholder {
  color: #8b938f;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--muted);
}

.textarea {
  min-height: 7rem;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 55%, calc(100% - 0.8rem) 55%;
  background-size: 0.4rem 0.4rem, 0.4rem 0.4rem;
  background-repeat: no-repeat;
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--red);
  background-color: #fffafa;
}

.input[type="file"] {
  padding: 0.55rem 0.75rem;
  line-height: 2;
}

/* One-time-code boxes — otp.js's progressive enhancement of the plain
   `<input name="code">`. Grid with minmax(0, 1fr) columns shrinks the boxes
   together rather than overflowing the viewport, so this stays inside a
   320px screen without horizontal scrolling. */
.otp-boxes {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
  max-width: 22rem;
}

.otp-box {
  width: 100%;
  min-height: 48px;
  padding: 0.5rem 0;
  font-size: max(1.25rem, 16px);
  line-height: 1.4;
  text-align: center;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.otp-box:hover {
  border-color: var(--muted);
}

/* Checkbox and radio — the control itself is small, so the whole label is
   the tap target and it is comfortably over 44px. */
.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.625rem 0.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
}

.choice:hover {
  border-color: var(--green);
  background: var(--tint-green);
}

.choice__control {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.15rem;
  accent-color: var(--green);
}

.choice__text {
  min-width: 0;
}

.choice__label {
  display: block;
  font-weight: 600;
}

.choice__text > .field__help {
  display: block;
}

.choice:has(.choice__control:checked) {
  border-color: var(--green);
  background: var(--tint-green);
}

.choice:has(.choice__control:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.fieldset__legend {
  padding: 0;
  font-weight: 700;
  font-size: 0.9412rem;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.choice-list--inline {
  flex-direction: row;
  flex-wrap: wrap;
}

.choice-list--inline > .choice {
  flex: 1 1 8rem;
}

/* -------------------------------------------------------------------------
   12. Alerts — colour plus a glyph plus a role, never colour alone
   ---------------------------------------------------------------------- */
.alert {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.875rem 1rem;
  border: 1px solid;
  border-left-width: 5px;
  border-radius: var(--radius-sm);
}

.alert__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.1rem;
  border-radius: 50%;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
}

.alert__body {
  min-width: 0;
}

.alert__title {
  font-weight: 800;
  font-size: var(--step-0);
}

.alert--error {
  background: var(--tint-red);
  border-color: var(--red);
  color: var(--on-red);
}
.alert--error .alert__icon {
  background: var(--red);
}

.alert--success {
  background: var(--tint-green);
  border-color: var(--green);
  color: var(--on-green);
}
.alert--success .alert__icon {
  background: var(--green);
}

.alert--info {
  background: var(--tint-blue);
  border-color: var(--blue);
  color: var(--on-blue);
}
.alert--info .alert__icon {
  background: var(--blue);
}

.alert a {
  color: inherit;
}

/* -------------------------------------------------------------------------
   13. Badges — the word is the content, the colour only reinforces it
   ---------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.8235rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--tint-grey);
  border-color: var(--line-strong);
  color: var(--on-grey);
}

.badge--good {
  background: var(--tint-green);
  border-color: #a8d3b6;
  color: var(--on-green);
}

.badge--warn {
  background: var(--tint-amber);
  border-color: #e8c48d;
  color: var(--on-amber);
}

.badge--bad {
  background: var(--tint-red);
  border-color: #eeb3b0;
  color: var(--on-red);
}

.badge--info {
  background: var(--tint-blue);
  border-color: #adc0e5;
  color: var(--on-blue);
}

/* Category tags take the three figure colours. */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8235rem;
  font-weight: 700;
  color: #fff;
  background: var(--muted);
}

.tag--1 {
  background: var(--pink);
}
.tag--2 {
  background: #b35a00;
}
.tag--3 {
  background: var(--blue);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
}

/* -------------------------------------------------------------------------
   14. Avatar
   ---------------------------------------------------------------------- */
.avatar {
  --avatar-size: 2.75rem;
  width: var(--avatar-size);
  height: var(--avatar-size);
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--tint-grey);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.avatar--sm {
  --avatar-size: 2.25rem;
}

.avatar--lg {
  --avatar-size: 6rem;
}

.avatar--initials {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: calc(var(--avatar-size) * 0.38);
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}

/* -------------------------------------------------------------------------
   15. Stepper
   ---------------------------------------------------------------------- */
.stepper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.stepper__label {
  font-size: 0.8824rem;
  font-weight: 700;
  color: var(--muted);
}

.stepper__label b {
  color: var(--green-dark);
}

.stepper__track {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.stepper__seg {
  flex: 1 1 0;
  min-width: 0;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}

.stepper__seg.is-done {
  background: var(--green);
}

.stepper__seg.is-current {
  background: var(--green);
  box-shadow: inset 0 0 0 2px var(--green-dark);
}

/* -------------------------------------------------------------------------
   15b. Join form — each of the six sections is a real <fieldset>, styled
   like a stack rather than a boxed group, so it reads the same whether
   `form.js` is showing one at a time or (no JS) all six at once.
   ---------------------------------------------------------------------- */
.step {
  border: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.step__legend {
  padding: 0;
  font-size: var(--step-2);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.photo-preview {
  width: 6rem;
  height: 6rem;
  margin-top: 0.5rem;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--tint-grey);
  border: 2px solid var(--line);
}

/* -------------------------------------------------------------------------
   16. Tables — a real table on a desktop, stacked cards on a phone
   ---------------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9412rem;
}

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

.table th {
  font-size: var(--step--1);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--cream);
  white-space: nowrap;
}

.table tbody tr:hover {
  background: var(--cream);
}

@media (max-width: 44.99rem) {
  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
  }

  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .table tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.35rem 0.9rem;
    margin-bottom: 0.75rem;
    background: var(--paper);
  }

  .table tbody tr:hover {
    background: var(--paper);
  }

  .table td {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
    /* "anywhere" rather than "break-word": only this value lets the cell's
       intrinsic minimum shrink, so a long email address wraps inside the
       card instead of being clipped by it. */
    overflow-wrap: anywhere;
  }

  .table td:last-child {
    border-bottom: 0;
  }

  .table td::before {
    content: attr(data-label);
    flex: 0 0 6.5rem;
    font-size: var(--step--1);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
  }

  /* A cell with no data-label (an actions cell) spans the row. */
  .table td:not([data-label])::before {
    display: none;
  }
}

.table__empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* -------------------------------------------------------------------------
   17. Admin shell
   ---------------------------------------------------------------------- */
.admin-shell {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.admin-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-nav__link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9412rem;
  color: var(--green-dark);
  text-decoration: none;
  background: var(--cream);
  border: 1px solid var(--line);
}

.admin-nav__link:hover {
  background: var(--cream-deep);
  color: var(--green-dark);
}

.admin-nav__link[aria-current="page"] {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.admin-nav__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  margin-left: 0.5rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--tint-red);
  border: 1px solid #eeb3b0;
  color: var(--on-red);
  font-size: 0.75rem;
  font-weight: 800;
}

@media (min-width: 60rem) {
  .admin-shell {
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: 2rem;
  }

  .admin-nav {
    position: sticky;
    top: 5.5rem;
  }

  .admin-nav__list {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* -------------------------------------------------------------------------
   18. Register toolbar & pagination
   ---------------------------------------------------------------------- */
.register-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toolbar-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.toolbar-form__fields {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-width: 0;
}

.toolbar-form__fields .field,
.toolbar-form--sort .field {
  flex: 1 1 12rem;
  min-width: 0;
}

@media (min-width: 34rem) {
  .toolbar-form__fields .field {
    min-width: 12rem;
  }
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* -------------------------------------------------------------------------
   19. Footer
   ---------------------------------------------------------------------- */
/* No border-top: the wave rule is the footer's first child and is the edge. */
.site-footer {
  flex: none;
  background: var(--cream);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-block: 1.75rem 2rem;
}

.footer-heading {
  font-size: var(--step--1);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 0.4rem;
}

.footer-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.footer-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--green-dark);
}

.footer-groups {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 40rem) {
  .footer-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* The motto is set in italic on the crest. It stays italic here. */
.motto {
  font-style: italic;
  font-weight: 700;
  font-size: var(--step-1);
  color: var(--green-dark);
  letter-spacing: -0.01em;
}

.colophon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-strong);
  font-size: 0.8824rem;
  color: var(--muted);
}

/* -------------------------------------------------------------------------
   18b. Public pages — hero, pull quote, project grid
   ---------------------------------------------------------------------- */
.hero {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Square, not rounded — see the note on .brand__crest: the motto beneath
   the crest runs out to the edges of the square artwork, so rounding this
   off would crop it. */
.hero__crest {
  width: 100%;
  max-width: 12.5rem;
  margin-inline: auto;
}

@media (min-width: 40rem) {
  .hero {
    flex-direction: row;
    align-items: center;
  }

  .hero__crest {
    flex: none;
    margin-inline: 0;
  }

  .hero__body {
    flex: 1;
    min-width: 0;
  }
}

/* The motto, called out on its own once the visitor has read why the forum
   exists. Styled after a printed pull quote: an accent rule, not a box. */
.pull-quote {
  font-style: italic;
  font-weight: 800;
  font-size: var(--step-2);
  color: var(--green-dark);
  border-left: 4px solid var(--green);
  padding-left: 1rem;
}

/* Adapts by available width alone, so it never needs its own breakpoints
   and always collapses to one column before 320px runs out of room. */
.project-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

/* -------------------------------------------------------------------------
   18c. Profile — a member's own view of their record (Task 16)
   ---------------------------------------------------------------------- */
.profile-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.profile-head__name {
  margin: 0;
  font-size: var(--step-2);
  font-weight: 800;
}

.profile-head__code {
  margin: 0.15rem 0 0.4rem;
  color: var(--muted);
}

/* Stacked label-over-value pairs at 320px, two columns once there is room —
   never a table, which would force horizontal scrolling on a narrow phone. */
.detail-list {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.detail-list dt {
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--muted);
}

.detail-list dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
}

@media (min-width: 30rem) {
  .detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* -------------------------------------------------------------------------
   20. Utilities
   ---------------------------------------------------------------------- */
.text-muted {
  color: var(--muted);
}
.text-center {
  text-align: center;
}
.text-sm {
  font-size: 0.8824rem;
}
.mt-0 {
  margin-top: 0;
}
.prose > * + * {
  margin-top: 1rem;
}
.prose h2,
.prose h3 {
  margin-top: 1.75rem;
}

/* Turnstile's iframe must not widen the page on a 320px screen. */
.cf-turnstile {
  max-width: 100%;
  overflow: hidden;
}

/* -------------------------------------------------------------------------
   21. Reduced motion
   ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .btn:active {
    transform: none;
  }
}
