/* Second Calamity — Official Guide design system.
   2000s print strategy-guide genre. Component geometry follows the genre;
   all content, art, and fonts are ours (OFL: Charm / Alegreya / Signika). */

@font-face {
  font-family: "Charm";
  src: url("fonts/Charm-Regular.ttf");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Charm";
  src: url("fonts/Charm-Bold.ttf");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya";
  src: url("fonts/Alegreya-VariableFont_wght.ttf");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya";
  src: url("fonts/Alegreya-Italic-VariableFont_wght.ttf");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Signika";
  src: url("fonts/Signika-VariableFont_GRAD,wght.ttf");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --paper: #f2ecdc;
  --paper-deep: #e9e1cc;
  --ink: #2e2822;
  --ink-soft: #55493c;

  --orange: #e0662a;        /* script heads, active tab, accent rules */
  --label-red: #b03226;     /* table/section labels */
  --label-rule: #7a2018;    /* rule under labels and h2 */

  --table-head: #2b4a58;    /* slate-teal header bar */
  --table-head-ink: #f4efe2;
  --cell-border: #24303c;   /* dark vertical column separators */
  --row-warm: #f2c48e;
  --row-pale: #f0e3cb;
  --row-blue: #b9d6e4;      /* bestiary variant */
  --row-blue-pale: #dcebf2;

  --sage: #a9b198;          /* job-name bar */
  --olive: #57683f;         /* zone-name band */

  --callout-strip: #eecaa2; /* callout banner */
  --flavor-panel: #c5bcd2;  /* lavender flavor panel */
  --flavor-outline: #e0ce4e;

  --serif: "Alegreya", Georgia, "Times New Roman", serif;
  --script: "Charm", "Segoe Script", cursive;
  --sans: "Signika", "Segoe UI", Calibri, sans-serif;
}

* { box-sizing: border-box; }

html { background: #cfc4ab; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.5;
}

p { text-align: justify; hyphens: auto; }

/* ---------- Book frame ---------- */

.book {
  display: flex;
  min-height: 100vh;
  max-width: 72rem;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 2.5rem rgba(46, 40, 34, 0.4);
}

/* Edge tab rail: pale pastel blocks, vertical text; current = orange */

nav.tabs {
  flex: 0 0 3.6rem;
  background: var(--paper-deep);
  padding: 5rem 0 2rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

nav.tabs a {
  writing-mode: vertical-rl;
  display: block;
  min-height: 6.2rem;
  padding: 0.7rem 0.35rem;
  margin: 0 auto;
  font-family: var(--sans);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: rgba(85, 73, 60, 0.55);
  background: var(--tab, #ddd5c2);
  width: 2.4rem;
}

nav.tabs a:hover { color: var(--ink); }

nav.tabs a.current {
  background: var(--orange);
  color: #fff;
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Inactive tab pastels */
.tab-basics    { --tab: #d6d2dc; }
.tab-world     { --tab: #d9c9b4; }
.tab-jobs      { --tab: #ecd9c4; }
.tab-equipment { --tab: #eadfba; }
.tab-crafting  { --tab: #cfd4cd; }
.tab-quests    { --tab: #ddd2be; }
.tab-regions   { --tab: #ccd6d2; }
.tab-appendix  { --tab: #c4d9e6; }

main.page {
  flex: 1;
  min-width: 0;
  padding: 0 2.8rem 4rem;
  border-top: 3px solid var(--orange);
  box-shadow: inset 0 5px 0 var(--paper), inset 0 6px 0 var(--orange);
}

/* ---------- Chapter head: giant orange script over a thin dark rule ---------- */

header.chapter-head {
  display: flex;
  flex-direction: column;
  margin: 0 0 2.2rem;
  text-align: right;
}

/* Photo banner strip across the page top; real art goes in --banner per page */
header.chapter-head::before {
  content: "";
  display: block;
  height: 4.6rem;
  margin: 0 -2.8rem 0.9rem;
  background: var(--banner, linear-gradient(100deg, #3e4a3a, #57683f 30%, #8a7a4e 55%, #2b4a58 80%, #24303c));
  border-bottom: 3px solid #6e1f14;
}

h1 {
  font-family: var(--script);
  font-weight: 400;
  font-size: 4.4rem;
  line-height: 0.95;
  margin: 0;
  padding-bottom: 0.1rem;
  border-bottom: 2px solid var(--ink);
  color: var(--orange);
}

/* Kicker sits below the rule, right-aligned, like a running subtitle */
header.chapter-head .kicker {
  order: 2;
  font-family: var(--serif);
  font-variant: small-caps;
  letter-spacing: 0.22em;
  font-size: 0.85rem;
  color: var(--orange);
  margin-top: 0.25rem;
}

/* ---------- h2: big orange script section head over a black rule ---------- */

h2 {
  font-family: var(--script);
  font-weight: 400;
  font-size: 2.7rem;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  color: var(--orange);
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.1rem;
  margin: 3rem 0 1.1rem;
}

/* ---------- h2.sub: serif caps over a maroon rule (the tier below) ---------- */

h2.sub {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 3px solid var(--label-rule);
  padding-bottom: 0.15rem;
  margin: 2.6rem 0 1rem;
}

/* ---------- h3: script on an olive band (zone names) ---------- */

h3 {
  font-family: var(--script);
  font-weight: 400;
  font-size: 1.9rem;
  color: #f4efe0;
  background: linear-gradient(100deg, var(--olive), #6d7f4e 70%, #7d8a5c);
  padding: 0.15rem 0.9rem 0.05rem;
  margin: 2.2rem 0 0.9rem;
  border-bottom: 2px solid #3c4a2a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* ---------- Job name: script drop-letter overlapping a sage bar ---------- */

.jobname {
  display: flex;
  align-items: baseline;
  margin: 2.5rem 0 1rem;
  border-bottom: 2px solid var(--ink);
  background: var(--sage);
  padding-left: 0.4rem;
}

.jobname .cap {
  font-family: var(--script);
  font-size: 4.2rem;
  line-height: 0.55;
  color: var(--orange);
  padding-right: 0.05em;
  position: relative;
  z-index: 1;
}

.jobname .rest {
  flex: 1;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.9rem;
  padding: 0.05rem 0.8rem 0.05rem 0.1rem;
}

/* ---------- Red section label (table captions & standalone) ---------- */

.label, table.stats caption {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--label-red);
  border-bottom: 2px solid var(--label-rule);
  padding-bottom: 0.1rem;
  margin: 1.6rem 0 0.5rem;
}

/* ---------- Drop cap intro ---------- */

.dropcap::first-letter {
  font-family: var(--script);
  font-size: 3.4em;
  float: left;
  line-height: 0.8;
  padding: 0.05em 0.1em 0 0;
  color: var(--orange);
}

/* ---------- Data tables: bar rows with white gaps, dark column separators ---------- */

table.stats {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 3px;
  font-family: var(--sans);
  font-weight: 350;
  font-size: 0.82rem;
  margin: 0 0 1.6rem;
}

table.stats caption {
  caption-side: top;
  text-align: left;
  display: table-caption;
}

table.stats th {
  background: var(--table-head);
  color: var(--table-head-ink);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.32rem 0.55rem;
  text-align: left;
  border-left: 2px solid var(--paper);
}
table.stats th:first-child { border-left: 0; }

table.stats td {
  padding: 0.28rem 0.55rem;
  border-left: 2px solid var(--cell-border);
}
table.stats td:first-child { border-left: 0; }

table.stats tbody tr:nth-child(odd)  td { background: var(--row-warm); }
table.stats tbody tr:nth-child(even) td { background: var(--row-pale); }

table.stats td.num { text-align: center; font-variant-numeric: tabular-nums; }

/* Bestiary / appendix variant: blue rows */
table.stats.blue tbody tr:nth-child(odd)  td { background: var(--row-blue); }
table.stats.blue tbody tr:nth-child(even) td { background: var(--row-blue-pale); }

/* Left orange rule beside major content blocks (tables, columns) */
.ruled {
  border-left: 2px solid var(--orange);
  padding-left: 1rem;
}

/* ---------- Callout: banner strip + open body (no box) ---------- */

aside.callout {
  margin: 1.6rem 0;
  break-inside: avoid;
}

aside.callout > h4 {
  margin: 0 0 0.6rem;
  padding: 0.28rem 0.7rem;
  background: var(--callout-strip);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

aside.callout > p, aside.callout > ol, aside.callout > ul { margin: 0.5rem 0; }

/* Variants tint the strip only */
aside.callout.warn > h4 { background: #e5a98e; }
aside.callout.aether > h4 { background: #b7cdd2; }

/* ---------- Flavor box: rounded border, title on paper, lavender panel ---------- */

blockquote.flavor {
  border: 1.5px solid var(--ink-soft);
  border-radius: 12px;
  margin: 1.8rem 0;
  padding: 0.7rem 0.9rem 0.9rem;
  break-inside: avoid;
}

blockquote.flavor > h4 {
  margin: 0 0 0.55rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
}

blockquote.flavor > .panel {
  background: var(--flavor-panel);
  border: 2px solid var(--flavor-outline);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-family: var(--sans);
  font-weight: 350;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #2a2433;
}

blockquote.flavor footer {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  text-align: right;
  color: var(--ink-soft);
}

/* ---------- Screenshots ---------- */

figure.shot {
  margin: 1.5rem 0;
  break-inside: avoid;
}

figure.shot img {
  width: 100%;
  display: block;
  border: 1px solid var(--ink-soft);
}

figure.shot figcaption {
  font-family: var(--sans);
  font-weight: 350;
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding-top: 0.3rem;
}

figure.shot.left  { float: left;  width: 46%; margin: 0.3rem 1.2rem 0.8rem 0; }
figure.shot.right { float: right; width: 46%; margin: 0.3rem 0 0.8rem 1.2rem; }

/* Portrait for job intros: image left, prose shapes around it */
figure.portrait { float: left; width: 38%; margin: 0 1.4rem 0.6rem 0; }
figure.portrait img { width: 100%; display: block; }

/* ---------- Badges (behavior / detection / element chips) ---------- */

.badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.08rem 0.42rem;
  border-radius: 0.6rem;
  background: var(--ink-soft);
  color: #fff;
  margin-right: 0.15rem;
}

.badge.aggro   { background: #a03a26; }
.badge.passive { background: #5e7a4e; }
.badge.links   { background: #b0812e; }
.badge.sight   { background: #4e6e8e; }
.badge.sound   { background: #77628e; }
.badge.aether  { background: #2e6e76; }

/* ---------- Layout helpers ---------- */

.cols-2 { column-count: 2; column-gap: 2rem; }
.cols-2 > * { break-inside: avoid; }

.clear { clear: both; }

hr { border: 0; border-top: 1px solid #b9a888; margin: 2rem 0; }

a { color: #1d6d75; }

/* ---------- TOC / cover (index.html) ---------- */

.toc-chapters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1.2rem;
  padding: 0;
  margin: 2rem 0;
  list-style: none;
}

.toc-chapters li {
  border-top: 0.4rem solid var(--tab, #ddd5c2);
  background: #f7f2e6;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 3px rgba(46, 40, 34, 0.15);
}

.toc-chapters li a {
  font-family: var(--script);
  font-size: 1.7rem;
  color: var(--orange);
  text-decoration: none;
}

.toc-chapters li p {
  font-family: var(--sans);
  font-weight: 350;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0.4rem 0 0;
  text-align: left;
}

@media (max-width: 54rem) {
  .book { flex-direction: column; }
  nav.tabs {
    position: static; height: auto; flex-basis: auto;
    flex-direction: row; flex-wrap: wrap; padding: 0.5rem; gap: 0.3rem;
  }
  nav.tabs a { writing-mode: horizontal-tb; min-height: 0; width: auto; padding: 0.4rem 0.7rem; }
  main.page { padding: 0 1.2rem 3rem; }
  h1 { font-size: 3rem; }
  .cols-2 { column-count: 1; }
  figure.shot.left, figure.shot.right, figure.portrait { float: none; width: 100%; margin: 1.5rem 0; }
}

/* ---------- Job quick-selector ---------- */

html { scroll-behavior: smooth; }
.jobname, h2.sub { scroll-margin-top: 1rem; }

.jobdex {
  margin: 1.6rem 0 2rem;
  padding: 0.9rem 1.1rem 1rem;
  background: var(--paper-deep);
  border: 1px solid var(--sage);
  border-left: 4px solid var(--olive);
}

.jobdex-group {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.65rem;
  margin: 0.35rem 0;
}

.jobdex-group a {
  font-family: var(--sans);
  font-size: 0.86rem;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.05rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 2px;
  white-space: nowrap;
}

.jobdex-group a:hover {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--sage);
}

.jobdex-group a.jobdex-role {
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label-red);
  min-width: 8.5rem;
  padding-left: 0;
}

/* ---------- Spoiler blocks ---------- */
/* Later-story material. Collapsed by default in the reading guide; a single
   selector to strip when the design-doc build becomes the shipped guide. */

details.spoiler {
  margin: 1.4rem 0;
  border: 1px solid #a03a26;
  background: #f6ebe2;
}

details.spoiler > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.5rem 0.9rem;
  background: #a03a26;
  color: #f7f1e4;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

details.spoiler > summary::-webkit-details-marker { display: none; }

details.spoiler > summary::before {
  content: "\25B8\00a0\00a0";
  display: inline-block;
  transition: transform 0.15s;
}

details.spoiler[open] > summary::before { content: "\25BE\00a0\00a0"; }

details.spoiler > summary:hover { background: #b8452f; }

details.spoiler > .spoiler-body { padding: 0.4rem 1.1rem 1rem; }

details.spoiler .spoiler-body > h3 { margin-top: 1.2rem; }

/* ---------- Design notes ---------- */
/* Design-doc-only content. Deleted wholesale at launch. */

.devnote {
  margin: 1.2rem 0;
  padding: 0.7rem 1rem;
  background: #e4e7ea;
  border-left: 4px solid #2b4a58;
  font-family: var(--sans);
  font-size: 0.86rem;
  color: #33414c;
}

.devnote p { text-align: left; margin: 0.4rem 0; }
.devnote p:first-child { margin-top: 0; }
.devnote p:last-child { margin-bottom: 0; }

.devnote-tag {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2b4a58;
}

/* Inactive tab pastels, continued */
.tab-adventuring { --tab: #d8ccc0; }
.tab-danger      { --tab: #e2c9c2; }
