:root {
  color-scheme: light;
  --paper: #f4e7d5;
  --paper-soft: #fff5e8;
  --ink: #2d241d;
  --muted: #706454;
  --line: rgba(53, 40, 30, 0.22);
  --stroke: #2b211b;
  --accent: #e58a63;
  --accent-deep: #9e4d3b;
  --sage: #93b19a;
  --clay: #cfa37e;
  --sky: #a9c6d3;
  --tile: rgba(255, 247, 236, 0.76);
  --shadow: 0 28px 70px rgba(73, 48, 29, 0.18), 6px 7px 0 rgba(43, 33, 27, 0.08);
  --radius: 8px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-reading: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1f201e;
  --paper-soft: #2d2a25;
  --ink: #f6ead8;
  --muted: #cdbfaa;
  --line: rgba(249, 230, 205, 0.18);
  --stroke: #f1dec6;
  --accent: #e99b78;
  --accent-deep: #f4c1a8;
  --sage: #9ebaa3;
  --clay: #b98767;
  --sky: #7697a8;
  --tile: rgba(48, 43, 37, 0.8);
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.36), 5px 6px 0 rgba(241, 222, 198, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    repeating-linear-gradient(102deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 15px),
    linear-gradient(132deg, color-mix(in srgb, var(--clay) 18%, transparent), transparent 34%),
    linear-gradient(160deg, var(--paper), var(--paper-soft) 54%, color-mix(in srgb, var(--sage) 20%, var(--paper)));
  color: var(--ink);
  font-family: var(--font-body);
  letter-spacing: 0;
}

main {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 22px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand,
.nav-links,
.theme-toggle,
.button,
.tool-tile {
  -webkit-tap-highlight-color: transparent;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  font-weight: 800;
}

.brand-logo {
  width: 36px;
  height: 36px;
  display: block;
  flex: 0 0 auto;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 46% 46%;
  background: var(--accent);
  position: relative;
  box-shadow:
    inset 0 -7px 0 rgba(0, 0, 0, 0.1),
    0 0 0 2px var(--stroke);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 12px;
  height: 16px;
  border-radius: 10px 10px 3px 3px;
  background: var(--accent);
}

.brand-mark::before {
  left: 2px;
  transform: rotate(-24deg);
}

.brand-mark::after {
  right: 2px;
  transform: rotate(24deg);
}

.nav-links {
  display: flex;
  gap: 24px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.nav-links a {
  transition: color 180ms ease;
}

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

.theme-toggle {
  position: relative;
  width: 54px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--tile);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 220ms ease;
}

[data-theme="dark"] .theme-toggle::before {
  transform: translateX(22px);
}

.toggle-sun,
.toggle-moon {
  position: absolute;
  top: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.toggle-sun {
  left: 10px;
  background: var(--paper);
}

.toggle-moon {
  right: 10px;
  border: 2px solid var(--paper);
}

.hero {
  min-height: calc(100svh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(340px, 1.14fr);
  align-items: center;
  gap: clamp(34px, 5vw, 72px);
  padding: clamp(36px, 6vw, 80px) clamp(18px, 5vw, 76px) clamp(28px, 5vw, 60px);
  overflow: hidden;
}

.hero-copy {
  max-width: 650px;
  animation: rise-in 700ms ease both;
}

.eyebrow,
.section-kicker {
  margin: 0 0 16px;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 650;
  line-height: 0.98;
}

h1 {
  max-width: 13ch;
  font-size: clamp(3.4rem, 7.2vw, 6.6rem);
}

h1 span {
  display: block;
}

h2 {
  font-size: clamp(2.1rem, 4.8vw, 5.2rem);
}

h3 {
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.06;
}

.hero-text,
.calculator-copy p,
.standards-band p {
  max-width: 610px;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.75;
}

.hero-text {
  margin-top: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border-radius: var(--radius);
  font-weight: 800;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 4px 5px 0 color-mix(in srgb, var(--accent) 46%, transparent);
}

.button.ghost {
  border: 2px solid var(--line);
  color: var(--ink);
}

.pet-window {
  position: relative;
  min-height: 590px;
  border: 3px solid var(--stroke);
  border-radius: 28px 28px 10px 10px;
  background:
    linear-gradient(175deg, rgba(255, 255, 255, 0.24), transparent 28%),
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.08) 0 6px, transparent 6px 22px),
    linear-gradient(180deg, color-mix(in srgb, var(--sky) 74%, var(--paper)) 0 62%, transparent 62%),
    var(--tile);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: float-window 6s ease-in-out infinite;
}

.pet-window.has-art {
  background: var(--paper-soft);
}

.pet-window.has-art::before,
.pet-window.has-art::after {
  display: none;
}

.pet-window.has-art img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 68% center;
}

.pet-window::before {
  content: "";
  position: absolute;
  inset: 46px 46px auto;
  height: 3px;
  background: color-mix(in srgb, var(--stroke) 68%, transparent);
  box-shadow: 0 118px 0 color-mix(in srgb, var(--stroke) 18%, transparent);
}

.pet-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32%;
  background:
    repeating-linear-gradient(108deg, rgba(255, 255, 255, 0.08) 0 8px, transparent 8px 28px),
    linear-gradient(180deg, color-mix(in srgb, var(--sage) 42%, var(--paper-soft)), color-mix(in srgb, var(--clay) 34%, var(--paper-soft)));
  border-top: 3px solid color-mix(in srgb, var(--stroke) 70%, transparent);
}

.tool-strip,
.journal,
.tool-workbench,
.standards-band {
  padding: clamp(64px, 9vw, 116px) clamp(18px, 6vw, 78px);
}

.tool-strip {
  padding-top: clamp(46px, 6vw, 78px);
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(28px, 5vw, 52px);
}

.section-heading h2 {
  max-width: 12ch;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.tool-tile {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  appearance: none;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-top: 0;
  border-left: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    background 190ms ease,
    transform 190ms ease,
    color 190ms ease;
}

.tool-tile:hover,
.tool-tile:focus-visible {
  background: var(--tile);
  transform: translate(-2px, -4px);
  box-shadow: 5px 5px 0 color-mix(in srgb, var(--stroke) 12%, transparent);
}

.tool-tile.featured {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.tool-number {
  color: var(--accent-deep);
  font-weight: 900;
}

.tool-tile strong {
  font-size: clamp(1.2rem, 1.5vw, 1.6rem);
  line-height: 1.1;
}

.tool-tile small {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.tool-workbench {
  display: grid;
  grid-template-columns: minmax(260px, 0.52fr) minmax(420px, 1fr);
  align-items: start;
  gap: clamp(34px, 6vw, 80px);
  background: color-mix(in srgb, var(--sage) 14%, transparent);
}

.calculator-copy h2 {
  max-width: 10ch;
}

.workbench-shell {
  display: grid;
  grid-template-columns: minmax(180px, 0.38fr) minmax(0, 1fr);
  min-height: 620px;
  border: 2px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--tile);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tool-tabs {
  display: grid;
  align-content: start;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-soft) 72%, transparent);
}

.tool-tab {
  appearance: none;
  display: grid;
  gap: 4px;
  padding: 15px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.tool-tab strong {
  color: var(--ink);
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}

.tool-tab span {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tool-tab[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent-deep);
}

.tool-panel {
  min-width: 0;
  padding: clamp(20px, 4vw, 36px);
  overflow: hidden;
}

.tool-card,
.mini-calculator {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.tool-card header {
  display: grid;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.tool-card header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.unit-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(78px, 1fr));
  width: fit-content;
  border: 2px solid var(--stroke);
  border-radius: var(--radius);
  overflow: hidden;
  background: color-mix(in srgb, var(--paper-soft) 74%, transparent);
}

.unit-toggle button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.unit-toggle button + button {
  border-left: 1px solid var(--line);
}

.unit-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.tool-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 18px;
}

.tool-form label,
.mini-calculator label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.tool-form select,
.tool-form input {
  width: 100%;
  min-height: 54px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper-soft) 84%, transparent);
  color: var(--ink);
  padding: 0 42px 0 14px;
  outline: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.tool-form select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

.field-with-unit {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.field-with-unit span {
  color: var(--muted);
  font-weight: 900;
}

.tool-form input:focus,
.tool-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.input-row input {
  width: 100%;
  border: 0;
  padding: 12px 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.8rem;
  font-weight: 800;
  outline: 0;
}

.input-row span {
  color: var(--muted);
  font-weight: 800;
}

.estimate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.tool-result {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.07) 0 6px, transparent 6px 20px),
    color-mix(in srgb, var(--paper-soft) 76%, var(--accent));
}

.tool-result strong {
  min-width: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.tool-result p,
.tool-note {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.tool-output-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool-output-list li {
  min-width: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--paper-soft) 66%, transparent);
  overflow-wrap: anywhere;
}

.source-line {
  min-width: 0;
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.food-visual {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border: 2px solid var(--stroke);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.12) 0 6px, transparent 6px 18px),
    color-mix(in srgb, var(--sky) 32%, var(--paper-soft));
}

.cup-meter {
  position: relative;
  display: grid;
  place-items: end center;
  width: 88px;
  height: 112px;
  border: 4px solid var(--stroke);
  border-top: 0;
  border-radius: 0 0 28px 28px;
  overflow: hidden;
  background: color-mix(in srgb, var(--paper-soft) 70%, transparent);
}

.cup-meter span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--fill);
  background: color-mix(in srgb, var(--accent) 76%, var(--clay));
}

.cup-meter b {
  position: relative;
  z-index: 1;
  padding: 0 4px 12px;
  color: var(--ink);
  font-size: 0.82rem;
}

.meal-split {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.meal-bowl {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.meal-bowl i {
  position: relative;
  width: 64px;
  height: 34px;
  border: 3px solid var(--stroke);
  border-radius: 0 0 42px 42px;
  background: var(--accent);
  overflow: hidden;
}

.meal-bowl i::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: -7px;
  height: calc(var(--fill) / 2);
  min-height: 8px;
  border: 2px solid var(--stroke);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-deep) 58%, var(--paper));
}

.calorie-ribbon {
  display: grid;
  gap: 3px;
  min-width: 92px;
  padding: 10px 12px;
  border-left: 4px solid var(--accent-deep);
  background: color-mix(in srgb, var(--paper-soft) 66%, transparent);
}

.calorie-ribbon span {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
}

.calorie-ribbon b {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.estimate span {
  color: var(--muted);
  font-weight: 800;
}

.estimate strong {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.article-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.article-list article {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--tile) 72%, transparent);
  box-shadow: 3px 4px 0 color-mix(in srgb, var(--stroke) 7%, transparent);
  overflow: hidden;
}

.article-list span {
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.article-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.article-link {
  display: grid;
  min-width: 0;
  min-height: 100%;
}

.article-cover {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
}

.article-cover img,
.guide-card-art img,
.guides-hero-art img,
.atlas-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-cover img {
  object-fit: contain;
  object-position: center;
  background: var(--paper-soft);
}

.article-copy {
  display: grid;
  gap: 14px;
  padding: 18px 20px 22px;
}

.article-copy h3 {
  font-size: clamp(1.35rem, 1.9vw, 1.9rem);
}

.standards-band {
  min-height: 420px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 34px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--clay) 22%, transparent), transparent),
    color-mix(in srgb, var(--paper-soft) 84%, var(--sage));
  border-top: 1px solid var(--line);
}

.standards-band h2 {
  max-width: 15ch;
}

.legal-page {
  padding: clamp(58px, 9vw, 108px) clamp(18px, 7vw, 96px);
}

.legal-page h1 {
  margin-bottom: clamp(32px, 6vw, 64px);
}

.legal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.legal-grid article {
  min-height: 240px;
  display: grid;
  align-content: space-between;
  gap: 22px;
  padding: clamp(22px, 4vw, 38px);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--tile) 64%, transparent);
}

.legal-grid h2 {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  line-height: 1.02;
}

.legal-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.guides-page {
  display: grid;
  gap: 0;
}

.guides-hero,
.guide-library,
.atlas-section,
.guides-note,
.journal {
  padding: clamp(58px, 8vw, 108px) clamp(18px, 6vw, 78px);
}

.guides-hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  background: color-mix(in srgb, var(--paper-soft) 88%, var(--sage));
}

.guides-hero-copy {
  display: grid;
  gap: 20px;
}

.guides-hero-copy p:last-child,
.guides-note p {
  max-width: 56ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.35vw, 1.18rem);
  line-height: 1.75;
}

.guides-hero-art {
  position: relative;
  min-height: 440px;
  border: 2px solid var(--stroke);
  border-radius: 24px 24px 8px 8px;
  overflow: hidden;
  background: var(--paper-soft);
  box-shadow: var(--shadow);
}

.guides-hero-art img {
  position: absolute;
  inset: 0;
}

.guide-library {
  border-top: 1px solid var(--line);
}

.journal {
  border-top: 1px solid var(--line);
}

.guide-library .section-heading,
.atlas-section .section-heading {
  display: grid;
  justify-content: start;
  gap: 10px;
}

.guide-library .section-heading h2,
.atlas-section .section-heading h2 {
  max-width: 14ch;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.guide-card {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--tile) 70%, transparent);
  overflow: hidden;
}

.guide-card-art {
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
}

.guide-card-copy {
  display: grid;
  gap: 14px;
  padding: 18px 20px 22px;
}

.guide-card-copy span,
.atlas-copy span {
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.guide-card-copy h2 {
  font-size: clamp(1.5rem, 2.2vw, 2.2rem);
  line-height: 1.05;
}

.guide-card-copy p,
.atlas-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.atlas-section {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-soft) 78%, transparent);
}

.atlas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.atlas-card {
  display: grid;
  gap: 18px;
}

.atlas-frame {
  aspect-ratio: 3 / 4;
  border: 2px solid var(--stroke);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-soft);
  box-shadow: var(--shadow);
}

.atlas-frame img {
  object-position: top center;
}

.atlas-copy {
  display: grid;
  gap: 10px;
}

.article-page {
  display: grid;
  gap: 0;
}

.article-hero,
.article-body,
.article-related,
.article-sources {
  padding: clamp(58px, 8vw, 108px) clamp(18px, 6vw, 78px);
}

.article-hero {
  min-height: calc(100svh - 72px);
  display: grid;
  grid-template-columns: minmax(280px, 0.84fr) minmax(0, 1.16fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  background: color-mix(in srgb, var(--paper-soft) 88%, var(--sage));
}

.article-hero h1 {
  max-width: 8.5ch;
  font-size: clamp(3.25rem, 6.3vw, 5.8rem);
  line-height: 0.92;
}

.article-hero-copy {
  display: grid;
  max-width: 35rem;
  gap: 24px;
}

.article-dek,
.article-note {
  max-width: 48ch;
  margin: 0;
  color: var(--muted);
}

.article-dek {
  font-family: var(--font-reading);
  font-size: clamp(1.18rem, 1.72vw, 1.38rem);
  line-height: 1.76;
  color: color-mix(in srgb, var(--muted) 90%, var(--ink));
}

.article-note {
  font-size: clamp(1rem, 1.2vw, 1.08rem);
  line-height: 1.74;
  padding: 18px 20px;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--tile) 76%, transparent);
}

.article-cover-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  border: 2px solid var(--stroke);
  border-radius: 24px 24px 8px 8px;
  overflow: hidden;
  background: var(--paper-soft);
  box-shadow: var(--shadow);
}

.article-cover-frame img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-cover-frame.poster img {
  object-fit: contain;
  object-position: center;
}

.article-body,
.article-related,
.article-sources {
  border-top: 1px solid var(--line);
}

.article-body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper-soft) 82%, transparent), transparent 26%),
    color-mix(in srgb, var(--paper-soft) 46%, transparent);
}

.article-body-grid {
  width: min(100%, 1180px);
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(28px, 4vw, 54px);
}

.article-rail {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 14px;
}

.article-rail-card {
  display: grid;
  gap: 12px;
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--tile) 82%, transparent);
  box-shadow: 3px 4px 0 color-mix(in srgb, var(--stroke) 7%, transparent);
}

.article-rail-card strong {
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-rail-card p,
.article-rail-card li {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.72;
}

.article-rail-card ul {
  margin: 0;
  padding-left: 18px;
}

.article-shell {
  width: min(100%, 780px);
  display: grid;
  gap: 38px;
}

.article-prose {
  width: 100%;
}

.article-body h2,
.article-related h2,
.article-sources h2 {
  margin: 0;
  font-size: clamp(1.86rem, 3vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.article-body section {
  display: grid;
  gap: 18px;
}

.article-body section + section {
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.article-body section h2 {
  max-width: 15ch;
  font-size: clamp(1.92rem, 2.7vw, 2.72rem);
  line-height: 1.06;
}

.article-body p,
.article-body li,
.related-list li,
.source-list li {
  max-width: 62ch;
  color: var(--muted);
  font-family: var(--font-reading);
  font-size: clamp(1.1rem, 1.24vw, 1.22rem);
  line-height: 1.86;
}

.article-body section > p:first-of-type {
  color: var(--ink);
  font-size: clamp(1.22rem, 1.46vw, 1.36rem);
  line-height: 1.8;
}

.article-body ul,
.related-list,
.source-list {
  margin: 0;
  padding-left: 24px;
}

.article-body a,
.related-list a,
.source-list a {
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.article-callout {
  display: grid;
  gap: 16px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--tile) 78%, transparent);
  border-left: 4px solid var(--accent);
}

.article-callout h2 {
  font-size: clamp(1.28rem, 1.9vw, 1.7rem);
  line-height: 1.05;
}

.article-callout p {
  margin: 0;
  font-family: var(--font-reading);
  font-size: clamp(1.08rem, 1.18vw, 1.18rem);
  line-height: 1.82;
}

.article-related {
  background: color-mix(in srgb, var(--paper) 78%, transparent);
}

.article-sources {
  background: color-mix(in srgb, var(--paper-soft) 84%, transparent);
}

.related-list,
.source-list {
  display: grid;
  gap: 10px;
}

.related-list a:hover,
.source-list a:hover,
.article-body a:hover {
  text-decoration: underline;
}

.guides-note {
  border-top: 1px solid var(--line);
}

.guides-note h2 {
  max-width: 14ch;
  margin-bottom: 18px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px clamp(18px, 5vw, 76px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float-window {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1040px) {
  .hero,
  .tool-workbench,
  .guides-hero,
  .article-hero {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .pet-window {
    min-height: 520px;
  }

  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-list,
  .guide-grid,
  .atlas-grid {
    grid-template-columns: 1fr;
  }

  .article-body-grid {
    grid-template-columns: 1fr;
  }

  .article-rail {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-shell {
    grid-template-columns: 1fr;
  }

  .tool-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 1280px) {
  .article-list,
  .guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-shell {
    grid-template-columns: 1fr;
  }

  .tool-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .site-header {
    gap: 14px;
    grid-template-columns: 1fr auto;
    padding: 10px 18px 12px;
  }

  .nav-links {
    grid-column: 1 / -1;
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    gap: 12px 28px;
    justify-content: flex-start;
  }

  .theme-toggle {
    justify-self: end;
    width: 50px;
    margin-right: 18px;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(2.55rem, 11vw, 3.25rem);
    line-height: 1.02;
  }

  .hero {
    padding: 28px 24px 42px;
  }

  .eyebrow,
  .section-kicker {
    max-width: 31ch;
    line-height: 1.45;
  }

  .pet-window {
    min-height: 430px;
    border-radius: 22px 22px 8px 8px;
  }

  .article-cover-frame {
    aspect-ratio: 4 / 3;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .tool-tile {
    min-height: 170px;
  }

  .tool-tabs,
  .tool-form,
  .legal-grid,
  .guide-grid,
  .atlas-grid,
  .article-list {
    grid-template-columns: 1fr;
  }

  .article-hero {
    min-height: auto;
  }

  .article-hero h1 {
    max-width: 9ch;
    font-size: clamp(2.34rem, 8.8vw, 3.32rem);
    line-height: 0.98;
  }

  .article-rail {
    grid-template-columns: 1fr;
  }

  .food-visual {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .section-heading,
.standards-band,
  .site-footer,
  .estimate {
    align-items: flex-start;
    flex-direction: column;
  }
}
