@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-italic.woff2") format("woff2");
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f7f5ec;
  --panel: #fffdf6;
  --ink: #1e3328;
  --forest: #29483a;
  --forest-dark: #1c372b;
  --muted: #4e5d4f;
  --divider: #cdd2c2;
  --sage: #e8ece1;
  --rust: #a3442b;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
}

img { display: block; max-width: 100%; }
figure, h1, h2, h3, p { margin: 0; }
a { color: inherit; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1;
}

:focus-visible { outline: 2px solid var(--rust); outline-offset: 5px; }
[id] { scroll-margin-top: 1.25rem; }

.shell { width: min(100% - 5rem, 75rem); margin-inline: auto; }

.skip-link {
  position: fixed;
  z-index: 2;
  inset: .75rem auto auto .75rem;
  transform: translateY(-200%);
  padding: .7rem 1rem;
  background: var(--panel);
  border: 1px solid currentColor;
}

.skip-link:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--divider); }

.site-header-inner, .site-footer-inner {
  min-height: 4.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.wordmark {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: .65rem;
  font-size: 1.13rem;
  font-weight: 700;
  letter-spacing: -.045em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav { display: flex; align-items: center; gap: clamp(1rem, 3.8vw, 3.2rem); }
.site-nav a { text-decoration: none; font-size: .92rem; font-weight: 600; white-space: nowrap; }
.site-nav a:hover, .featured-guide h3 a:hover { text-decoration: underline; text-underline-offset: .16em; }

.home-hero {
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
  padding-block: clamp(3rem, 6vw, 5.25rem) clamp(2.8rem, 5.2vw, 4.6rem);
}

.hero-copy { padding-bottom: 1.15rem; }

.hero-copy h1 {
  font-size: clamp(4.25rem, 9vw, 8rem);
  line-height: .86;
  letter-spacing: -.037em;
}

.hero-copy h1 em { color: var(--forest); font-weight: 400; }
.hero-copy p { color: var(--muted); max-width: 24rem; margin-top: 1.75rem; font-size: 1.1rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  min-height: 3.3rem;
  margin-top: 1.9rem;
  padding: .65rem 1.25rem;
  border-radius: .35rem;
  color: #fffdf4;
  background: var(--forest);
  font-weight: 700;
  font-size: .94rem;
  text-decoration: none;
  transition: background-color .18s ease;
}

.button:hover { background: var(--forest-dark); }

.arrow {
  display: inline-block;
  width: 1rem;
  height: .7rem;
  position: relative;
  flex: none;
  color: inherit;
}

.arrow::before, .arrow::after { content: ""; position: absolute; }
.arrow::before { inset: .3rem .06rem auto 0; border-top: 1.5px solid currentColor; }
.arrow::after { width: .43rem; height: .43rem; right: .1rem; top: .14rem; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }

.hero-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 1.32;
  object-fit: cover;
  object-position: center 52%;
  border-radius: .55rem;
  background: var(--sage);
}

.hero-image figcaption { margin-top: .45rem; color: var(--muted); font-size: .73rem; text-align: right; }

.guide-section { padding-block: clamp(2.75rem, 5.3vw, 4.85rem); background: var(--sage); border-block: 1px solid var(--divider); }
.guide-section h2, .method h2 { font-size: clamp(2.7rem, 5.3vw, 4.5rem); letter-spacing: -.024em; }

.featured-guide {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  margin-top: 1.6rem;
  border: 1px solid var(--divider);
  border-radius: .55rem;
  background: var(--panel);
  padding: clamp(1.25rem, 4vw, 3rem);
  gap: clamp(1rem, 4vw, 3rem);
}

.category {
  margin-bottom: .65rem;
  color: var(--rust);
  font-size: .77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .095em;
}

.featured-guide h3, .more-guide h3 { font-size: clamp(2rem, 4vw, 3.3rem); letter-spacing: -.023em; }
.featured-guide h3 a, .more-guide h3 a { text-decoration: none; }
.feature-intro > :last-child, .more-guide p { margin-top: .62rem; max-width: 29rem; color: var(--muted); }

.chapter-links { align-self: center; }

.chapter-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3rem;
  padding-block: .6rem;
  border-bottom: 1px solid var(--divider);
  font-size: .92rem;
  font-weight: 600;
  text-decoration: none;
}

.chapter-links a:first-child { border-top: 1px solid var(--divider); }
.chapter-links a:hover { color: var(--rust); }
.more-guide { padding-block: 1.5rem 0; }
.method { padding-block: clamp(3.1rem, 6vw, 5.5rem); }

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 3vw, 2.3rem);
  margin-top: 1.55rem;
}

.method-grid > div { border-top: 1px solid #9cae99; padding-top: .9rem; }
.method-grid h3 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.method-grid p { margin-top: .55rem; color: var(--muted); }
.site-footer { border-top: 1px solid var(--divider); background: #eff0e6; }
.site-footer p { color: var(--muted); font-size: .88rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: .45rem 1.25rem; }
.footer-nav a { font-size: .88rem; font-weight: 600; text-underline-offset: .18em; }

.guide-main { max-width: 67rem; padding-block: 2rem 5.5rem; }

.breadcrumb { color: var(--muted); font-size: .84rem; }

.breadcrumb a { text-underline-offset: .19em; }
.guide-heading { max-width: 59rem; padding-block: 1.55rem 2.15rem; }
.guide-heading h1 { font-size: clamp(2.8rem, 5.8vw, 4.7rem); letter-spacing: -.03em; line-height: .96; }
.guide-heading p { margin-top: 1.1rem; max-width: 42rem; color: var(--muted); font-size: clamp(1rem, 2.2vw, 1.17rem); }

.guide-layout:has(.guide-sidebar) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12.75rem;
  gap: clamp(2rem, 5.5vw, 4.55rem);
}

.guide-body { grid-area: 1 / 1; max-width: 47rem; min-width: 0; }
.guide-sidebar { grid-area: 1 / 2; }

.guide-sidebar nav {
  position: sticky;
  top: 1.5rem;
  display: grid;
  gap: .65rem;
  border-left: 1px solid #9cae99;
  padding: .25rem 0 .45rem 1rem;
}

.guide-sidebar h2 { font: 700 .83rem/1.4 var(--sans); }
.guide-sidebar a { color: var(--muted); font-size: .85rem; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.guide-sidebar a:hover { color: var(--rust); }

.measurement-figure { overflow: hidden; border: 1px solid var(--divider); border-radius: .55rem; background: var(--sage); }
.measurement-canvas { display: grid; place-items: center; padding: clamp(1.1rem, 4vw, 2.2rem); }

.measurement-cabinet {
  position: relative;
  width: min(96%, 27rem);
  height: clamp(8.5rem, 28vw, 12.5rem);
  border: 2px solid #6d806e;
  border-radius: .35rem;
  background: #f5f5eb;
}

.cabinet-back { position: absolute; inset: 12% 13% 24% 14%; border: 1px solid #aab7a4; background: #eff0e4; }
.cabinet-floor { position: absolute; inset: 76% 0 0; background: #d9dfcf; clip-path: polygon(14% 0, 87% 0, 100% 100%, 0 100%); }
.cabinet-hinge { position: absolute; inset: 30% auto auto 0; width: 7%; height: 11%; border: 1px solid #829782; border-left: 0; background: #dbe2d4; }
.pipe-top { position: absolute; inset: 0 auto auto 45%; width: 4.5%; height: 42%; border-inline: 1px solid #788677; background: #aebaac; }
.pipe-bend { position: absolute; inset: 29% auto auto 45%; width: 18%; height: 22%; border: solid #aebaac; border-width: 0 .75rem .75rem; border-radius: 0 0 1.4rem 1.4rem; }

.measure-line { position: absolute; display: grid; place-items: center; color: var(--rust); }
.measure-line b, .measurement-figure figcaption b { display: grid; place-items: center; min-width: 1.45rem; height: 1.45rem; padding: 0 .2rem; border-radius: 50%; background: var(--rust); color: white; font: 700 .75rem/1 var(--sans); }
.measure-line-width { inset: 86% 65% auto 6%; height: 1px; background: currentColor; }
.measure-line-height { inset: 53% auto 23% 52%; width: 1px; background: currentColor; }
.measure-line-depth { inset: 85% 1% auto 75%; height: 1px; background: currentColor; transform: rotate(-28deg); }
.measure-line-width b, .measure-line-depth b { transform: translateY(-50%); }
.measure-line-height b { transform: translateX(-50%); }
.measure-line-depth b { transform: translateY(-50%) rotate(28deg); }

.measurement-figure figcaption {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .5rem clamp(.75rem, 3vw, 2rem);
  border-top: 1px solid var(--divider);
  background: var(--panel);
  padding: .8rem .6rem;
  font-size: .81rem;
  font-weight: 600;
}

.measurement-figure figcaption span { display: inline-flex; align-items: center; gap: .35rem; }
.prose { line-height: 1.7; }
.prose h2 { margin-top: 2.3rem; font-size: clamp(2rem, 4.5vw, 3.3rem); letter-spacing: -.02em; }
.prose p, .prose ol, .prose ul { margin: .8rem 0 0; }
.prose ol, .prose ul { padding-left: 1.35rem; }
.prose li { margin-top: .65rem; padding-left: .2rem; }
.prose li::marker { font-weight: 700; color: var(--rust); }
.prose a { color: var(--forest-dark); font-weight: 600; text-underline-offset: .17em; }
.prose a:hover { color: var(--rust); }

.prose table { width: 100%; border-collapse: collapse; margin-top: 1rem; background: var(--panel); font-size: .93rem; }
.prose th, .prose td { padding: .75rem clamp(.55rem, 1.5vw, 1rem); border: 1px solid var(--divider); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.prose th { background: var(--sage); font-weight: 700; }
.prose td:first-child { width: 25%; font-weight: 700; }

.fit-example { margin-top: 1.2rem; padding: 1rem 1.15rem; border-left: 3px solid var(--rust); background: var(--sage); }
.fit-example p:first-child { margin-top: 0; }
.fit-example p + p { margin-top: .4rem; }

@media (max-width: 56rem) {
  .shell { width: min(100% - 2.5rem, 75rem); }
  .home-hero { gap: 2rem; }
  .hero-copy h1 { font-size: clamp(3.9rem, 10vw, 6rem); }
  .guide-layout:has(.guide-sidebar) { gap: 2rem; grid-template-columns: minmax(0, 1fr) 10rem; }
}

@media (max-width: 43rem) {
  .home-hero, .featured-guide, .method-grid, .guide-layout:has(.guide-sidebar) { grid-template-columns: 1fr; }
  .home-hero { padding-block: 2.7rem 2.15rem; gap: 1.6rem; }
  .hero-copy { padding-bottom: 0; }
  .hero-copy h1 { font-size: clamp(4rem, 13vw, 6.3rem); }
  .hero-copy p { margin-top: 1.3rem; }
  .button { margin-top: 1.2rem; }
  .hero-image img { aspect-ratio: 1.43; }
  .site-header-inner { min-height: 4rem; }
  .site-footer-inner { flex-wrap: wrap; justify-content: flex-start; padding-block: .85rem; }
  .guide-main { padding-block: 1rem 3rem; }
  .guide-heading { padding-block: 1.35rem 1.2rem; }
  .guide-heading p { margin-top: .8rem; }
  .guide-sidebar, .guide-body { grid-area: auto; }
  .guide-layout:has(.guide-sidebar) { gap: 1.25rem; }
  .guide-sidebar nav { position: static; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem .7rem; }
  .guide-sidebar h2 { grid-column: 1 / -1; }
  .guide-sidebar a { font-size: .77rem; }
  .prose td:first-child { width: 31%; }
}

@media (max-width: 23rem) {
  .shell { width: calc(100% - 2rem); }
  .site-nav { gap: .7rem; }
  .site-nav a { font-size: .78rem; }
  .wordmark { gap: .43rem; font-size: 1.05rem; }
  .wordmark img { width: 29px; height: 29px; }
  .prose table { font-size: .83rem; }
}

@media (prefers-reduced-motion: reduce) { .button { transition: none; } }

@media print {
  .site-header, .site-footer, .breadcrumb, .guide-sidebar, .skip-link { display: none; }
  body { background: white; color: black; }
  .guide-main { width: 100%; padding: 0; }
  .guide-layout:has(.guide-sidebar) { display: block; }
  .guide-heading h1 { font-size: 2.4rem; }
  .prose { font-size: 10pt; }
  .prose h2 { break-after: avoid; }
  .prose tr, .fit-example, .measurement-figure { break-inside: avoid; }
}
