/*
  Home and Garage Guide
  The look is borrowed from paint chips: a block of colour with a white label.
  Green shades are home guides. Blue shades are garage and car guides.
  Tape-measure yellow is used only for focus rings and small marks.
*/

@font-face {
  font-family: "Bitter";
  src: url("/assets/fonts/bitter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/assets/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/assets/fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --concrete: #eef0ec;
  --ink: #1b2327;
  --ink-soft: #55606a;
  --line: #d3d9d4;
  --tape: #f4c430;

  --home-1: #1e5a4c;
  --home-2: #2f7a64;
  --home-3: #6aa58c;
  --home-4: #a9cdb9;
  --home-5: #dcebdd;

  --garage-1: #24405f;
  --garage-2: #38608c;
  --garage-3: #7598bd;
  --garage-4: #b4c8de;
  --garage-5: #e0e9f2;

  --display: "Bitter", Rockwell, "Roboto Slab", Georgia, serif;
  --text: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", Verdana, "Segoe UI", sans-serif;

  --gutter: clamp(1.125rem, 4vw, 2.5rem);
  --radius: 4px;
}

*,
*::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(--text);
  font-size: 1.125rem;
  line-height: 1.6;
}

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

a {
  color: inherit;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

:focus-visible {
  outline: 3px solid var(--tape);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--ink);
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.12;
  letter-spacing: -0.012em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

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

.wrap--narrow {
  max-width: calc(41rem + var(--gutter) * 2);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 0.75rem;
}

.lede {
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 38rem;
}

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

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.wordmark__mark {
  flex: none;
}

.wordmark__text {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  font-size: 1rem;
}

.site-nav a {
  padding-block: 0.35rem;
  text-decoration: none;
  border-bottom: 4px solid transparent;
}

.site-nav a:hover {
  border-bottom-color: var(--line);
}

.site-nav a[aria-current] {
  border-bottom-color: var(--tape);
  font-weight: 700;
}

/* ---------- Home page ---------- */

.hero {
  padding-block: clamp(2.5rem, 8vw, 6rem) clamp(2rem, 5vw, 3.5rem);
}

.hero h1 {
  font-weight: 800;
  font-size: clamp(2.5rem, 7.4vw, 5.25rem);
  line-height: 1;
  letter-spacing: -0.028em;
  max-width: 15ch;
}

.hero .lede {
  margin-top: clamp(1.25rem, 3vw, 2rem);
}

/* The strip under the hero: ten shades, the same ones the guides use. */
.strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.strip__group {
  display: block;
  text-decoration: none;
}

.strip__shades {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: clamp(2.75rem, 7vw, 4.5rem);
  border-radius: var(--radius);
  overflow: hidden;
}

.strip__name {
  display: block;
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
}

.strip__group:hover .strip__name {
  text-decoration: underline;
  text-decoration-thickness: 0.16em;
  text-underline-offset: 0.18em;
}

.rack-section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) 0;
}

.rack-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: 1.5rem;
}

.rack-section__head h2 {
  font-weight: 800;
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
}

.rack-section__head p {
  color: var(--ink-soft);
  max-width: 34rem;
}

.how {
  margin-top: clamp(3rem, 8vw, 6rem);
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  background: var(--concrete);
}

.how h2 {
  font-weight: 800;
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
  margin-bottom: 2rem;
}

.how__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 2rem clamp(1.5rem, 4vw, 3.5rem);
}

.how__grid h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.how__grid p {
  font-size: 1.05rem;
}

/* ---------- Chips ---------- */

.chip-rack {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: clamp(0.9rem, 2vw, 1.5rem);
}

.chip {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
}

.chip__color {
  display: flex;
  align-items: flex-end;
  aspect-ratio: 5 / 4;
  padding: 0.9rem 1rem;
  background: var(--chip, var(--concrete));
  color: var(--chip-ink, var(--ink));
}

.chip__mark {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  line-height: 1;
  letter-spacing: -0.02em;
  opacity: 0.92;
}

.chip__label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--line);
  flex: 1;
}

.chip__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.22;
  letter-spacing: -0.008em;
}

.chip__meta {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.chip:hover .chip__title {
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.16em;
}

/* On a phone, a chip turns on its side: colour on the left, label on the right. */
@media (max-width: 34rem) {
  .chip-rack {
    grid-template-columns: 1fr;
  }

  .chip {
    flex-direction: row;
  }

  .chip__color {
    flex: none;
    width: 38%;
    aspect-ratio: auto;
    min-height: 6.25rem;
    padding: 0.75rem 0.8rem;
  }

  .chip__mark {
    font-size: 1.2rem;
    line-height: 1.05;
  }

  .chip__label {
    justify-content: center;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}

.chip--home-1,
.guide-header--home-1 { --chip: var(--home-1); --chip-ink: #fff; }
.chip--home-2,
.guide-header--home-2 { --chip: var(--home-2); --chip-ink: #fff; }
.chip--home-3,
.guide-header--home-3 { --chip: var(--home-3); }
.chip--home-4,
.guide-header--home-4 { --chip: var(--home-4); }
.chip--home-5,
.guide-header--home-5 { --chip: var(--home-5); }

.chip--garage-1,
.guide-header--garage-1 { --chip: var(--garage-1); --chip-ink: #fff; }
.chip--garage-2,
.guide-header--garage-2 { --chip: var(--garage-2); --chip-ink: #fff; }
.chip--garage-3,
.guide-header--garage-3 { --chip: var(--garage-3); }
.chip--garage-4,
.guide-header--garage-4 { --chip: var(--garage-4); }
.chip--garage-5,
.guide-header--garage-5 { --chip: var(--garage-5); }

/* ---------- Section pages ---------- */

.section-page__header {
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.75rem, 4vw, 3rem);
}

.section-page__header h1 {
  font-weight: 800;
  font-size: clamp(2.3rem, 6vw, 4rem);
  letter-spacing: -0.024em;
  line-height: 1.02;
  margin-bottom: 1rem;
}

.section-page__note {
  margin-block: clamp(2.5rem, 6vw, 4rem);
  max-width: 41rem;
}

/* ---------- Guide pages ---------- */

.guide-header {
  background: var(--chip, var(--concrete));
  color: var(--chip-ink, var(--ink));
  padding-block: clamp(2.25rem, 7vw, 4.75rem);
}

.guide-header__section {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.guide-header h1 {
  font-weight: 800;
  font-size: clamp(2.1rem, 5.4vw, 3.5rem);
  letter-spacing: -0.022em;
  line-height: 1.05;
}

.guide-header__dek {
  margin-top: 1.1rem;
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  line-height: 1.5;
  max-width: 36rem;
}

.guide-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  margin: 0;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.98rem;
}

.guide-facts dt {
  color: var(--ink-soft);
}

.guide-facts dd {
  margin: 0;
  font-weight: 700;
}

.notice {
  margin-top: 1.5rem;
  padding: 0.9rem 1.1rem;
  background: var(--concrete);
  border-left: 5px solid var(--tape);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1rem;
}

/* ---------- Long-form text ---------- */

.prose {
  padding-block: clamp(1.75rem, 4vw, 2.75rem);
}

.prose > * + * {
  margin-top: 1.15em;
}

.prose h2 {
  font-weight: 800;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  margin-top: 2.2em;
}

.prose h3 {
  font-weight: 700;
  font-size: 1.22rem;
  margin-top: 1.8em;
}

.prose h2 + *,
.prose h3 + * {
  margin-top: 0.7em;
}

.prose ul,
.prose ol {
  margin-bottom: 0;
  padding-left: 1.35rem;
}

.prose li + li {
  margin-top: 0.45em;
}

.prose li::marker {
  color: var(--ink-soft);
  font-weight: 700;
}

.prose strong {
  font-weight: 700;
}

.prose a {
  text-decoration-color: var(--home-2);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.prose table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.45;
}

.prose th,
.prose td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.prose thead th {
  font-family: var(--display);
  font-weight: 700;
  background: var(--concrete);
  white-space: nowrap;
}

.prose tbody tr:last-child td,
.prose tbody tr:last-child th {
  border-bottom: 0;
}

.prose tbody th {
  font-weight: 700;
}

/* A checklist a reader can print and tick off. */
.prose ul.checklist {
  list-style: none;
  padding-left: 0;
}

.prose ul.checklist li {
  position: relative;
  padding-left: 2.15rem;
}

.prose ul.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.22em;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--paper);
}

.print-row {
  margin-top: 0.5rem;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.15rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: #2c383e;
}

.save {
  display: grid;
  grid-template-columns: minmax(6.5rem, 9rem) 1fr;
  gap: 1.25rem clamp(1rem, 4vw, 2rem);
  align-items: center;
  margin-top: clamp(2rem, 5vw, 3rem);
  padding: clamp(1rem, 3vw, 1.5rem);
  background: var(--concrete);
  border-radius: var(--radius);
}

.save img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.save h2 {
  font-weight: 800;
  font-size: clamp(1.2rem, 2.6vw, 1.45rem);
  margin-bottom: 0.4rem;
}

.save p + p {
  margin-top: 0.9rem;
}

.save .button {
  white-space: nowrap;
}

@media (max-width: 30rem) {
  .save {
    grid-template-columns: 5.5rem 1fr;
    align-items: start;
  }

  .save .button {
    padding-inline: 0.9rem;
  }
}

.basis {
  margin-block: clamp(2rem, 5vw, 3rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.98rem;
  color: var(--ink-soft);
}

.related {
  padding-block: clamp(2.5rem, 6vw, 4rem);
  background: var(--concrete);
}

.related h2 {
  font-weight: 800;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-bottom: 1.5rem;
}

/* ---------- Plain pages (About, Privacy and so on) ---------- */

.plain-page__header {
  padding-block: clamp(2.5rem, 7vw, 4.5rem) 0;
}

.plain-page__header h1 {
  font-weight: 800;
  font-size: clamp(2.1rem, 5.4vw, 3.4rem);
  letter-spacing: -0.022em;
  line-height: 1.05;
  margin-bottom: 1rem;
}

.plain-page .prose {
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

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

.site-footer {
  background: var(--ink);
  color: #e9edea;
  font-size: 1rem;
}

.related + .site-footer,
.how + .site-footer {
  margin-top: 0;
}

.site-footer__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

.site-footer__name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.site-footer__about {
  max-width: 26rem;
}

.site-footer__nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.site-footer__legal {
  grid-column: 1 / -1;
  padding-top: 1.5rem;
  border-top: 1px solid #3a474d;
  color: #b5beb9;
  font-size: 0.92rem;
  max-width: 52rem;
}

@media (min-width: 48rem) {
  .site-footer__inner {
    grid-template-columns: 1.4fr 1fr;
  }
}

/* ---------- Print ---------- */

@media print {
  .site-header,
  .site-footer,
  .related,
  .save,
  .print-row,
  .skip-link,
  .notice {
    display: none !important;
  }

  body {
    font-size: 11.5pt;
    color: #000;
  }

  .guide-header {
    background: none !important;
    color: #000 !important;
    padding-block: 0 0.5rem;
  }

  .guide-header__section,
  .guide-facts {
    display: none;
  }

  .prose {
    padding-block: 0.5rem;
  }

  .prose a {
    text-decoration: none;
  }

  .prose h2 {
    break-after: avoid;
  }

  .prose li {
    break-inside: avoid;
  }
}
