/* SFT Studio Pro · User Manual
   Palette: purple / light grey / cream · Typeface: Playfair Display */

:root {
  --cream: #f6f1e6;
  --cream-deep: #eee8d9;
  --paper: #fdfbf4;

  --grey-050: #f2eff5;
  --grey-100: #e9e4ee;
  --grey-300: #cfc7dc;

  --purple-300: #b7a3d6;
  --purple-500: #6d46a8;
  --purple-700: #4b2e7c;
  --purple-900: #2c1b45;

  --ink: #38303f;
  --ink-soft: #6d6580;

  --shadow: 0 32px 64px rgba(44, 27, 69, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -10%, #faf6ec 0%, transparent 60%),
    linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  color: var(--ink);
  padding: clamp(1rem, 4vw, 3.5rem) 1rem;
}

/* ---------- Paper sheet ---------- */

.page {
  max-width: 900px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid rgba(75, 46, 124, 0.10);
  outline: 1px solid rgba(75, 46, 124, 0.05);
  outline-offset: 6px;
  box-shadow: var(--shadow);
  padding: clamp(2rem, 5vw, 4rem) clamp(1.25rem, 5vw, 4rem);
  position: relative;
}

.page::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--purple-700), var(--purple-300), var(--purple-700));
}

/* ---------- Masthead (ToC) ---------- */

.masthead {
  text-align: center;
}

.masthead__brand {
  margin: 0 0 1.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--purple-500);
}

.masthead__title {
  margin: 0;
  font-size: clamp(2.4rem, 6.5vw, 3.9rem);
  font-weight: 700;
  line-height: 1.08;
  color: var(--purple-900);
}

.masthead__subtitle {
  margin: 0.9rem 0 0;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  font-style: italic;
  color: var(--ink-soft);
}

.masthead__desc {
  margin: 1.2rem auto 0;
  max-width: 38rem;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.7;
  color: var(--ink-soft);
}

.masthead__rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin: 1.75rem auto 1.5rem;
  max-width: 340px;
}

.masthead__line {
  flex: 1;
  height: 1px;
  background: var(--purple-300);
}

.masthead__diamond {
  width: 8px;
  height: 8px;
  background: var(--purple-500);
  transform: rotate(45deg);
  flex: none;
}

.masthead__toc {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--purple-700);
}

/* ---------- Table of contents ---------- */

.toc {
  margin-top: 2.75rem;
}

.toc__list,
.toc__children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc__group + .toc__group {
  margin-top: 1.35rem;
}

.toc__children {
  padding-left: 1.9rem;
  margin-top: 0.15rem;
}

.toc__row {
  display: flex;
  align-items: baseline;
  text-decoration: none;
  color: inherit;
  padding: 0.42rem 0.9rem;
  margin: 0 -0.9rem;
  border-radius: 6px;
  transition: background-color 160ms ease;
}

.toc__row:hover {
  background-color: var(--grey-050);
}

.toc__row:focus-visible {
  outline: 2px solid var(--purple-500);
  outline-offset: 2px;
}

.toc__row--part {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--purple-700);
}

.toc__row--part .toc__page {
  font-weight: 600;
  color: var(--purple-500);
}

.toc__row--child {
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink);
}

.toc__leader {
  flex: 1 1 auto;
  min-width: 1.75rem;
  margin: 0 0.65rem;
  border-bottom: 2px dotted var(--grey-300);
  transform: translateY(-0.28em);
}

.toc__page {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: right;
}

/* ---------- Content page chrome ---------- */

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--grey-100);
}

.topline__brand {
  font-size: 0.75rem;
  font-style: italic;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--purple-500);
}

.topline a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--purple-700);
  text-decoration: none;
}

.topline a:hover {
  text-decoration: underline;
}

.doc-head {
  margin-bottom: 2rem;
}

.doc-head__kicker {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-style: italic;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--purple-500);
}

.doc-head h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--purple-900);
}

.doc__section {
  scroll-margin-top: 1.5rem;
}

.doc h2 {
  margin: 2.4rem 0 0.75rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--purple-700);
}

.doc h2:first-of-type {
  margin-top: 0;
}

.doc h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--purple-700);
}

.doc p {
  margin: 0.8rem 0;
  font-size: 1.02rem;
  line-height: 1.75;
}

.doc ul,
.doc ol {
  margin: 0.8rem 0;
  padding-left: 1.5rem;
  font-size: 1.02rem;
  line-height: 1.75;
}

.doc li + li {
  margin-top: 0.35rem;
}

.doc strong {
  color: var(--purple-900);
}

.doc hr {
  margin: 2.5rem auto;
  border: none;
  border-top: 1px solid var(--grey-100);
}

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

.table-scroll {
  overflow-x: auto;
  margin: 1.1rem 0 1.5rem;
  border: 1px solid var(--grey-100);
  border-radius: 8px;
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
  line-height: 1.5;
  background: var(--paper);
}

.table-scroll th {
  background: var(--grey-050);
  color: var(--purple-700);
  font-weight: 700;
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 2px solid var(--purple-300);
  white-space: nowrap;
}

.table-scroll td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--grey-100);
  vertical-align: top;
}

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

.table-scroll tr:hover td {
  background: var(--grey-050);
}

/* ---------- Prev / next navigation ---------- */

.pagenav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--grey-100);
}

.pagenav a {
  display: inline-block;
  padding: 0.6rem 1rem;
  border: 1px solid var(--grey-300);
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--purple-700);
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.pagenav a:hover {
  background: var(--grey-050);
  border-color: var(--purple-300);
}

.pagenav__toc {
  text-align: center;
}

.pagenav__next {
  text-align: right;
  justify-self: end;
}

.pagenav__spacer {
  visibility: hidden;
}

/* ---------- Colophon ---------- */

.colophon {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--grey-100);
  text-align: center;
}

.colophon p {
  margin: 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-soft);
}

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

@media (max-width: 640px) {
  .toc__children {
    padding-left: 1.05rem;
  }

  .toc__row--part {
    font-size: 1.05rem;
  }

  .toc__row--child {
    font-size: 0.95rem;
  }

  .pagenav {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .pagenav__next {
    justify-self: stretch;
  }

  .pagenav__spacer {
    display: none;
  }
}