/* ==========================================================================
   Age of Wonders 4: The Silver Seas — guide site skin
   Palette sampled from the DLC key art and Steam screenshots (see DESIGN-BRIEF.md).
   Structure: ship's log + trade ledger — hairline rules, numbered sections,
   chart-plate cards, notched contract buttons.
   ========================================================================== */

:root {
  --ink: #06131c;
  --ink-2: #0a2030;
  --panel: #0f2b3a;
  --panel-2: #123648;
  --line: #2c556a;
  --silver: #cdd9e2;
  --muted: #93aebd;
  --teal: #5fc2cd;
  --teal-deep: #2f9aa8;
  --gold: #d9a441;
  --gold-soft: #e7c07a;
  --coral: #d9694f;
  --maxw: 1240px;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ink); }

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 12% -6%, rgba(47, 154, 168, .16) 0%, transparent 70%),
    radial-gradient(1100px 520px at 88% 4%, rgba(217, 164, 65, .08) 0%, transparent 72%),
    linear-gradient(180deg, #081823 0%, var(--ink) 42%, #04101a 100%);
  background-color: var(--ink);
  color: var(--silver);
  font: 16px/1.7 var(--body);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--teal); text-decoration: none; }
a:hover, a:focus-visible { color: var(--gold-soft); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skip { position: absolute; left: -9999px; top: 0; z-index: 90; background: var(--gold); color: #1a1206; padding: 10px 16px; font-weight: 700; }
.skip:focus { left: 12px; top: 12px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 26px; }

/* ---------------------------------------------------------------- ribbon */
.ribbon {
  background: linear-gradient(90deg, rgba(217, 164, 65, .16), rgba(217, 164, 65, .04) 55%, transparent);
  border-bottom: 1px solid rgba(217, 164, 65, .35);
  font-size: 12.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--gold-soft);
}
.ribbon .wrap { padding-top: 8px; padding-bottom: 8px; }

/* ---------------------------------------------------------------- header */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(180deg, rgba(8, 26, 38, .98), rgba(6, 19, 28, .96));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(205, 217, 226, .05);
}
.topbar::after {
  content: ""; display: block; height: 2px;
  background: linear-gradient(90deg, var(--gold) 0 84px, transparent 84px);
  opacity: .8;
}
.bar { display: flex; align-items: center; gap: 22px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--silver); margin-right: auto; }
.brand:hover { color: var(--silver); text-decoration: none; }
.brand img {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(217, 164, 65, .6);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, .08);
}
.brand span { font-family: var(--display); font-size: 19px; line-height: 1.15; letter-spacing: .02em; max-width: 430px; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav > ul { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav > ul > li { position: relative; }
.nav > ul > li > a {
  display: inline-block; padding: 9px 12px;
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--silver); border-bottom: 2px solid transparent;
}
.nav > ul > li > a:hover,
.nav > ul > li.active > a { color: var(--gold-soft); border-bottom-color: var(--gold); text-decoration: none; }

.nav .kids {
  position: absolute; left: 0; top: 100%; min-width: 100%;
  display: none; flex-direction: column; gap: 0;
  margin: 0; padding: 6px 0; list-style: none; z-index: 60;
  background: #0b2331; border: 1px solid var(--line); border-top: 2px solid var(--gold);
  box-shadow: 0 18px 34px rgba(0, 0, 0, .45);
}
.nav .kids li { margin: 0; }
.nav .kids a {
  display: block; padding: 9px 16px; white-space: nowrap;
  font-size: 13.5px; letter-spacing: .02em; text-transform: none;
  color: var(--silver); border: 0;
}
.nav .kids a:hover { background: rgba(217, 164, 65, .1); color: var(--gold-soft); text-decoration: none; }
.nav .has-kids:hover > .kids,
.nav .has-kids:focus-within > .kids,
.nav .has-kids:has(> a:focus-visible) > .kids { display: flex; }

.nav .cta {
  margin-left: 10px; padding: 9px 16px;
  font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  color: #171006; background: var(--gold);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.nav .cta:hover { background: var(--gold-soft); color: #171006; text-decoration: none; }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative; border-bottom: 1px solid var(--line);
  background:
    radial-gradient(760px 340px at 8% 0%, rgba(47, 154, 168, .18), transparent 70%),
    linear-gradient(180deg, #0a2231, #071721 70%, var(--ink));
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px; pointer-events: none;
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='40' viewBox='0 0 160 40'%3E%3Cpath d='M0 28c20 0 20-12 40-12s20 12 40 12 20-12 40-12 20 12 40 12' fill='none' stroke='%23cdd9e2' stroke-opacity='.16' stroke-width='1.2'/%3E%3C/svg%3E") repeat-x;
  opacity: .45;
}
.hero-in {
  display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr);
  gap: 40px; align-items: center; padding-top: 50px; padding-bottom: 56px;
}
.hero-copy { position: relative; z-index: 1; }
.eyebrow {
  margin: 0 0 14px; font-size: 12.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 34px; height: 1px; background: var(--gold); display: inline-block; }
.hero h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(34px, 4.2vw, 58px); line-height: 1.04; letter-spacing: -.01em;
  margin: 0 0 18px; color: #f2f6f8;
}
.hero h1 .thin { color: var(--silver); font-style: italic; font-weight: 400; }
.lead { font-size: 17px; line-height: 1.65; color: #c2d1db; margin: 0 0 24px; max-width: 46ch; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.btn {
  display: inline-block; padding: 12px 20px;
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  color: #171006; background: var(--gold);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.btn:hover { background: var(--gold-soft); color: #171006; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--silver); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { color: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold); }

.hero-plate { margin: 0; position: relative; }
.hero-plate .plate {
  display: block; position: relative; padding: 7px;
  background: linear-gradient(160deg, rgba(217, 164, 65, .5), rgba(44, 85, 106, .5));
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
.hero-plate .plate::before,
.hero-plate .plate::after {
  content: ""; position: absolute; width: 26px; height: 26px; pointer-events: none; border: 1px solid var(--gold);
}
.hero-plate .plate::before { top: 14px; left: 14px; border-right: 0; border-bottom: 0; }
.hero-plate .plate::after { bottom: 14px; right: 14px; border-left: 0; border-top: 0; }
.hero-plate img { width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: cover; }
.hero-plate figcaption { margin-top: 9px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------------- facts ledger */
.facts-strip { background: #071a26; border-bottom: 1px solid var(--line); }
.facts { display: flex; flex-wrap: wrap; }
.fact { flex: 1 1 190px; padding: 15px 18px 14px; border-left: 1px solid var(--line); }
.fact:first-child { border-left: 0; padding-left: 0; }
.fact-k { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.fact-v { display: block; font-family: var(--display); font-size: 17px; color: var(--gold-soft); }

/* ---------------------------------------------------------------- section heads */
.section-head { margin: 36px 0 18px; }
.overline { display: inline-block; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.section-head h2, .all-guides h2 {
  font-family: var(--display); font-weight: 600; font-size: 27px; line-height: 1.15;
  margin: 0; color: #eef4f7; display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line); position: relative;
}
.section-head h2::before, .all-guides h2::before {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 64px; height: 2px; background: var(--gold);
}
.count-pill {
  font-family: var(--body); font-size: 12px; letter-spacing: .08em; color: #171006;
  background: var(--gold); padding: 2px 9px; border-radius: 2px;
}

/* ---------------------------------------------------------------- cards */
.grid { display: flex; flex-wrap: wrap; gap: 18px; }
.grid[data-n="2"] .card { flex: 1 1 calc(50% - 18px); }
.grid[data-n="4"] .card { flex: 1 1 calc(25% - 18px); }
.card {
  flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel), #0c2431);
  border: 1px solid var(--line); color: var(--silver); position: relative;
  transition: border-color .18s ease, transform .18s ease;
}
.card::before, .card::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border: 1px solid rgba(217, 164, 65, .55); pointer-events: none;
}
.card::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.card::after { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }
.card:hover { border-color: var(--gold); transform: translateY(-2px); text-decoration: none; }
.card .thumb { display: block; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.card .thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card .thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6, 19, 28, .06), rgba(6, 19, 28, .42));
}
.pill-tag {
  position: absolute; left: 10px; bottom: 10px; z-index: 2;
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  background: rgba(6, 19, 28, .82); color: var(--gold-soft);
  border: 1px solid rgba(217, 164, 65, .5); padding: 3px 8px;
}
.card-body { padding: 15px 16px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-body h3 { font-family: var(--display); font-size: 19px; line-height: 1.25; margin: 0; color: #eef4f7; font-weight: 600; }
.card-body p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.card .go { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-top: auto; }
.card .stamp { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #6e8798; }

/* ---------------------------------------------------------------- home prose */
.home-prose {
  max-width: 82ch; margin: 34px 0 6px; padding: 26px 30px 30px;
  background: linear-gradient(180deg, rgba(15, 43, 58, .92), rgba(9, 30, 42, .92));
  border: 1px solid var(--line); border-top: 2px solid var(--gold);
}
.home-prose p { color: #c6d4dd; }
.home-prose h2 {
  font-family: var(--display); font-size: 24px; margin: 30px 0 12px; color: #eef4f7;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.home-prose h2:first-child { margin-top: 0; }
.home-prose h3 { font-family: var(--display); font-size: 18px; color: var(--gold-soft); margin: 22px 0 8px; }
.home-prose ul, .home-prose ol { padding-left: 22px; }
.home-prose li { margin: 6px 0; }

/* ---------------------------------------------------------------- article */
.article-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 34px;
  align-items: start; padding-top: 24px; padding-bottom: 40px;
}
.article-grid > div { min-width: 0; }

.crumb { font-size: 12.5px; letter-spacing: .05em; color: var(--muted); margin-bottom: 14px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--gold-soft); }
.crumb .sep { color: #6e8798; margin: 0 6px; }
.crumb .here { color: var(--silver); }

article {
  counter-reset: sec;
  background: linear-gradient(180deg, rgba(15, 43, 58, .94), rgba(8, 27, 38, .94));
  border: 1px solid var(--line); border-top: 2px solid var(--gold);
  padding: 30px 34px 34px; min-width: 0;
}
article > h1 {
  font-family: var(--display); font-weight: 600; font-size: clamp(30px, 3.2vw, 42px);
  line-height: 1.12; letter-spacing: -.01em; margin: 0 0 8px; color: #f4f8fa;
}
article h2 {
  font-family: var(--display); font-weight: 600; font-size: 25px; line-height: 1.2;
  margin: 38px 0 12px; color: #eef4f7; padding-bottom: 9px; border-bottom: 1px solid var(--line);
  counter-increment: sec; scroll-margin-top: 96px; display: flex; align-items: baseline; gap: 12px;
}
article h2::before {
  content: counter(sec, decimal-leading-zero);
  font-family: var(--display); font-size: 15px; color: var(--gold);
  letter-spacing: .06em; border-right: 1px solid var(--line); padding-right: 11px;
}
article h3 { font-family: var(--display); font-size: 19px; margin: 24px 0 8px; color: var(--gold-soft); font-weight: 600; }
article p { margin: 0 0 15px; color: #c6d4dd; }
article ul, article ol { margin: 0 0 16px; padding-left: 22px; color: #c6d4dd; }
article li { margin: 6px 0; }
article strong, article b { color: #f0f5f7; font-weight: 650; }
article a { border-bottom: 1px solid rgba(95, 194, 205, .35); }
article a:hover { border-bottom-color: var(--gold); text-decoration: none; }
article hr { border: 0; border-top: 1px solid var(--line); margin: 30px 0; }
article blockquote {
  margin: 20px 0; padding: 12px 18px; border-left: 2px solid var(--teal-deep);
  background: rgba(47, 154, 168, .08); color: #cfe0e8; font-style: italic;
}
article img.zoom { width: 100%; cursor: zoom-in; border: 1px solid var(--line); margin: 8px 0 6px; }
article p > img.zoom:only-child { margin: 20px 0; }

.callout {
  margin: 20px 0; padding: 14px 18px 6px;
  background: rgba(217, 164, 65, .07); border: 1px solid rgba(217, 164, 65, .3);
  border-left: 3px solid var(--gold);
}
.callout p { color: #d8e2e9; }
.callout.note::before {
  content: "Margin note"; display: block; font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 6px;
}

/* ledger tables */
.tbl-wrap { width: 100%; overflow-x: auto; margin: 18px 0 24px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: rgba(6, 19, 28, .35); }
thead th {
  background: var(--panel-2); color: var(--gold-soft);
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600;
  text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 10px 13px; border-bottom: 1px solid rgba(44, 85, 106, .55); vertical-align: top; color: #c9d7df; }
tbody tr:nth-child(even) td { background: rgba(47, 154, 168, .045); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { color: #e6eef3; }
table strong, table b { color: inherit; }
table code { color: var(--gold-soft); }

/* quick answer */
.quick-answer {
  margin: 18px 0 26px; padding: 14px 18px 12px;
  background: linear-gradient(180deg, rgba(47, 154, 168, .12), rgba(47, 154, 168, .04));
  border: 1px solid rgba(95, 194, 205, .3); border-left: 3px solid var(--teal);
}
.qa-stamp { display: block; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--teal); margin-bottom: 6px; }
.quick-answer p { margin: 0; color: #dbe7ee; }

/* toc */
.toc { position: sticky; top: 96px; padding: 16px 16px 14px; background: rgba(10, 32, 48, .72); border: 1px solid var(--line); }
.toc .overline { margin-bottom: 10px; }
.toc-list { display: flex; flex-direction: column; gap: 2px; }
.toc-list a {
  display: block; padding: 7px 0 7px 26px; position: relative;
  font-size: 13px; line-height: 1.35; color: var(--muted);
  border-bottom: 1px dotted rgba(44, 85, 106, .5); counter-increment: toc;
}
.toc-list { counter-reset: toc; }
.toc-list a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute; left: 0; top: 7px; font-size: 11px; color: var(--gold); letter-spacing: .04em;
}
.toc-list a:hover { color: var(--gold-soft); text-decoration: none; }

/* all guides */
.all-guides { margin-top: 42px; padding-top: 6px; border-top: 1px solid var(--line); }
.all-guides .grid { margin-top: 16px; }
.card.sm .card-body { padding: 11px 13px; }
.card.sm .card-body h3 { font-size: 15.5px; }
.more { margin: 14px 0 0; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.more a { color: var(--gold); }

/* ---------------------------------------------------------------- ad slot (only rendered when keys exist) */
.ad-slot { margin: 26px auto; max-width: var(--maxw); }
.ad-inner { min-height: 0; overflow: hidden; }
.ad-slot:empty { display: none; }
@media (hover: hover) and (pointer: fine) { .ad-slot { display: block; } }
@media not all and (hover: hover) and (pointer: fine) { .ad-slot { display: none; } }
.ad-label { margin: 0 0 8px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------------- footer */
.foot {
  background: #04101a; border-top: 1px solid var(--line); margin-top: 30px;
  padding: 26px 0 34px; font-size: 12.5px; color: var(--muted);
}
.foot p { margin: 0 0 8px; }
.foot .disclaimer { max-width: 88ch; color: #7f99a9; }
.foot-links a { color: var(--silver); margin-right: 4px; }
.foot-links a:hover { color: var(--gold-soft); }
.foot .muted { color: #6e8798; letter-spacing: .05em; }

/* ---------------------------------------------------------------- lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(3, 11, 17, .95); cursor: zoom-out; padding: 20px;
}
.lightbox img { max-width: min(1560px, 96vw); max-height: 92vh; width: auto; height: auto; border: 1px solid var(--line); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .article-grid { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; margin-top: 8px; }
}
@media (max-width: 980px) {
  .hero-in { grid-template-columns: minmax(0, 1fr); gap: 22px; padding-top: 32px; padding-bottom: 38px; }
  .hero-plate { order: -1; }
  .brand span { font-size: 17px; max-width: 100%; }
  .bar { gap: 12px; }
  .nav { width: 100%; }
  .nav > ul { flex-wrap: wrap; gap: 0 4px; }
  .nav > ul > li > a { padding: 7px 9px; font-size: 12px; }
  .nav .cta { margin-left: auto; }
}
@media (max-width: 700px) {
  .wrap { padding: 0 16px; }
  .fact { flex: 1 1 46%; border-left: 0; padding-left: 0; }
  .fact:nth-child(n+3) { border-top: 1px solid var(--line); }
  article { padding: 22px 18px 26px; }
  .home-prose { padding: 20px 18px 22px; }
  .grid[data-n="4"] .card, .grid[data-n="2"] .card { flex: 1 1 100%; }
  .nav .kids { position: static; display: none; border: 0; background: transparent; box-shadow: none; padding: 0 0 6px 8px; }
  .nav .has-kids:hover > .kids, .nav .has-kids:focus-within > .kids { display: flex; }
  .nav .kids a { white-space: normal; padding: 6px 8px; font-size: 13px; }
  .hero h1 { font-size: 33px; }
  article h2 { font-size: 22px; }
}
@media (max-width: 460px) {
  .brand span { font-size: 15.5px; }
  .nav > ul > li > a { font-size: 11.5px; letter-spacing: .06em; padding: 6px 7px; }
  .nav .cta { display: none; }
  thead th { white-space: normal; }
  tbody td { overflow-wrap: anywhere; }
  .tbl-wrap table { min-width: 460px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
