
  #heraldi-historical {
    --ha-paper: #f6e8c5;
    --ha-ink: #291a15;
    --ha-secondary: #4b3629;
    --ha-muted: #675038;
    --ha-rule: #bc9a65;
    --ha-accent: #902c38;
    --ha-field: #912934;
    --ha-wine: #582126;
    --ha-gold: #b88a43;
    --ha-light-gold: #e6c27a;
    --ha-vellum: url("/media/vellum.jpg");
    --ha-flourish: url("/media/illuminated-divider.png");
    --ha-charges: url("/media/stag-and-crescent.png");
    --ha-serif: Georgia, "Times New Roman", serif;
    --ha-ui: system-ui, sans-serif;
    background-color: var(--ha-paper);
    background-image:
      radial-gradient(ellipse at 42% 34%, #fff8e6ab 8%, #fff6dd55 64%, #66411317 100%),
      var(--ha-vellum);
    background-size: 100% 100%, 720px 720px;
    background-position: center, center top;
    border-block: 6px solid var(--ha-wine);
    box-shadow: inset 0 0 0 1px var(--ha-light-gold);
    color: var(--ha-ink);
    color-scheme: light;
    font: 400 17px/1.6 var(--ha-serif);
    box-sizing: border-box;
    padding: 0 clamp(20px, 5vw, 56px) clamp(32px, 6vw, 64px);
  }
  #heraldi-historical *, #heraldi-historical *::before { box-sizing: border-box; }
  #heraldi-historical :is(h1,h2,p,ol,ul,figure,dl,dd) { margin: 0; }
  #heraldi-historical [hidden] { display: none !important; }
  #heraldi-historical .ha-width { max-width: 1080px; margin-inline: auto; }
  #heraldi-historical a { color: inherit; text-underline-offset: .22em; }
  #heraldi-historical a:hover { color: var(--ha-accent); text-decoration: underline; }
  #heraldi-historical a:focus-visible { outline: 2px solid var(--ha-accent); outline-offset: 3px; }
  #heraldi-historical .ha-masthead {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 3px double var(--ha-gold);
  }
  #heraldi-historical .ha-mark {
    display: grid;
    align-items: center;
    width: 144px;
    min-height: 44px;
    flex-shrink: 0;
  }
  #heraldi-historical .ha-mark img { display: block; width: 172px; max-width: none; height: auto; margin-inline-start: -14px; }
  #heraldi-historical .ha-masthead nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
  #heraldi-historical .ha-masthead nav a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    font: 600 15px/1.2 var(--ha-serif);
    text-decoration: none;
  }
  #heraldi-historical .ha-masthead a[aria-current="page"] {
    color: var(--ha-accent);
    box-shadow: inset 0 -2px 0 var(--ha-accent);
  }
  #heraldi-historical .ha-title { grid-area: title; padding-block: 3px 4px; }
  #heraldi-historical h1 {
    font-family: var(--ha-serif);
    font-weight: 400;
    font-size: clamp(34px, 6.1vw, 64px);
    line-height: 1.04;
    letter-spacing: -.038em;
    text-wrap: balance;
  }
  #heraldi-historical .ha-title h1 {
    color: var(--ha-wine);
    font-size: clamp(32px, 5.7vw, 60px);
    line-height: 1.03;
    text-wrap: initial;
  }
  #heraldi-historical .ha-title h1::first-letter {
    color: #ffe4a1;
    background: var(--ha-accent);
    border: 1px solid var(--ha-light-gold);
    box-shadow: 0 0 0 1px var(--ha-wine);
    font-size: 1.07em;
    padding-inline: .11em .13em;
    margin-inline-end: .1em;
  }
  #heraldi-historical :is(.ha-title,.ha-article-intro) p {
    max-width: 56ch;
    margin-top: 16px;
    color: var(--ha-secondary);
    font-size: clamp(17px, 2.3vw, 20px);
    line-height: 1.55;
    text-wrap: pretty;
  }
  #heraldi-historical .ha-index-spread {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    grid-template-areas: "title folio" "flourish folio" "chapters folio";
    grid-template-rows: auto auto 1fr;
    align-items: start;
    column-gap: clamp(28px, 5vw, 56px);
    padding-top: clamp(28px, 5vw, 52px);
  }
  #heraldi-historical .ha-flourish {
    grid-area: flourish;
    height: clamp(28px, 4vw, 44px);
    width: min(100%, 344px);
    margin-block: 16px 20px;
    background: var(--ha-flourish) center / 100% auto no-repeat;
  }
  #heraldi-historical .ha-index-chapters { grid-area: chapters; }
  #heraldi-historical .ha-list-heading {
    font: 500 17px/1.4 var(--ha-serif);
    color: #fff0c8;
    background: var(--ha-wine);
    padding: 8px 14px;
    border-block: 3px double var(--ha-light-gold);
    margin-bottom: 0;
  }
  #heraldi-historical .ha-chapters { padding: 0; list-style: none; background: #fff5dc50; }
  #heraldi-historical .ha-chapters li { border-top: 1px solid var(--ha-rule); }
  #heraldi-historical .ha-chapters li:first-child { border-top: 0; }
  #heraldi-historical .ha-chapters li:last-child { border-bottom: 1px solid var(--ha-rule); }
  #heraldi-historical .ha-chapters a {
    display: flex;
    flex-wrap: wrap;
    position: relative;
    align-items: baseline;
    justify-content: space-between;
    min-height: 44px;
    gap: 4px 12px;
    padding: 8px 12px 8px 32px;
    text-decoration: none;
    font-size: clamp(18px, 2.4vw, 23px);
    line-height: 1.3;
  }
  #heraldi-historical .ha-chapters a::before {
    content: "";
    position: absolute;
    width: 7px;
    height: 7px;
    border: 1px solid var(--ha-accent);
    background: var(--ha-light-gold);
    left: 14px;
    top: 17px;
    transform: rotate(45deg);
  }
  #heraldi-historical .ha-chapters a:hover { background: #fff7e280; }
  #heraldi-historical .ha-subentry { color: var(--ha-muted); font: 400 12px/1.5 var(--ha-ui); }
  #heraldi-historical .ha-folio { grid-area: folio; width: min(100%, 372px); justify-self: end; }
  #heraldi-historical .ha-folio img { display: block; width: 100%; height: auto; }
  #heraldi-historical .ha-folio a {
    display: block;
    padding: 8px;
    border: 3px double var(--ha-light-gold);
    outline: 1px solid var(--ha-wine);
    background: var(--ha-wine);
    box-shadow: 0 4px 10px #38221324;
  }
  #heraldi-historical .ha-folio a:focus-visible { outline: 2px solid var(--ha-accent); }
  #heraldi-historical .ha-folio figcaption {
    margin-top: 16px;
    padding-inline: 12px;
    border-inline-start: 2px solid var(--ha-accent);
  }
  #heraldi-historical figcaption {
    color: var(--ha-muted);
    font: 400 13px/1.5 var(--ha-ui);
    margin-top: 12px;
  }
  #heraldi-historical .ha-caption-title {
    color: var(--ha-wine);
    font: 600 19px/1.35 var(--ha-serif);
    margin-bottom: 4px;
  }
  #heraldi-historical .ha-article { max-width: 788px; padding-top: 20px; }
  #heraldi-historical .ha-back, #heraldi-historical .ha-continuation a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--ha-accent);
    font: 500 14px/1.45 var(--ha-ui);
    text-decoration: none;
  }
  #heraldi-historical .ha-article-intro { margin-block: 12px 28px; }
  #heraldi-historical .ha-article h1 { color: var(--ha-wine); font-size: clamp(34px, 5.7vw, 60px); }
  #heraldi-historical .ha-comparison, #heraldi-historical .ha-anatomy {
    background: #fff4d690;
    padding: clamp(12px, 4vw, 36px);
    border-block: 3px double var(--ha-gold);
  }
  #heraldi-historical .ha-shield-plate {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(8px, 3vw, 28px);
    text-align: center;
  }
  #heraldi-historical .ha-shield-plate li {
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 12px;
    font: 500 clamp(12px, 1.7vw, 15px)/1.35 var(--ha-ui);
  }
  #heraldi-historical .ha-shield {
    display: block;
    aspect-ratio: 1 / 1.12;
    width: min(100%, 164px);
    background-color: var(--ha-field);
    background-image: var(--ha-charges);
    background-repeat: no-repeat;
    background-position: center 43%;
    background-size: 77% auto;
  }
  #heraldi-historical .ha-pointed {
    clip-path: polygon(0 0, 100% 0, 98% 43%, 94% 58%, 86% 72%, 74% 84%, 62% 93%, 50% 100%, 38% 93%, 26% 84%, 14% 72%, 6% 58%, 2% 43%);
  }
  #heraldi-historical .ha-rounded { border-radius: 0 0 50% 50% / 0 0 42% 42%; }
  #heraldi-historical .ha-oval { border-radius: 50%; }
  @supports (clip-path: shape(from 0 0, line to 100% 0, close)) {
    #heraldi-historical .ha-pointed {
      clip-path: shape(from 0 0, line to 100% 0, curve to 50% 100% with 99% 54% / 94% 70%, curve to 0 0 with 6% 70% / 1% 54%, close);
    }
  }
  #heraldi-historical .ha-comparison > figcaption { margin-top: 20px; text-align: center; }
  #heraldi-historical .ha-anatomy {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    align-items: center;
    gap: clamp(16px, 4vw, 36px);
  }
  #heraldi-historical .ha-anatomy-drawing { display: grid; justify-items: center; }
  #heraldi-historical .ha-anatomy .ha-shield { width: min(100%, 192px); }
  #heraldi-historical .ha-anatomy figcaption { margin: 0; font: 400 clamp(14px, 1.8vw, 17px)/1.5 var(--ha-serif); }
  #heraldi-historical .ha-anatomy dl div + div { margin-top: 8px; }
  #heraldi-historical .ha-anatomy dt { color: var(--ha-ink); font-weight: 600; }
  #heraldi-historical .ha-prose { max-width: 64ch; margin-top: 28px; }
  #heraldi-historical :is(.ha-prose, .ha-history) h2 {
    color: var(--ha-wine);
    font: 400 clamp(24px, 3.4vw, 32px)/1.2 var(--ha-serif);
    margin-bottom: 8px;
  }
  #heraldi-historical :is(.ha-prose, .ha-history) p { color: var(--ha-secondary); }
  #heraldi-historical :is(.ha-prose, .ha-history) p + p { margin-top: 12px; }
  #heraldi-historical .ha-source {
    font: 400 13px/1.55 var(--ha-ui);
    color: var(--ha-muted);
    margin-top: 16px;
    text-wrap: pretty;
  }
  #heraldi-historical .ha-source a { text-decoration-color: var(--ha-rule); }
  #heraldi-historical .ha-history {
    border-top: 3px double var(--ha-gold);
    margin-top: 32px;
    padding-top: 20px;
  }
  #heraldi-historical .ha-history-text { max-width: 64ch; }
  #heraldi-historical .ha-history-spread {
    display: grid;
    grid-template-columns: minmax(0, .66fr) minmax(0, 1fr);
    align-items: start;
    gap: clamp(16px, 4vw, 36px);
    margin-top: 16px;
  }
  #heraldi-historical .ha-historical-image {
    max-width: 296px;
    padding-top: 2px;
  }
  #heraldi-historical .ha-historical-narrow { max-width: 172px; }
  #heraldi-historical .ha-historical-image img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--ha-rule);
  }
  #heraldi-historical .ha-glossary-source { max-width: 64ch; }
  #heraldi-historical .ha-continuation {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 16px;
    margin-top: 28px;
    padding-top: 4px;
    border-top: 1px solid var(--ha-rule);
  }
  #heraldi-historical .ha-continuation a:hover, #heraldi-historical .ha-back:hover { text-decoration: underline; }
  #heraldi-historical .ha-glossary { max-width: 64ch; }
  #heraldi-historical .ha-glossary div { padding: 12px 0; border-top: 1px solid var(--ha-rule); }
  #heraldi-historical .ha-glossary dt { font-size: 21px; }
  #heraldi-historical .ha-glossary dd { color: var(--ha-secondary); margin-top: 4px; }
  #heraldi-historical .ha-tinctures { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 12px; }
  #heraldi-historical .ha-tinctures li { font: 500 13px/1.45 var(--ha-ui); }
  #heraldi-historical .ha-tinctures span { display: block; height: 44px; margin-bottom: 8px; background: var(--ha-sample); border: 1px solid var(--ha-rule); }
  #heraldi-historical .ha-divide-vertical { background: linear-gradient(90deg, var(--ha-field) 50%, #dbb55f 50%); }
  #heraldi-historical .ha-divide-horizontal { background: linear-gradient(180deg, var(--ha-field) 50%, #dbb55f 50%); }
  #heraldi-historical .ha-divide-diagonal { background: linear-gradient(45deg, var(--ha-field) 50%, #dbb55f 50%); }
  #heraldi-historical .ha-divide-quarterly { background: conic-gradient(#dbb55f 25%, var(--ha-field) 0 50%, #dbb55f 0 75%, var(--ha-field) 0); }
  #heraldi-historical .ha-division-plate { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  @media (max-width: 640px) {
    #heraldi-historical .ha-index-spread {
      grid-template-columns: minmax(0, 1fr);
      grid-template-areas: "title" "folio" "flourish" "chapters";
      grid-template-rows: auto;
      row-gap: 20px;
    }
    #heraldi-historical .ha-folio { width: clamp(204px, 67%, 304px); justify-self: center; }
    #heraldi-historical .ha-flourish { justify-self: center; margin: 0; }
    #heraldi-historical .ha-division-plate { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 540px) {
    #heraldi-historical .ha-history-spread { grid-template-columns: minmax(0, 1fr); }
    #heraldi-historical .ha-historical-image { max-width: min(100%, 256px); }
    #heraldi-historical .ha-historical-narrow { max-width: 144px; }
  }
  @media (max-width: 412px) {
    #heraldi-historical .ha-masthead { gap: 8px; }
    #heraldi-historical .ha-mark { width: 112px; }
    #heraldi-historical .ha-mark img { width: 134px; margin-inline-start: -11px; }
    #heraldi-historical .ha-masthead nav a { font-size: 13px; }
    #heraldi-historical .ha-tinctures { grid-template-columns: 1fr 1fr; }
    #heraldi-historical .ha-shield-plate li { hyphens: auto; }
  }

  html, body { margin: 0; min-height: 100%; }
  #heraldi-historical { min-height: 100vh; }
  #heraldi-historical .ha-skip {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
    padding: 8px 12px;
    background: var(--ha-paper);
    transform: translateY(calc(-100% - 18px));
  }
  #heraldi-historical .ha-skip:focus { transform: none; }
  #heraldi-historical .ha-error {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(160px, .7fr);
    align-items: center;
    gap: clamp(24px, 6vw, 72px);
    max-width: 850px;
    padding-block: clamp(36px, 8vw, 96px);
  }
  #heraldi-historical .ha-error-code {
    color: var(--ha-accent);
    font: 400 clamp(44px, 7vw, 80px)/1 var(--ha-serif);
    margin-bottom: 12px;
  }
  #heraldi-historical .ha-error h1 { font-size: clamp(36px, 5vw, 58px); color: var(--ha-wine); }
  #heraldi-historical .ha-error-explanation {
    margin-top: 16px;
    color: var(--ha-secondary);
    font-size: clamp(17px, 2.4vw, 20px);
  }
  #heraldi-historical .ha-error-action {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    margin-top: 24px;
    padding: 8px 16px;
    border-block: 3px double var(--ha-light-gold);
    background: var(--ha-wine);
    color: #fff0c8;
    font-weight: 600;
    text-decoration: none;
  }
  #heraldi-historical .ha-error-action:hover { background: var(--ha-accent); color: #fff0c8; text-decoration: underline; }
  #heraldi-historical .ha-error-illustration { display: grid; justify-items: center; }
  #heraldi-historical .ha-error-illustration .ha-shield { width: min(100%, 172px); }
  #heraldi-historical .ha-error-illustration .ha-flourish {
    grid-area: auto;
    width: min(100%, 272px);
    margin: 16px 0 0;
  }
  @media (max-width: 540px) {
    #heraldi-historical .ha-error { grid-template-columns: minmax(0, 1fr); }
    #heraldi-historical .ha-error-illustration { justify-items: start; }
    #heraldi-historical .ha-error-illustration .ha-shield { margin-inline-start: 44px; width: 130px; }
    #heraldi-historical .ha-error-illustration .ha-flourish { width: min(100%, 218px); }
  }
