:root {
  --color-bg: #faf6f0;
  --color-bg-alt: #f1e8db;
  --color-text: #2a2420;
  --color-text-muted: #6b5f54;
  --color-border: #ddd0c1;
  --color-accent: #a8433a;
  --color-accent-2: #3c7a6e;
  --color-accent-3: #c98a2c;
  --color-accent-contrast: #fff8f2;
  --font-serif: "Fraunces", Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max-width: 60rem;
  --radius: 0.25rem;
  --radius-lg: 0.75rem;
  --shadow-sm: 0 1px 2px rgba(42, 36, 32, 0.06), 0 1px 3px rgba(42, 36, 32, 0.08);
  --shadow-md: 0 2px 6px rgba(42, 36, 32, 0.07), 0 6px 16px rgba(42, 36, 32, 0.09);
  --shadow-lg: 0 8px 24px rgba(42, 36, 32, 0.14), 0 2px 8px rgba(42, 36, 32, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background-color: var(--color-bg);
  background-image:
    radial-gradient(at 15% 8%, rgba(168, 67, 58, 0.05) 0, transparent 45%),
    radial-gradient(at 85% 92%, rgba(60, 122, 110, 0.05) 0, transparent 45%),
    repeating-linear-gradient(45deg, rgba(42, 36, 32, 0.015) 0, rgba(42, 36, 32, 0.015) 1px, transparent 1px, transparent 3px);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
}

h1 {
  font-size: 2.25rem;
  letter-spacing: -0.01em;
  margin: 0.25em 0 0.5em;
}

h2 {
  font-size: 1.5rem;
  margin: 1.5em 0 0.5em;
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.25em 0 0.4em;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--color-accent);
}

a:hover,
a:focus {
  text-decoration-thickness: 2px;
}

.entry-body .glossary-link {
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.entry-body .glossary-link:hover,
.entry-body .glossary-link:focus {
  text-decoration-style: solid;
}

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

/* Unify the color temperature of the photo library: the source photos run
   from cool blue to warm pink with nothing tying them to the site palette,
   so every content photo gets a shared filter and a warm accent wash. */

.hero-image,
.entry-thumb,
.category-thumb {
  position: relative;
}

.hero-image img,
.entry-thumb img,
.category-thumb img {
  filter: saturate(0.82) sepia(0.1) contrast(1.03);
}

.hero-image::after,
.entry-thumb::after,
.category-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(168, 67, 58, 0.18) 0%,
    rgba(60, 122, 110, 0.08) 55%,
    rgba(42, 36, 32, 0.12) 100%
  );
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Header / nav */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #f6ede0 0%, var(--color-bg-alt) 100%);
  box-shadow: var(--shadow-sm);
}

.site-header::after {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background-image: repeating-linear-gradient(90deg, var(--color-accent) 0 5px, transparent 5px 11px);
  opacity: 0.55;
}

.site-header,
.site-footer {
  padding: 1rem 1.25rem;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  text-decoration: none;
}

.site-nav {
  min-width: 0;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  position: relative;
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.2em;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 2px;
  background: var(--color-accent);
  transition: right 0.2s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--color-accent);
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  right: 0;
}

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

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}

.nav-toggle-box {
  position: relative;
  display: block;
  width: 1.125rem;
  height: 2px;
}

.nav-toggle-box,
.nav-toggle-box::before,
.nav-toggle-box::after,
.nav-toggle-bar {
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.nav-toggle-box::before,
.nav-toggle-box::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
}

.nav-toggle-box::before {
  top: -0.4375rem;
}

.nav-toggle-box::after {
  top: 0.4375rem;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-box::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-box::after {
  top: 0;
  transform: rotate(-45deg);
}

@media (max-width: 40rem) {
  .js .nav-toggle {
    display: inline-flex;
  }

  .js .site-nav {
    flex-basis: 100%;
    order: 1;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .js .site-nav.is-open {
    max-height: 48rem;
  }

  .site-nav ul {
    flex-direction: column;
    gap: 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
  }

  .site-nav li {
    border-bottom: 1px solid var(--color-border);
  }

  .site-nav a {
    display: block;
    padding: 0.75rem 0.1rem;
  }

  .site-nav a::after {
    display: none;
  }
}

/* 404 */

.not-found {
  max-width: 32rem;
  margin: 3rem auto;
  text-align: center;
}

.not-found .hero-actions {
  justify-content: center;
}

/* Footer */

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.footer-links {
  margin-top: 0.4em;
}

.footer-links a {
  color: var(--color-text-muted);
}

/* Breadcrumbs */

.breadcrumbs {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.breadcrumbs a {
  color: var(--color-text-muted);
}

/* Entry lists (collection index pages) */

.entry-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.5rem;
}

.entry-list-compact {
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem;
}

.entry-list li {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.entry-list li:has(a:hover),
.entry-list li:has(a:focus-visible) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.entry-list li > a {
  font-weight: bold;
  text-decoration: none;
}

.entry-list li p {
  margin: 0.4em 0 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.entry-list .era {
  display: inline-block;
  margin-left: 0.5em;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Difficulty filter (techniques/garments index pages) */

.difficulty-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  border: 0;
}

.difficulty-filter legend {
  padding: 0;
  margin-right: 0.25rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.difficulty-option {
  position: relative;
  display: inline-flex;
}

.difficulty-filter input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.difficulty-filter label {
  cursor: pointer;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.difficulty-filter input:checked + label {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-contrast);
}

.difficulty-filter input:focus-visible + label {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.filterable-list:has(#filter-beginner:checked) .entry-list li:not([data-difficulty="beginner"]),
.filterable-list:has(#filter-intermediate:checked) .entry-list li:not([data-difficulty="intermediate"]),
.filterable-list:has(#filter-advanced:checked) .entry-list li:not([data-difficulty="advanced"]) {
  display: none;
}

.difficulty-badge {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0.05em 0.55em;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: capitalize;
  vertical-align: middle;
}

.difficulty-badge.difficulty-beginner {
  background: color-mix(in srgb, var(--color-accent-2) 16%, white);
  color: var(--color-accent-2);
}

.difficulty-badge.difficulty-intermediate {
  background: color-mix(in srgb, var(--color-accent-3) 20%, white);
  color: #8a611c;
}

.difficulty-badge.difficulty-advanced {
  background: color-mix(in srgb, var(--color-accent) 16%, white);
  color: var(--color-accent);
}

/* A-Z jump nav (glossary index) */

.az-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.25rem 0 0;
}

.az-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: #fff;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.az-nav a:hover,
.az-nav a:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.az-group {
  margin-top: 2rem;
  scroll-margin-top: 5rem;
}

/* Simple pill link lists (e.g. Where to Begin) */

.quick-terms {
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.75rem 1.5rem;
}

.quick-term {
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--color-border);
  background: rgba(255, 255, 255, 0.6);
}

.quick-term dt {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.quick-term dd {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.pill-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0.75rem 0 1.75rem;
  padding: 0;
}

.pill-links a {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
  font-size: 0.9375rem;
}

.pill-links a:hover,
.pill-links a:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.az-letter {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.35rem;
  margin: 0 0 0.75rem;
}

.entry-thumb {
  position: relative;
  margin: -1rem -1rem 0.75rem;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}

.entry-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Article entries */

.entry-header + .entry-body {
  margin-top: 1.5rem;
}

.entry-dates {
  margin: -0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.entry-header .summary {
  color: var(--color-text-muted);
  font-size: 1.125rem;
}

.hero-image {
  margin: 1rem 0 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hero-image img {
  width: 100%;
  max-height: 24rem;
  object-fit: cover;
}

/* Drawn diagrams used as a hero: show the whole drawing rather than
   cropping it, and skip the photo color treatment. */

.hero-image--diagram {
  background: var(--color-bg-alt);
}

.hero-image--diagram img {
  object-fit: contain;
  filter: none;
}

.hero-image--diagram::after {
  display: none;
}

/* Museum photographs: show the whole object uncropped and in its true colours. */

.hero-image--contain {
  background: var(--color-bg-alt);
}

.hero-image--contain img {
  object-fit: contain;
  filter: none;
}

.hero-image--contain::after {
  display: none;
}

/* Step-by-step diagrams inside article bodies */

.entry-body .diagram {
  margin: 1.75rem 0;
}

.entry-body .diagram img {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
}

.entry-body .diagram figcaption {
  max-width: 40rem;
  margin: 0.5rem auto 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.entry-body h2 {
  margin-top: 1.75em;
}

.entry-body li {
  margin-bottom: 0.35em;
}

.table-scroll {
  overflow-x: auto;
  margin: 1.25rem 0 1.5rem;
}

.entry-body table,
.reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: #fff;
}

.entry-body th,
.entry-body td,
.reference-table th,
.reference-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--color-border);
}

.entry-body th,
.reference-table th {
  background: var(--color-bg-alt);
  font-weight: 600;
}

.entry-meta {
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}

.entry-meta dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35em 0.75em;
}

.entry-meta dt {
  font-weight: bold;
  color: var(--color-text-muted);
}

.entry-meta dd {
  margin: 0;
}

.related-entries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.related-group h3 {
  margin-top: 0;
}

.related-group ul {
  margin: 0;
  padding-left: 1.1em;
}

.sources {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.byline {
  margin-top: 2rem;
  font-style: italic;
  color: var(--color-text-muted);
}

/* "From my sewing" first-hand notes inside articles */

.from-my-sewing {
  margin: 1.5rem 0 2rem;
  padding: 1rem 1.25rem;
  background: var(--color-bg-alt);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.from-my-sewing .from-my-sewing-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--color-accent);
}

.from-my-sewing p:last-child {
  margin-bottom: 0;
}

/* Author box at the end of articles, and the About page portrait */

.author-box {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.author-avatar {
  flex: 0 0 auto;
}

.author-avatar img {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}

.author-text p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.author-text .author-name {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.2rem;
}

.about-intro {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin: 1rem 0 1.5rem;
}

.about-portrait {
  flex: 0 0 auto;
}

.about-portrait img {
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: var(--shadow-md);
}

.about-intro p {
  margin: 0;
  font-size: 1.125rem;
}

@media (max-width: 36rem) {
  .about-intro {
    flex-direction: column;
    align-items: flex-start;
  }

  .about-portrait img {
    width: 9rem;
    height: 9rem;
  }
}

/* Homepage */

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2rem;
  align-items: center;
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 0 0 2.5rem;
  box-shadow: var(--shadow-sm);
}

.hero h1 {
  margin-top: 0;
}

.hero-lede {
  font-size: 1.125rem;
  color: var(--color-text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.hero-aside {
  margin: 0.85rem 0 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.button {
  display: inline-block;
  padding: 0.6em 1.3em;
  border-radius: 999px;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.9375rem;
  border: 1.5px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button-primary {
  background: linear-gradient(180deg, #b34e44 0%, var(--color-accent) 100%);
  color: var(--color-accent-contrast);
  box-shadow: var(--shadow-sm);
}

.button-primary:hover {
  background: linear-gradient(180deg, #9c3f36 0%, #8f372f 100%);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.button-secondary {
  background: transparent;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.button-secondary:hover {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  transform: translateY(-1px);
}

.hero .hero-image {
  margin: 0;
  border-radius: var(--radius-lg);
}

.hero .hero-image img {
  max-height: none;
  aspect-ratio: 4 / 3;
}

.stats-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 2.5rem;
  margin: 0 0 3rem;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat {
  text-align: center;
  min-width: 6rem;
}

.stat-number {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.875rem;
  font-weight: bold;
  color: var(--color-accent);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0 3rem;
}

.category-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.category-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1;
  background-image: repeating-linear-gradient(90deg, var(--color-accent) 0 7px, transparent 7px 13px);
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.category-card.accent-2::before {
  background-image: repeating-linear-gradient(90deg, var(--color-accent-2) 0 7px, transparent 7px 13px);
}

.category-card.accent-3::before {
  background-image: repeating-linear-gradient(90deg, var(--color-accent-3) 0 7px, transparent 7px 13px);
}

.category-thumb img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.category-card h3 {
  margin: 0.85rem 1rem 0.25rem;
}

.category-card p {
  margin: 0 1rem 0.75rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.category-count {
  display: inline-block;
  margin: 0 1rem 1rem;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: bold;
  color: #fff;
  background: var(--color-accent);
}

.accent-2 .category-count {
  background: var(--color-accent-2);
}

.accent-3 .category-count {
  background: var(--color-accent-3);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-heading h2 {
  margin-top: 0;
}

.section-heading a {
  font-size: 0.9375rem;
  white-space: nowrap;
}

.stitch-divider {
  height: 1px;
  margin: 2.5rem 0;
  border: 0;
  background-image: repeating-linear-gradient(90deg, var(--color-border) 0 6px, transparent 6px 14px);
}

@media (max-width: 40rem) {
  .hero {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .hero-image {
    order: -1;
  }
}

/* History timeline */

.timeline {
  position: relative;
  margin: 2rem 0;
  padding: 0;
  border-left: 2px solid var(--color-border);
}

.timeline-era {
  position: relative;
  padding: 0 0 0 1.75rem;
  margin-bottom: 2.5rem;
}

.timeline-era:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -0.4375rem;
  top: 0.35em;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-bg);
}

.timeline-era-marker {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.timeline-era-marker h2 {
  margin: 0;
}

.timeline-years {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.timeline-entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.timeline-entry {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  padding: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.timeline-entry:has(a:hover),
.timeline-entry:has(a:focus-visible) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.timeline-thumb {
  flex: 0 0 6rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.timeline-thumb img {
  width: 6rem;
  height: 4.5rem;
  object-fit: cover;
  display: block;
}

.timeline-entry-body a {
  font-weight: bold;
  text-decoration: none;
}

.timeline-entry-body p {
  margin: 0.3em 0 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.timeline-undated {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 30rem) {
  .timeline-entry {
    flex-direction: column;
  }

  .timeline-thumb,
  .timeline-thumb img {
    width: 100%;
  }
}

/* Calculators */

.calc {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin: 1.5rem 0 2rem;
  box-shadow: var(--shadow-md);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.9rem 1.25rem;
}

.calc label,
.calc .calc-label {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
}

.calc input[type="number"],
.calc input[type="text"],
.calc input[type="date"],
.calc select {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}

.calc input:focus-visible,
.calc select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.calc .hint {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.2rem;
}

.unit-toggle {
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.unit-toggle legend {
  float: left;
  margin-right: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.unit-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.unit-toggle label {
  margin: 0;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  background: var(--color-bg);
}

.unit-toggle input:checked + label {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-contrast);
}

.unit-toggle input:focus-visible + label {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.calc-results {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--color-border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.75rem;
}

.result {
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}

.result-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.result-value {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 0.15rem;
}

.result-note {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.2rem;
}

.calc-message {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.9375rem;
}

.calc-message.is-warning {
  color: var(--color-accent);
}

.calc .button {
  font: inherit;
  cursor: pointer;
  border: 0;
}

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.calc-filter {
  max-width: 24rem;
  margin: 1rem 0;
}

.measure-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem 1.5rem;
}

.measure-list li {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.75rem;
}

.measure-list .measure-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.measure-list .measure-row input {
  max-width: 7rem;
}

.measure-list p {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.calc-card-list li > a {
  font-family: var(--font-serif);
  font-size: 1.125rem;
}

/* Search */

#search {
  margin-top: 1.5rem;
}

/* Print */

@media print {
  .site-header,
  .site-footer,
  .breadcrumbs,
  .difficulty-filter,
  #search {
    display: none;
  }

  .filterable-list .entry-list li {
    display: block !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .stitch-divider,
  .site-header::after {
    background-image: none;
    background-color: #000;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  main {
    padding: 0;
    max-width: none;
  }

  .hero-image img {
    max-height: none;
  }

  .calc {
    box-shadow: none;
    border: 0;
    padding: 0;
  }

  .calc-actions,
  .unit-toggle,
  .no-print,
  .related-entries,
  .byline,
  .author-box,
  .stitch-divider {
    display: none;
  }

  .measure-list li {
    break-inside: avoid;
  }

  .measure-list input {
    border: 0;
    border-bottom: 1px solid #000;
    border-radius: 0;
    background: none;
  }
}
