:root {
  --bg: #f5efe2;
  --paper: #fffaf0;
  --paper-2: #efe5d0;
  --ink: #282521;
  --soft: #4f493f;
  --muted: #766d5d;
  --line: #a89c80;
  --rust: #b54a2a;
  --navy: #1f3a5f;
  --ochre: #c7943d;
  --moss: #5a7345;
  --shadow: rgba(49, 39, 25, 0.12);
  --serif: "Source Serif Pro", Georgia, serif;
  --display: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
  --col: 730px;
  --wide: 1100px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 22% 10%, rgba(181, 74, 42, 0.05), transparent 28%),
    linear-gradient(180deg, #f8f1e5 0%, var(--bg) 38%, #efe5d0 100%);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
}

body:before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    radial-gradient(#6e604c 0.55px, transparent 0.55px),
    radial-gradient(#b8a98b 0.45px, transparent 0.45px);
  background-size: 19px 19px, 23px 23px;
  background-position: 0 0, 7px 11px;
}

article {
  margin: 0 auto;
  padding: 4rem 1rem 6rem;
}

article > * {
  max-width: var(--col);
  margin-left: auto;
  margin-right: auto;
}

article .wide { max-width: var(--wide); }

h1, h2, h3 {
  font-family: var(--display);
  color: var(--ink);
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3.2rem, 8vw, 6.4rem);
  font-weight: 700;
  margin: 0 0 1rem;
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  margin: 0 0 1.1rem;
}

h3 {
  font-size: 1.45rem;
  font-weight: 600;
  margin: 0;
}

p { margin: 0 0 1.1rem; }

a { color: var(--navy); text-decoration-color: rgba(31, 58, 95, 0.38); }
a:hover { color: var(--rust); }

.hero {
  min-height: 92vh;
  padding-top: 2rem;
  display: grid;
  align-content: center;
}

.kicker {
  margin: 0 0 1rem;
  color: var(--rust);
  font-family: var(--display);
  font-size: 0.95rem;
  font-variant: small-caps;
  letter-spacing: 0.18em;
}

.lede {
  max-width: 680px;
  font-size: 1.25rem;
  line-height: 1.52;
  color: var(--soft);
}

.caption {
  font-family: var(--sans);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  font-style: italic;
}

.hero-visual {
  height: 300px;
  margin: 1.8rem 0 0.65rem;
  border-top: 1px solid rgba(168, 156, 128, 0.8);
  border-bottom: 1px solid rgba(168, 156, 128, 0.8);
}

.rule {
  border: 0;
  border-top: 1px solid var(--line);
  width: 7rem;
  margin: 5rem auto;
}

section { scroll-margin-top: 18px; }

.widget, .workshop, .plate {
  background: rgba(255, 250, 240, 0.74);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px var(--shadow);
  padding: 1.2rem;
  margin-top: 1.8rem;
}

.widget-header {
  border-bottom: 1px solid rgba(168, 156, 128, 0.65);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
}

.widget-header h3, .plate-title, .fragment-head p, .step-label {
  font-family: var(--display);
  font-variant: small-caps;
  letter-spacing: 0.16em;
}

.widget-header h3 {
  color: var(--rust);
  font-size: 1.2rem;
}

.widget-header p {
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0.15rem 0 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.75fr);
  gap: 1rem;
  align-items: stretch;
}

.figure, .plate-canvas {
  min-height: 360px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.32), rgba(255,255,255,0)),
    var(--paper);
  border: 1px solid rgba(168, 156, 128, 0.8);
  position: relative;
  overflow: hidden;
}

.figure.small { min-height: 250px; }

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-family: var(--sans);
  font-size: 0.88rem;
}

label {
  display: grid;
  gap: 0.25rem;
  color: var(--soft);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--rust);
}

select {
  min-height: 2.25rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  padding: 0 0.5rem;
}

.readout {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.2rem;
}

.readout div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dotted rgba(118, 109, 93, 0.5);
  padding-bottom: 0.35rem;
}

.readout span {
  color: var(--muted);
}

.readout strong {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  max-width: 58%;
  overflow-wrap: anywhere;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

.axis-line { stroke: var(--line); stroke-width: 1; }
.ink-line { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.rust-line { stroke: var(--rust); stroke-width: 2; fill: none; }
.navy-line { stroke: var(--navy); stroke-width: 2; fill: none; }
.moss-line { stroke: var(--moss); stroke-width: 2; fill: none; }
.soft-fill { fill: rgba(199, 148, 61, 0.18); }
.rust-fill { fill: var(--rust); }
.navy-fill { fill: var(--navy); }
.moss-fill { fill: var(--moss); }
.label-text {
  font-family: var(--sans);
  font-size: 12px;
  fill: var(--soft);
}
.plate-text {
  font-family: var(--display);
  font-size: 18px;
  fill: var(--ink);
}

.workshop { padding: 1.2rem; }

.fragment-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.7rem;
  margin-bottom: 1rem;
}

.fragment-head p {
  color: var(--rust);
  margin: 0;
}

.workshop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(270px, 0.85fr);
  gap: 1rem;
}

pre {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  min-height: 330px;
  background: #f8efdd;
  border: 1px solid rgba(168, 156, 128, 0.85);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
}

code mark {
  display: block;
  background: rgba(181, 74, 42, 0.14);
  color: var(--ink);
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.step-label {
  color: var(--rust);
  font-size: 0.88rem;
  margin: 0.8rem 0 0.2rem;
}

.workshop-note {
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--soft);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.86rem;
  padding: 0.48rem 0.7rem;
  cursor: pointer;
}

button:hover { border-color: var(--rust); color: var(--rust); }

.takeaway {
  border-left: 3px solid var(--rust);
  padding-left: 0.8rem;
  margin: 1rem 0 0;
  font-style: italic;
  color: var(--soft);
}

.plate {
  margin-top: 1.2rem;
}

.plate-title {
  color: var(--rust);
  margin-bottom: 0.7rem;
}

.plate-canvas {
  min-height: 330px;
}

footer {
  font-family: var(--sans);
  color: var(--muted);
  font-size: 0.9rem;
  padding-bottom: 5rem;
}

@media (max-width: 820px) {
  html, body { font-size: 17px; }
  article { padding: 2.2rem 0.85rem 4rem; }
  .hero { min-height: auto; }
  .grid-2, .workshop-grid {
    grid-template-columns: 1fr;
  }
  .figure, .plate-canvas { min-height: 300px; }
  .hero-visual { height: 230px; }
  .fragment-head { display: block; }
}
