/*
  Layout and components. Uses only values from tokens.css.
  Sections: base · layout · header · stripes · labels and buttons · hero ·
  petition (incl. Action Network embed) · video · vision · calendar ·
  coalition · page header and prose · footer · phones
*/

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--leading);
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  text-transform: uppercase;
}

h1 {
  font-size: var(--size-h1);
  font-weight: var(--weight-black);
  font-stretch: var(--stretch-display);
  line-height: 0.95;
}

h2 {
  font-size: var(--size-h2);
  font-weight: var(--weight-black);
  font-stretch: var(--stretch-heading);
}

h3 {
  font-size: var(--size-h3);
  font-weight: var(--weight-display);
  font-stretch: var(--stretch-label);
  line-height: 1.2;
}

p,
ul,
ol {
  margin: 0;
}

img,
video,
iframe {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--color-muted);
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.on-dark :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-m);
  top: -100%;
  z-index: 10;
  padding: var(--space-xs) var(--space-m);
  background: var(--color-text);
  color: var(--color-bg);
}

.skip-link:focus {
  top: var(--space-m);
}

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--space-2xl);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

.stack--tight {
  gap: var(--space-m);
}

.lead {
  max-width: var(--measure);
  font-size: var(--size-lead);
}

/* ---------- Header ---------- */

.site-header {
  background: var(--color-bg);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  padding-block: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  color: var(--color-text);
  text-decoration: none;
}

.brand:hover {
  color: var(--color-text);
}

.brand__mark {
  flex: none;
  width: 34px;
  height: 34px;
}

.brand__name {
  font-weight: var(--weight-display);
  font-stretch: 80%;
  font-size: var(--size-h3);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs) var(--space-l);
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: var(--weight-semibold);
}

.nav a {
  text-decoration: none;
}

.nav a:not(.button):hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.nav__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

/* ---------- Stripes (coloured "lines" between sections) ---------- */

.stripe {
  height: 12px;
  background: var(--color-stripe-2);
  border-block: 2px solid var(--color-text);
}

.stripe--thin {
  height: 8px;
  background: var(--color-stripe-1);
  border-block-width: 1.5px;
}

/* ---------- Labels and buttons ---------- */

/* Small grey label in monospace, e.g. "Key to the centre" */
.tag {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  background: var(--color-stone);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--size-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Numbered section label: [1 | Our vision] */
.badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: stretch;
  border: var(--border-width) solid currentColor;
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: var(--weight-bold);
  font-size: 0.9375rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge__number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.badge__label {
  padding: 6px 14px;
}

.on-dark .badge {
  background: transparent;
  color: var(--color-dark-text);
}

.button {
  display: inline-block;
  padding: 10px 16px;
  border: var(--border-width) solid var(--color-text);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-weight: var(--weight-bold);
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.button--primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.button--primary:hover {
  border-color: var(--color-text);
}

/* On dark sections */
.button--light {
  border-color: var(--color-dark-text);
  background: var(--color-dark-text);
  color: var(--color-text);
}

.button--light:hover {
  background: transparent;
  color: var(--color-dark-text);
}

.button--outline-light {
  border-color: var(--color-dark-text);
  color: var(--color-dark-text);
}

.button--outline-light:hover {
  background: var(--color-dark-text);
  color: var(--color-text);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Hero ---------- */

/* Map background: blue grid, grid numbers, and a river down the right */
.hero {
  position: relative;
  overflow: hidden;
  background-color: var(--color-bg);
  background-image:
    url("../img/hero-grid-labels.svg"),
    url("../img/hero-river.svg"),
    linear-gradient(to right, var(--color-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-grid) 1px, transparent 1px);
  background-repeat: no-repeat, no-repeat, repeat, repeat;
  background-position: 0 0, right -60px top 0, 0 0, 0 0;
  background-size: auto, 440px 100%, var(--grid-size) var(--grid-size), var(--grid-size) var(--grid-size);
}

/* On phones the river would run under the text, so leave it out */
@media (max-width: 52em) {
  .hero {
    background-image:
      url("../img/hero-grid-labels.svg"),
      linear-gradient(to right, var(--color-grid) 1px, transparent 1px),
      linear-gradient(to bottom, var(--color-grid) 1px, transparent 1px);
    background-repeat: no-repeat, repeat, repeat;
    background-position: 0 0, 0 0, 0 0;
    background-size: auto, var(--grid-size) var(--grid-size), var(--grid-size) var(--grid-size);
  }
}

.hero__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-xl);
  padding-top: clamp(2.5rem, 1.5rem + 4vw, 4rem);
  padding-bottom: var(--space-2xl);
}

.hero__main {
  flex: 999 1 32rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

.hero__side {
  flex: 1 1 18rem;
  max-width: 340px;
  margin-inline: auto;
}

.hero .lead {
  font-size: var(--size-lead);
}

/* ---------- Petition ---------- */

.petition-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 620px;
  padding: clamp(1.25rem, 0.8rem + 1.5vw, 1.75rem);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-text);
  scroll-margin-top: var(--space-m);
}

.petition-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-xs);
}

.petition-card__head h2 {
  font-size: 1.75rem;
  font-weight: var(--weight-display);
  font-stretch: var(--stretch-label);
}

.petition-card__to {
  font-family: var(--font-mono);
  font-size: var(--size-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.petition-card__note {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

/*
  Action Network embed. Use AN's unstyled embed option so these rules,
  not AN's stylesheet, control the look. Selectors are kept generic
  (scoped to .an-embed) so they survive changes to AN's markup.
*/
.an-embed #can_embed_form {
  font-family: var(--font-body);
  color: var(--color-text);
}

/* AN repeats the petition title; the card already has one */
.an-embed #can_embed_form h2,
.an-embed #can_embed_form h4 {
  font-size: var(--size-h3);
  font-weight: var(--weight-display);
  font-stretch: var(--stretch-label);
}

.an-embed label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--size-small);
  font-weight: var(--weight-semibold);
}

.an-embed input[type="text"],
.an-embed input[type="email"],
.an-embed input[type="tel"],
.an-embed input[type="number"],
.an-embed select,
.an-embed textarea {
  width: 100%;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1.5px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 1rem;
}

.an-embed input:focus,
.an-embed select:focus,
.an-embed textarea:focus {
  border-color: var(--color-text);
}

.an-embed input[type="checkbox"],
.an-embed input[type="radio"] {
  width: 22px;
  height: 22px;
  margin: 0 var(--space-s) 0 0;
  accent-color: var(--color-text);
  vertical-align: middle;
}

.an-embed input[type="submit"],
.an-embed button {
  width: 100%;
  min-height: 52px;
  padding: 16px 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  font: inherit;
  font-weight: var(--weight-display);
  font-size: 1.125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.an-embed input[type="submit"]:hover,
.an-embed button:hover {
  background: var(--color-text);
}

.an-embed ul {
  padding: 0;
  list-style: none;
}

/* Tidy-ups for the markup Action Network generates (we don't load its stylesheet) */
.an-embed .can_embed,
.an-embed #can_embed_form,
.an-embed #can_embed_form_inner {
  float: none;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
}

.an-embed li {
  list-style: none;
}

.an-embed .hide,
.an-embed .can_select,
.an-embed .ajax-loading,
.an-embed #can_embed_form_inner > h2,
.an-embed #can_embed_form_inner > h4,
.an-embed .js-form_builder_output:not(:has(*)),
.an-embed .floatlabel-label,
.an-embed .control-label.disabled {
  display: none;
}

/* The petition's target line, e.g. "Target: ...". The card already has a title */
.an-embed #can_embed_form_inner > h3 {
  margin-bottom: var(--space-m);
  font-family: var(--font-mono);
  font-size: var(--size-mono);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.an-embed .international_link {
  display: inline-block;
  margin-bottom: var(--space-m);
  font-size: var(--size-small);
  text-decoration: underline;
  cursor: pointer;
}

.an-embed .check_radio_label {
  display: block;
  margin-top: var(--space-s);
}

.an-embed .checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: var(--space-xs);
  font-weight: 400;
}

.an-embed .checkbox input {
  flex: none;
  margin: 2px 0 0;
}

.an-embed textarea {
  height: 6.5rem;
  resize: vertical;
}

.an-embed #d_sharing {
  margin-top: var(--space-m);
  font-size: var(--size-small);
}

.an-embed #d_sharing label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
}

/* Shown where an embed (petition, video) has not been added yet */
.embed-placeholder {
  display: grid;
  place-items: center;
  min-height: 12rem;
  padding: var(--space-l);
  border: var(--border-width) dashed var(--color-rule);
  background: var(--color-bg);
  color: var(--color-muted);
  text-align: center;
}

/* ---------- Video (vertical, like an Instagram reel) ---------- */

.video-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.video-card__frame {
  padding: 10px;
  border: var(--border-width) solid var(--color-text);
  background: var(--color-bg);
}

.video-card__screen {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #1c1c1a;
}

.video-card__screen video,
.video-card__screen iframe {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.video-card__screen .embed-placeholder {
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--color-dark-muted);
}

/* ---------- Vision (dark) ---------- */

.on-dark {
  background: var(--color-dark);
  color: var(--color-dark-text);
}

.on-dark a:hover {
  color: var(--color-dark-muted);
}

.vision__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(2.5rem, 1.5rem + 3vw, 3.5rem);
}

.vision__aside {
  flex: 1 1 18rem;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.vision__main {
  flex: 999 1 30rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

.vision__main .lead {
  color: var(--color-dark-muted);
}

/* The vision PDF's cover, drawn as a sheet of graph paper */
.cover {
  aspect-ratio: 210 / 297;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-l);
  border: var(--border-width) solid var(--color-dark-text);
  background-color: var(--color-bg);
  background-image:
    linear-gradient(to right, var(--color-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--color-text);
  text-decoration: none;
}

.cover:hover {
  color: var(--color-text);
}

.cover__top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.cover__title,
.cover__subtitle {
  padding: 2px 6px;
  background: var(--color-bg);
}

.cover__title {
  font-weight: var(--weight-black);
  font-stretch: var(--stretch-heading);
  font-size: 2.125rem;
  line-height: 1;
  text-transform: uppercase;
}

.cover__subtitle {
  font-size: 0.9375rem;
}

.cover .brand__mark {
  width: 30px;
  height: 30px;
}

.photo {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.photo img {
  width: 100%;
  height: clamp(200px, 30vw, 300px);
  object-fit: cover;
  object-position: 50% 40%;
  filter: grayscale(1) contrast(1.05);
  border: var(--border-width) solid var(--color-dark-text);
}

/* "Key to the centre": what the centre does, like a map legend */
.key {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--color-dark-rule);
}

.key li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-m);
  padding: var(--space-l) clamp(1rem, 0.5rem + 1.5vw, 1.5rem);
  background: var(--color-dark);
}

.key__icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: var(--border-width) solid var(--color-icon);
  color: var(--color-icon);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.9375rem;
}

.key h3 {
  margin-bottom: 6px;
}

.key p {
  color: var(--color-dark-muted);
}

/* ---------- Calendar ---------- */

.calendar__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-m);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--size-small);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Each organisation's colour is set inline: style="--swatch: #hex" */
.legend li:not(.tag)::before {
  content: "";
  flex: none;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--color-text);
  background: var(--swatch, var(--color-muted));
}

.calendar-frame {
  width: 100%;
  height: clamp(36rem, 80vh, 52rem);
  border: var(--border-width) solid var(--color-text);
  background: var(--color-surface);
}

.calendar__note {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

/* ---------- Coalition ---------- */

/* Cream background with a faint graph-paper pattern */
.coalition {
  background-color: var(--color-cream);
  background-image:
    linear-gradient(rgba(26, 26, 26, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 26, 26, 0.07) 1px, transparent 1px);
  background-size: 18px 14px;
}

.partners {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.75rem), 1fr));
  gap: var(--space-m);
  margin: 0;
  padding: 0;
  list-style: none;
}

.partner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-text);
}

.partner__ref {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--size-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Same colour as the organisation's calendar: style="--swatch: #hex" */
.partner__ref::before {
  content: "";
  width: 16px;
  height: 16px;
  border: var(--border-width) solid var(--color-text);
  background: var(--swatch, var(--color-muted));
}

.partner__name {
  font-size: 1.25rem;
  font-weight: var(--weight-display);
  font-stretch: 100%;
  line-height: 1.2;
  text-transform: none;
}

.partner p {
  font-size: 0.9375rem;
  color: var(--color-text-2);
}

.note {
  align-self: flex-start;
  padding: 6px 10px;
  background: var(--color-bg);
}

/* ---------- Page header and prose (privacy notice, 404) ---------- */

.page-header {
  padding-block: var(--space-xl);
  background-color: var(--color-bg);
  background-image:
    linear-gradient(to right, var(--color-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-grid) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

.page-header .wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

.page-header h1 {
  font-size: var(--size-h2);
}

.page-header .lead {
  align-self: flex-start;
  padding: 2px 6px;
  background: var(--color-bg);
}

.prose > * {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: var(--space-m);
}

.prose h2 {
  margin-top: var(--space-xl);
  font-size: 1.75rem;
  font-stretch: var(--stretch-label);
}

.prose > h2:first-child {
  margin-top: 0;
}

.prose ul {
  padding-left: var(--space-l);
}

.prose li + li {
  margin-top: var(--space-2xs);
}

/* ---------- Footer (dark) ---------- */

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-xl);
  padding-block: var(--space-xl);
  font-size: 0.9375rem;
}

.site-footer__id {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.site-footer__id .brand__name {
  color: var(--color-dark-text);
}

.site-footer__id a {
  color: var(--color-dark-muted);
}

/* North arrow and scale bar, as on a printed map */
.map-furniture {
  display: flex;
  align-items: flex-end;
  gap: var(--space-l);
}

.scale-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scale-bar__bar {
  display: flex;
  border: 1.5px solid var(--color-dark-text);
}

.scale-bar__bar span {
  width: 36px;
  height: 8px;
}

.scale-bar__bar span:nth-child(odd) {
  background: var(--color-dark-text);
}

.scale-bar__labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-dark-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-l);
  margin: 0;
  padding: 0;
  list-style: none;
}


/* ---------- Phones ---------- */

@media (max-width: 40em) {
  /* Keep the vertical video and the PDF cover from filling the whole screen */
  .hero__side,
  .vision__aside {
    max-width: 17rem;
    margin-inline: 0;
  }
}
