/* ============================================
   SIGIL - On-chain heraldry
   Illuminated manuscript stylesheet
   ============================================ */

:root {
  --vellum-dark: #0d0a07;
  --vellum-darker: #060503;
  --parchment: #f0e2c4;
  --parchment-muted: #cbbb95;
  --parchment-dim: #8d7f64;
  --crimson: #8a2f2f;
  --crimson-bright: #a84242;
  --gold: #b5883a;
  --gold-bright: #d9a64e;
  --peerage-blue: #2d4a5a;
  --peerage-blue-bright: #4a7590;
  --leather: #52493e;
  --leather-dark: #2c261f;
  --royal-green: #3b5c3d;
  --rule: rgba(240, 226, 196, 0.14);
  --panel: rgba(240, 226, 196, 0.035);
  --panel-strong: rgba(240, 226, 196, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  font-family: 'EB Garamond', 'Libre Caslon Text', Georgia, serif;
  background-color: var(--vellum-dark);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.94  0 0 0 0 0.88  0 0 0 0 0.77  0 0 0 0.08 0'/></filter><rect width='400' height='400' filter='url(%23n)'/></svg>");
  background-attachment: fixed;
  color: var(--parchment);
  line-height: 1.7;
  font-size: 1.0625rem;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Type scale ---------- */

.display-1 {
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 7.5rem;
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--parchment);
  font-weight: 700;
}

.display-2 {
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 4.5rem;
  line-height: 1;
  font-weight: 700;
}

h1, .h1 {
  font-family: 'Cinzel', serif;
  font-size: 2.75rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

h2, .h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h3, .h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

p { font-size: 1rem; line-height: 1.75; color: var(--parchment-muted); }
.small { font-size: 0.8125rem; }
.micro { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }

a { color: var(--gold); text-decoration: none; transition: color 160ms ease; }
a:hover { color: var(--gold-bright); }

.mono, code {
  font-family: 'Old Standard TT', 'Libre Caslon Text', Georgia, serif;
  font-style: italic;
  font-size: 0.9em;
  letter-spacing: 0.02em;
  color: var(--parchment-muted);
}

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

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-narrow {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---------- Navigation ---------- */

.topbar {
  border-bottom: 1px solid var(--rule);
  background: rgba(13, 10, 7, 0.9);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  max-width: 1280px;
  margin: 0 auto;
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.brandmark-seal {
  width: 36px;
  height: 36px;
}

.brandmark-text {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--parchment);
  font-weight: 600;
}

.brandmark-sub {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 0.75rem;
  color: var(--parchment-dim);
  letter-spacing: 0.04em;
  display: block;
  margin-top: 2px;
}

.topnav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.topnav a {
  padding: 0.5rem 1rem;
  color: var(--parchment-muted);
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
}

.topnav a:hover, .topnav a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: 1px solid var(--parchment);
  background: transparent;
  color: var(--parchment);
  cursor: pointer;
  transition: all 180ms ease;
  border-radius: 2px;
}

.btn:hover {
  background: var(--parchment);
  color: var(--vellum-dark);
}

.btn-primary {
  border-color: var(--crimson);
  background: var(--crimson);
  color: var(--parchment);
}
.btn-primary:hover {
  background: var(--crimson-bright);
  border-color: var(--crimson-bright);
  color: var(--parchment);
}

.btn-gold {
  border-color: var(--gold);
  color: var(--gold);
}
.btn-gold:hover {
  background: var(--gold);
  color: var(--vellum-dark);
}

.btn-ghost {
  border-color: var(--rule);
  color: var(--parchment-muted);
}
.btn-ghost:hover {
  border-color: var(--parchment);
  background: transparent;
  color: var(--parchment);
}

.btn-lg { padding: 1rem 2rem; font-size: 0.8125rem; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.6875rem; }

/* ---------- Panels ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  position: relative;
  padding: 2rem;
}

.panel-illuminated {
  position: relative;
}

.panel-illuminated::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(181, 136, 58, 0.3);
  pointer-events: none;
}

.panel-illuminated::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    linear-gradient(135deg, var(--gold) 0 10px, transparent 10px) top left / 22px 22px no-repeat,
    linear-gradient(225deg, var(--gold) 0 10px, transparent 10px) top right / 22px 22px no-repeat,
    linear-gradient(45deg, var(--gold) 0 10px, transparent 10px) bottom left / 22px 22px no-repeat,
    linear-gradient(315deg, var(--gold) 0 10px, transparent 10px) bottom right / 22px 22px no-repeat;
  opacity: 0.35;
  pointer-events: none;
}

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

.hero {
  padding: 6rem 0 5rem;
  position: relative;
  border-bottom: 1px solid var(--rule);
}

.hero-flag {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.8125rem;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: 'UnifrakturCook', serif;
  font-size: clamp(3.5rem, 9vw, 7.5rem);
  line-height: 0.95;
  color: var(--parchment);
  background: linear-gradient(180deg, #f0e2c4 0%, #b5883a 60%, #7b5d2a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem;
}

.hero-lede {
  max-width: 640px;
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--parchment-muted);
}

.hero-lede .drop-cap {
  float: left;
  font-family: 'UnifrakturCook', serif;
  font-size: 5rem;
  line-height: 0.8;
  color: var(--crimson);
  padding: 0.4rem 0.6rem 0 0;
  margin-top: 0.35rem;
}

/* ---------- Peerage stats ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 4rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.stat-cell {
  padding: 1.5rem;
  border-right: 1px solid var(--rule);
}
.stat-cell:last-child { border-right: none; }

.stat-label {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--parchment-dim);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.stat-value {
  font-family: 'Cinzel', serif;
  font-size: 2.25rem;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.stat-sub {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 0.8125rem;
  color: var(--parchment-dim);
  margin-top: 0.25rem;
}

/* ---------- Book spread ---------- */

.book-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  padding: 5rem 0;
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.book-spread::after {
  content: '';
  position: absolute;
  top: 4rem;
  bottom: 4rem;
  left: 50%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--rule) 10%, var(--rule) 90%, transparent);
}

.folio {
  position: relative;
}

.folio-number {
  position: absolute;
  top: -1rem;
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  color: var(--parchment-dim);
  font-size: 0.8125rem;
}

.folio-left .folio-number { left: 0; }
.folio-right .folio-number { right: 0; }

.drop-cap {
  float: left;
  font-family: 'UnifrakturCook', serif;
  font-size: 4.5rem;
  line-height: 0.8;
  color: var(--crimson);
  padding: 0.35rem 0.55rem 0 0;
  margin-top: 0.4rem;
}

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

.section {
  padding: 5rem 0;
  border-bottom: 1px solid var(--rule);
}

.section-label {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.24em;
  color: var(--crimson-bright);
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.section-heading {
  font-family: 'Cinzel', serif;
  font-size: 2.25rem;
  letter-spacing: 0.02em;
  color: var(--parchment);
  margin-bottom: 1.25rem;
  max-width: 720px;
}

.section-sub {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 1.125rem;
  color: var(--parchment-dim);
  max-width: 620px;
  margin-bottom: 3.5rem;
}

/* ---------- Tri-explainer ---------- */

.triptych {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
}

.triptych-panel {
  padding: 2.5rem 2rem;
  border-right: 1px solid var(--rule);
  position: relative;
}
.triptych-panel:last-child { border-right: none; }

.triptych-roman {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 0.8125rem;
  letter-spacing: 0.3em;
  margin-bottom: 1rem;
}

.triptych-title {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--parchment);
  margin-bottom: 1rem;
}

.triptych-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--parchment-muted);
}

/* ---------- Sigil card ---------- */

.sigil-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.sigil-card {
  background: var(--vellum-dark);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
  cursor: pointer;
  transition: background 160ms ease;
}

.sigil-card:hover {
  background: rgba(181, 136, 58, 0.05);
}

.sigil-card svg {
  width: 140px;
  height: 160px;
}

.sigil-card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  color: var(--parchment);
  text-align: center;
}

.sigil-card-motto {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 0.8125rem;
  color: var(--parchment-dim);
  text-align: center;
  min-height: 1.4em;
}

/* ---------- Carousel ---------- */

.carousel {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding: 2rem 0;
  scrollbar-width: thin;
}

.carousel::-webkit-scrollbar { height: 4px; }
.carousel::-webkit-scrollbar-thumb { background: var(--rule); }

.featured-card {
  flex: 0 0 260px;
  border: 1px solid var(--rule);
  padding: 1.5rem;
  background: var(--panel);
}

.featured-card .sigil-small {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

/* ---------- Forge (sigil builder) ---------- */

.forge-layout {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 0;
  min-height: calc(100vh - 90px);
  border-top: 1px solid var(--rule);
}

.forge-column {
  padding: 2rem 1.5rem;
  border-right: 1px solid var(--rule);
  overflow-y: auto;
}

.forge-column:last-child { border-right: none; }

.forge-center {
  background: radial-gradient(ellipse at center, rgba(240, 226, 196, 0.04) 0%, transparent 70%);
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2rem;
}

.forge-section-title {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.option-tile {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  transition: all 160ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 0.7rem;
  color: var(--parchment-muted);
}

.option-tile:hover {
  border-color: var(--gold);
  color: var(--parchment);
}

.option-tile.selected {
  border-color: var(--gold);
  background: rgba(181, 136, 58, 0.1);
  color: var(--gold);
}

.option-tile svg { width: 38px; height: 38px; }

.tincture-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.tincture-chip {
  aspect-ratio: 1;
  border: 1.5px solid var(--rule);
  cursor: pointer;
  position: relative;
  transition: all 140ms ease;
}

.tincture-chip.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}

.tincture-chip:hover { border-color: var(--parchment); }

.tincture-label {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 0.75rem;
  color: var(--parchment-dim);
  margin-bottom: 0.75rem;
}

.quarter-picker {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.quarter-btn {
  flex: 1;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--parchment-muted);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.quarter-btn.active {
  border-color: var(--gold);
  color: var(--gold);
}

.sigil-preview-wrap {
  background-image:
    radial-gradient(ellipse at top, rgba(240, 226, 196, 0.1) 0%, transparent 55%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n2'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='3'/><feColorMatrix values='0 0 0 0 0.94  0 0 0 0 0.88  0 0 0 0 0.77  0 0 0 0.2 0'/></filter><rect width='300' height='300' filter='url(%23n2)' opacity='0.5'/></svg>");
  background-color: rgba(240, 226, 196, 0.05);
  border: 1px solid var(--rule);
  padding: 3rem;
  position: relative;
  width: min(440px, 100%);
}

.sigil-preview-wrap::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px double rgba(181, 136, 58, 0.25);
  pointer-events: none;
}

.sigil-preview {
  width: 100%;
  aspect-ratio: 10 / 12;
  display: block;
}

.forge-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 0.625rem 0;
  color: var(--parchment);
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 1rem;
  margin-bottom: 1.25rem;
  outline: none;
}

.forge-input:focus { border-bottom-color: var(--gold); }

.forge-label {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--parchment-dim);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  display: block;
}

/* ---------- Register / Search ---------- */

.toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 280px;
  background: transparent;
  border: 1px solid var(--rule);
  padding: 0.75rem 1rem;
  color: var(--parchment);
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 1rem;
  outline: none;
}

.search-input:focus { border-color: var(--gold); }

.filter-select {
  background: transparent;
  border: 1px solid var(--rule);
  padding: 0.75rem 1rem;
  color: var(--parchment);
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
  cursor: pointer;
}

.filter-select option {
  background: var(--vellum-dark);
  color: var(--parchment);
}

/* ---------- House directory ---------- */

.houses-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
}

.house-row {
  display: grid;
  grid-template-columns: 120px 1fr 180px 140px 120px;
  gap: 1.5rem;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}

.house-row:last-child { border-bottom: none; }

.house-row:hover { background: var(--panel); }

.house-banner {
  width: 80px;
  height: 90px;
}

.house-name {
  font-family: 'Cinzel', serif;
  font-size: 1.125rem;
  letter-spacing: 0.04em;
  color: var(--parchment);
  margin-bottom: 0.25rem;
}

.house-motto {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--parchment-dim);
}

.house-meta {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--parchment-muted);
}

/* ---------- Declarations ---------- */

.declaration-feed {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
}

.declaration {
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 120px 1fr 140px;
  gap: 2rem;
  align-items: center;
}

.declaration:last-child { border-bottom: none; }

.declaration-date {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  color: var(--parchment-dim);
  font-size: 0.875rem;
}

.declaration-body {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--parchment);
}

.declaration-body strong {
  font-family: 'Cinzel', serif;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-size: 0.95em;
}

.declaration-kind {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: right;
}

.kind-pact { color: var(--royal-green); }
.kind-rivalry { color: var(--crimson-bright); }
.kind-fealty { color: var(--peerage-blue-bright); }
.kind-founding { color: var(--gold); }

/* ---------- Sigil detail ---------- */

.sigil-detail {
  display: grid;
  grid-template-columns: minmax(360px, 480px) 1fr;
  gap: 4rem;
  padding: 4rem 0;
}

.sigil-detail-display {
  background-image:
    radial-gradient(ellipse at top, rgba(240, 226, 196, 0.1) 0%, transparent 55%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n3'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='3'/><feColorMatrix values='0 0 0 0 0.94  0 0 0 0 0.88  0 0 0 0 0.77  0 0 0 0.2 0'/></filter><rect width='300' height='300' filter='url(%23n3)' opacity='0.5'/></svg>");
  background-color: rgba(240, 226, 196, 0.04);
  border: 1px solid var(--rule);
  padding: 3rem;
  position: relative;
}

.sigil-detail-display::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px double rgba(181, 136, 58, 0.28);
  pointer-events: none;
}

.sigil-detail-display svg {
  width: 100%;
  aspect-ratio: 10 / 12;
  display: block;
}

.sigil-meta-block {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.meta-label {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--parchment-dim);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.meta-value {
  font-family: 'Cinzel', serif;
  font-size: 1.375rem;
  color: var(--parchment);
  letter-spacing: 0.02em;
}

.meta-motto {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

/* ---------- Archives ---------- */

.archives-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 4rem;
  padding: 3rem 0;
}

.archives-toc {
  position: sticky;
  top: 100px;
  align-self: start;
  border-right: 1px solid var(--rule);
  padding-right: 2rem;
}

.archives-toc-heading {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.archives-toc a {
  display: block;
  padding: 0.5rem 0;
  font-family: 'Cinzel', serif;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  color: var(--parchment-muted);
  border-bottom: 1px solid var(--rule);
}

.archives-toc a:hover { color: var(--gold); }

.archives-content section {
  margin-bottom: 4rem;
}

.archives-content h2 {
  margin-bottom: 1rem;
  color: var(--parchment);
}

.archives-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.archives-content p {
  font-size: 1.0625rem;
  line-height: 1.85;
  margin-bottom: 1.25rem;
  color: var(--parchment-muted);
}

.archives-content p:first-of-type::first-letter {
  float: left;
  font-family: 'UnifrakturCook', serif;
  font-size: 4rem;
  line-height: 0.8;
  color: var(--crimson);
  padding: 0.4rem 0.6rem 0 0;
  margin-top: 0.3rem;
}

.term-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem 2rem;
  font-size: 0.95rem;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: var(--panel);
  border-left: 3px solid var(--gold);
}

.term-list dt {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-size: 0.85rem;
}

.term-list dd {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  color: var(--parchment-muted);
}

/* ---------- Forms ---------- */

.form-group {
  margin-bottom: 1.5rem;
}

textarea.forge-input {
  border: 1px solid var(--rule);
  padding: 0.75rem;
  min-height: 80px;
  resize: vertical;
}

textarea.forge-input:focus { border-color: var(--gold); }

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

.footer {
  border-top: 1px solid var(--rule);
  padding: 3rem 0 2rem;
  margin-top: 6rem;
  background: var(--vellum-darker);
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.footer-colophon {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  color: var(--parchment-dim);
  font-size: 0.875rem;
  max-width: 360px;
  margin-top: 1rem;
  line-height: 1.7;
}

.footer-col h4 {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--gold);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
}

.footer-col a {
  display: block;
  padding: 0.4rem 0;
  color: var(--parchment-muted);
  font-size: 0.9rem;
}

.footer-bottom {
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--parchment-dim);
  font-family: 'Old Standard TT', serif;
  font-style: italic;
}

/* ---------- Utilities ---------- */

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }
.mt-4 { margin-top: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }

.divider {
  height: 1px;
  background: var(--rule);
  margin: 3rem 0;
}

.ornament {
  text-align: center;
  color: var(--gold);
  font-size: 1.25rem;
  letter-spacing: 1em;
  margin: 3rem 0;
  opacity: 0.6;
}

.ornament::before { content: '✦ · ✦ · ✦'; }

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--parchment-muted);
  margin-right: 0.5rem;
}

.badge-gold {
  border-color: var(--gold);
  color: var(--gold);
}

.badge-crimson {
  border-color: var(--crimson);
  color: var(--crimson-bright);
}

.badge-green {
  border-color: var(--royal-green);
  color: #6a9a6d;
}

.badge-blue {
  border-color: var(--peerage-blue);
  color: var(--peerage-blue-bright);
}

/* wallet pill */
.wallet-pill {
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--parchment);
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--gold);
  background: rgba(181, 136, 58, 0.08);
  margin-left: 0.5rem;
}

/* toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--vellum-darker);
  border: 1px solid var(--gold);
  color: var(--parchment);
  font-family: 'Old Standard TT', serif;
  font-style: italic;
  font-size: 0.95rem;
  z-index: 200;
  max-width: 340px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  animation: slideIn 240ms ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* responsive */
@media (max-width: 960px) {
  .forge-layout { grid-template-columns: 1fr; }
  .forge-column { border-right: none; border-bottom: 1px solid var(--rule); }
  .book-spread { grid-template-columns: 1fr; gap: 2rem; }
  .book-spread::after { display: none; }
  .triptych { grid-template-columns: 1fr; }
  .triptych-panel { border-right: none; border-bottom: 1px solid var(--rule); }
  .sigil-detail { grid-template-columns: 1fr; }
  .archives-layout { grid-template-columns: 1fr; }
  .archives-toc { position: static; border-right: none; border-bottom: 1px solid var(--rule); padding: 0 0 2rem; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat-cell { border-bottom: 1px solid var(--rule); }
  .house-row { grid-template-columns: 80px 1fr; }
  .house-row > *:nth-child(n+3) { display: none; }
  .declaration { grid-template-columns: 1fr; gap: 0.5rem; }
  .topnav { display: none; }
}

/* =====================================================================
   Mobile + responsive expansion
   - Replaces the old single-breakpoint behaviour with a stack that
     handles tablet, phone and small phone separately. Touch targets
     bumped to a 44px minimum across the board.
   ===================================================================== */

/* Tablet: tighten gutters, drop multi-column layouts a bit earlier */
@media (max-width: 1024px) {
  .container { padding: 0 24px; }
  .topbar-inner { padding: 16px 24px; gap: 16px; }
  .topnav { gap: 14px; }
  .topnav a { font-size: 13px; }
  .hero { padding: 56px 0; }
  .hero-title { font-size: clamp(48px, 7vw, 84px); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .carousel { gap: 16px; }
  .featured-card { width: 220px; }
}

/* Phone: collapse top nav, single-column everywhere, larger type for tap */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .container { padding: 0 18px; }
  .topbar-inner {
    flex-wrap: wrap;
    padding: 14px 18px;
    gap: 12px;
  }
  .brandmark-text { font-size: 22px; }
  .brandmark-sub { display: none; }
  .topnav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 6px 0 2px;
    margin: 0 -18px;
    padding-left: 18px;
    padding-right: 18px;
    border-top: 1px solid var(--rule);
    display: flex;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 13px;
    border-radius: 4px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }
  .topnav a.active { background: rgba(181,136,58,0.10); color: var(--gold); }

  /* Hero */
  .hero { padding: 40px 0 56px; }
  .hero-flag { font-size: 12px; }
  .hero-title { font-size: clamp(40px, 11vw, 64px); line-height: 1; }
  .hero-lede { font-size: 17px; line-height: 1.55; }
  .drop-cap { font-size: 52px; }
  .flex.gap-2 { flex-wrap: wrap; gap: 10px; }
  .btn { min-height: 44px; padding: 12px 20px; font-size: 14px; }
  .btn-lg { padding: 14px 22px; font-size: 15px; }
  .btn-sm { min-height: 36px; padding: 8px 14px; }

  /* Stats */
  .stat-row { grid-template-columns: 1fr 1fr; gap: 0; }
  .stat-cell { padding: 18px 14px; }
  .stat-value { font-size: 28px; }
  .stat-label { font-size: 11px; }
  .stat-sub { font-size: 11px; }

  /* Sections */
  .section { padding: 48px 0; }
  .section-heading { font-size: clamp(24px, 5vw, 32px); line-height: 1.2; }
  .section-label { font-size: 11px; }
  .section-sub { font-size: 15px; }

  /* Cards */
  .featured-card { width: 180px; padding: 14px; }
  .sigil-small svg { width: 100%; height: auto; }
  .sigil-card-name { font-size: 14px; }
  .sigil-card-motto { font-size: 12px; }

  .triptych-panel { padding: 22px 18px; }
  .triptych-roman { font-size: 32px; }
  .triptych-title { font-size: 18px; }
  .triptych-text { font-size: 14px; }

  .folio { padding: 24px 18px; }
  .h2 { font-size: 22px; }

  /* Forge */
  .forge-column { padding: 16px 14px; }
  .forge-section { margin-bottom: 18px; }
  .forge-section h4 { font-size: 13px; }
  .swatch { width: 36px; height: 36px; }
  .swatch-label { font-size: 10px; }
  .charge-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .charge-tile { padding: 8px; }

  /* Register */
  .register-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .register-card { padding: 14px; }

  /* Houses */
  .house-row {
    grid-template-columns: 64px 1fr;
    gap: 12px;
    padding: 16px 14px;
  }
  .house-row > *:nth-child(n+3) { display: none; }
  .house-banner { width: 64px; height: 64px; }
  .house-banner svg { width: 100%; height: 100%; }
  .house-name { font-size: 16px; }
  .house-motto { font-size: 12px; }

  /* Declarations */
  .declaration {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 16px 14px;
  }
  .decl-house { font-size: 14px; }
  .decl-arrow { display: none; }
  .decl-time { font-size: 12px; opacity: 0.7; }

  /* Sigil detail */
  .sigil-detail { gap: 24px; padding: 0; }
  .sigil-large svg { width: 100%; height: auto; }
  .blazon h2 { font-size: 24px; }

  /* Forms */
  input, select, textarea, .input, .select {
    min-height: 44px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }
  textarea { min-height: 88px; }

  /* Toast positioning */
  .toast { left: 18px; right: 18px; bottom: 24px; max-width: none; font-size: 14px; }

  /* Footer */
  .footer { padding: 40px 0 28px; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-col h4 { font-size: 12px; }
  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    font-size: 11px;
  }

  /* Whitepaper */
  .wp-grid { padding: 0 18px; margin: 28px 0 64px; gap: 28px; }
  .wp-toc h4 { font-size: 16px; }
  .wp-toc { font-size: 11px; line-height: 1.7; }
  .wp-cover h1 { font-size: 48px; }
  .wp-cover .deck { font-size: 17px; }
  .wp-body { font-size: 16px; }
  .wp-body h2 { font-size: 17px; margin-top: 36px; }
  .wp-body h3 { font-size: 14px; }
  .wp-body table { font-size: 11px; }
  .wp-body th, .wp-body td { padding: 7px 9px; }
  .wp-formula { font-size: 12px; padding: 14px; }
}

/* Small phone: ultra-tight */
@media (max-width: 420px) {
  .topbar-inner { padding: 12px 14px; }
  .container { padding: 0 14px; }
  .hero-title { font-size: 38px; }
  .stat-row { grid-template-columns: 1fr; }
  .stat-cell { padding: 14px; border-right: none; border-bottom: 1px solid var(--rule); }
  .stat-cell:last-child { border-bottom: none; }
  .charge-grid { grid-template-columns: repeat(3, 1fr); }
  .register-grid { grid-template-columns: 1fr; }
  .featured-card { width: 160px; }
  .btn { padding: 11px 18px; font-size: 13px; }
}

/* Touch interactions: kill the hover bounce on touch devices */
@media (hover: none) {
  .featured-card:hover, .game-card:hover, .btn:hover, .sigil-card:hover {
    transform: none !important;
  }
}

/* Fee curve table on the home page */
.fee-table-wrap {
  margin-top: 32px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(181, 136, 58, 0.04);
}
.fee-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Cinzel', serif;
  font-size: 14px;
}
.fee-table th {
  background: rgba(181, 136, 58, 0.10);
  padding: 14px 18px;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--rule);
}
.fee-table th:nth-child(2),
.fee-table th:nth-child(3),
.fee-table td:nth-child(2),
.fee-table td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.fee-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}
.fee-table tr:last-child td { border-bottom: none; }
.fee-table .fee-row-base { color: var(--ink-mut); }
.fee-table .fee-row-floor td {
  background: rgba(181, 136, 58, 0.10);
  color: var(--gold);
  font-weight: 600;
}
@media (max-width: 600px) {
  .fee-table { font-size: 12px; }
  .fee-table th, .fee-table td { padding: 10px 12px; }
  .fee-table th { font-size: 10px; }
}

/* Social link styling — used in footer columns + the minimal footer rows */
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-mut);
  transition: color .15s, transform .15s;
}
.social-link:hover { color: var(--gold); }
.social-link:hover svg { transform: translateY(-1px); }
.social-link svg { transition: transform .15s; }

.footer-socials {
  display: flex; gap: 24px; flex-wrap: wrap;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-top: 8px;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.06em;
}
@media (max-width: 600px) {
  .footer-socials { gap: 16px; padding: 14px 0; }
}
