/* Crest Space — single stylesheet for the whole site.
   Palette: warm paper, deep olive, bronze accent. Separation by rule and tint, not shadow. */

:root {
  --bg: #fbf8f1;
  --surface: #ffffff;
  --tint: #f1ede1;
  --tint-2: #e8e3d2;
  --ink: #1f2418;
  --muted: #4c5241;
  --line: #d6d0be;
  --line-strong: #b9b19a;
  --olive: #35521f;
  --olive-deep: #263c16;
  --bronze: #7d4f0c;
  --radius: 3px;
  --measure: 68ch;
  --step: 1.5rem;
  --font-head: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.95rem, 1.4rem + 2.2vw, 2.9rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1.1vw, 1.9rem); margin-top: 2.2em; }
h3 { font-size: 1.22rem; margin-top: 1.9em; }
h4 { font-size: 1.05rem; font-family: var(--font-body); font-weight: 700; margin-top: 1.6em; }

p, ul, ol, dl, table, figure { margin: 0 0 1.15em; }

a { color: var(--olive); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--olive-deep); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--bronze);
  outline-offset: 2px;
  border-radius: 2px;
}

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

/* ---------- Skip link ---------- */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--olive-deep);
  color: #fff;
  padding: 0.7rem 1.1rem;
  z-index: 100;
  text-decoration: none;
  font-weight: 700;
}
.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
  color: #fff;
}

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

main { display: block; }

.prose { max-width: var(--measure); }

.band { padding: 2.6rem 0; border-bottom: 1px solid var(--line); }
.band:last-of-type { border-bottom: 0; }
.band-tint { background: var(--tint); }

/* ---------- Header and navigation ---------- */

.site-head {
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 50;
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-head);
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  padding: 0.3rem 0;
}
.brand:hover { color: var(--olive-deep); }
.brand-mark { flex: 0 0 auto; display: block; }
.brand-sub {
  display: block;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
  margin-top: 1px;
}

.nav-toggle {
  display: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
}

.nav-list > li { position: relative; }

.nav-list a,
.drop-toggle {
  display: block;
  font: inherit;
  font-size: 0.945rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}

.nav-list a:hover,
.drop-toggle:hover { background: var(--tint-2); color: var(--olive-deep); }

.nav-list a[aria-current="page"] {
  box-shadow: inset 0 -3px 0 var(--bronze);
  font-weight: 700;
}

.drop-toggle::after {
  content: "";
  display: inline-block;
  margin-left: 0.4rem;
  border: 4px solid transparent;
  border-top-color: currentColor;
  transform: translateY(2px);
}
.drop-toggle[aria-expanded="true"]::after { transform: translateY(-2px) rotate(180deg); }

.drop-menu {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 290px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  display: none;
}
.drop-menu.is-open { display: block; }
.drop-menu a {
  white-space: normal;
  font-size: 0.92rem;
  padding: 0.5rem 0.6rem;
}
.drop-menu .step-n {
  font-weight: 700;
  color: var(--bronze);
  font-variant-numeric: tabular-nums;
  margin-right: 0.35rem;
}

/* ---------- Hero ---------- */

.hero { padding: 3rem 0 2.4rem; border-bottom: 1px solid var(--line); }
.hero .lede {
  font-size: 1.18rem;
  color: var(--muted);
  max-width: 62ch;
}
.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--bronze);
  margin: 0 0 0.9rem;
}

/* ---------- Path list (contents-first hero) ---------- */

.path {
  list-style: none;
  counter-reset: step;
  margin: 2rem 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.path > li {
  counter-increment: step;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 3.1rem 1fr;
  gap: 0 0.9rem;
  padding: 1rem 0;
  align-items: baseline;
}
.path > li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--bronze);
  font-variant-numeric: tabular-nums;
}
.path a { font-weight: 600; font-size: 1.08rem; }
.path p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.97rem; }

/* ---------- Disclosure ---------- */

.disclosure {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 5px solid var(--bronze);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin: 2rem 0;
  max-width: var(--measure);
}
.disclosure h2, .disclosure h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-family: var(--font-body);
  font-weight: 700;
}
.disclosure p { margin: 0 0 0.7em; }
.disclosure p:last-child { margin-bottom: 0; }

.aff-note {
  font-size: 0.97rem;
  color: var(--muted);
  max-width: 62ch;
  margin: 0.55rem 0 0;
  border-left: 3px solid var(--line-strong);
  padding-left: 0.8rem;
}

/* ---------- Buttons / outbound links ---------- */

.btn {
  display: inline-block;
  font-weight: 700;
  font-size: 1rem;
  background: var(--olive);
  color: #fff;
  text-decoration: none;
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--olive-deep);
  border-radius: var(--radius);
}
.btn:hover { background: var(--olive-deep); color: #fff; text-decoration: underline; }

/* ---------- Callouts and panels ---------- */

.callout, .watch, .method, .quick {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  margin: 1.8rem 0;
  max-width: var(--measure);
  background: var(--surface);
}
.callout { border-left: 5px solid var(--olive); }
.watch { border-left: 5px solid var(--bronze); background: var(--tint); }
.method { background: var(--tint); border-style: dashed; }
.quick { background: var(--olive-deep); color: #f4f2e8; border-color: var(--olive-deep); }
.quick h2, .quick h3 { color: #fff; }
.quick a { color: #d9e6cb; }

.callout > :first-child, .watch > :first-child,
.method > :first-child, .quick > :first-child { margin-top: 0; }
.callout > :last-child, .watch > :last-child,
.method > :last-child, .quick > :last-child { margin-bottom: 0; }

.panel-title {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bronze);
  margin: 0 0 0.6rem;
}
.quick .panel-title { color: #cbdcb4; }

/* ---------- Lists ---------- */

.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: 0.5em; }

.checklist { list-style: none; padding-left: 0; }
.checklist li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.75em;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid var(--olive);
  border-radius: 2px;
}

.steps { counter-reset: proc; list-style: none; padding-left: 0; }
.steps > li {
  counter-increment: proc;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.3em;
}
.steps > li::before {
  content: counter(proc);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.1rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--olive);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 50%;
}

dl.defs { margin: 1.5rem 0; }
dl.defs dt {
  font-weight: 700;
  font-family: var(--font-head);
  font-size: 1.1rem;
  margin-top: 1.2em;
  color: var(--olive-deep);
}
dl.defs dd { margin: 0.3em 0 0; padding-left: 0; color: var(--muted); }

/* ---------- Tables ---------- */

.table-scroll {
  overflow-x: auto;
  margin: 1.6rem 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
  margin: 0;
  min-width: 520px;
}
caption {
  text-align: left;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.7rem 0.9rem;
  background: var(--tint);
  border-bottom: 1px solid var(--line-strong);
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
thead th {
  background: var(--tint-2);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
tbody th { font-weight: 700; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

/* ---------- Pros and cons ---------- */

.twocol {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  margin: 1.7rem 0;
  max-width: var(--measure);
}
.twocol > div {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  background: var(--surface);
}
.twocol h3 { margin-top: 0; font-size: 1.05rem; }
.twocol ul { margin-bottom: 0; }

/* ---------- FAQ accordion ---------- */

.faq { max-width: var(--measure); margin: 1.6rem 0; }
.faq details {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  margin-bottom: 0.7rem;
  background: var(--surface);
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.9rem 1.1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--font-head);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--bronze);
  flex: 0 0 auto;
}
.faq details[open] summary::after { content: "\2212"; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq .faq-body { padding: 0.95rem 1.1rem 0.2rem; }

/* ---------- Content page layout with contents rail ---------- */

.page-grid { display: block; }
.toc { margin: 2rem 0; }
.toc-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bronze);
  margin: 0 0 0.6rem;
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
.toc li { border-bottom: 1px solid var(--line); margin: 0; }
.toc a {
  display: block;
  padding: 0.45rem 0;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--muted);
}
.toc a:hover { color: var(--olive-deep); text-decoration: underline; }

/* ---------- Step ribbon ---------- */

.ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  align-items: baseline;
  font-size: 0.86rem;
  color: var(--muted);
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0 0 2rem;
}
.ribbon strong { color: var(--bronze); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.74rem; }

.nextprev {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 3rem 0 0;
  padding-top: 1.6rem;
  border-top: 2px solid var(--ink);
  max-width: var(--measure);
}
.nextprev a {
  display: block;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  text-decoration: none;
  background: var(--surface);
}
.nextprev a:hover { background: var(--tint); }
.nextprev span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bronze);
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.nextprev strong { font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; color: var(--ink); }

/* ---------- Decorative figure ---------- */

.fig {
  margin: 2rem 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.2rem;
  max-width: var(--measure);
}
.fig figcaption {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.8rem;
}

/* ---------- Related reading ---------- */

.related { max-width: var(--measure); }
.related ul { list-style: none; padding: 0; }
.related li {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0;
}
.related a { font-weight: 600; }
.related span { display: block; color: var(--muted); font-size: 0.93rem; }

/* ---------- Footer ---------- */

.site-foot {
  background: var(--tint);
  border-top: 2px solid var(--ink);
  padding: 2.6rem 0 3rem;
  font-size: 0.95rem;
  margin-top: 3rem;
}
.foot-name {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.15rem;
}
.publisher { margin: 0 0 1.1rem; max-width: 60ch; }
.publisher span { display: block; }
.foot-links { margin: 0 0 1.1rem; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem 0.1rem; }
.foot-links li::after { content: "\00b7"; margin: 0 0.5rem; color: var(--line-strong); }
.foot-links li:last-child::after { content: ""; margin: 0; }
.trademark, .reviewed {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 78ch;
  margin: 0 0 0.7rem;
}
.reviewed { margin-bottom: 0; }

/* ---------- Responsive ---------- */

@media (min-width: 640px) {
  .twocol { grid-template-columns: 1fr 1fr; }
  .nextprev { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1000px) {
  .page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 232px;
    gap: 3rem;
    align-items: start;
  }
  .toc {
    position: sticky;
    top: 96px;
    margin: 0;
  }
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--surface);
    border-bottom: 2px solid var(--ink);
    border-top: 1px solid var(--line);
    padding: 0.6rem 20px 1.1rem;
  }
  .site-nav.is-open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-list > li { border-bottom: 1px solid var(--line); }
  .nav-list > li:last-child { border-bottom: 0; }
  .nav-list a, .drop-toggle { padding: 0.75rem 0.2rem; width: 100%; text-align: left; }
  .drop-menu {
    position: static;
    display: none;
    border: 0;
    border-left: 3px solid var(--tint-2);
    border-radius: 0;
    min-width: 0;
    margin: 0 0 0.6rem 0.4rem;
    padding: 0;
  }
  .drop-menu.is-open { display: block; }
}

@media print {
  .site-head, .nav-toggle, .toc { display: none; }
  body { background: #fff; }
}
