/* Shared by the theme and each portable HTML card. Keep every selector scoped. */
.at-sample {
  --at-paper: #f3f0e7;
  --at-ink: #10100e;
  --at-red: #d63524;
  --at-hair: rgba(16, 16, 14, .24);
  --at-spine: 64px;
  position: relative;
  isolation: isolate;
  width: 100%;
  box-sizing: border-box;
  margin: 2.5rem auto;
  padding: 2rem 1.25rem 2.2rem calc(var(--at-spine) + 2rem);
  min-height: 245px;
  background: var(--at-paper);
  background-image: linear-gradient(rgba(243, 240, 231, .9), rgba(243, 240, 231, .9)), url('../images/vellum-field.png');
  background-size: auto, 800px 800px;
  color: var(--at-ink);
  border-block: 1px solid rgba(16, 16, 14, .1);
  font: 22px/1.45 "EB Garamond", Georgia, serif;
  text-align: left;
  overflow-wrap: anywhere;
}
.at-sample *, .at-binding { box-sizing: border-box; }
.at-binding {
  --at-spine: 64px;
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--at-spine);
  pointer-events: none;
  overflow: hidden;
}
/* PNGs are 2:3 canvases with the strip occupying the middle half.
   Two naturally scaled full strips overlap at half-height; no bitmap is
   stretched to the content height. Missing images leave only the SVG seam. */
.at-binding::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--at-material, none), var(--at-material, none);
  background-size: 200% auto, 200% auto;
  background-position: center 0, center calc(var(--at-spine) * 1.5);
  background-repeat: repeat-y;
}
.at-binding-patch {
  position: absolute;
  width: 68%;
  height: 100px;
  top: 52px;
  left: 13%;
  transform: rotate(-8deg);
  background-image: var(--at-intrusion, none);
  background-size: 220% auto;
  background-position: center 42%;
  background-repeat: no-repeat;
  clip-path: polygon(0 4%, 100% 0, 95% 98%, 6% 93%);
}
.at-binding .at-stitches {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: #d63524;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.at-binding .at-stitches path { vector-effect: non-scaling-stroke; }
.at-thread-anchor { position: absolute; left: 26%; width: 2px; height: 2px; }
.at-sample .at-sample-body { min-width: 0; }
.at-sample .at-sample-label {
  display: block;
  margin: 0 0 1.3rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--at-hair);
  font: 10px/1.5 "JetBrains Mono", monospace;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.at-sample h2, .at-sample h3, .at-sample .at-title {
  display: block;
  margin: .1rem 0 1rem;
  color: var(--at-ink);
  font: 400 clamp(30px, 4vw, 48px)/1.06 "EB Garamond", Georgia, serif;
  letter-spacing: -.025em;
}
.at-sample p { margin: .65rem 0 1rem; }
.at-sample .at-original > :first-child { margin-top: 0; }
.at-sample .at-original > :last-child { margin-bottom: 0; }
.at-sample a { color: inherit; border: 0; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.at-sample a:hover { color: var(--at-red); }
.at-sample a:focus-visible, .at-sample summary:focus-visible { outline: 2px solid var(--at-red); outline-offset: 4px; }
.at-sample blockquote { margin: 0; padding: .5rem 0; border: 0; font: inherit; }
.at-sample blockquote p { font-size: 1.25em; }
.at-sample footer { font-size: .85em; }
.at-sample ul, .at-sample ol { padding-left: 1.15em; margin: 1rem 0; }
.at-sample li + li { margin-top: .4rem; }
.at-sample .at-table-scroll { max-width: 100%; overflow-x: auto; margin: 1.25rem 0; }
.at-sample table { border-collapse: collapse; width: 100%; font-size: .87em; line-height: 1.35; }
.at-sample th, .at-sample td { padding: .55rem .65rem; border: 1px solid var(--at-hair); vertical-align: top; }
.at-sample th { font: 11px/1.5 "JetBrains Mono", monospace; text-align: left; }
.at-sample details { margin: 1rem 0; padding: .75rem 0; border-block: 1px solid var(--at-hair); }
.at-sample summary { cursor: pointer; font-size: .95em; }
.at-sample details > :not(summary) { margin-top: 1rem; }
.at-sample .at-label { font: 10px/1.5 "JetBrains Mono", monospace; letter-spacing: .06em; }
.at-sample .at-flow { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .9rem; }
.at-sample .at-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; margin: 1rem 0; }
.at-sample .at-fields > .at-wide { grid-column: 1 / -1; }
.at-sample .at-field { border-bottom: 1px solid var(--at-hair); padding: .65rem 0; }
.at-sample .at-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.at-sample .at-roster-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: .7rem; border-bottom: 1px solid var(--at-hair); padding: 1rem 0; }
.at-sample .at-roster-row > :last-child { font: 10px/1.5 "JetBrains Mono", monospace; }
.at-sample .at-character { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; }
.at-sample .at-morale { height: 8px; margin: 1.25rem 0; background: linear-gradient(90deg, #10100e 0 65%, #a99a7a 65% 85%, #d63524 85%); }
.at-sample .at-archive-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.at-sample .at-archive-links a { display: grid; gap: .5rem; }
.at-sample .at-archive-links [rel="next"] { text-align: right; }
.at-sample .at-new-form { border-left: 1px solid var(--at-hair); padding-left: 1rem; }
.at-post-binding { left: max(0px, calc(50% - 460px)); }
.at-article-reading:has(> .at-post-binding) { position: relative; }
.at-article-reading:has(> .at-post-binding) > .gh-content {
  --at-reading-inset: 24px;
  padding-left: var(--at-reading-inset);
}
/* Ghost breakouts center on the content box. Undo half the extra left inset
   so full/wide cards stay viewport-centered while prose clears the sleeve. */
.at-article-reading:has(> .at-post-binding) > .gh-content :is(.kg-width-full, .kg-width-wide) {
  margin-left: calc(50% - (var(--at-reading-inset) - 24px) / 2);
}
.at-post-binding[data-binding="bast"] { --at-material: url(../images/materials/bast.png); }
.at-post-binding[data-binding="linen"] { --at-material: url(../images/materials/linen.png); }
.at-post-binding[data-binding="felt"] { --at-material: url(../images/materials/felt.png); }
.at-post-binding[data-binding="leather"] { --at-material: url(../images/materials/leather.png); }
.at-post-binding[data-binding="silk"] { --at-material: url(../images/materials/silk.png); }
.at-post-binding[data-binding="canvas"] { --at-material: url(../images/materials/canvas.png); }
.at-post-binding[data-binding="mesh"] { --at-material: url(../images/materials/mesh.png); }
.at-post-binding[data-binding="filament"] { --at-material: url(../images/materials/filament.png); }
.at-post-binding[data-intrusion="bast"] { --at-intrusion: url(../images/materials/bast.png); }
.at-post-binding[data-intrusion="linen"] { --at-intrusion: url(../images/materials/linen.png); }
.at-post-binding[data-intrusion="felt"] { --at-intrusion: url(../images/materials/felt.png); }
.at-post-binding[data-intrusion="leather"] { --at-intrusion: url(../images/materials/leather.png); }
.at-post-binding[data-intrusion="silk"] { --at-intrusion: url(../images/materials/silk.png); }
.at-post-binding[data-intrusion="canvas"] { --at-intrusion: url(../images/materials/canvas.png); }
.at-post-binding[data-intrusion="mesh"] { --at-intrusion: url(../images/materials/mesh.png); }
.at-post-binding[data-intrusion="filament"] { --at-intrusion: url(../images/materials/filament.png); }
@media (max-width: 600px) {
  .at-sample, .at-binding { --at-spine: 34px; }
  .at-sample { padding: 1.4rem .25rem 1.5rem calc(var(--at-spine) + 1rem); font-size: 19px; min-height: 200px; }
  .at-binding-patch { top: 35px; height: 65px; }
  .at-sample .at-fields, .at-sample .at-archive-links { grid-template-columns: 1fr; }
  .at-sample .at-roster-row { grid-template-columns: auto minmax(0, 1fr); }
  .at-sample .at-roster-row > :last-child { grid-column: 2; }
  .at-sample .at-archive-links [rel="next"] { text-align: left; }
  .at-sample th, .at-sample td { padding: .4rem; }
  .at-article-reading:has(> .at-post-binding) > .gh-content { --at-reading-inset: 50px; }
}
@media (min-width: 601px) and (max-width: 920px) {
  .at-article-reading:has(> .at-post-binding) > .gh-content { --at-reading-inset: 84px; }
}
