/* Pirate — Weathered map & skull-adorned seafaring style */
:root {
  --color-bg: #1a1510;
  --color-surface: #e8d5a3;
  --color-border: #7a5c2e;
  --color-border-strong: #4a3520;
  --color-accent: #c0392b;
  --color-accent-gold: #d4a017;
  --color-text: #33261a;
  --color-muted: #6b5a42;
  --radius-sm: 2px;
  --radius: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 60px rgba(139, 105, 20, 0.15);
  --line: 1.75;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 16px;
  line-height: var(--line);
  background: var(--color-bg);
  background-image:
    radial-gradient(
      ellipse at 20% 50%,
      rgba(100, 80, 30, 0.12) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse at 80% 50%,
      rgba(192, 57, 43, 0.06) 0%,
      transparent 70%
    );
  color: var(--color-text);
  padding: 32px 18px 72px;
}

/* ─── Header ─── */
.header {
  max-width: 940px;
  margin: 0 auto 44px;
  background: var(--color-surface);
  border: 4px double var(--color-border);
  border-radius: var(--radius);
  padding: 56px 48px 52px;
  text-align: center;
  position: relative;
  background-image:
    linear-gradient(to bottom, rgba(100, 80, 30, 0.06) 1px, transparent 1px),
    radial-gradient(
      ellipse at center,
      rgba(100, 80, 30, 0.1) 0%,
      transparent 70%
    );
  background-size:
    100% 28px,
    100% 100%;
  box-shadow:
    inset 0 0 40px rgba(74, 53, 32, 0.1),
    0 6px 20px rgba(0, 0, 0, 0.4);
}
.header::before,
.header::after {
  content: "☠";
  position: absolute;
  font-size: 32px;
  color: var(--color-accent);
  opacity: 0.5;
  top: 12px;
}
.header::before {
  left: 20px;
}
.header::after {
  right: 20px;
}
.header__title {
  margin: 0 0 6px;
  font-size: 46px;
  font-weight: 700;
  color: var(--color-accent);
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.25),
    0 0 12px rgba(192, 57, 43, 0.12);
  font-variant: small-caps;
  letter-spacing: 0.06em;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.header__title::before {
  content: "⚓ ";
  font-size: 0.65em;
}
.header__title::after {
  content: " ⚓";
  font-size: 0.65em;
}
.header__subtitle {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  color: var(--color-muted);
  letter-spacing: 0.08em;
}

/* ─── Main content ─── */
.main {
  max-width: 940px;
  margin: 0 auto;
  background: var(--color-surface);
  padding: 52px 58px;
  border: 3px double var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  background-image:
    linear-gradient(to bottom, rgba(100, 80, 30, 0.04) 1px, transparent 1px),
    radial-gradient(
      ellipse at 50% 0%,
      rgba(100, 80, 30, 0.06) 0%,
      transparent 50%
    );
  background-size:
    100% 28px,
    100% 100%;
}
.main::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(122, 92, 46, 0.2);
  border-radius: 4px;
  pointer-events: none;
}

/* ─── Sections ─── */
.section {
  margin-bottom: 52px;
  position: relative;
}
.section:last-child {
  margin-bottom: 0;
}
.section + .section::before {
  content: "⚔  ☠  ⚔";
  display: block;
  text-align: center;
  color: var(--color-accent);
  font-size: 16px;
  letter-spacing: 0.3em;
  margin-bottom: 32px;
  opacity: 0.4;
}
.section--included {
  font-size: 0.6em;
}
.section--included .section__heading {
  font-size: 20px;
}
.section--included .subheading {
  font-size: 13px;
}
.section--included .table {
  font-size: 10px;
}
.section--included .table th,
.section--included .table td {
  padding: 5px 7px;
}
.section__heading {
  font-size: 27px;
  margin: 0 0 20px;
  padding: 8px 44px;
  border-bottom: 2px solid var(--color-border);
  border-top: 2px solid var(--color-border);
  color: var(--color-accent);
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  position: relative;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.08);
  text-align: center;
}
.section__heading::before {
  content: "🏴‍☠️";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  opacity: 0.7;
}
.section__heading::after {
  content: "🏴‍☠️";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  opacity: 0.7;
}
.subheading {
  font-size: 19px;
  margin: 32px 0 10px;
  color: var(--color-border-strong);
  font-weight: 600;
  font-style: italic;
  padding-bottom: 4px;
  border-bottom: 1px dotted rgba(122, 92, 46, 0.3);
}

/* ─── Text ─── */
p {
  margin: 0 0 14px;
  text-align: justify;
  hyphens: auto;
}
p:first-of-type::first-letter {
  font-size: 2.2em;
  float: left;
  line-height: 0.85;
  margin: 4px 6px 0 0;
  color: var(--color-accent);
  font-weight: 700;
  text-shadow: 1px 1px 0 rgba(192, 57, 43, 0.15);
}
strong {
  color: var(--color-accent);
}
em {
  color: var(--color-border-strong);
}
ul,
ol {
  margin: 0 0 18px 28px;
  padding: 0;
}
li {
  margin-bottom: 6px;
}
li::marker {
  color: var(--color-accent);
}

/* ─── Tables ─── */
.table {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), auto);
  width: 100%;
  margin: 20px 0 30px;
  font-size: 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.table thead,
.table tbody,
.table tr {
  display: contents;
}
.table th,
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  vertical-align: top;
}
.table th:last-child,
.table td:last-child {
  border-right: none;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table th {
  background: linear-gradient(to bottom, #5a4020, var(--color-border-strong));
  color: #e8d5a3;
  font-weight: 600;
  text-align: left;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.table tbody tr:nth-child(even) td {
  background: rgba(100, 80, 30, 0.06);
}
.table tbody tr:hover td {
  background: rgba(192, 57, 43, 0.06);
}
.caption {
  font-weight: 600;
  font-size: 15px;
  padding: 4px 2px 10px;
  color: var(--color-accent);
  text-align: left;
  font-style: italic;
}

/* ─── Callout / blockquote ─── */
.callout {
  background: rgba(192, 57, 43, 0.04);
  border: 1px solid rgba(122, 92, 46, 0.25);
  border-left: 6px solid var(--color-accent);
  padding: 16px 22px;
  margin: 28px 0 36px;
  font-style: italic;
  color: var(--color-muted);
  border-radius: var(--radius-sm);
  position: relative;
  box-shadow: inset 0 0 16px rgba(74, 53, 32, 0.04);
}
.callout::before {
  content: "☠";
  position: absolute;
  top: -10px;
  left: 16px;
  font-size: 24px;
  color: var(--color-accent);
  opacity: 0.35;
  font-style: normal;
}

/* ─── Page Breaks ─── */
.pagebreak {
  page-break-before: always;
  break-before: page;
  height: 0;
  margin: 0;
  padding: 0;
}

/* ─── Footer ─── */
.footer {
  text-align: center;
  margin-top: 72px;
  font-size: 13px;
  color: #a08c6c;
  font-style: italic;
  position: relative;
}
.footer::before {
  content: "⸻  ☠  ⸻";
  display: block;
  margin-bottom: 12px;
  color: var(--color-accent);
  opacity: 0.35;
  letter-spacing: 0.2em;
}

/* ─── Links ─── */
a {
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--color-accent-gold);
  transition: border-color 0.2s;
}
a:hover {
  border-bottom-style: solid;
  color: #e74c3c;
}

/* ─── Accessibility ─── */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: #000;
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  body {
    background: #fff;
    padding: 0;
    font-size: 12px;
    background-image: none;
  }
  .header,
  .main {
    box-shadow: none;
    border: none;
    background-image: none;
  }
  .header::before,
  .header::after,
  .main::before,
  .section + .section::before,
  .callout::before,
  .footer::before {
    display: none;
  }
  .header {
    margin-bottom: 12px;
    padding: 0 0 12px;
    border-bottom: 2px solid var(--color-border);
    background: #fff;
  }
  .main {
    padding: 0;
    background: #fff;
  }
  p:first-of-type::first-letter {
    float: none;
    font-size: inherit;
    margin: 0;
  }
  .section__heading {
    page-break-after: avoid;
  }
  .section__heading::before,
  .section__heading::after {
    content: none;
  }
  .table {
    page-break-inside: avoid;
  }
  .section {
    page-break-inside: avoid;
  }
  .footer {
    display: none;
  }
}
