/*
 * keepopen.co.uk: one hand-written stylesheet for every page.
 *
 * The colours and fonts are the product admin's "Harbour" brand
 * (keepopen-deposits/apps/classes-ui/src/admin/brand.css). Light theme only.
 * The fonts are self-hosted, latin subset, from the @fontsource-variable packages (OFL, licences in /fonts).
 * The Content-Security-Policy in _headers allows styles and fonts from this origin only, so nothing here may be
 * inline in the HTML and nothing may load from another host.
 */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("/fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* Harbour colours. Every text pair below passes WCAG AA (ink 15.5:1, muted 5.9:1, accent 7.3:1 on the page). */
  --paper: #f6f7f4;
  --surface: #ffffff;
  --ink: #16201c;
  --muted: #55635c;
  --accent: #1f5c4a;
  --accent-subtle: #e4eee8;
  --rule: #dde3dd;
  --control: #6b7a73;

  /* The footer uses the admin sidebar's dark pair. */
  --night: #16201c;
  --night-text: #e9efeb;
  --night-muted: #a9bbb2;
  --night-focus: #9fd3bc;

  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wrap: 70rem;
  --measure: 38rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

/* Base ---------------------------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  margin: 0 0 0.5em;
  font-family: var(--font-head);
  line-height: 1.15;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.3125rem;
  font-weight: 650;
}

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

strong {
  font-weight: 650;
}

/* Skip link and page frame -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  border-radius: 6px;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.skip-link:focus-visible {
  outline-color: var(--ink);
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.wordmark {
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: 0.25rem 0;
  font-weight: 600;
}

main {
  display: block;
}

main:focus {
  outline: none;
}

/* Home: the opening ---------------------------------------------------------------------------------- */

.hero .wrap {
  display: grid;
  gap: 2.5rem;
  padding-top: clamp(1.5rem, 5vw, 4rem);
  padding-bottom: clamp(3rem, 7vw, 5.5rem);
}

.hero h1 {
  max-width: 14ch;
  margin-bottom: 0.4em;
  font-size: clamp(2.375rem, 1.4rem + 4.4vw, 4.25rem);
  font-weight: 760;
  letter-spacing: -0.025em;
  line-height: 1.02;
}

.lede {
  max-width: var(--measure);
  font-size: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);
  line-height: 1.5;
}

.hero-who {
  max-width: var(--measure);
  color: var(--muted);
}

.hero-action {
  margin-top: 1.75rem;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.button:hover {
  background: var(--ink);
  border-color: var(--ink);
}

@media (min-width: 60rem) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: start;
    gap: 4rem;
  }

  .timetable {
    margin-top: 0.75rem;
  }
}

/* The example timetable: the one picture on the page, drawn as a list of real-looking classes. --------- */

.timetable {
  margin: 0;
  padding: 1.25rem 1.25rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
}

.tt-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-head);
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.25;
}

.tt-day {
  margin: 1rem 0 0;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--ink);
  font-size: 1rem;
  font-weight: 650;
}

.tt-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tt-list li {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  gap: 0.15rem 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.tt-time {
  grid-row: span 2;
  font-family: var(--font-head);
  font-size: 1.0625rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.tt-name {
  font-weight: 600;
  line-height: 1.35;
}

.tt-status {
  justify-self: start;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 600;
}

.tt-status--full {
  border: 1px dashed var(--control);
  background: transparent;
  color: var(--muted);
}

.tt-bundle {
  margin: 0.85rem 0 0.25rem;
  font-size: 1rem;
}

.timetable figcaption {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* In forced-colours mode backgrounds disappear, so the pills keep an edge. */
@media (forced-colors: active) {
  .tt-status {
    border: 1px solid CanvasText;
  }
}

/* Home: sections ------------------------------------------------------------------------------------- */

.section {
  padding: clamp(2.75rem, 6vw, 4.5rem) 0;
  border-top: 1px solid var(--rule);
}

.section-intro {
  max-width: var(--measure);
  color: var(--muted);
}

.feature-groups {
  display: grid;
  gap: 2rem 3rem;
  margin-top: 2rem;
}

@media (min-width: 48rem) {
  .feature-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 68rem) {
  .feature-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.feature-group h3 {
  padding-top: 0.75rem;
  border-top: 3px solid var(--accent);
}

.ticks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticks li {
  position: relative;
  margin-bottom: 0.7rem;
  padding-left: 1.4rem;
}

.ticks li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 0.15rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
}

@media (forced-colors: active) {
  .ticks li::before {
    background: CanvasText;
  }
}

.more-coming {
  margin-top: 1.5rem;
  color: var(--muted);
}

/* How payments work: a real sequence, so it is numbered. */
.steps {
  display: grid;
  gap: 1.25rem 2.5rem;
  max-width: 60rem;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

@media (min-width: 48rem) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.steps li {
  counter-increment: step;
  padding-top: 0.5rem;
  border-top: 1px solid var(--ink);
}

.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 0.25rem;
  color: var(--accent);
  font-family: var(--font-head);
  font-size: 2.25rem;
  font-weight: 760;
  line-height: 1.1;
}

.callout {
  max-width: var(--measure);
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-subtle);
}

.callout p:last-child {
  margin-bottom: 0;
}

.contact-address {
  margin: 1.5rem 0;
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 1rem + 2.6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.contact-address a {
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
}

.narrow {
  max-width: var(--measure);
}

/* Policy pages (privacy, terms) and the 404 page ----------------------------------------------------- */

.doc {
  padding-top: clamp(1.5rem, 5vw, 3.5rem);
  padding-bottom: clamp(3rem, 7vw, 5rem);
}

.doc > .wrap > * {
  max-width: var(--measure);
}

.doc h1 {
  font-size: clamp(2.125rem, 1.6rem + 2.4vw, 3.25rem);
  font-weight: 760;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.doc h2 {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
}

.doc h3 {
  margin-top: 1.5rem;
  font-size: 1.1875rem;
}

.doc li {
  margin-bottom: 0.45rem;
}

.updated {
  color: var(--muted);
}

.doc-summary {
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-subtle);
}

.doc-summary p:last-child {
  margin-bottom: 0;
}

.facts {
  margin: 0 0 1.25rem;
}

.facts dt {
  font-weight: 650;
}

.facts dd {
  margin: 0 0 0.6rem;
}

/* Footer ---------------------------------------------------------------------------------------------- */

.site-footer {
  background: var(--night);
  color: var(--night-text);
  font-size: 1rem;
}

.site-footer .wrap {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.site-footer .wordmark {
  color: var(--night-text);
}

.site-footer a {
  color: var(--night-text);
}

.site-footer :focus-visible {
  outline-color: var(--night-focus);
}

.legal {
  max-width: 44rem;
  margin: 0.75rem 0 1.25rem;
  color: var(--night-muted);
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-nav a {
  display: inline-block;
  padding: 0.25rem 0;
}

/* Motion and print ------------------------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  .skip-link {
    transition: transform 0.15s ease-out;
  }
}

@media print {
  .skip-link,
  .site-nav,
  .footer-nav {
    display: none;
  }

  body {
    background: #ffffff;
  }

  .site-footer {
    background: #ffffff;
    color: var(--ink);
  }

  .legal {
    color: var(--ink);
  }
}
