/* ============================================================
   Site stylesheet
   Palette: ink indigo field, brass rules, parchment data insets
   ============================================================ */

:root {
  --ink:        #121D3B;
  --ink-deep:   #0B1428;
  --ink-raise:  #1A2650;
  --brass:      #C79A45;
  --brass-dim:  #8C6C2F;
  --text:       #E4E7F0;
  --muted:      #97A1BC;
  --paper:      #EFEADF;
  --paper-rule: #CFC6B2;
  --paper-ink:  #21283C;
  --up:         #3F8F62;
  --down:       #B8543F;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --rule: 1px solid rgba(199, 154, 69, 0.28);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.68;
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; margin: 0 0 0.5em; }

h1 {
  font-family: "Bodoni Moda", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.012em;
}

h2 {
  font-family: "Bodoni Moda", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  letter-spacing: -0.008em;
  margin-top: 2.6rem;
}

h3 {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-top: 2rem;
  color: var(--brass);
}

p, li { max-width: var(--measure); }
p { margin: 0 0 1.1rem; }

a { color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #E0BC72; }

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

.wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute; left: -9999px;
  background: var(--brass); color: var(--ink-deep);
  padding: 0.6rem 1rem; z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- masthead ---------- */

.masthead {
  border-bottom: var(--rule);
  background: var(--ink-deep);
  position: sticky; top: 0; z-index: 50;
}

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

.wordmark {
  font-family: "Bodoni Moda", Georgia, serif;
  font-size: 1.4rem; letter-spacing: 0.08em;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.wordmark:hover { color: var(--brass); }
.wordmark span { color: var(--brass); }

.nav ul {
  display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0;
  flex-wrap: wrap;
}
.nav a {
  color: var(--muted); text-decoration: none; font-size: 0.9375rem;
  padding: 0.35rem 0; display: inline-block;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--brass); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--brass-dim);
  color: var(--text); padding: 0.45rem 0.7rem; font: inherit; font-size: 0.875rem;
  cursor: pointer; border-radius: 2px;
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; width: 100%; order: 3;
    border-top: var(--rule); padding: 0.75rem 0 1rem;
  }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; gap: 0.25rem; }
  .nav a { padding: 0.5rem 0; font-size: 1rem; }
  .masthead__inner { flex-wrap: wrap; }
}

/* ---------- hero ---------- */

.hero { padding: clamp(3.5rem, 9vw, 7rem) 0 0; }
.hero h1 { max-width: 16ch; }
.hero__lede {
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  color: var(--muted); max-width: 56ch; margin-top: 1.5rem;
}

.hero__rule {
  height: 2px; background: var(--brass); margin: 2.5rem 0 0;
  transform-origin: left center;
  animation: draw 900ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- section index (home) ---------- */

.index { margin: 0 0 4.5rem; }
.index__row {
  display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr);
  gap: 0.35rem 2rem; align-items: baseline;
  padding: 1.4rem 0; border-bottom: var(--rule);
  text-decoration: none; color: inherit;
}
.index__row:first-child { border-top: var(--rule); }
.index__row:hover { background: rgba(199, 154, 69, 0.06); }
.index__row:hover .index__name { color: var(--brass); }
.index__name {
  font-family: "Bodoni Moda", Georgia, serif; font-size: 1.5rem;
  line-height: 1.2; color: var(--text);
}
.index__desc { color: var(--muted); font-size: 0.9688rem; margin: 0; max-width: 52ch; }

@media (max-width: 640px) {
  .index__row { grid-template-columns: 1fr; }
}

/* ---------- content pages ---------- */

.page { padding: clamp(2.5rem, 6vw, 4.5rem) 0 1rem; }
.page h1 { max-width: 18ch; }
.page__lede { color: var(--muted); max-width: 58ch; font-size: 1.125rem; margin-top: 1.25rem; }

.layout {
  display: grid; grid-template-columns: 15rem minmax(0, 1fr);
  gap: 3.5rem; align-items: start;
  padding: 2.5rem 0 5rem;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 1.5rem; }
}

.toc { position: sticky; top: 88px; border-top: var(--rule); padding-top: 1rem; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 0.55rem; max-width: none; }
.toc a { color: var(--muted); text-decoration: none; font-size: 0.9063rem; }
.toc a:hover { color: var(--brass); }
@media (max-width: 900px) { .toc { position: static; } }

.prose > h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.15rem; margin: 0 0 1.25rem; }
.prose li { margin-bottom: 0.45rem; }
.prose strong { color: #F3F5FA; font-weight: 600; }

.callout {
  border-left: 2px solid var(--brass);
  padding: 0.35rem 0 0.35rem 1.15rem;
  margin: 1.75rem 0; color: var(--muted);
}

/* ---------- parchment: data + tools ---------- */

.ledger {
  background: var(--paper); color: var(--paper-ink);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin: 2rem 0; border-radius: 2px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.35);
}
.ledger h3 { color: var(--paper-ink); margin-top: 0; }
.ledger p { color: #3A4358; }
.ledger a { color: #7A5A17; }

table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
.ledger th, .ledger td {
  text-align: left; padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--paper-rule); vertical-align: top;
}
.ledger th { font-weight: 600; font-size: 0.8438rem; color: #5A6174; }
.ledger td.num, .ledger th.num {
  text-align: right; padding-right: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.up { color: var(--up); }
.down { color: var(--down); }

.table-scroll { overflow-x: auto; }

/* ---------- forms / calculators ---------- */

.calc { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.8438rem; font-weight: 600; color: #5A6174; }
.field input, .field select {
  font: inherit; font-size: 0.9375rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--paper-rule); background: #FBF9F4;
  color: var(--paper-ink); border-radius: 2px;
}
.field input:focus, .field select:focus { border-color: var(--brass-dim); }

.result {
  margin-top: 1.75rem; padding-top: 1.25rem;
  border-top: 1px solid var(--paper-rule);
  display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.result div { max-width: none; }
.result dt { font-size: 0.8125rem; color: #5A6174; font-weight: 600; margin-bottom: 0.25rem; }
.result dd {
  margin: 0; font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1.375rem; font-variant-numeric: tabular-nums;
}

.note { font-size: 0.8438rem; color: #5A6174; margin-top: 1.25rem; }

/* ---------- contact form (on ink) ---------- */

.form-ink { max-width: 34rem; display: grid; gap: 1rem; margin-top: 2rem; }
.form-ink label { font-size: 0.8438rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: 0.35rem; }
.form-ink input, .form-ink textarea {
  font: inherit; width: 100%; padding: 0.65rem 0.75rem;
  background: var(--ink-raise); border: 1px solid rgba(199,154,69,0.3);
  color: var(--text); border-radius: 2px;
}
.form-ink textarea { min-height: 8rem; resize: vertical; }
.btn {
  font: inherit; font-weight: 600; font-size: 0.9375rem;
  background: var(--brass); color: var(--ink-deep);
  border: none; padding: 0.7rem 1.4rem; border-radius: 2px;
  cursor: pointer; justify-self: start;
}
.btn:hover { background: #E0BC72; }

/* ---------- briefings ---------- */

.brief { border-top: var(--rule); padding: 1.75rem 0; }
.brief__date {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8125rem; color: var(--brass); margin-bottom: 0.4rem;
}
.brief h3 { margin-top: 0; color: var(--text); font-size: 1.25rem; font-family: "Bodoni Moda", Georgia, serif; font-weight: 400; }

.empty {
  border: 1px dashed rgba(199,154,69,0.4); padding: 2rem;
  color: var(--muted); border-radius: 2px;
}

/* ---------- footer ---------- */

.foot {
  border-top: var(--rule); background: var(--ink-deep);
  padding: 3rem 0 2.5rem; margin-top: 4rem;
  font-size: 0.875rem; color: var(--muted);
}
.foot__grid {
  display: grid; gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 2.5rem;
}
.foot h4 { color: var(--text); font-size: 0.8125rem; font-weight: 600; margin-bottom: 0.75rem; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: 0.4rem; max-width: none; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--brass); }
.foot p { max-width: none; font-size: 0.8125rem; line-height: 1.6; }

.disclosure {
  border-top: var(--rule); padding-top: 1.5rem;
  color: #7E88A4; font-size: 0.8125rem;
}
.disclosure strong { color: var(--muted); }
