/* Mobile-first: base styles are for phones; min-width queries add tablet (48rem) and desktop (64rem) layouts.
   Palette taken from the 1965 Shelby GT350: Wimbledon White with Guardsman Blue stripes. */
:root {
  --white: #f1f2ef;        /* Wimbledon White */
  --paper: #fafaf8;
  --blue: #1b2a4e;         /* Guardsman Blue */
  --ink: #161b2c;
  --red: #b3121b;          /* Candyapple Red */
  --chrome: #5f687c;
  --rule: #d6d9df;

  --font: "Archivo", system-ui, sans-serif;
  --narrow: 62;
  --measure: 34rem;
  --gutter: max(1rem, env(safe-area-inset-left), env(safe-area-inset-right));
  --max: 72rem;
  --tap: 2.75rem;          /* minimum touch target */

  color-scheme: light;
}

@media (min-width: 48rem) {
  :root { --gutter: max(2rem, env(safe-area-inset-left), env(safe-area-inset-right)); }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 7rem;   /* keep anchored headings clear of the sticky header */
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (min-width: 48rem) {
  html { scroll-padding-top: 5rem; }
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

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

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

.display {
  font-variation-settings: "wdth" var(--narrow);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ---------- Tail-light mark ---------- */

.lights {
  display: inline-flex;
  gap: 3px;
  height: 1.1em;
  vertical-align: -0.15em;
}
.lights span {
  width: 0.32em;
  background: var(--red);
  border-radius: 1px;
}

@media (prefers-reduced-motion: no-preference) {
  .lights--sequence span { animation: light 0.9s ease-out both; }
  .lights--sequence span:nth-child(1) { animation-delay: 0.3s; }
  .lights--sequence span:nth-child(2) { animation-delay: 0.5s; }
  .lights--sequence span:nth-child(3) { animation-delay: 0.7s; }
}

@keyframes light {
  from { background: #4a1518; }
  40%  { background: #ff2a2f; box-shadow: 0 0 0.6em #ff2a2f; }
  to   { background: var(--red); box-shadow: none; }
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding-top: env(safe-area-inset-top);
}
.site-header .wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.5rem;
  font-weight: 800;
  font-size: 1.35rem;
  font-variation-settings: "wdth" var(--narrow);
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--blue);
}
.header-button {
  grid-row: 1;
  grid-column: -2;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 1.1rem;
  border-radius: 3px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.header-button:hover, .header-button:active { background: #8f0e15; }
.header-button--quiet { background: transparent; color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.header-button--quiet:hover, .header-button--quiet:active { background: var(--blue); color: var(--paper); }

/* Phones: section links get their own row of equal-width tap targets */
.nav {
  grid-column: 1 / -1;
  display: flex;
  margin-inline: calc(var(--gutter) * -1);
  border-top: 1px solid var(--rule);
}
.nav a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--blue);
}
.nav a + a { border-left: 1px solid var(--rule); }
.nav a:active { background: var(--white); }

@media (min-width: 48rem) {
  .site-header .wrap { grid-template-columns: auto 1fr auto; }
  .nav {
    grid-row: 1;
    grid-column: 2;
    justify-content: flex-end;
    gap: 0.25rem;
    margin: 0 0.75rem 0 0;
    border: 0;
  }
  .nav a { flex: none; padding-inline: 0.75rem; font-weight: 500; color: var(--ink); }
  .nav a + a { border: 0; }
  .nav a:hover { text-decoration: underline; text-underline-offset: 0.25em; }
}

/* ---------- Hero ---------- */

/* Le Mans stripes: two broad bands with a narrow gap, the way they run over a GT350's bonnet */
.hero {
  --stripe: 1.1rem;
  --stripe-gap: 0.35rem;
  --stripe-edge: var(--gutter);
  position: relative;
  overflow: hidden;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--stripe);
  background: var(--blue);
}
.hero::after  { right: var(--stripe-edge); }
.hero::before { right: calc(var(--stripe-edge) + var(--stripe) + var(--stripe-gap)); }

.hero .wrap {
  position: relative;
  z-index: 1;
  padding-right: calc(var(--stripe-edge) + var(--stripe) * 2 + var(--stripe-gap) + 1.25rem);
  padding-block: 2rem 2.25rem;
}
.hero h1 {
  font-size: clamp(2.6rem, 12.5vw, 7.5rem);
  color: var(--blue);
}
.hero h1 .lights { display: flex; font-size: 0.5em; height: 0.9em; margin-bottom: 0.3em; }
.hero p {
  max-width: var(--measure);
  margin: 1.25rem 0 0;
  font-size: 1.0625rem;
}

@media (min-width: 48rem) {
  .hero { --stripe: 4.5rem; --stripe-gap: 0.9rem; --stripe-edge: 4rem; }
  .hero .wrap { padding-block: 4rem 3.5rem; }
  .hero h1 { max-width: 11ch; }
  .hero p { font-size: 1.2rem; margin-top: 1.75rem; }
}
@media (min-width: 64rem) {
  .hero { --stripe: 7rem; --stripe-gap: 1.25rem; --stripe-edge: 10vw; }
  .hero .wrap { padding-block: 5.5rem 5rem; padding-right: var(--gutter); }
}

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

.actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.6rem 1.4rem;
  border: 0;
  border-radius: 3px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  background: var(--red);
  color: #fff;
  cursor: pointer;
}
.button:hover, .button:active { background: #8f0e15; }
.button--quiet {
  background: transparent;
  color: var(--blue);
  box-shadow: inset 0 0 0 2px var(--blue);
}
.button--quiet:hover, .button--quiet:active { background: var(--blue); color: var(--paper); }
.button--light { background: var(--paper); color: var(--blue); }
.button--light:hover, .button--light:active { background: #fff; }

@media (min-width: 30rem) {
  .actions { display: flex; flex-wrap: wrap; }
  .button { display: inline-flex; }
}

/* ---------- Sections ---------- */

.section { padding-block: 2.75rem 3rem; }
.section h2 {
  font-size: clamp(2.25rem, 10vw, 3.75rem);
  color: var(--blue);
  margin-bottom: 1rem;
}
.section p { max-width: var(--measure); }
.section--tint { background: var(--paper); border-block: 1px solid var(--rule); }
.section--blue { background: var(--blue); color: var(--white); }
.section--blue h2 { color: #fff; }

@media (min-width: 48rem) {
  .section { padding-block: 4.5rem; }
}

.subhead {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.1rem;
  color: var(--chrome);
}
.section--blue .subhead { color: #aab3c7; }

.small { font-size: 0.9rem; color: var(--chrome); }
.small a { color: var(--blue); }

.empty {
  padding: 1.25rem;
  border: 2px dashed var(--rule);
  border-radius: 3px;
  background: var(--paper);
}

/* ---------- Events ---------- */

.next-event {
  display: grid;
  gap: 1.25rem;
  margin: 1.25rem 0 0;
  max-width: 52rem;
}
.next-event-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 4px;
  background: var(--rule);
}
.next-event time,
.event time {
  font-variation-settings: "wdth" var(--narrow);
  font-weight: 800;
  color: var(--red);
}
.next-event time { font-size: 1.6rem; line-height: 1; }
.next-event h3 {
  margin: 0.35rem 0 0;
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--blue);
}
.next-event .event-note {
  margin: 0.75rem 0 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--red);
}
.next-event .button { margin-top: 1.25rem; }

@media (min-width: 48rem) {
  .next-event { grid-template-columns: 1fr 1fr; align-items: center; gap: 2rem; }
  .next-event time { font-size: 2rem; }
}

.event-location { margin: 0.25rem 0 0; color: var(--chrome); }

.event-list {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  max-width: 52rem;
  border-top: 2px solid var(--blue);
}
.event {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.event img {
  grid-row: span 2;
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--rule);
}
.event h4 { margin: 0; font-size: 1.05rem; line-height: 1.25; }
.event h4 a { color: var(--blue); text-decoration: none; }
.event h4 a:hover { text-decoration: underline; }
.event time { grid-column: 2; font-size: 1.1rem; }

@media (min-width: 48rem) {
  .event { grid-template-columns: 4rem 1fr auto; column-gap: 1.25rem; }
  .event img { grid-row: auto; width: 4rem; height: 4rem; }
  .event time { grid-column: auto; font-size: 1.3rem; white-space: nowrap; }
}
#events .button--quiet { margin-top: 1.75rem; }
#more-events + .button--quiet { margin-top: 0; }

/* ---------- Meeting finder ---------- */

.finder {
  display: grid;
  gap: 1rem;
  max-width: 30rem;
  margin-top: 1.5rem;
}
.postcode-form label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.postcode-row { display: flex; gap: 0.5rem; }
.postcode-row input {
  flex: 1;
  min-width: 0;
  min-height: 3rem;
  padding: 0 0.85rem;
  border: 2px solid var(--chrome);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;   /* 16px+ stops iOS zooming on focus */
  text-transform: uppercase;
}
.postcode-row input::placeholder { text-transform: none; color: #8b93a3; }
.postcode-row input:focus-visible { border-color: var(--blue); outline-offset: 1px; }
.finder-status { margin: 0; min-height: 1.5em; font-weight: 600; color: var(--blue); }

.area-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  max-width: 44rem;
  border-top: 2px solid var(--blue);
}
.area { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.area-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.area h3 { margin: 0; font-size: 1.15rem; color: var(--blue); }
.distance {
  font-variation-settings: "wdth" var(--narrow);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--red);
  white-space: nowrap;
}
.area p { margin: 0.2rem 0 0; }
.area-when { font-weight: 600; }
.area-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.area-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--blue);
  font-weight: 600;
}

.all-areas { margin-top: 2rem; max-width: 44rem; }
.all-areas summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
}
.all-areas[open] summary { margin-bottom: 0.25rem; }

/* ---------- Contacts and links ---------- */

.contacts,
.links {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  max-width: 64rem;
}
.contacts { border-top: 2px solid var(--blue); }
.contacts li { border-bottom: 1px solid var(--rule); }
.contacts a,
.links a {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 0;
  text-decoration: none;
}
.contacts strong { color: var(--blue); font-size: 1.05rem; }
.contacts span { color: var(--ink); }
.contacts .addr { color: var(--red); font-weight: 600; word-break: break-word; }
.contacts a:hover strong,
.links a:hover strong { text-decoration: underline; text-underline-offset: 0.2em; }

@media (min-width: 48rem) {
  .contacts { grid-template-columns: 1fr 1fr; column-gap: 2.5rem; }
}

.join { max-width: 40rem; }
.section--blue .join p { color: #c5cbd8; }

.links { border-top: 1px solid #3b4a70; }
.links li { border-bottom: 1px solid #3b4a70; }
.links strong { font-size: 1.15rem; color: #fff; }
.links span { color: #c5cbd8; }

@media (min-width: 48rem) {
  .links { grid-template-columns: repeat(2, 1fr); column-gap: 2.5rem; }
}
@media (min-width: 64rem) {
  .links { grid-template-columns: repeat(3, 1fr); }
}

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

.site-footer {
  padding-block: 1.75rem calc(1.75rem + env(safe-area-inset-bottom));
  font-size: 0.9rem;
  color: var(--chrome);
}
.site-footer .wrap { display: grid; gap: 0.5rem; }
.site-footer p { margin: 0; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--blue); }

@media (min-width: 48rem) {
  .site-footer .wrap { grid-template-columns: 1fr auto; align-items: center; }
}

/* ---------- Simple page (members) ---------- */

.page {
  min-height: 60vh;
  padding-block: 3rem;
}
.page h1 { font-size: clamp(3rem, 14vw, 6rem); color: var(--blue); margin-bottom: 1.25rem; }
.page p { max-width: var(--measure); }

@media (min-width: 48rem) {
  .page { padding-block: 6rem; }
}

/* ---------- Install ---------- */

.install { margin-top: 1.5rem; max-width: var(--measure); }
.install .install-hint {
  margin: 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--red);
  background: var(--white);
  font-size: 0.95rem;
}
