/* Plus Bus Dunedin. The design brief and token reasons are in
   _source/DESIGN.md. Colours come from the van livery and the old site
   (_source/palette.md), written here in OKLCH.
   Accessibility follows the older adults and dementia guide: one font,
   no all-caps, no italics, 44px targets, visible nav, nothing moves. */

:root {
  /* Colour roles */
  --paper: oklch(0.970 0.024 83.4);        /* surface: tint of the old cream */
  --cream: oklch(0.916 0.073 77.4);        /* old site background #ffdead */
  --peach: oklch(0.818 0.090 53.9);        /* old site side panel #f2b48c */
  --peach-soft: oklch(0.898 0.051 58.4);
  --ink: oklch(0.320 0.012 70);            /* warm-tinted #333 */
  --ink-soft: oklch(0.396 0.013 81.8);
  --blue: oklch(0.337 0.133 274.5);        /* livery "PLUS BUS" */
  --red: oklch(0.537 0.190 27.5);          /* livery "+60 + SHOPPING + $ =": large marks only */
  --red-deep: oklch(0.470 0.164 27.9);     /* call button */
  --red-text: oklch(0.426 0.147 27.6);     /* red text, hover */
  --asphalt: oklch(0.306 0.007 274.7);     /* car park, tinted to the livery blue */
  --asphalt-lift: oklch(0.365 0.010 278.3);
  --asphalt-line: oklch(0.838 0.008 286.2);
  --asphalt-rule: oklch(0.532 0.009 278.5);
  --white: oklch(1 0 0);
  --black: oklch(0 0 0);

  /* Type: one family. Character comes from the 800 weight and the jumps in size. */
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", Verdana, Arial, sans-serif;
  --t-label: 1.05rem;
  --t-body: 1.25rem;
  --t-h3: 1.5rem;
  --t-lede: clamp(1.4rem, 2.6vw, 1.65rem);
  --t-h2: clamp(2.25rem, 5vw, 3rem);
  --t-figure: clamp(2.75rem, 7vw, 4.5rem);
  --t-sum: clamp(1.5rem, 3.6vw, 2.6rem);
  --t-name: clamp(3.25rem, 17vw, 8rem);

  /* Space: 4px base */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 1rem;
  --s4: 1.5rem;
  --s5: 2rem;
  --s6: 3rem;
  --s7: 5rem;
  --section: clamp(var(--s6), 8vw, var(--s7));

  --gutter: clamp(1rem, 4vw, 3rem);
  --wide: 72rem;
  --measure: 60ch;
}

html { font-size: 100%; }
html.big-text { font-size: 125%; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.6;
  overflow-wrap: break-word;
}

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

a { color: var(--blue); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 2px; }
a:hover { color: var(--red-text); text-decoration-thickness: 3px; }
p > a[href^="tel:"] { white-space: nowrap; }
p > a { padding-block: 0.2em; } /* 24px tall targets for links inside sentences */
a:focus-visible, button:focus-visible {
  outline: 4px solid var(--asphalt);
  outline-offset: 3px;
  box-shadow: 0 0 0 8px var(--cream);
}

h1, h2, h3 { font-family: var(--font); color: var(--blue); line-height: 1.1; margin: 0; }
h2 { font-size: var(--t-h2); font-weight: 800; }
h3 { font-size: var(--t-h3); font-weight: 700; line-height: 1.2; }
p { margin: 0 0 var(--s3); }
section { scroll-margin-top: 6.5rem; }

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

.skip {
  position: absolute; left: var(--s3); top: -6rem; z-index: 20;
  background: var(--asphalt); color: var(--white); padding: 0.8rem 1.2rem; font-weight: 700;
}
.skip:focus { top: var(--s3); color: var(--white); }

/* ---------- Top bar: today's day and the text-size button ---------- */

.bar { background: var(--asphalt); color: var(--cream); }
.bar__inner {
  max-width: var(--wide); margin: 0 auto; padding: var(--s2) var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); flex-wrap: wrap;
}
.bar__today { margin: 0; font-size: var(--t-label); }
.bar__today strong { color: var(--white); }
.bar__size {
  font: inherit; font-size: var(--t-label); font-weight: 700; cursor: pointer;
  min-height: 44px; padding: 0.35rem var(--s3);
  background: var(--cream); color: var(--asphalt); border: 2px solid var(--cream);
}
.bar__size:hover { background: var(--white); }
.big-text .bar__size { background: var(--asphalt); color: var(--cream); }

/* ---------- Masthead and the livery lockup (the one signature move) ---------- */

.mast {
  max-width: var(--wide); margin: 0 auto;
  padding: clamp(var(--s5), 6vw, var(--s7)) var(--gutter) clamp(var(--s6), 6vw, var(--s7));
  display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--s6) clamp(var(--s5), 5vw, var(--s7)); align-items: center;
}

/* Set like the side of the van: the red sum on one line, the blue name under it. */
.livery { margin: 0 0 var(--s5); }
.livery > span { display: block; }
.livery__sum {
  color: var(--red); font-size: var(--t-sum); font-weight: 800; line-height: 1.1;
  margin-bottom: var(--s2);
}
.livery__name {
  color: var(--blue); font-size: var(--t-name); font-weight: 800; line-height: 0.92;
  letter-spacing: -0.02em;
}
.livery__city { color: var(--blue); font-size: var(--t-sum); font-weight: 700; line-height: 1.2; margin-top: var(--s2); }

.mast__lede { font-size: var(--t-lede); line-height: 1.4; max-width: 30ch; }
.mast__who { color: var(--ink-soft); max-width: 36ch; }

.callbox { margin-top: var(--s5); }
.btn {
  display: inline-flex; align-items: center; min-height: 3.5rem;
  font-family: var(--font); font-weight: 700; font-size: var(--t-h3); line-height: 1.2;
  padding: var(--s3) var(--s4); text-decoration: none;
  background: var(--red-deep); color: var(--white);
}
.btn:hover { background: var(--red-text); color: var(--white); }
.callbox__hours { margin: var(--s3) 0 var(--s1); color: var(--ink-soft); font-size: var(--t-label); }
.callbox__email { font-size: var(--t-label); }

.mast__van { margin: 0; max-width: 448px; justify-self: end; }
.mast__van img { width: 100%; border: 10px solid var(--white); outline: 1px solid var(--asphalt-line); }
.mast__van figcaption { font-size: var(--t-label); color: var(--ink-soft); margin-top: var(--s3); max-width: 38ch; }

/* ---------- Route nav: five stops on a road. Sticky on large screens. ---------- */

.route { background: var(--cream); border-bottom: 2px solid var(--peach); }
@media (min-width: 900px) and (min-height: 700px) {
  .route { position: sticky; top: 0; z-index: 10; }
}
.route ol {
  list-style: none; margin: 0 auto; max-width: var(--wide); padding: var(--s2) var(--gutter);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.route li { position: relative; }
.route li + li::before {
  /* the road between this stop and the one before it */
  content: ""; position: absolute; top: 0.95rem; right: calc(50% + 0.7rem); width: calc(100% - 1.4rem);
  height: 4px; background: var(--blue);
}
.route a {
  display: flex; flex-direction: column; align-items: center; gap: var(--s1);
  min-height: 44px; padding: 0.35rem var(--s1) 0.3rem;
  font-weight: 700; font-size: var(--t-label); text-decoration: none; text-align: center; line-height: 1.2;
}
.route a:hover { text-decoration: underline; }
.stop {
  width: 1.2rem; height: 1.2rem; border-radius: 50%; flex: none;
  background: var(--paper); border: 4px solid var(--blue);
}
.route a[aria-current="true"] { color: var(--red-text); text-decoration: underline; text-decoration-thickness: 3px; }
.route a[aria-current="true"] .stop { background: var(--red); border-color: var(--red-text); }

/* ---------- What we do: three real steps ---------- */

.what { max-width: var(--wide); margin: 0 auto; padding: var(--section) var(--gutter); }

.trip {
  list-style: none; margin: var(--s5) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s5) var(--s6);
  border-top: 4px solid var(--blue); padding-top: var(--s4);
}
.trip__n {
  display: block; color: var(--red); font-size: var(--t-figure); font-weight: 800; line-height: 1;
  margin-bottom: var(--s3);
}
.trip h3 { margin-bottom: var(--s2); }
.trip p { max-width: 34ch; }

/* ---------- Days and prices ---------- */

.runs { background: var(--asphalt); color: var(--cream); }
.runs__inner { max-width: var(--wide); margin: 0 auto; padding: var(--section) var(--gutter); }
.runs h2 { color: var(--white); }
.runs__sub { font-size: var(--t-lede); line-height: 1.4; margin-top: var(--s3); max-width: 40ch; }
.runs strong { color: var(--white); }
.runs a { color: var(--white); }

.board { width: 100%; border-collapse: collapse; margin: var(--s6) 0 var(--s4); font-size: var(--t-body); }
.board thead th {
  text-align: left; font-weight: 700; font-size: var(--t-label); color: var(--asphalt-line);
  padding: 0 var(--s3) var(--s2) 0; border-bottom: 2px solid var(--asphalt-line);
}
.board tbody th, .board td {
  text-align: left; vertical-align: top; padding: var(--s3) var(--s3) var(--s3) 0;
  border-bottom: 1px solid var(--asphalt-rule);
}
.board tbody th { font-weight: 700; color: var(--white); }
.board td:nth-child(2) { color: var(--peach); font-weight: 700; }
.board__k { display: none; }
.board__ask { margin: 0 0 var(--s6); }
.board .today-tag {
  display: inline-block; margin-left: var(--s2);
  background: var(--cream); color: var(--asphalt); font-size: 0.9rem; font-weight: 700;
  padding: 0 var(--s2); vertical-align: 0.1em;
}
/* Today's rows: a lighter fill, a full cream frame and the word "Today". */
.board tr.is-today { background: var(--asphalt-lift); outline: 3px solid var(--cream); outline-offset: -3px; }
.board tr.is-today > :first-child { padding-left: var(--s3); }

.fare { display: flex; flex-wrap: wrap; gap: var(--s5) var(--s6); align-items: center; }
.fare__ticket { background: var(--peach); color: var(--asphalt); padding: var(--s3) var(--s5) var(--s4); }
.fare__label {
  margin: 0 0 var(--s2); padding-bottom: var(--s2); font-weight: 700; font-size: var(--t-label);
  border-bottom: 3px dotted var(--asphalt); /* the tear line on a paper ticket */
}
.fare__price { font-weight: 800; font-size: var(--t-figure); line-height: 1.05; margin: 0; color: var(--blue); white-space: nowrap; }
.fare__notes { flex: 1 1 18rem; max-width: 36ch; }

.totop { margin: var(--s5) 0 0; font-size: var(--t-label); }
.totop a { display: inline-block; padding: 0.6rem 0; }

/* ---------- Volunteer ---------- */

.vol { max-width: var(--wide); margin: 0 auto; padding: var(--section) var(--gutter); }
.vol__lede { font-size: var(--t-lede); line-height: 1.4; margin-top: var(--s3); max-width: 40ch; }

/* One role per row, read top to bottom. The job title sits in the same
   15rem column as "About a volunteer shift". */
.roles { margin-top: var(--s5); border-bottom: 2px solid var(--peach); }
.role {
  display: grid; grid-template-columns: 15rem minmax(0, var(--measure)); gap: 0 var(--s5);
  padding: var(--s4) 0 var(--s3); border-top: 2px solid var(--peach);
}
.role > * { grid-column: 2; }
.role h3 { grid-column: 1; grid-row: 1 / span 3; margin-bottom: var(--s2); }
.role__need { color: var(--ink-soft); }
.role__doc { font-weight: 700; display: inline-block; justify-self: start; padding: var(--s2) 0; }

.vol__facts {
  margin-top: var(--s6); background: var(--peach-soft);
  padding: var(--s4) clamp(var(--s3), 4vw, var(--s5)) var(--s3);
  display: grid; grid-template-columns: 15rem 1fr; gap: var(--s3) var(--s5);
}
.vol__facts ul { margin: 0; padding-left: 1.3rem; }
.vol__facts li { margin-bottom: var(--s2); }
.vol__facts li::marker { color: var(--red-deep); }

.vol__join { margin-top: var(--s5); display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); align-items: center; }
.vol__join p { flex: 1 1 22rem; margin: 0; max-width: 46ch; }
.vs { display: flex; flex-direction: column; gap: var(--s2); font-weight: 700; padding: var(--s1) 0; }
.vs img { width: 200px; }

/* ---------- Contact ---------- */

.contact { background: var(--blue); color: var(--cream); }
.contact__inner { max-width: var(--wide); margin: 0 auto; padding: var(--section) var(--gutter); }
.contact h2 { color: var(--white); }
.contact__lede { font-size: var(--t-lede); line-height: 1.4; margin-top: var(--s3); }
.contact a { color: var(--white); }
.contact a:hover { color: var(--cream); }
.contact a:focus-visible { outline-color: var(--cream); box-shadow: none; }
.contact__grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--s5) var(--s7); margin-top: var(--s5); align-items: start; }
/* As big as the number painted on the van, with a livery-red line under it. */
.contact__big {
  display: inline-block; font-weight: 800; text-decoration: none;
  font-size: var(--t-figure); line-height: 1.1; white-space: nowrap;
  border-bottom: 6px solid var(--red); margin-bottom: var(--s3);
}
.contact__big:hover { border-bottom-color: var(--cream); }
.contact__other { margin: 0; }
.contact__other dt { font-weight: 700; }
.contact__other dd { margin: 0 0 var(--s4); }
.contact__other dd > a { display: inline-block; padding: var(--s2) 0; }
.contact address { font-style: normal; }

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

.foot {
  background: var(--asphalt); color: var(--cream); font-size: var(--t-label);
  padding: var(--s4) var(--gutter);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s2) var(--s5);
}
.foot p { margin: 0; }
.foot a { color: var(--white); display: inline-block; padding: 0.6rem 0; }
/* io-code credit: the end of the line. The road from the route nav runs
   out along the asphalt and stops at one last round stop, where the maker
   signs. Same 4px road and ringed stop as the nav, drawn in cream. */
.foot .terminus {
  flex: 1 1 100%; display: flex; align-items: center;
  margin-top: var(--s5); padding: var(--s2) 0 var(--s3);
}
.terminus__road { flex: 1 1 auto; min-width: 3rem; height: 4px; background: var(--cream); }
.foot .terminus .stop { background: var(--asphalt); border-color: var(--cream); margin-right: var(--s3); }
.foot .credit {
  display: inline-flex; align-items: center; gap: var(--s3);
  min-height: 2.75rem; padding: var(--s2) 0;
  color: var(--white); font: 800 var(--t-h3)/1.2 var(--font); text-decoration: none;
}
.foot .credit .nobr { white-space: nowrap; }
.foot .credit img { width: 2.5rem; height: auto; flex: none; }
.foot .credit:hover { color: var(--cream); text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 3px; }
@media (max-width: 640px) {
  .foot { flex-direction: column; align-items: flex-start; }
  .foot .terminus { align-self: stretch; }
  .foot .terminus .stop { display: block; margin-right: var(--s2); }
  .foot .credit { font-size: 1.25rem; gap: var(--s2); }
  .foot .credit img { width: 2rem; }
}

/* ---------- Stronger contrast when the system asks for it ---------- */

@media (prefers-contrast: more) {
  :root { --paper: var(--white); --ink: var(--black); --ink-soft: oklch(0.25 0 0); --peach-soft: var(--white); }
  .vol__facts { border: 3px solid var(--ink); }
}

/* ---------- Tablet ---------- */

@media (max-width: 900px) {
  .mast { grid-template-columns: 1fr; }
  .mast__van { justify-self: start; }
  .role { grid-template-columns: minmax(0, 1fr); }
  .role > *, .role h3 { grid-column: 1; grid-row: auto; }
  .trip { grid-template-columns: 1fr; }
  .trip li { display: grid; grid-template-columns: 4rem 1fr; column-gap: var(--s3); }
  .trip__n { grid-row: 1 / span 2; margin: 0; }
  .vol__facts { grid-template-columns: 1fr; }
  .contact__grid { grid-template-columns: 1fr; }
}

/* ---------- Phone ---------- */

@media (max-width: 640px) {
  body { font-size: 1.15rem; }
  section { scroll-margin-top: var(--s3); }

  /* Five stops do not fit one row. Show them as plain boxes on two rows.
     Each section ends with a link back to the top instead of a sticky bar. */
  .route ol { display: flex; flex-wrap: wrap; gap: var(--s2); padding: var(--s2) 0.75rem; }
  .route li { flex: 1 1 auto; }
  .route li + li::before, .stop { display: none; }
  .route a {
    justify-content: center; font-size: 1rem;
    background: var(--paper); border: 2px solid var(--blue); padding: 0.3rem 0.6rem;
  }
  .route a[aria-current="true"] { background: var(--red-deep); border-color: var(--red-deep); color: var(--white); }

  .trip li { grid-template-columns: 3rem 1fr; }

  .board, .board tbody, .board tr, .board th, .board td { display: block; }
  .board thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .board tr { padding: var(--s3) var(--s1); border-bottom: 1px solid var(--asphalt-rule); }
  .board tbody th, .board td { border: 0; padding: 0.1rem 0; }
  .board__k { display: inline; color: var(--asphalt-line); font-weight: 400; }
  .board tr.is-today { padding: var(--s3); }
  .board tr.is-today + tr.is-today { margin-top: var(--s2); }
  .board tr.is-today > :first-child { padding-left: 0; }

  .fare__ticket { padding: var(--s3) var(--s4); }
  .fare__price { white-space: normal; }
  .btn { width: 100%; justify-content: center; text-align: center; font-size: 1.3rem; }
  /* Large text plus a text-spacing override makes the number wider than a
     phone. Let it wrap here rather than scroll sideways. */
  .contact__big { white-space: normal; }
}

/* ---------- Print: plain black on white, no nav ---------- */

@media print {
  .bar, .route, .skip, .mast__van, .vs img, .totop { display: none; }
  body { background: var(--white); color: var(--black); font-size: 12pt; }
  .runs, .contact, .foot, .fare__ticket, .vol__facts { background: var(--white); color: var(--black); }
  h1 span, h2, h3, .board tbody th, .board td, .contact a, .foot a, .fare__price, .trip__n { color: var(--black); }
  .board thead th { color: var(--black); border-color: var(--black); }
  .fare__ticket { border: 2px solid var(--black); }
  .foot .credit { color: var(--black); }
  .terminus__road, .terminus .stop { display: none; }
  .mast { grid-template-columns: 1fr; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}
