/* ==========================================================================
   BJJ Ohrid — shared stylesheet (used by every page)
   Change colours and fonts in the :root block below and the whole site follows.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-raised: #f5f5f6;
  --line: #e2e2e6;
  --text: #0d0d0f;
  --text-muted: #55555c;
  --red: #e10600;        /* buttons and small highlights */
  --red-hover: #ff1a12;
  --red-text: #c80500;   /* slightly darker red, readable as link text on the white background */

  /* ---------- FONTS ----------
     Lexend and Space Mono are both loaded on every page.
     To switch the whole site, change the ONE line marked "FONT SWITCH". */
  --font-space-mono: "Space Mono", "Courier New", Courier, monospace;
  --font-lexend: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --font-site: var(--font-lexend);   /* FONT SWITCH: var(--font-lexend) or var(--font-space-mono) */

  --font-heading: var(--font-site);
  --font-body: var(--font-site);
  --tracking-heading: -0.02em;       /* headings: -0.02em for Lexend (Space Mono used -0.03em) */
  --tracking-title: -0.02em;         /* big red titles: -0.02em for Lexend (Space Mono used -0.05em) */
  --size-title: 5.25rem;             /* max size of big red titles: 5.25rem for Lexend (Space Mono used 7rem) */

  --header-h: 152px;
  --wrap: 1160px;
  --gutter: 20px;
  --section: clamp(4rem, 10vw, 8rem);
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3 {
  margin: 0 0 1rem;
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: var(--tracking-heading);
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 4.75rem);
}

h2 {
  font-size: clamp(1.75rem, 4.5vw, 3rem);
}

h3 {
  font-size: 1.25rem;
  line-height: 1.15;
}

p {
  margin: 0 0 1.25rem;
}

a {
  color: var(--red-text);
  text-underline-offset: 0.2em;
}

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

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: var(--section) 0;
}

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

.narrow {
  max-width: 44rem;
}

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

.lead {
  font-size: clamp(1.125rem, 2vw, 1.3125rem);
  color: var(--text-muted);
}

.eyebrow {
  display: block;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red-text);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  left: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 1rem 1.75rem;
  border: 2px solid var(--red);
  border-radius: 2px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

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

.btn--black {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.btn--black:hover {
  background: transparent;
  border-color: var(--text);
  color: var(--text);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  /* coming back (scrolling up): a slower, soft slide and fade in */
  transition: transform 0.8s cubic-bezier(0.33, 0, 0.2, 1), opacity 0.8s ease;
  will-change: transform, opacity;
}

/* Hidden while scrolling down, slides back in when scrolling up (js/main.js) */
/* going away (scrolling down) */
.site-header.is-hidden {
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.45, 0, 0.25, 1), opacity 0.8s ease;
}

.intro-btn {
  margin-top: 0.75rem;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.375rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo span {
  color: var(--red);
}

/* Used when the text logo is swapped for an image */
.logo img {
  height: 128px;
  width: auto;
}

/* Home page: the header sits transparent on top of the hero photo,
   then turns white once the visitor scrolls (the is-scrolled class is added in js/main.js). */
.site-header--overlay {
  position: fixed;
  left: 0;
  right: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: background-color 0.4s ease, transform 0.8s cubic-bezier(0.33, 0, 0.2, 1), opacity 0.8s ease;
}

.site-header--overlay.is-hidden {
  transition: background-color 0.4s ease, transform 0.8s cubic-bezier(0.45, 0, 0.25, 1), opacity 0.8s ease;
}

.site-header--overlay.is-scrolled {
  background: rgba(255, 255, 255, 0.96);
}

.site-header--overlay.menu-open {
  background: #fff;
}

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

.site-nav a {
  display: block;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 0.15s;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  border-bottom-color: var(--red);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 10px;
  border: 0;
  background: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(4) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 719px) {
  :root {
    --header-h: 112px;
  }

  .logo {
    padding: 10px 0;
  }

  .logo img {
    height: 92px;
  }

  .site-header .wrap {
    flex-wrap: wrap;
  }

  .site-nav {
    width: 100%;
    padding-bottom: 1rem;
  }

  .site-nav ul {
    flex-direction: column;
    gap: 0;
  }

  .site-nav li {
    border-top: 1px solid var(--line);
  }

  .site-nav a {
    padding: 1rem 0;
    border-bottom: 0;
    font-size: 0.9375rem;
  }

  .site-nav a[aria-current="page"] {
    color: var(--red-text);
  }

  /* Hamburger only when JavaScript is running; without it the links just stay visible */
  .js .nav-toggle {
    display: block;
  }

  .js .site-nav {
    display: none;
  }

  .js .site-nav.is-open {
    display: block;
  }
}

/* ---------- Hero (home) ---------- */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--header-h) + 4rem) 0 clamp(3rem, 9vw, 6.5rem);
  overflow: hidden;
  background: #e9e4dc;
  color: var(--text);
}

.hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

.hero h1 {
  max-width: 12ch;
  margin-bottom: 1.5rem;
  font-size: clamp(2.5rem, 10vw, 7rem);
  line-height: 0.95;
}

.hero p {
  max-width: 34rem;
  margin-bottom: 2.25rem;
  font-size: clamp(1.0625rem, 2vw, 1.25rem);
  font-weight: 500;
  color: var(--text);
}

/* ---------- Page header (inner pages) ---------- */

.page-head {
  padding: clamp(4rem, 10vw, 7.5rem) 0 clamp(2.5rem, 6vw, 4.5rem);
}

.page-head h1 {
  margin-bottom: 1.5rem;
}

.page-head .lead {
  max-width: 40rem;
  margin: 0;
}

/* ---------- About ---------- */

/* ---------- Call to action band ---------- */

/* White belt photo with a dark tint so the white text stays readable.
   To change the photo, replace images/white-belt.jpg.
   Raise 0.5 (up to 1) for a darker tint, lower it for a lighter one. */
.cta {
  text-align: center;
  color: #fff;
  background:
    linear-gradient(rgba(13, 13, 15, 0.5), rgba(13, 13, 15, 0.5)),
    url("../images/white-belt.jpg") center / cover no-repeat;
  border-top: 0;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.45);
}

.cta .btn {
  text-shadow: none;
}

.cta h2 {
  margin-bottom: 1rem;
}

.cta p {
  max-width: 32rem;
  margin: 0 auto 2rem;
  color: #fff;
}

/* ---------- Schedule ---------- */

.timetable {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.timetable thead th {
  padding: 0 1rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timetable tbody {
  border-top: 1px solid var(--line);
}

.timetable td,
.timetable .day {
  padding: 1.125rem 1rem;
  vertical-align: top;
}

.timetable thead th:first-child,
.timetable .day {
  padding-left: 0;
}

.timetable .day {
  width: 24%;
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.timetable .time {
  width: 22%;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-muted);
}

.timetable .name {
  font-weight: 600;
}

.timetable .empty {
  color: var(--text-muted);
}

.schedule-note {
  margin-top: 3rem;
  color: var(--text-muted);
}

/* Mobile: the table stacks into one block per day */
@media (max-width: 719px) {
  .timetable,
  .timetable tbody,
  .timetable td,
  .timetable th {
    display: block;
  }

  .timetable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .timetable tbody {
    padding: 1.75rem 0;
  }

  .timetable tr {
    display: grid;
    grid-template-columns: 7.75rem 1fr;
    padding: 0.875rem 0;
    border-top: 1px solid var(--line);
  }

  .timetable tr:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .timetable td,
  .timetable .day {
    width: auto;
    padding: 0;
  }

  .timetable .day {
    grid-column: 1 / -1;
    margin-bottom: 1rem;
    font-size: 1.5rem;
  }

  .timetable .time {
    grid-column: 1;
    font-size: 0.9375rem;
  }

  .timetable .name {
    grid-column: 2;
  }

  .timetable .empty {
    grid-column: 1 / -1;
  }
}

/* Schedule page: everything centred, heading close to the table */
.schedule-page .page-head {
  padding-bottom: 0;
  text-align: center;
}

.schedule-page .page-head h1 {
  margin-bottom: 0;
}

.schedule-page .schedule-body {
  padding-top: clamp(2.5rem, 6vw, 4rem);
  text-align: center;
}

.schedule-page .timetable {
  max-width: 46rem;
  margin: 0 auto;
  table-layout: fixed;
  text-align: center;
}

.schedule-page .timetable thead th,
.schedule-page .timetable .day,
.schedule-page .timetable td {
  width: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (max-width: 719px) {
  .schedule-page .timetable tr {
    grid-template-columns: auto auto;
    justify-content: center;
    gap: 0 1.5rem;
    align-items: baseline;
  }

  .schedule-page .timetable tbody:first-of-type {
    border-top: 0;
    padding-top: 0;
  }

  .schedule-page .timetable td,
  .schedule-page .timetable .day {
    padding: 0;
  }
}

/* ---------- Editorial layout (About + Contact) ----------
   Big red titles, numbered index rows with thin red rules, photos with a red caption line. */

.ed-section {
  padding-top: clamp(3rem, 7vw, 5.5rem);
}

.ed-section + .ed-section {
  padding-top: 0;
}

.ed-grid {
  display: grid;
  gap: 3.5rem;
}

@media (min-width: 900px) {
  .ed-grid {
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: start;
  }
}

.ed-title {
  margin: 0 0 1.75rem;
  color: var(--red);
  font-size: clamp(3.25rem, 9vw, var(--size-title));
  line-height: 0.88;
  letter-spacing: var(--tracking-title);
}

.ed-intro {
  max-width: 30rem;
  margin-bottom: 2.75rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.ed-index {
  margin: 0;
  border-top: 1px solid var(--red);
}

.ed-row {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) auto;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: 1px solid var(--red);
}

.ed-row dt {
  color: var(--red);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.ed-num {
  margin-right: 0.4em;
  font-weight: 400;
}

.ed-row dd {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

.ed-row dd a {
  color: var(--text);
  text-decoration-color: var(--red);
  text-underline-offset: 0.25em;
}

.ed-row dd a:hover {
  color: var(--red-text);
}

/* Round red-outlined buttons that fill red on hover */
.ed-row dd .ed-pill {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--red);
  border-radius: 999px;
  color: var(--red);
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.ed-row dd .ed-pill:hover,
.ed-row dd .ed-pill:focus-visible {
  background: var(--red);
  color: #fff;
}

.ed-row dd br + .ed-pill {
  margin-top: 0.75rem;
}

.ed-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ed-list li {
  display: grid;
  grid-template-columns: 3rem 4rem auto;
  justify-content: end;
  text-align: left;
}

.ed-figure {
  margin: 0;
}

.ed-figure img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.ed-figure figcaption {
  display: flex;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--red);
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ed-title--sm {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
}

.ed-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ed-lines li + li {
  margin-top: 0.35rem;
}

/* Competition results table (About page) */
.ed-row--full {
  grid-template-columns: 1fr;
}

.ed-medals {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}

.ed-medals th,
.ed-medals td {
  padding: 0.55rem 0.5rem 0.55rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.ed-medals thead th {
  padding-top: 0;
  color: var(--red);
  font-weight: 700;
}

.ed-medals abbr {
  text-decoration: none;
}

/* Year column, and the three medal columns with right-aligned numbers */
.ed-medals th:first-child {
  width: 3.75rem;
}

.ed-medals thead th:nth-child(n + 3) {
  width: 2.25rem;
}

.ed-medals thead th:nth-child(n + 3),
.ed-medals tbody td:nth-child(n + 3),
.ed-medals tfoot td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ed-medals tr > :last-child {
  padding-right: 0;
}

.ed-medals tfoot th,
.ed-medals tfoot td {
  border-bottom: 0;
  font-weight: 700;
}

.ed-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--red);
  border-radius: 999px;
  color: var(--red);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 1px;
}

@media (max-width: 599px) {
  .ed-medals th:first-child {
    width: 3rem;
  }

  .ed-medals thead th:nth-child(n + 3) {
    width: 1.75rem;
  }
}

.ed-figure figcaption + .ed-note {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.ed-people {
  display: grid;
  gap: 3rem 1.5rem;
  max-width: 46rem;
}

@media (min-width: 600px) {
  .ed-people {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* What is BJJ? on phones and tablets: first photo after "The art", second photo at the end */
@media (max-width: 899px) {
  .ed-grid--story {
    gap: 0;
  }

  .ed-grid--story .ed-story-text,
  .ed-grid--story .ed-story,
  .ed-grid--story .ed-photos {
    display: contents;
  }

  .ed-grid--story .ed-story__row:first-child {
    order: 1;
    border-top: 1px solid var(--red);
  }

  .ed-grid--story .ed-photos > :first-child {
    order: 2;
    margin: 2rem 0;
  }

  .ed-grid--story .ed-story__row:not(:first-child) {
    order: 3;
  }

  .ed-grid--story .ed-story__row:nth-child(2) {
    border-top: 1px solid var(--red);
  }

  .ed-grid--story .ed-photos > :last-child {
    order: 4;
    margin-top: 2rem;
  }
}

/* About page on phones and tablets: the medals photo sits just before the Competition row,
   the Gi and No-Gi photos stay at the end */
@media (max-width: 899px) {
  .ed-grid--about {
    gap: 0;
  }

  .ed-grid--about .ed-about-text,
  .ed-grid--about .ed-index,
  .ed-grid--about .ed-photos {
    display: contents;
  }

  .ed-grid--about .ed-row {
    order: 1;
  }

  .ed-grid--about .ed-row:first-child {
    border-top: 1px solid var(--red);
  }

  .ed-grid--about .ed-photos > :last-child {
    order: 2;
    margin: 2rem 0;
  }

  .ed-grid--about .ed-row--full {
    order: 3;
    border-top: 1px solid var(--red);
  }

  .ed-grid--about .ed-photos > :not(:last-child) {
    order: 4;
    margin-top: 2.5rem;
  }
}

/* About page on desktop: the Competition table stretches so its bottom line lines up
   with the bottom of the last photo */
@media (min-width: 900px) {
  .ed-grid--about {
    align-items: stretch;
  }

  .ed-grid--about .ed-about-text,
  .ed-grid--about .ed-index {
    display: flex;
    flex-direction: column;
  }

  .ed-grid--about .ed-index {
    flex: 1;
  }

  .ed-grid--about .ed-row--full {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  .ed-grid--about .ed-row--full dd {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  .ed-grid--about .ed-medals {
    flex: 1;
  }
}

/* What is BJJ? on desktop: the last row stretches so its bottom line lines up
   with the bottom of the last photo */
@media (min-width: 900px) {
  .ed-grid--story {
    align-items: stretch;
  }

  .ed-grid--story .ed-story-text,
  .ed-grid--story .ed-story {
    display: flex;
    flex-direction: column;
  }

  .ed-grid--story .ed-story {
    flex: 1;
  }

  .ed-grid--story .ed-story__row:last-child {
    flex: 1;
  }

  /* and if the text is the taller side, the last photo grows (cropped, not stretched) to match */
  .ed-grid--story .ed-photos {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
  }

  .ed-grid--story .ed-photos > :last-child {
    display: flex;
    flex: 1;
  }

  .ed-grid--story .ed-photos > :last-child img {
    flex: 1;
    min-height: 0;
    height: 100%;
    object-fit: cover;
  }
}

.ed-story__row dd p:last-child {
  margin-bottom: 0;
}

/* Labelled paragraphs (What is BJJ page): red label, text beside it, thin red rules */
.ed-story {
  margin: 0;
  border-top: 1px solid var(--red);
}

.ed-story__row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.5rem 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--red);
}

.ed-story__row dt {
  color: var(--red);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.ed-story__row dd {
  margin: 0;
  font-size: 0.9375rem;
}

@media (max-width: 599px) {
  .ed-story__row {
    grid-template-columns: 1fr;
  }
}

/* Instructors: the two photos, with the text about them alongside */
.ed-team {
  display: grid;
  gap: 2.5rem;
}

.ed-team__text {
  line-height: 1.7;
}

.ed-team__text p:last-child {
  margin-bottom: 0;
}

@media (min-width: 900px) {
  .ed-team {
    grid-template-columns: minmax(0, 38rem) minmax(0, 1fr);
    gap: 3rem;
    align-items: center;
  }
}

/* Instructor portraits are tall full-body shots: a taller frame shows face down to the belt */
.ed-people img {
  aspect-ratio: 3 / 5;
  object-position: center top;
}

/* Lineage diagram (About page): boxes joined by red arrows.
   Phones and tablets: one vertical chain. Wide screens and phones: circles on a black belt (see below). */
.lineage-head .ed-intro {
  margin-bottom: 2.5rem;
}

.lineage-tree {
  --arrow-gap-y: 2.25rem;
  --arrow-gap-x: 4rem;
  display: flex;
  flex-direction: column;
  gap: var(--arrow-gap-y);
  margin: 0;
  padding: 0;
  list-style: none;
}

.lineage-tree__node {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--red);
  border-radius: 2px;
  text-align: center;
  text-transform: uppercase;
}

/* arrow line + arrowhead, pointing down by default */
.lineage-tree__node:not(:last-child)::before,
.lineage-tree__node:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.lineage-tree__node:not(:last-child)::before {
  top: 100%;
  width: 2px;
  height: calc(var(--arrow-gap-y) - 7px);
  background: var(--red);
}

.lineage-tree__node:not(:last-child)::after {
  top: calc(100% + var(--arrow-gap-y) - 7px);
  border: 6px solid transparent;
  border-top: 7px solid var(--red);
  border-bottom: 0;
}

.lineage-tree__flag {
  display: block;
  width: 21px;
  height: 14px;
  margin: 0 auto 0.45rem;
}

.lineage-tree__node--us .lineage-tree__flag {
  box-shadow: 0 0 0 1px #fff;
}

.lineage-tree__node strong {
  display: block;
  color: var(--red);
  font-size: 0.9375rem;
  line-height: 1.25;
}

.lineage-tree__node span {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
}

.lineage-tree__node--us {
  background: var(--red);
}

.lineage-tree__node--us strong,
.lineage-tree__node--us span {
  color: #fff;
}

/* The lineage is drawn as circles on one long black belt (js/main.js): a wide version
   for desktops and a tall version for phones. The list above stays in the page for screen
   readers, and shows as a chain of boxes only if the drawing can't load. */
.lineage-belt {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.lineage-belt--tall {
  max-width: 26rem;
}

.lineage-wrap.has-belt .lineage-tree {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.lineage-belt .oct-name {
  fill: var(--red);
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.lineage-belt .oct-rank {
  fill: var(--text-muted);
  font-family: var(--font-body);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lineage-belt .is-us .oct-name,
.lineage-belt .is-us .oct-rank {
  fill: #fff;
}

.ed-photos {
  display: grid;
  gap: 2.5rem;
}

.ed-figure--wide img {
  aspect-ratio: auto;
}

@media (max-width: 599px) {
  .ed-row {
    grid-template-columns: 1fr;
  }

  .ed-row dd {
    text-align: left;
  }

  .ed-list li {
    justify-content: start;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 4rem 0 2rem;
  font-size: 0.9375rem;
}

.footer-grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 760px) {
  .footer-grid {
    grid-template-columns: 1fr auto auto;
    column-gap: clamp(3rem, 7vw, 6rem);
    align-items: start;
  }
}

.site-footer h2 {
  margin-bottom: 1rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.site-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer li {
  margin-bottom: 0.4rem;
}

.site-footer a {
  color: var(--text);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--red-text);
}

.site-footer .logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0;
}

.site-footer .logo img {
  width: auto;
  height: 56px;
}

.logo .logo__text {
  color: var(--text);
}

.footer-links a {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-footer .footer-links li {
  margin-bottom: 0.6rem;
}

/* Phones: footer content centred */
@media (max-width: 759px) {
  .site-footer {
    text-align: center;
  }

  .site-footer .footer-tagline {
    margin: 0 auto;
    text-wrap: balance;
  }
}

@media (min-width: 760px) {
  /* Logo on the left; page links and socials grouped on the right */
  .footer-nav,
  .footer-socials {
    justify-self: start;
  }
}

.site-footer .footer-socials h2 {
  margin-bottom: 0.75rem;
}

.footer-tagline {
  max-width: 22rem;
  margin: 0;
  color: var(--text-muted);
}

.footer-bottom {
  margin: 3rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ---------- Motion preferences ---------- */

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

  * {
    transition: none !important;
  }
}

/* ---------- Typewriter details ----------
   Letter spacing and sizes for the small labels, nav, buttons, times and the hero tagline. */

.eyebrow,
.site-nav a,
.btn,
.timetable thead th,
.timetable .time,
.site-footer h2 {
  font-family: var(--font-body);
  letter-spacing: 0.06em;
}

.hero p,
.footer-tagline {
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.hero p {
  font-size: clamp(0.9375rem, 1.6vw, 1.125rem);
  line-height: 1.6;
}

.timetable .time {
  letter-spacing: 0;
}

@media (max-width: 719px) {
  .timetable .time {
    font-size: 0.8125rem;
  }

  .site-nav a {
    font-size: 0.875rem;
  }
}

/* ---------- Phones: centred text (Home, About, Contact) ---------- */
@media (max-width: 719px) {
  .hero .wrap,
  .narrow,
  .ed-title,
  .ed-intro,
  .ed-row dt,
  .ed-row dd,
  .ed-team__text,
  .lineage-head {
    text-align: center;
  }

  .hero h1,
  .hero p,
  .narrow,
  .ed-intro {
    margin-left: auto;
    margin-right: auto;
  }

  .ed-list li {
    justify-content: center;
  }

  .ed-figure figcaption {
    justify-content: center;
    gap: 0.75rem;
  }

  .ed-figure figcaption span + span::before {
    content: "·";
    margin-right: 0.75rem;
  }

  /* the medals table keeps its columns; only its heading is centred */
  .ed-row--full .ed-medals {
    text-align: left;
  }
}

/* Longer paragraphs are justified (straight edges on both sides) on every screen size */
.narrow .lead,
.ed-intro,
.ed-team__text,
.ed-story__row dd {
  text-align: justify;
}

/* Phones: menu button on the left, logo in the middle of the header */
@media (max-width: 719px) {
  .site-header .wrap {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
  }

  .site-header .nav-toggle {
    grid-column: 1;
    grid-row: 1;
    margin: 0 0 0 -10px;
  }

  .site-header .logo {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }

  .site-header .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Phones: paragraphs centred (desktop stays justified) */
@media (max-width: 719px) {
  .narrow .lead,
  .ed-intro,
  .ed-team__text,
  .ed-story__row dt,
  .ed-story__row dd {
    text-align: center;
  }
}
