/* Pirate Court Quick Reference Styles — Synced with pirate theme */
: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 4px 16px -3px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 14px;
  line-height: 1.6;
  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: 20px 16px 40px;
}

/* Header */
.header {
  max-width: 210mm;
  margin: 0 auto 30px;
  background: var(--color-surface);
  border: 4px double var(--color-border);
  border-radius: var(--radius);
  padding: 24px 32px;
  text-align: center;
  position: relative;
  background-image: linear-gradient(
    to bottom,
    rgba(100, 80, 30, 0.06) 1px,
    transparent 1px
  );
  background-size: 100% 28px;
  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: 24px;
  color: var(--color-accent);
  opacity: 0.5;
  top: 50%;
  transform: translateY(-50%);
}

.header::before {
  left: 16px;
}

.header::after {
  right: 16px;
}

.header__title {
  margin: 0 0 4px;
  font-size: 32px;
  color: var(--color-accent);
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.25);
  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: 15px;
  color: var(--color-muted);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.08em;
}

/* Main content */
.main {
  max-width: 210mm;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Reference sections */
.ref-section {
  background: var(--color-surface);
  border: 3px double var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  background-image: linear-gradient(
    to bottom,
    rgba(100, 80, 30, 0.04) 1px,
    transparent 1px
  );
  background-size: 100% 28px;
}

/* Column row — sections displayed side-by-side */
.ref-row {
  display: grid;
  gap: 24px;
}

.ref-row--cols-2 {
  grid-template-columns: 1fr 1fr;
}

.ref-row--cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.ref-row .ref-section {
  min-width: 0; /* prevent grid blowout */
}

.ref-section__title {
  margin: 0;
  padding: 12px 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-accent);
  font-variant: small-caps;
  letter-spacing: 0.04em;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.08);
  border-bottom: 2px solid var(--color-border);
  background: rgba(122, 92, 46, 0.1);
}

.ref-section__body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Tables */
.ref-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ref-section thead tr {
  background: rgba(122, 92, 46, 0.15);
}

.ref-section th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-border);
}

.ref-section td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(122, 92, 46, 0.2);
  vertical-align: top;
}

.ref-section tbody tr:last-child td {
  border-bottom: none;
}

.ref-section tbody tr:hover {
  background: rgba(122, 92, 46, 0.06);
}

.ref-section td img {
  vertical-align: middle;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

/* Lists */
.ref-section ol,
.ref-section ul {
  margin: 0;
  padding-left: 24px;
  font-size: 13px;
  line-height: 1.7;
}

.ref-section ol {
  list-style: decimal;
}

.ref-section li {
  margin-bottom: 6px;
  padding-left: 4px;
}

.ref-section li::marker {
  color: var(--color-accent);
  font-weight: 700;
}

.ref-section li:last-child {
  margin-bottom: 0;
}

/* Blockquotes (formula) */
.ref-section blockquote {
  margin: 0;
  padding: 14px 20px;
  background: rgba(122, 92, 46, 0.1);
  border-left: 5px solid var(--color-accent);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

/* Paragraphs */
.ref-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--color-text);
}

/* Inline elements */
.ref-section strong {
  color: var(--color-accent);
  font-weight: 700;
}

.ref-section code {
  background: rgba(122, 92, 46, 0.12);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.92em;
}

/* Footer */
.footer {
  max-width: 210mm;
  margin: 40px auto 0;
  padding-top: 20px;
  border-top: 2px solid var(--color-border);
  text-align: center;
  color: #a08c6c;
  font-size: 12px;
  font-style: italic;
  position: relative;
}

.footer::before {
  content: "⸻  ☠  ⸻";
  display: block;
  margin-bottom: 8px;
  color: var(--color-accent);
  opacity: 0.35;
  letter-spacing: 0.2em;
}

.footer p {
  margin: 0;
}

/* Print Styles */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    padding: 0;
    background: white;
    background-image: none;
  }

  .header {
    margin-bottom: 16px;
    padding: 14px 24px;
    box-shadow: none;
  }

  .footer {
    display: none;
  }

  .main {
    max-width: 100%;
    gap: 12px;
  }

  .ref-section {
    box-shadow: none;
    border: 1px solid var(--color-border);
    background-image: none;
    page-break-inside: avoid;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .ref-section table {
    font-size: 11px;
  }

  .ref-section th,
  .ref-section td {
    padding: 6px 8px;
  }

  .ref-row {
    grid-template-columns: 1fr !important;
  }
}
