/* Shared foundation: colour, type and page frame.
 *
 * The light is a cool, neutral grey rather than a warm cream: paper, not
 * parchment. The ink family follows it, so nothing on the page is tinted
 * yellow against it. */

:root {
  --paper: #f4f5f7;
  --ink: #191c21;
  --ink-soft: #626973;
  --ink-faint: #9ca3ad; /* decorative marks only — too light for text */
  --line: #d9dde3;
  --surface: #fbfcfd;
  --focus: #3b6ea5;

  --swatch-amber: #e0a93b;
  --swatch-blue: #4c79b8;
  --swatch-terracotta: #d25b4a;
  --swatch-sage: #5e9169;
  --swatch-violet: #7d6ba8;
  --swatch-chalk: #e6ded0;

  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
  --measure: 34rem;
  /* One frame for every page, so the column does not jump when navigating. */
  --page-width: 46rem;

  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial,
    sans-serif;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 5vw, 3rem);
  background: var(--paper);
  color: var(--ink);
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
  line-height: 1.55;
  overflow-x: hidden;
}

h1,
h2,
p,
figure,
dl,
dd {
  margin: 0;
}

a {
  color: inherit;
}

/* Page frame ------------------------------------------------------------- */

.masthead {
  display: flex;
  /* Top-aligned: a page may stack a second line under Index. */
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--page-width);
  width: 100%;
  margin-inline: auto;
}

.mark {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.3rem;
  color: var(--ink);
}

.mark rect {
  fill: currentColor;
}

a.mark:hover {
  color: var(--swatch-terracotta);
}

/* Index, and under it whatever this page offers. */
.masthead__links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.masthead__link {
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
}

.masthead__link:hover {
  color: var(--ink);
}

/* The mark, and beside it the language switch on the pages that have one. */
.masthead__brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* The language switch: quieter still than the links, since it is rarely used. */
.masthead__languages {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.masthead__lang {
  color: inherit;
  text-decoration: none;
  /* A full-sized target on a phone without pushing the two apart on a desktop. */
  padding: 0.55rem 0.1rem;
}

.masthead__lang:hover {
  color: var(--ink);
}

.masthead__lang[aria-current='page'] {
  color: var(--ink);
  font-weight: 600;
}

/*
 * A button, but as quiet as the link above it — and still a full-sized target.
 * The target comes from padding the margin takes back, so that Share sits a
 * line under Index rather than a thumb's width under it.
 */
.masthead__share {
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  /* 0.95rem, not less: the line inside is about 16px, and the target has to
     come to 44. A check measures it, and caught this at 42. */
  padding: 0.95rem 0;
  margin: -0.95rem 0;
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* A separator inside the eyebrow, spaced a little wider than the letters are. */
.eyebrow__dot {
  margin-inline: 0.35em;
  color: var(--ink-faint);
}

.lede {
  color: var(--ink-soft);
  max-width: var(--measure);
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 0.35rem;
}

/* Listing ------------------------------------------------------------------ */

.listing {
  max-width: var(--page-width);
  width: 100%;
  margin-inline: auto;
}

.index {
  max-width: var(--page-width);
  width: 100%;
  margin-inline: auto;
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--line);
}

.index li {
  border-bottom: 1px solid var(--line);
}

.entry {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding: 1.5rem 0.25rem;
  text-decoration: none;
  transition: background-color 0.25s var(--ease);
}

.entry:hover,
.entry:focus-visible {
  background-color: #eaedf1;
}

.entry__number {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.entry__title {
  font-size: 1.125rem;
  font-weight: 500;
}

.entry__title::after {
  content: '\2197';
  margin-left: 0.6rem;
  color: var(--ink-faint);
  display: inline-block;
  transition: transform 0.25s var(--ease);
}

.entry:hover .entry__title::after {
  transform: translate(0.15rem, -0.15rem);
}

.entry__description {
  grid-column: 2;
  color: var(--ink-soft);
  max-width: var(--measure);
}

.entry__swatches {
  grid-column: 2;
  display: flex;
  gap: 0.3rem;
  margin-top: 0.9rem;
}

.entry__swatches span {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 0.25rem;
}

/* Prose pages ------------------------------------------------------------ */

.prose {
  max-width: var(--page-width);
  width: 100%;
  margin-inline: auto;
}

.prose h1 {
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.prose h2 {
  font-size: 1rem;
  font-weight: 500;
  margin-top: 2.5rem;
}

.prose p,
.prose ul,
.prose address {
  max-width: var(--measure);
  color: var(--ink-soft);
  margin-top: 0.85rem;
}

.prose .lede {
  margin-top: 0.6rem;
}

.prose address {
  font-style: normal;
}

.prose ul {
  padding-left: 1.1rem;
}

.prose li {
  margin-top: 0.3rem;
}

.prose a {
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
}

.prose a:hover {
  text-decoration-color: currentColor;
}

/* Colophon --------------------------------------------------------------- */

.colophon {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: var(--page-width);
  width: 100%;
  margin-inline: auto;
  margin-top: auto;
  padding-top: 2rem;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

/* Where it was made, and whose it is: one line where there is room, two where not. */
.colophon__note {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.heart {
  width: 0.85em;
  height: 0.85em;
  fill: var(--swatch-terracotta);
  vertical-align: -0.05em;
}

.colophon__links {
  display: flex;
  gap: 1.25rem;
}

.colophon__links a {
  text-decoration: none;
}

.colophon__links a:hover,
.colophon__links a[aria-current='page'] {
  color: var(--ink);
}

/* The name in the copyright line leads to its owner, as quietly as the links beside it. */
.colophon__copyright a {
  text-decoration: none;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
