/* ==========================================================================
   The Revenue House — house ledger stylesheet
   Editorial boutique system · Fraunces display / Inter UI
   Warm ivory ground, deep forest accent, oxblood detail, hairline structure
   ========================================================================== */

/* ---- Design tokens ---- */

:root {
  /* Colour */
  --bg:              #FAF6EF;
  --bg-deep:         #F3EDE2;
  --surface:         #FFFFFF;
  --surface-inverse: #17251E;
  --text-1:          #1C1A17;
  --text-2:          #4A463F;
  --text-3:          #6E675C;   /* warm meta grey, darkened from #837D72 for AA at small sizes */
  --accent:          #1E4D3B;
  --accent-hover:    #163B2D;
  --accent-soft:     #E4EBE4;
  --oxblood:         #7A2E2E;
  --border:          #E3DCCF;
  --border-strong:   #CFC6B4;
  --inv-text:        #F6F1E7;
  --inv-muted:       #A8B3AC;
  --inv-border:      rgba(246, 241, 231, .14);

  --shadow-card:  0 1px 2px rgba(28,26,23,.05), 0 8px 24px rgba(28,26,23,.06);
  --shadow-hover: 0 2px 4px rgba(28,26,23,.06), 0 16px 40px rgba(28,26,23,.10);
  --radius-card:  12px;
  --radius-btn:   999px;

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sans:    "Inter", -apple-system, "Segoe UI", sans-serif;

  --fs-h1:   clamp(2.75rem, 2rem + 3.5vw, 4.5rem);
  --fs-h2:   clamp(2rem, 1.6rem + 1.8vw, 3rem);
  --fs-h3:   1.5rem;
  --fs-lead: 1.25rem;
  --fs-body: 1.0625rem;
  --fs-ui:   0.9375rem;
  --fs-meta: 0.8125rem;

  /* Layout */
  --measure:         1120px;
  --measure-text:    720px;
  --gutter:          24px;
  --section-y:       96px;
  --masthead-h:      72px;
}

@media (max-width: 60em) { :root { --section-y: 64px; } }
@media (max-width: 40em) { :root { --section-y: 48px; --masthead-h: 60px; } }

/* ---- Reset & base ---- */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  color: var(--text-1);
  margin: 0 0 1rem;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-h2); line-height: 1.12; letter-spacing: -0.015em; }
h3 { font-size: var(--fs-h3); line-height: 1.3;  letter-spacing: -0.01em; }
h4 { font-size: 1.125rem;     line-height: 1.35; letter-spacing: -0.01em; }

h1 em, h2 em {
  font-style: italic;
  font-weight: 400;
  color: inherit;
}

p, ul, ol, table { margin: 0 0 1rem; }

strong { color: var(--text-1); font-weight: 600; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 160ms ease;
}

a:hover { color: var(--accent-hover); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection { background: var(--accent-soft); color: var(--text-1); }

address { font-style: normal; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ---- Folio jump (bypass link) ---- */

.foliojump {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--fs-ui);
}

.foliojump:focus { left: 0; color: var(--bg); }

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

.folio {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.readmatter { max-width: 65ch; }

.readmatter > *:first-child { margin-top: 0; }

section { padding-block: var(--section-y); }

.subdued { color: var(--text-2); }

/* ---- Ledger line (eyebrow rule) ---- */

.ledgerline {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

/* editorial header: eyebrow left, hairline running right */
.folio-head .ledgerline::after,
.subbrief .ledgerline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 2rem;
}

.inkwell .ledgerline { color: var(--inv-muted); }

/* ---- Masthead / nav ---- */

.ledgerhead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 246, 239, .85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
}

.ledgerhead.is-ruled { border-bottom-color: var(--border); }

.ledgerhead .folio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--masthead-h);
}

/* ---- House mark lockup ---- */

.housemark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--text-1);
  white-space: nowrap;
}

.housemark:hover { color: var(--text-1); }

.housemark-glyph {
  flex: none;
  color: var(--accent);
  display: block;
}

.housemark-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  font-size: 1.3125rem;
  letter-spacing: -0.01em;
  line-height: 1;
  padding-top: 1px; /* optical baseline alignment with the mark */
}

.housemark-name em {
  font-style: italic;
  font-weight: 400;
}

/* ---- Docket navigation ---- */

.docket-latch {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-1);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  line-height: 0;
  transition: border-color 160ms ease;
}

.docket-latch:hover { border-color: var(--accent); color: var(--accent); }

.docketnav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 2rem);
  margin: 0;
  padding: 0;
}

.docketnav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: var(--fs-ui);
  font-weight: 500;
  padding: 0.35rem 0;
  transition: color 160ms ease;
}

.docketnav a:hover { color: var(--text-1); }

.docketnav a[aria-current="page"] {
  color: var(--text-1);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
  text-underline-offset: 6px;
}

.docketnav .docket-summons {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 20px;
  background: var(--accent);
  color: #FAF6EF;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  text-decoration: none;
  transition: background-color 160ms ease, transform 160ms ease;
}

.docketnav .docket-summons:hover {
  background: var(--accent-hover);
  color: #FAF6EF;
  transform: translateY(-1px);
}

@media (max-width: 47em) {
  .docket-latch { display: inline-flex; }

  .docketnav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    display: none;
    z-index: 90;
  }

  .docketnav.is-open { display: block; }

  .docketnav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0 1.25rem;
  }

  .docketnav li { border-top: 1px solid var(--border); }
  .docketnav li:first-child { border-top: 0; }

  .docketnav a {
    display: block;
    padding: 0.9rem var(--gutter);
  }

  .docketnav a[aria-current="page"] {
    text-decoration: none;
    border-left: 2px solid var(--accent);
    padding-left: calc(var(--gutter) - 2px);
  }

  .docketnav .docket-summons {
    display: inline-flex;
    justify-content: center;
    margin: 0.9rem var(--gutter) 0;
  }
}

/* ---- Summons (calls to action) ---- */

.summons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px;
  font-family: var(--font-sans);
  font-size: var(--fs-ui);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  transition: background-color 160ms ease, color 160ms ease,
              border-color 160ms ease, transform 160ms ease;
}

.summons-filled {
  background: var(--accent);
  color: #FAF6EF;
}

.summons-filled:hover {
  background: var(--accent-hover);
  color: #FAF6EF;
  transform: translateY(-1px);
}

.summons-outline {
  background: transparent;
  color: var(--text-1);
  border-color: var(--border-strong);
}

.summons-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.summons-rank {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin: 1.75rem 0 0;
}

.summons-footnote {
  font-size: var(--fs-meta);
  color: var(--text-3);
  margin-top: 1rem;
}

/* Text link with travelling tick */
.onward {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: var(--fs-ui);
  color: var(--accent);
  text-decoration: none;
}

.onward-tick {
  display: inline-block;
  transition: transform 160ms ease;
}

.onward:hover { color: var(--accent-hover); }
.onward:hover .onward-tick { transform: translateX(4px); }

/* ---- Brief band (opening statement) ---- */

.briefband {
  padding-block: clamp(3.5rem, 8vw, 6rem) clamp(4rem, 9vw, 7rem);
}

.briefband-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}

.briefband h1 { max-width: 17ch; margin-bottom: 1.5rem; }

.briefband p.standfirst,
.subbrief p.standfirst {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 560px;
  margin-bottom: 0;
}

@media (max-width: 55em) {
  .briefband-columns { grid-template-columns: 1fr; }
  .briefband-plate { max-width: 32rem; }
}

/* Sub-page brief: shorter, editorial, hairline base */
.subbrief {
  padding-block: clamp(3rem, 6vw, 5rem) clamp(3rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--border);
}

.subbrief h1 { max-width: 22ch; margin-bottom: 1.25rem; }

/* Matted plate — figures are always mounted, never raw */
.plate {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

.plate .plate-face {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.plate svg { display: block; width: 100%; height: auto; }

/* ---- Section rhythm ---- */

.vellum { background: var(--bg-deep); }

.vellum .plate { background: var(--surface); }

.folio-head {
  max-width: 46rem;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.folio-head h2 { max-width: 20ch; }

/* .folio-head applied directly to an h2 */
h2.folio-head { margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }

.folio-head p {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text-2);
  margin-bottom: 0;
}

/* ---- Counsel cards & tallies ---- */

.tally-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.tally-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.tally-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (max-width: 55em) {
  .tally-3, .tally-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 38em) {
  .tally-2, .tally-3, .tally-4 { grid-template-columns: 1fr; }
}

.counsel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: clamp(1.5rem, 3vw, 2rem);
  transition: box-shadow 200ms ease-out, transform 200ms ease-out;
}

.counsel-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.counsel-card h3 { margin-top: 1rem; margin-bottom: 0.6rem; }

.counsel-card > p:last-child, .counsel-card > ul:last-child { margin-bottom: 0; }

.counsel-card .counsel-glyph { color: var(--accent); display: block; }

.counsel-card > a:last-child {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.counsel-card > a:last-child:hover { color: var(--accent-hover); }

/* ---- Remit panels ---- */

.remit {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: start;
}

@media (max-width: 55em) {
  .remit { grid-template-columns: 1fr; }
}

.remit-roll {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.remit-roll li {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.remit-roll li:last-child { border-bottom: 1px solid var(--border); }

.remit-roll strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  color: var(--text-1);
  margin-bottom: 0.15rem;
}

.remit-roll span { color: var(--text-2); font-size: var(--fs-ui); line-height: 1.6; }

/* ---- Sequence (numbered method run) ---- */

.sequence {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sequence-figure {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  font-variant-numeric: lining-nums;
  font-size: 2.75rem;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.sequence-item h3 { margin-bottom: 0.4rem; }
.sequence-item p { color: var(--text-2); font-size: var(--fs-ui); margin-bottom: 0; }

.counsel-card .sequence-figure { font-size: 2.25rem; margin-bottom: 0.5rem; }

/* ---- Tick points ---- */

.tickpoints {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.tickpoints li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.75rem;
}

.tickpoints li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 1rem;
  height: 0.5rem;
  border-left: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(-50deg) scale(0.82);
  transform-origin: center;
}

/* ---- Docket panels (structured detail) ---- */

.docket-panel { padding-top: 1.75rem; }

.docket-panel .docket-flag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-btn);
  padding: 0.3rem 0.85rem;
  margin-bottom: 1rem;
}

.docket-panel h3 { margin-top: 0.25rem; }

.docket-panel dl { margin: 1.25rem 0 0; }

.docket-panel dt {
  font-weight: 600;
  font-size: var(--fs-meta);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.docket-panel dt:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

.docket-panel dd {
  margin: 0.3rem 0 0;
  color: var(--text-2);
  font-size: var(--fs-ui);
  line-height: 1.6;
}

/* ---- Inkwell band (closing address) ---- */

.inkwell {
  background: var(--surface-inverse);
  color: var(--inv-text);
}

.inkwell h1, .inkwell h2, .inkwell h3, .inkwell h4 { color: var(--inv-text); }
.inkwell p { color: var(--inv-text); }
.inkwell .subdued { color: var(--inv-muted); }
.inkwell strong { color: var(--inv-text); }
.inkwell a { color: var(--inv-text); }
.inkwell a:hover { color: #FFFFFF; }
.inkwell .summons-footnote { color: var(--inv-muted); }
.inkwell hr { border-top-color: var(--inv-border); }

/* the one gradient on the site */
.closing-address {
  background: radial-gradient(120% 140% at 50% 0%, #1E332A 0%, #17251E 62%);
  text-align: center;
}

.closing-address .ledgerline { justify-content: center; }
.closing-address .ledgerline::after { content: none; }

.closing-address h2 { max-width: 24ch; margin-inline: auto; }

.closing-address p {
  max-width: 52ch;
  margin-inline: auto;
}

.closing-address .summons-rank { justify-content: center; }

.inkwell .summons-filled {
  background: #FAF6EF;
  color: var(--accent);
}

.inkwell .summons-filled:hover {
  background: #FFFFFF;
  color: var(--accent-hover);
}

.inkwell .summons-outline {
  color: var(--inv-text);
  border-color: rgba(246, 241, 231, .35);
}

.inkwell .summons-outline:hover {
  border-color: var(--inv-text);
  color: #FFFFFF;
  background: rgba(246, 241, 231, .06);
}

/* ---- Ledger foot ---- */

.ledgerfoot {
  background: var(--surface-inverse);
  color: var(--inv-muted);
  font-size: 0.875rem;
  padding-block: 4.5rem 2.5rem;
}

.ledgerfoot-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
}

@media (max-width: 55em) {
  .ledgerfoot-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 38em) {
  .ledgerfoot-columns { grid-template-columns: 1fr; gap: 2rem; }
}

.ledgerfoot-mark .housemark {
  color: var(--inv-text);
  margin-bottom: 1rem;
}

.ledgerfoot-mark .housemark-glyph { color: var(--inv-text); }

.ledgerfoot-mark .housemark-name { font-size: 1.25rem; }

.ledgerfoot-mark p { max-width: 34ch; }

.ledgerfoot h2 {
  color: var(--inv-text);
  font-family: var(--font-sans);
  font-variation-settings: normal;
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}

.ledgerfoot p { color: var(--inv-muted); }

.ledgerfoot address { color: var(--inv-muted); line-height: 1.7; }

.ledgerfoot ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ledgerfoot li { margin-bottom: 0.6rem; }

.ledgerfoot a {
  color: var(--inv-muted);
  text-decoration: none;
  transition: color 160ms ease;
}

.ledgerfoot a:hover { color: var(--inv-text); }

.ledgerfoot-mark .housemark:hover .housemark-name { color: #FFFFFF; }

.ledgerfoot-record {
  border-top: 1px solid var(--inv-border);
  padding-top: 1.75rem;
  font-size: var(--fs-meta);
  color: var(--inv-muted);
}

.ledgerfoot-record p { margin-bottom: 0.4rem; color: var(--inv-muted); }

.ledgerfoot-record a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ==========================================================================
   Memorandum pages (privacy / terms / cookies)
   The policies are set as board memoranda: a masthead, numbered items, and
   three fixed rubrics inside each item.
   ========================================================================== */

.memo-head {
  padding-block: clamp(3rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
}

.memo-head h1 { max-width: 22ch; }

.memo-head .ledgerline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 2rem;
}

.memo-head p.memo-stamp {
  color: var(--text-3);
  font-size: var(--fs-meta);
  margin: 0;
  max-width: 72ch;
}

/* Masthead block: To / From / Subject / Standing */
.memo-masthead {
  margin: 2rem 0 0;
  max-width: 68ch;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  padding: 1.25rem 0 1.1rem;
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  column-gap: 1.5rem;
  row-gap: 0.55rem;
}

.memo-masthead dt {
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.6;
}

.memo-masthead dd {
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-ui);
  line-height: 1.6;
}

@media (max-width: 38em) {
  .memo-masthead { grid-template-columns: 1fr; row-gap: 0.15rem; }
  .memo-masthead dd { margin-bottom: 0.6rem; }
}

.memo-body { padding-block: 3rem var(--section-y); }

.memo-body .readmatter { max-width: 68ch; }

.memo-body li { margin-bottom: 0.5rem; }

.memo-body [id] { scroll-margin-top: calc(var(--masthead-h) + 1.5rem); }

/* A single numbered memo item */
.memo-item {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  margin-top: 3.25rem;
  max-width: 68ch;
  scroll-margin-top: calc(var(--masthead-h) + 1.5rem);
}

.memo-item:first-of-type { margin-top: 0; }

.memo-item > h2 {
  font-size: 1.75rem;
  margin-bottom: 1.25rem;
  scroll-margin-top: calc(var(--masthead-h) + 1.5rem);
}

.memo-item-ref {
  display: block;
  font-family: var(--font-sans);
  font-variation-settings: normal;
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--oxblood);
  margin-bottom: 0.5rem;
}

/* The three rubrics inside an item */
.memo-turn { margin-bottom: 1.5rem; }

.memo-turn:last-child { margin-bottom: 0; }

.memo-rubric {
  font-family: var(--font-sans);
  font-variation-settings: normal;
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 0.5rem;
  scroll-margin-top: calc(var(--masthead-h) + 1.5rem);
}

.memo-turn-owed {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
  background: linear-gradient(90deg, var(--accent-soft) 0%, transparent 70%);
  padding-block: 0.9rem;
  padding-right: 1rem;
  border-radius: 0 6px 6px 0;
}

.memo-turn-owed .memo-rubric { color: var(--accent); }

.memo-turn-owed > *:last-child { margin-bottom: 0; }

.memo-item h4 {
  font-size: 1.0625rem;
  margin-top: 1.4rem;
  margin-bottom: 0.4rem;
  scroll-margin-top: calc(var(--masthead-h) + 1.5rem);
}

/* Index of items */

.memo-index {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 3rem;
  max-width: 68ch;
}

.memo-index h2 {
  margin: 0 0 1rem;
  border-top: 0;
  padding-top: 0;
  font-family: var(--font-sans);
  font-variation-settings: normal;
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.memo-index ol {
  margin: 0;
  padding-left: 1.4rem;
  columns: 2;
  column-gap: 2.5rem;
}

@media (max-width: 38em) {
  .memo-index ol { columns: 1; }
}

.memo-index li {
  margin-bottom: 0.45rem;
  font-size: var(--fs-ui);
  break-inside: avoid;
}

.memo-index a {
  text-decoration: none;
  color: var(--text-2);
}

.memo-index a:hover { color: var(--accent); text-decoration: underline; }

/* ---- Tally tables ---- */

.tally-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-ui);
  min-width: 34rem;
}

caption {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  font-size: 1.0625rem;
  padding: 1rem 1.25rem 0.35rem;
  color: var(--text-1);
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.8rem 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-2);
}

thead th {
  border-top: none;
  background: var(--bg-deep);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---- Return to head of folio ---- */

.folio-return {
  display: inline-block;
  margin-top: 3rem;
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.folio-return:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
