/* ============================================================
   Ash Brides — setting codex
   Desert manuscript on ash. Separate from main index parchment.
   ============================================================ */

/* ----- shell ----- */

html { scroll-behavior: smooth; }

body.ash-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", Times, serif;
  font-size: 17px;
  line-height: 1.55;
  color: #2c1e14;
  text-align: left;
  background-color: #14100c;
  background-image:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(140, 70, 25, 0.22), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(60, 20, 10, 0.35), transparent 60%),
    url("../img/ash-brides/ash_bg.jpg");
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: 100% 70vh, 80% 50vh, 512px 512px;
  background-attachment: fixed;
}

body.ash-page * { box-sizing: border-box; }

body.ash-page p::first-letter {
  font: inherit;
  float: none;
  color: inherit;
  text-shadow: none;
  margin: 0;
}

/* ----- codex frame ----- */

.ash-codex {
  --ink: #2c1e14;
  --blood: #6e1610;
  --bronze: #9a7340;
  --bronze-light: #c9a86a;
  --sand: #e9d7b0;
  --sand-deep: #d4be94;
  --soot: #1a120c;
  --panel: #f0e2c4;

  max-width: 880px;
  margin: 1.75rem auto 3.5rem;
  padding: 0;
  position: relative;
  background: var(--panel);
  background-image:
    linear-gradient(180deg, #f4e8cc 0%, #ead7b0 55%, #e0ca9e 100%);
  border: 2px solid var(--soot);
  box-shadow:
    0 0 0 1px var(--bronze),
    0 0 0 8px #221810,
    0 0 0 9px var(--bronze),
    0 18px 50px rgba(0, 0, 0, 0.55);
}

/* double inner margin line */
.ash-codex-inner {
  position: relative;
  margin: 10px;
  padding: 1.25rem 1.5rem 1.75rem;
  border: 1px solid rgba(154, 115, 64, 0.55);
  min-height: 200px;
}

/* corner studs */
.ash-codex-inner::before,
.ash-codex-inner::after,
.ash-codex-foot::before,
.ash-codex-foot::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  background: var(--soot);
  border: 1px solid var(--bronze-light);
  box-shadow: inset 0 0 0 2px #3d2a18;
  z-index: 2;
}
.ash-codex-inner::before { top: -1px; left: -1px; }
.ash-codex-inner::after  { top: -1px; right: -1px; }
.ash-codex-foot {
  position: absolute;
  left: 10px; right: 10px; bottom: 10px;
  height: 0;
  pointer-events: none;
}
.ash-codex-foot::before { bottom: -1px; left: -1px; }
.ash-codex-foot::after  { bottom: -1px; right: -1px; }

/* ----- masthead ----- */

.ash-mast {
  text-align: center;
  margin: 0 0 1.25rem;
}

.ash-banner {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 0.75rem;
  border: 1px solid var(--soot);
  box-shadow: 0 1px 0 var(--bronze);
}

.ash-nav {
  margin: 0.4rem 0 0.55rem;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  color: #5c4030;
}

.ash-nav a {
  color: var(--blood);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.ash-nav a:hover {
  border-bottom-color: var(--bronze);
  color: #8a1c14;
}

.ash-nav .sep {
  margin: 0 0.55em;
  color: var(--bronze);
  opacity: 0.85;
}

.ash-rule {
  display: block;
  width: min(100%, 520px);
  height: auto;
  margin: 0.35rem auto 0;
  opacity: 0.9;
}

/* ----- primer chapters ----- */

.ash-chapter {
  margin: 0 0 1.6rem;
  padding: 0 0 1.1rem;
  border-bottom: 1px solid rgba(154, 115, 64, 0.4);
}

.ash-chapter:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.ash-chapter > h2 {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 0.06em;
  color: var(--blood);
  border-bottom: 2px solid var(--blood);
  padding-bottom: 0.3rem;
  display: inline-block;
}

.ash-chapter > h3 {
  margin: 0.9rem 0 0.4rem;
  font-size: 0.78rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blood);
}

.ash-chapter p {
  margin: 0 0 0.75em;
  text-align: justify;
  color: var(--ink);
  line-height: 1.55;
}

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

.ash-chapter ul {
  margin: 0.4rem 0 0.85rem 1.2rem;
  padding: 0;
  color: var(--ink);
}

.ash-chapter li {
  margin: 0 0 0.4rem;
  line-height: 1.45;
}

/* ----- prologue ----- */

.ash-prologue {
  margin: 0 0 1.35rem;
  padding: 0 0.15rem;
}

.ash-prologue p {
  margin: 0 0 0.85em;
  text-align: justify;
  hyphens: auto;
  color: var(--ink);
}

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

.ash-warning {
  margin: 0 0 1.1rem;
  padding: 0.7rem 1rem;
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #3a1810;
  background: rgba(110, 22, 16, 0.09);
  border-top: 2px solid var(--blood);
  border-bottom: 2px solid var(--blood);
}

.ash-warning b {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--blood);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

/* ----- atlas / map ----- */

.ash-atlas {
  margin: 0 0 1.35rem;
  padding: 0.85rem 1rem 1rem;
  background: rgba(26, 18, 12, 0.06);
  border: 1px solid rgba(154, 115, 64, 0.65);
}

.ash-atlas-title {
  margin: 0 0 0.55rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blood);
}

.ash-map {
  margin: 0;
  padding: 0.5rem 0.25rem;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
  text-align: center;
  color: #3d2a1c;
}

/* ----- contents ----- */

.ash-toc-wrap {
  margin: 0 0 1.6rem;
  padding: 0.75rem 0.5rem 0.85rem;
  border-top: 1px solid var(--bronze);
  border-bottom: 1px solid var(--bronze);
}

.ash-toc-title {
  margin: 0 0 0.55rem;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6b5038;
}

.ash-toc {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ash-toc a {
  display: inline-block;
  padding: 0.28rem 0.65rem;
  font-size: 0.9rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(154, 115, 64, 0.35);
  background: rgba(255, 250, 235, 0.35);
}

.ash-toc a:hover {
  border-color: var(--bronze);
  background: rgba(154, 115, 64, 0.12);
  color: var(--blood);
}

/* ----- kin entry ----- */

.ash-kin {
  margin: 0 0 1.75rem;
  padding: 0;
  border: 1px solid rgba(61, 42, 28, 0.35);
  background: rgba(255, 248, 230, 0.28);
  box-shadow: inset 0 0 0 4px rgba(240, 226, 196, 0.8);
}

/* title strip full width */
.ash-kin-titleblock {
  min-width: 0;
  padding: 0.75rem 1rem 0.55rem;
  background:
    linear-gradient(180deg, rgba(42, 28, 18, 0.08) 0%, transparent 100%);
  border-bottom: 1px solid rgba(154, 115, 64, 0.45);
}

.ash-kin-titleblock h2 {
  margin: 0 0 0.2rem;
  font-size: 1.55rem;
  font-weight: bold;
  line-height: 1.15;
  letter-spacing: 0.03em;
  color: var(--blood);
  border-bottom: 2px solid var(--blood);
  padding-bottom: 0.28rem;
  display: inline-block;
  max-width: 100%;
}

.ash-kin-aka {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  font-style: italic;
  color: #6b5038;
  line-height: 1.35;
}

.ash-tag {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0.12em 0.45em;
  font-size: 0.55em;
  font-style: normal;
  font-weight: bold;
  letter-spacing: 0.1em;
  vertical-align: middle;
  color: #f0e2c4;
  background: var(--blood);
  border: 1px solid var(--bronze);
}

/* text left + large portrait right */
.ash-kin-main {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 300px);
  gap: 0.85rem 1.15rem;
  align-items: start;
  padding: 0.85rem 1rem 0.45rem;
}

/* portrait */
.ash-portrait {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 300px;
  justify-self: end;
  position: sticky;
  top: 0.75rem;
}

.ash-portrait-frame {
  padding: 6px;
  background: linear-gradient(160deg, #5a4030 0%, #1a120c 45%, #6b4a28 100%);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px var(--bronze-light);
}

.ash-portrait-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid #0c0806;
  background: #1a120c;
}

.ash-portrait-cap {
  margin: 0.35rem 0 0;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #3d2a1c;
}

/* body fields (left column) */
.ash-kin-body {
  min-width: 0;
  padding: 0;
}

.ash-field {
  margin: 0 0 0.75rem;
}

.ash-field:last-child {
  margin-bottom: 0;
}

.ash-field h3 {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blood);
}

.ash-field p {
  margin: 0;
  text-align: justify;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink);
}

/* stats + trait footer */
.ash-kin-foot {
  padding: 0.55rem 1rem 0.95rem;
  border-top: 1px dashed rgba(154, 115, 64, 0.55);
  background: rgba(26, 18, 12, 0.04);
}

.ash-stat-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.45rem;
  margin: 0 0 0.55rem;
}

.ash-stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.2;
}

.ash-stat-table th {
  background: var(--soot);
  color: #e8d4a8;
  font-weight: normal;
  letter-spacing: 0.04em;
  padding: 0.38em 0.15em;
  border: 1px solid #3d2a1c;
}

.ash-stat-table td {
  background: rgba(255, 250, 235, 0.55);
  border: 1px solid #a08060;
  padding: 0.38em 0.15em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ash-trait {
  margin: 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
  background: rgba(110, 22, 16, 0.07);
  border-left: 3px solid var(--blood);
  border: 1px solid rgba(154, 115, 64, 0.4);
  border-left: 4px solid var(--blood);
}

.ash-trait b {
  color: var(--blood);
  letter-spacing: 0.02em;
}

/* ----- reference ----- */

.ash-ref {
  margin: 1.5rem 0 0.5rem;
  padding: 0.9rem 0.75rem 1rem;
  border: 1px solid rgba(61, 42, 28, 0.4);
  background: rgba(26, 18, 12, 0.05);
}

.ash-ref-title {
  margin: 0 0 0.65rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blood);
}

.ash-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.3;
}

.ash-ref-table th {
  background: var(--soot);
  color: #e8d4a8;
  font-weight: normal;
  letter-spacing: 0.04em;
  padding: 0.4em 0.25em;
  border: 1px solid #3d2a1c;
}

.ash-ref-table td {
  border: 1px solid #a08060;
  padding: 0.35em 0.25em;
  background: rgba(255, 250, 235, 0.4);
}

.ash-ref-table tr:nth-child(even) td {
  background: rgba(42, 28, 18, 0.06);
}

.ash-ref-table td:first-child,
.ash-ref-table th:first-child {
  text-align: left;
  padding-left: 0.5em;
}

/* ----- close ----- */

.ash-close {
  margin-top: 1.5rem;
  text-align: center;
}

.ash-end {
  margin: 0.75rem 0 0;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #6b5038;
}

/* ----- links ----- */

.ash-codex a { color: var(--blood); }
.ash-codex a:hover { color: #8a1c14; }

/* ----- responsive ----- */

@media (max-width: 700px) {
  .ash-codex {
    margin: 0.6rem;
  }

  .ash-codex-inner {
    margin: 6px;
    padding: 0.9rem 0.75rem 1.25rem;
  }

  .ash-kin-main {
    grid-template-columns: 1fr;
  }

  .ash-portrait {
    justify-self: center;
    max-width: 280px;
    position: static;
    order: -1; /* image first on small screens, then text */
  }

  .ash-kin-body {
    order: 1;
  }

  .ash-stat-row {
    grid-template-columns: 1fr;
  }

  body.ash-page { font-size: 16px; }
}
