:root {
  --paper: #fbf7ef;
  --paper-deep: #f0e6d8;
  --white: #fffdf9;
  --ink: #302a28;
  --ink-soft: #685f5a;
  --berry: #8d3558;
  --berry-dark: #5f233e;
  --clay: #b45f47;
  --moss: #607655;
  --indigo: #344f63;
  --line: #d8c9b8;
  --line-dark: #ad9481;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", Verdana, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(141, 53, 88, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(141, 53, 88, .035) 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: var(--font-body);
  font-size: 1.08rem;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--berry-dark);
  text-decoration-color: rgba(141, 53, 88, .4);
  text-decoration-thickness: .09em;
  text-underline-offset: .18em;
}

a:hover, a:focus-visible { color: var(--clay); text-decoration-color: currentColor; }

:focus-visible { outline: 3px solid rgba(180, 95, 71, .5); outline-offset: 4px; }

.skip-link {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 1000;
  padding: .7rem 1rem;
  color: var(--white);
  background: var(--berry-dark);
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.reading-progress {
  position: fixed;
  z-index: 1001;
  inset: 0 0 auto;
  width: 100%;
  height: 3px;
  background: var(--clay);
  transform: scaleX(0);
  transform-origin: left;
}

.site-nav {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid var(--line-dark);
  background: rgba(251, 247, 239, .96);
  backdrop-filter: blur(12px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 2rem));
  min-height: 78px;
  margin: auto;
  gap: 2rem;
}

.brand {
  display: grid;
  grid-template-columns: 29px auto;
  column-gap: .65rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.brand-stitch {
  position: relative;
  grid-row: 1 / span 2;
  width: 29px;
  height: 29px;
  border: 1px solid var(--line-dark);
  background:
    linear-gradient(45deg, transparent 45%, var(--berry) 46% 54%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, var(--clay) 46% 54%, transparent 55%);
}

.brand strong { font-size: 1.35rem; letter-spacing: -.02em; }
.brand small { margin-top: .35rem; color: var(--ink-soft); font: 600 .68rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; }

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: .55rem .72rem;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--berry); background: rgba(141, 53, 88, .07); }

.article-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  width: min(1180px, calc(100% - 2rem));
  margin: 2.75rem auto 0;
  border: 1px solid var(--line-dark);
  background: var(--white);
}

.hero-copy {
  position: relative;
  display: flex;
  min-height: 450px;
  padding: clamp(2rem, 5vw, 5.2rem);
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.hero-copy::after {
  position: absolute;
  right: -70px;
  bottom: -70px;
  width: 180px;
  height: 180px;
  border: 22px double rgba(141, 53, 88, .07);
  content: "";
  transform: rotate(45deg);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 0 0 1.15rem;
  color: var(--berry);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.eyebrow::before { width: 34px; height: 2px; background: var(--clay); content: ""; }

h1, h2, h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 650;
}

h1 { max-width: 760px; margin: 0; font-size: clamp(2.55rem, 5.4vw, 5.1rem); line-height: 1.01; letter-spacing: -.045em; }

.article-hero:not(.has-image) h1 { font-size: clamp(2.7rem, 6vw, 5.8rem); }

.hero-deck { max-width: 55ch; margin: 1.35rem 0 0; color: var(--ink-soft); font-size: 1.18rem; line-height: 1.55; }

.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.6rem; }

.button-link {
  display: inline-block;
  padding: .7rem 1rem;
  border: 1px solid var(--berry-dark);
  color: var(--white);
  background: var(--berry-dark);
  font-size: .86rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-decoration: none;
}

.button-link.secondary { color: var(--berry-dark); background: transparent; }
.button-link:hover { color: var(--white); background: var(--clay); }

.hero-media { position: relative; min-height: 450px; margin: 0; background: var(--paper-deep); overflow: hidden; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-media::after { position: absolute; inset: 12px; border: 1px solid rgba(255,255,255,.65); content: ""; pointer-events: none; }

.hero-swatch {
  position: relative;
  min-height: 450px;
  background:
    linear-gradient(90deg, transparent 49%, rgba(141,53,88,.18) 50% 51%, transparent 52%),
    linear-gradient(transparent 49%, rgba(141,53,88,.18) 50% 51%, transparent 52%),
    var(--paper-deep);
  background-size: 52px 52px;
}

.hero-swatch::before,
.hero-swatch::after { position: absolute; width: 110px; height: 110px; border: 13px double var(--berry); content: ""; transform: rotate(45deg); }
.hero-swatch::before { top: 22%; left: 20%; }
.hero-swatch::after { right: 18%; bottom: 17%; border-color: var(--moss); }

.article-shell {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(220px, 300px);
  justify-content: space-between;
  width: min(1120px, calc(100% - 2rem));
  margin: clamp(3rem, 6vw, 6rem) auto;
  gap: clamp(2rem, 6vw, 5rem);
}

.prose { min-width: 0; }
.prose > p:first-child { color: var(--ink); font-family: var(--font-display); font-size: 1.32rem; line-height: 1.55; }
.prose h2 { margin: 3.6rem 0 1rem; padding-top: .4rem; font-size: clamp(1.75rem, 3vw, 2.45rem); line-height: 1.15; letter-spacing: -.025em; scroll-margin-top: 100px; }
.prose h2::before { display: block; width: 54px; height: 5px; margin-bottom: .85rem; background: repeating-linear-gradient(90deg, var(--berry) 0 6px, transparent 6px 9px, var(--clay) 9px 15px, transparent 15px 18px); content: ""; }
.prose h3 { margin-top: 2.2rem; font-size: 1.35rem; }
.prose p { margin: 0 0 1.2rem; }
.prose ul, .prose ol { margin: 1.2rem 0 1.7rem; padding-left: 1.25rem; }
.prose li { margin-bottom: .55rem; padding-left: .35rem; }
.prose dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 1.4rem 0 2rem; border: 1px solid var(--line); background: var(--line); }
.prose dt, .prose dd { margin: 0; background: var(--white); }
.prose dt { padding: 1.15rem 1.15rem .25rem; font-family: var(--font-display); font-size: 1.15rem; font-weight: 650; }
.prose dd { padding: 0 1.15rem 1.2rem; color: var(--ink-soft); }

.page-aside { align-self: start; position: sticky; top: 106px; padding-top: .25rem; }
.aside-label { margin: 0 0 .9rem; color: var(--berry); font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.on-page { margin: 0; padding: 0; border-top: 1px solid var(--line-dark); list-style: none; }
.on-page li { border-bottom: 1px solid var(--line); }
.on-page a { display: block; padding: .72rem 0; color: var(--ink-soft); font-size: .9rem; line-height: 1.35; text-decoration: none; }
.on-page a:hover { color: var(--berry); padding-left: .35rem; }
.aside-note { margin-top: 1.6rem; padding: 1rem; border-left: 4px solid var(--moss); background: rgba(96, 118, 85, .08); color: var(--ink-soft); font-size: .88rem; line-height: 1.5; }

.technique-figure { margin: 1.8rem 0 2.2rem; border: 1px solid var(--line-dark); background: var(--white); }
.technique-figure svg { display: block; width: 100%; height: auto; min-height: 220px; padding: 1rem; background: var(--paper); }
.technique-figure figcaption { padding: .9rem 1.1rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .9rem; line-height: 1.5; }
.diagram-key { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem 1rem; margin-top: .6rem; }
.diagram-key span { display: flex; align-items: center; gap: .5rem; }
.key-line { width: 30px; height: 3px; background: var(--indigo); }
.key-line.dashed { background: repeating-linear-gradient(90deg, var(--berry) 0 5px, transparent 5px 9px); }

.citation-note { padding: 1.2rem 1.4rem; border-left: 4px solid var(--clay); background: rgba(180, 95, 71, .075); }

.site-footer { color: #f8eee6; background: var(--indigo); }
.footer-grid { display: grid; grid-template-columns: 1.2fr .8fr .8fr; width: min(1120px, calc(100% - 2rem)); margin: auto; padding: 3.5rem 0 2.5rem; gap: 2.5rem; }
.footer-title { margin: 0 0 .6rem; color: var(--white); font-family: var(--font-display); font-size: 1.55rem; }
.site-footer p { max-width: 62ch; margin: 0 0 .8rem; color: rgba(255,255,255,.8); font-size: .9rem; }
.footer-links { margin: 0; padding: 0; list-style: none; }
.footer-links li { margin-bottom: .45rem; }
.site-footer a { color: var(--white); text-decoration-color: rgba(255,255,255,.35); }
.legal-line { padding: 1.25rem 0; border-top: 1px solid rgba(255,255,255,.2); }
.legal-line p { width: min(1120px, calc(100% - 2rem)); max-width: none; margin: auto; color: rgba(255,255,255,.88); font-size: .82rem; }
.footer-copy { padding: 0 0 1.4rem; text-align: center; }

.back-top {
  position: fixed;
  z-index: 80;
  right: 1rem;
  bottom: 1rem;
  width: 44px;
  height: 44px;
  border: 1px solid var(--berry-dark);
  color: var(--white);
  background: var(--berry-dark);
  font: 800 1.2rem/1 var(--font-body);
  cursor: pointer;
}

.error-page .article-shell { display: block; max-width: 760px; text-align: center; }
.error-code { margin: 0; color: var(--berry); font-family: var(--font-display); font-size: clamp(5rem, 18vw, 11rem); line-height: .8; }

@media (max-width: 900px) {
  .nav-inner { align-items: flex-start; padding: .8rem 0; flex-direction: column; gap: .65rem; }
  .nav-links { justify-content: flex-start; margin-left: -.65rem; }
  .article-hero { grid-template-columns: 1fr; }
  .hero-copy { min-height: auto; padding: 3rem clamp(1.5rem, 7vw, 4rem); }
  .hero-media, .hero-swatch { min-height: 340px; }
  .article-shell { grid-template-columns: 1fr; }
  .page-aside { position: static; padding: 1.2rem; border: 1px solid var(--line); background: var(--white); grid-row: 1; }
  .on-page { columns: 2; column-gap: 2rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-intro { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .nav-links { gap: 0; }
  .nav-links a { padding: .45rem .58rem; font-size: .78rem; }
  .article-hero { width: calc(100% - 1rem); margin-top: .5rem; }
  .hero-copy { padding: 2.4rem 1.3rem; }
  .hero-media, .hero-swatch { min-height: 260px; }
  .article-shell { width: calc(100% - 2rem); margin: 3rem auto; }
  .on-page { columns: 1; }
  .prose dl, .diagram-key { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-intro { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

