/* Twofold Hearthnote — Warm Cream Paper Epistolary Stylesheet */

:root {
  --paper: #FAF7F2;
  --paper-tint: #F3EDE3;
  --ink: #2B231D;
  --ink-soft: #574B41;
  --ink-muted: #786B5F;
  --ochre: #9A4D43;
  --ochre-deep: #7B3930;
  --ochre-wash: rgba(154, 77, 67, 0.07);
  --rule: #DFD5C6;
  --rule-strong: #C8B8A2;
  --serif: "Iowan Old Style", Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background-color: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 85% 0%, rgba(154, 77, 67, 0.045) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 95%, rgba(154, 77, 67, 0.03) 0%, transparent 50%);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.74;
  font-kerning: normal;
}

a {
  color: var(--ochre);
  text-decoration-color: rgba(154, 77, 67, 0.4);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--ochre-deep);
  text-decoration-color: var(--ochre-deep);
}

/* Two-column folio layout */
.folio-frame {
  max-width: 1040px;
  margin: 0 auto;
  padding: 3.5rem 2.25rem 5.5rem;
  display: flex;
  align-items: flex-start;
  gap: 4.5rem;
}

/* Left fixed narrow index column */
.folio-rail {
  width: 224px;
  flex-shrink: 0;
  position: sticky;
  top: 2.75rem;
  padding-right: 1.5rem;
  border-right: 1px solid var(--rule);
}

.seal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 1.5rem;
}

.seal-link:hover {
  color: var(--ochre);
}

.seal-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: block;
}

.seal-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.seal-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.seal-sub {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ochre);
  margin-top: 2px;
}

.rail-section-label {
  margin: 1.5rem 0 0.55rem;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

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

.rail-nav li {
  margin: 0;
}

.rail-nav a {
  display: block;
  padding: 0.34rem 0 0.34rem 0.65rem;
  margin-left: -0.65rem;
  font-size: 0.94rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 2px solid transparent;
}

.rail-nav a:hover {
  color: var(--ochre);
}

.rail-nav a[aria-current="page"] {
  color: var(--ochre);
  font-weight: 700;
  border-left-color: var(--ochre);
  background: var(--ochre-wash);
}

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

.rail-anchors li {
  margin: 0;
}

.rail-anchors a {
  display: block;
  padding: 0.24rem 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink-muted);
  text-decoration: none;
}

.rail-anchors a:hover {
  color: var(--ochre);
  text-decoration: underline;
}

.rail-colophon {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

.rail-colophon a {
  color: var(--ink-soft);
  word-break: break-word;
}

/* Right long-form letter column */
.letter-sheet {
  flex: 1;
  min-width: 0;
  max-width: 64ch;
}

.letter-header {
  padding-bottom: 1.75rem;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--rule-strong);
}

.letter-kicker {
  margin: 0 0 0.55rem;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ochre);
}

.letter-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.85rem, 3.2vw, 2.4rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.letter-dateline {
  margin: 0;
  font-size: 0.96rem;
  font-style: italic;
  color: var(--ink-muted);
}

.letter-lead {
  font-size: 1.12rem;
  line-height: 1.78;
  color: var(--ink);
  margin: 0 0 1.65rem;
}

.letter-sheet h2 {
  margin: 2.6rem 0 0.85rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--rule);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.32;
  color: var(--ink);
  scroll-margin-top: 2rem;
}

.letter-sheet h2.no-top-rule {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.letter-sheet h3 {
  margin: 1.5rem 0 0.45rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ochre-deep);
}

.letter-sheet p {
  margin: 0 0 1.15rem;
  color: var(--ink-soft);
}

.letter-sheet p strong {
  color: var(--ink);
}

.letter-sheet ul {
  margin: 0.4rem 0 1.35rem;
  padding-left: 1.35rem;
  color: var(--ink-soft);
}

.letter-sheet li {
  margin-bottom: 0.55rem;
}

.letter-sheet li strong {
  color: var(--ink);
}

/* Epistolary margin note */
.margin-note {
  margin: 1.6rem 0;
  padding: 0.85rem 0 0.85rem 1.25rem;
  border-left: 2px solid var(--ochre);
  background: var(--ochre-wash);
  color: var(--ink);
  font-size: 0.97rem;
}

.margin-note p:last-child {
  margin-bottom: 0;
}

/* Fine-rule permission & data ledger table */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0 1.85rem;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.58;
  border-top: 1.5px solid var(--ochre);
  border-bottom: 1.5px solid var(--ochre);
}

.ledger-table thead th {
  text-align: left;
  padding: 0.7rem 0.75rem 0.65rem 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ochre);
  border-bottom: 1px solid var(--rule-strong);
  vertical-align: bottom;
}

.ledger-table tbody td {
  padding: 0.85rem 0.75rem 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
  vertical-align: top;
}

.ledger-table tbody tr:last-child td {
  border-bottom: none;
}

.ledger-table td:first-child {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  padding-right: 1.15rem;
}

/* Editorial chapter index on home letter */
.chapter-list {
  list-style: none;
  margin: 1.35rem 0 2rem;
  padding: 0;
  border-top: 1px solid var(--rule-strong);
}

.chapter-item {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--rule);
}

.chapter-num {
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--ochre);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  width: 1.8rem;
}

.chapter-body h3 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.chapter-body p {
  margin: 0 0 0.45rem;
  font-size: 0.96rem;
  color: var(--ink-soft);
}

.chapter-link {
  font-size: 0.92rem;
  font-weight: 700;
}

/* Sign-off & footer */
.letter-signoff {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-strong);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.signoff-mark {
  font-style: italic;
  color: var(--ink-soft);
}

@media (max-width: 820px) {
  .folio-frame {
    flex-direction: column;
    gap: 2rem;
    padding: 2rem 1.35rem 3.5rem;
  }

  .folio-rail {
    position: static;
    width: 100%;
    padding-right: 0;
    padding-bottom: 1.35rem;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }

  .rail-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.15rem;
  }

  .rail-nav a {
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 0.25rem 0;
    margin-left: 0;
  }

  .rail-nav a[aria-current="page"] {
    border-left-color: transparent;
    border-bottom-color: var(--ochre);
    background: none;
  }

  .rail-anchors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1rem;
  }

  .rail-colophon {
    display: none;
  }

  .ledger-table td:first-child {
    white-space: normal;
  }
}
