/* The British Quiz League: site styles
   Tokens first, then base, then components, then page layouts. */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face {
  font-family: "Libre Caslon Display";
  src: url("/fonts/libre-caslon-display-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Caslon Text";
  src: url("/fonts/libre-caslon-text-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Caslon Text";
  src: url("/fonts/libre-caslon-text-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Libre Caslon Text";
  src: url("/fonts/libre-caslon-text-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* colour */
  --oxblood: #6B1A22;   /* brand, links, primary actions */
  --claret: #4A0F16;    /* hover and pressed */
  --deep: #59131B;      /* tone-on-tone graphics on oxblood */
  --ink: #17130F;       /* text */
  --graphite: #5E564B;  /* secondary text, captions */
  --stone: #CFC4AE;     /* hairlines, input borders at rest */
  --parchment: #F3ECDD; /* page ground */
  --paper: #FAF6EC;     /* inputs, cards, tables */
  --brass: #A9822F;     /* league leader marker only, never text */
  --error: #8E1B1B;

  /* type */
  --font-display: "Libre Caslon Display", "Big Caslon", Baskerville, "Times New Roman", serif;
  --font-text: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --font-ui: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  /* space (4px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  --radius: 2px;        /* sharp, never pill-shaped */
  --measure: 62ch;
  --gutter: clamp(20px, 5vw, 72px);
}

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

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

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--oxblood);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--claret);
  text-decoration-thickness: 2px;
}

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

[hidden] {
  display: none !important;
}

.nowrap {
  white-space: nowrap;
}

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

/* ---------- Components ---------- */

/* Small uppercase label, used for form labels and section tags */
.label {
  display: block;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--graphite);
}

.label--brand {
  color: var(--oxblood);
}

.logo {
  display: inline-block;
}

.logo img {
  width: auto;
  height: 34px;
}

.field {
  width: 100%;
  min-height: 54px;
  padding: 0 var(--s-4);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.2;
}

.field::placeholder {
  color: var(--graphite);
  opacity: 1;
}

.field:focus-visible {
  outline: 2px solid var(--oxblood);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 var(--s-6);
  border: 1px solid var(--oxblood);
  border-radius: var(--radius);
  background: var(--oxblood);
  color: var(--parchment);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.button:hover {
  background: var(--claret);
  border-color: var(--claret);
}

.button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* Email form, shared by sign-up and unsubscribe */
.email-form {
  display: grid;
  gap: var(--s-3);
  max-width: 560px;
}

.email-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-3);
}

.email-form__note {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  color: var(--graphite);
}

.email-form__status {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  min-height: 1.5em;
}

.email-form__status[data-state="error"] {
  color: var(--error);
}

.email-form__status:empty {
  display: none;
}

/* Honeypot: hidden from people, visible to naive bots */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  align-items: center;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--graphite);
}

.site-footer a {
  color: var(--graphite);
}

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

/* ---------- Home: split layout ---------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  min-height: 100vh;
  min-height: 100svh;
}

.split__content {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  padding: var(--s-7) var(--gutter) var(--s-6);
}

.split__panel {
  position: relative;
  overflow: hidden;
  background: var(--oxblood);
}

/* Oversized tone-on-tone Q, cropped by the panel */
.split__q {
  position: absolute;
  top: 50vh;
  top: 50svh;
  left: 12%;
  width: 150%;
  max-width: none;
  transform: translateY(-46%);
  fill: var(--deep);
}

.split__seal {
  position: absolute;
  right: var(--s-6);
  bottom: var(--s-6);
  width: 112px;
}

.hero {
  display: grid;
  gap: var(--s-5);
  margin-block: auto;
  padding-block: var(--s-6);
}

.hero h1 {
  font-size: clamp(40px, 5.6vw, 80px);
  line-height: 1.04;
}

.hero__lede {
  font-size: clamp(19px, 1.6vw, 22px);
  line-height: 1.5;
  max-width: 34ch;
}

.hero .email-form {
  margin-top: var(--s-4);
}

.points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-6);
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 760px;
}

.points li {
  display: grid;
  gap: var(--s-2);
  align-content: start;
}

.points p {
  font-size: 16px;
  line-height: 1.5;
}

/* ---------- Inner pages: single reading column ---------- */
.page {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--s-7) var(--gutter) var(--s-6);
}

.page__main {
  width: 100%;
  max-width: 680px;
  margin-inline: auto;
  flex-grow: 1;
}

.page__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-5);
  align-items: center;
  justify-content: space-between;
}

.page__footer img {
  width: 72px;
}

.prose {
  display: grid;
  gap: var(--s-4);
  align-content: start;
}

.prose h1 {
  font-size: clamp(40px, 5vw, 60px);
  line-height: 1.05;
  margin-bottom: var(--s-2);
}

.prose h2 {
  font-size: 30px;
  line-height: 1.15;
  margin-top: var(--s-6);
}

.prose ul {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: var(--s-2);
}

.prose li::marker {
  color: var(--oxblood);
}

.prose .meta {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--graphite);
}

.prose address {
  font-style: normal;
}

.prose .email-form {
  margin-top: var(--s-3);
}

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .split__panel {
    position: relative;
    order: -1;
    height: 120px;
  }

  .split__q {
    top: 0;
    left: auto;
    right: -8%;
    width: 62%;
    transform: translateY(-22%);
  }

  .split__seal {
    display: none;
  }

  .split__content {
    gap: var(--s-7);
    padding-top: var(--s-6);
    min-height: calc(100svh - 120px);
  }

  .hero {
    margin-block: 0;
    padding-block: 0;
  }

  .points {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-5);
  }

  .logo img {
    height: 28px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 17px;
  }

  .email-form__row {
    grid-template-columns: minmax(0, 1fr);
  }

  .button {
    width: 100%;
  }
}

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

/* Unsubscribe link with a token: the email box is not needed */
.email-form__row.has-token {
  grid-template-columns: auto;
  justify-content: start;
}

.email-form__row.has-token .field {
  display: none;
}
