/* ==========================================================================
   Táin Reader's Guide: one stylesheet.
   ALL COLOURS LIVE IN THE :root BLOCK BELOW. Nothing else in this file or in
   the SVG maps contains a colour value. Change a variable and the whole site follows.
   ========================================================================== */
:root {
  /* ---- Page ---- */
  --page-bg:              #0c0a08;  /* base colour behind everything */
  --page-grain-a:         #15120e;  /* texture stripe, lighter */
  --page-grain-b:         #070605;  /* texture stripe, darker */
  --page-vignette:        #000000;  /* dark edge falloff */

  /* ---- Panels (the beveled table-like boxes) ---- */
  --panel-bg:             #1b1814;  /* panel fill */
  --panel-bg-deep:        #131110;  /* recessed areas inside panels */
  --panel-bg-grain:       #211d18;  /* panel texture stripe */
  --panel-border-light:   #6f6657;  /* bevel highlight (top and left edges) */
  --panel-border-dark:    #070605;  /* bevel shadow (bottom and right edges) */
  --panel-border-mid:     #3a342b;  /* inner groove line */

  /* ---- Text ---- */
  --text:                 #cdc3ad;  /* body text */
  --text-dim:             #8f8673;  /* notes, captions, small print */
  --heading:              #c19f4b;  /* headings: tarnished gold */
  --heading-shadow:       #000000;  /* heading drop shadow */
  --heading-label:        #a58a4a;  /* small caps labels */

  /* ---- Links ---- */
  --link:                 #d1b26a;  /* unvisited link */
  --link-visited:         #8d7266;  /* visited link: dusty brown */
  --link-hover:           #f0dca0;  /* hover and focus */
  --link-active:          #b5432f;  /* while pressed: old blood */
  --link-gloss-line:      #a58a4a;  /* dotted underline of glossary links */
  --focus-ring:           #e6cf8f;  /* keyboard focus outline */

  /* ---- Dividers ---- */
  --rule-gold:            #8e7432;  /* gold rule */
  --rule-gold-dim:        #4b3d1b;  /* shadow line beside the gold rule */

  /* ---- Quote ---- */
  --quote-bg:             #12100d;
  --quote-text:           #e0d5b9;
  --quote-border:         #8e7432;  /* left bar */
  --quote-attribution:    #a58a4a;

  /* ---- Trait card (stat block) ---- */
  --trait-bg:             #14110e;
  --trait-border:         #8e7432;
  --trait-title-bg:       #3a2d14;
  --trait-title-text:     #e6cf8f;
  --trait-label-bg:       #231e17;
  --trait-label-text:     #b9a064;
  --trait-value-text:     #d8cdb3;
  --trait-row-line:       #3a342b;

  /* ---- Sample and not-written-yet markers ---- */
  --sample-bg:            #3b1a14;
  --sample-text:          #e3b8a6;
  --sample-border:        #8a3a2a;
  --unwritten-text:       #8a8070;
  --unwritten-border:     #5a5244;

  /* ---- Maps ---- */
  --map-sea:              #101619;  /* sea fill */
  --map-land:             #2d281f;  /* land fill */
  --map-coast:            #8a7843;  /* coastline stroke */
  --map-province-label:   #5f5744;  /* province text */
  --map-marker:           #c19f4b;  /* place marker */
  --map-marker-stroke:    #0c0a08;  /* marker outline */
  --map-marker-visited:   #8d7266;  /* marker of a place whose page was visited */
  --map-marker-hover:     #f0dca0;
  --map-label:            #d9cfb4;  /* place name text */
  --map-label-halo:       #0c0a08;  /* outline behind place names so they stay readable */
  --map-highlight:        #b5432f;  /* the place on a location page's locator map */
  --map-highlight-ring:   #7a2b20;
  --map-dim-marker:       #5a5244;  /* other places on the locator map */
  --map-route:            #b5432f;  /* the cattle raid route line */
  --map-route-planned:    #6f8fa8;  /* the planned route, when switched on in mapdata.yaml */
  --map-zoom-frame:       #6f6657;  /* dashed frame that opens the zoomed map */
  --map-zoom-frame-hover: #f0dca0;

  /* ---- Images and frames ---- */
  --image-frame:          #6f6657;
  --image-bg:             #070605;

  /* ---- Footer ---- */
  --footer-text:          #7d7463;

  /* ---- Fonts (all installed with macOS; no downloads) ---- */
  --font-body:    "Times New Roman", Times, "Liberation Serif", serif;
  --font-heading: "Big Caslon", Baskerville, "Hoefler Text", "Palatino Linotype", Palatino, Georgia, serif;
  --font-label:   Copperplate, "Copperplate Gothic Light", "Big Caslon", Baskerville, Georgia, serif;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  min-height: 100%;
  background-color: var(--page-bg);
  /* Texture from layered gradients. Optional GIF tile sits underneath. */
  background-image:
    radial-gradient(ellipse at 50% 30%, transparent 40%, var(--page-vignette) 130%),
    repeating-linear-gradient(45deg, var(--page-grain-a) 0, var(--page-grain-a) 1px, transparent 1px, transparent 5px),
    repeating-linear-gradient(-45deg, var(--page-grain-b) 0, var(--page-grain-b) 1px, transparent 1px, transparent 7px),
    url("../img/site/bg-tile.gif");
}
body {
  margin: 0;
  padding: 14px 10px 30px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
}
#wrap { width: 760px; max-width: 100%; margin: 0 auto; }

a { color: var(--link); text-decoration: underline; }
a:visited { color: var(--link-visited); }
/* Glossary links: the same colours as other links, but a dotted underline in place of the solid one. */
a.xref.gloss { text-decoration: underline dotted; text-decoration-color: var(--link-gloss-line); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover, a:focus { color: var(--link-hover); }
a:active { color: var(--link-active); }
a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: normal;
  color: var(--heading);
  text-shadow: 1px 1px 0 var(--heading-shadow);
  line-height: 1.2;
}
h1 { font-size: 2.1rem; margin: 0.3em 0 0.2em; text-align: center; letter-spacing: 0.02em; }
h2 { font-size: 1.45rem; margin: 1em 0 0.4em; border-bottom: 1px solid var(--rule-gold-dim); padding-bottom: 0.15em; }
h3 { font-family: var(--font-label); font-size: 0.95rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--heading-label); margin: 1em 0 0.3em; }
p { margin: 0.7em 0; }
img { max-width: 100%; height: auto; }

/* ---------- Beveled panel ---------- */
.panel {
  margin: 0 0 10px;
  padding: 14px 18px;
  background-color: var(--panel-bg);
  background-image: repeating-linear-gradient(0deg, var(--panel-bg-grain) 0, var(--panel-bg-grain) 1px, transparent 1px, transparent 4px);
  border: 4px solid;
  border-color: var(--panel-border-light) var(--panel-border-dark) var(--panel-border-dark) var(--panel-border-light);
  outline: 1px solid var(--panel-border-mid);
  outline-offset: -8px;
}

/* ---------- Main ---------- */
.main { position: relative; min-height: 300px; }
.lead { text-align: center; font-size: 1.1rem; }
.back { font-size: 0.95rem; margin: 0 0 0.6em; }
/* Sits on the same line as the back link, at the top right of the panel. */
.report-issue { position: absolute; top: 14px; right: 18px; margin: 0; font-size: 0.95rem; }
.irish { text-align: center; font-style: italic; font-size: 1.15rem; margin: 0; color: var(--text); }
.altnames { text-align: center; font-size: 0.95rem; color: var(--text-dim); margin: 0.3em 0; }
.epithet { text-align: center; font-family: var(--font-label); letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.85rem; color: var(--heading-label); margin: 0.3em 0; }
.summary { text-align: center; font-size: 1.05rem; margin: 0.4em 0; }
.clear { clear: both; }

/* ---------- Dividers ---------- */
hr {
  border: 0; height: 2px; margin: 1.2em 0;
  background: var(--rule-gold); box-shadow: 0 1px 0 var(--rule-gold-dim);
}
.divider { text-align: center; margin: 0.8em 0; line-height: 0; }
.divider img { max-width: 100%; height: auto; border-top: 1px solid var(--rule-gold); border-bottom: 1px solid var(--rule-gold-dim); }

/* ---------- Home ---------- */
.home-title { font-size: 3rem; margin: 0.2em 0 0.4em; }
.home-art { margin: 0 auto 1em; padding: 4px; max-width: 640px; background: var(--image-bg); border: 3px ridge var(--image-frame); }
.home-art img { display: block; width: 100%; height: auto; }
.home-links { list-style: none; margin: 0; padding: 0; text-align: center; font-size: 1.3rem; }
.home-links li { margin: 0.5em 0; }

/* ---------- Detail pages ---------- */
/* Two columns: text on the left with a readable measure, portrait and trait card on the right. */
.detail-body { display: grid; grid-template-columns: minmax(0, 1fr) 240px; column-gap: 24px; align-items: start; margin-bottom: 0.5em; }
.detail-body .overview { grid-column: 1; grid-row: 1; min-width: 0; max-width: 36em; }
.detail-body.solo { display: block; }
.sidebar { grid-column: 2; grid-row: 1; min-width: 0; position: sticky; top: 10px; }
.portrait { margin: 0 0 12px; padding: 4px; background: var(--image-bg); border: 3px ridge var(--image-frame); }
.portrait img { display: block; width: 100%; height: auto; }

.traits { margin: 0 0 12px; background: var(--trait-bg); border: 2px solid var(--trait-border); }
.traits h2 {
  margin: 0; padding: 4px 8px; border: 0; background: var(--trait-title-bg); color: var(--trait-title-text);
  font-family: var(--font-label); font-size: 0.9rem; letter-spacing: 0.2em; text-transform: uppercase; text-align: center;
}
.traits table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.traits th, .traits td { padding: 4px 8px; vertical-align: top; text-align: left; border-top: 1px solid var(--trait-row-line); }
.traits th { width: 38%; background: var(--trait-label-bg); color: var(--trait-label-text); font-family: var(--font-label); font-weight: normal; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.traits td { color: var(--trait-value-text); }

.locator { margin: 0 0 12px; padding: 8px; background: var(--panel-bg-deep); border: 3px groove var(--panel-border-light); }
.locator h2 { font-size: 0.9rem; font-family: var(--font-label); letter-spacing: 0.15em; text-transform: uppercase; border: 0; margin: 0 0 6px; text-align: center; color: var(--heading-label); }
.locator svg { display: block; width: 100%; height: auto; max-height: 300px; }
.coords { margin: 0.3em 0 0; font-size: 0.85rem; text-align: center; color: var(--text-dim); }

.overview { line-height: 1.6; }
.overview h2:first-child { margin-top: 0.3em; }
.overview p { margin: 0 0 1em; }
.overview h2 { margin-top: 1.4em; }
.overview h3 { margin-top: 1.4em; }
.overview ul, .overview ol { margin: 0 0 1em; padding-left: 1.4em; }
.overview li { margin: 0.3em 0; }

.quote { margin: 1.2em 0; padding: 12px 18px; background: var(--quote-bg); border-left: 6px solid var(--quote-border); border-top: 1px solid var(--rule-gold-dim); border-bottom: 1px solid var(--rule-gold-dim); }
.quote blockquote { margin: 0; }
.quote blockquote p { margin: 0; color: var(--quote-text); font-size: 1.2rem; font-style: italic; }
.quote figcaption { margin-top: 0.6em; text-align: right; font-size: 0.9rem; color: var(--quote-attribution); }
.quote figcaption::before { content: "- "; }

.events ol { padding-left: 1.4em; }
.events li { margin: 0.5em 0; }
.note { font-size: 0.88rem; color: var(--text-dim); }
.blurb { font-size: 0.95rem; color: var(--text); }

/* ---------- Link lists with GIF bullets ---------- */
ul.links { list-style: none; margin: 0.4em 0; padding: 0; }
ul.links li { margin: 0.3em 0; padding: 0 0 0 24px; min-height: 18px; background: url("../img/site/bullet.gif") no-repeat 0 0.25em; }
.index-list li { margin: 0.7em 0; }
.xlist h3:first-child { margin-top: 0.4em; }

/* ---------- Index pages: tiers, jump links, compact lists ---------- */
.jump { text-align: center; font-size: 0.95rem; color: var(--text-dim); }
.index-section h2:first-child { margin-top: 0.4em; }
.major-list { list-style: none; margin: 0; padding: 0; }
.major-entry { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px; background: var(--panel-bg-deep); border: 2px groove var(--panel-border-light); }
.major-thumb img { display: block; width: 64px; height: auto; border: 2px ridge var(--image-frame); background: var(--image-bg); }
.major-text { min-width: 0; }
.major-text > * { display: block; }
.major-name { font-family: var(--font-heading); font-size: 1.35rem; }
.epithet-inline { font-family: var(--font-label); letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.8rem; color: var(--heading-label); }
.index-list.compact li { margin: 0.45em 0; }
.members { margin: 1em 0; }
.member-table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.member-table th, .member-table td { text-align: left; vertical-align: top; padding: 5px 10px; border-top: 1px solid var(--trait-row-line); }
.member-table thead th { font-family: var(--font-label); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--heading-label); background: var(--trait-label-bg); }
.member-table tbody th { font-weight: normal; width: 34%; }

/* ---------- Glossary ---------- */
.glossary dt { margin: 1em 0 0.1em; font-family: var(--font-heading); font-size: 1.15rem; color: var(--heading); }
.glossary dt:target { background: var(--panel-bg-deep); }
.glossary dd { margin: 0 0 0.5em 1.2em; max-width: 36em; }

/* ---------- Not written yet and sample markers ---------- */
.unwritten { color: var(--unwritten-text); border-bottom: 1px dashed var(--unwritten-border); cursor: default; }
.unwritten-tag { font-size: 0.78rem; font-variant: small-caps; letter-spacing: 0.05em; }
.sample-flag { margin: 0 0 0.8em; padding: 6px 10px; background: var(--sample-bg); color: var(--sample-text); border: 2px dashed var(--sample-border); font-family: var(--font-label); font-size: 0.8rem; letter-spacing: 0.08em; text-align: center; }

/* ---------- Chapter prev/next ---------- */
.prevnext { display: flex; justify-content: space-between; gap: 10px; margin-top: 1.4em; padding: 8px 10px; background: var(--panel-bg-deep); border: 2px groove var(--panel-border-light); }
.prevnext .prev { text-align: left; flex: 1; }
.prevnext .up { text-align: center; }
.prevnext .next { text-align: right; flex: 1; }

/* ---------- Maps ---------- */
.mapwrap { margin: 0.8em auto; padding: 6px; background: var(--panel-bg-deep); border: 4px ridge var(--panel-border-light); }
.mapwrap svg { display: block; width: 100%; height: auto; }
.mapwrap .map-full { max-width: 700px; margin: 0 auto; }
.mapwrap .map-region { max-width: 720px; margin: 0 auto; }
.mapnote { text-align: center; font-size: 0.85rem; color: var(--text-dim); }

.map-sea { fill: var(--map-sea); }
.map-land { fill: var(--map-land); stroke: var(--map-coast); stroke-width: 1.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; fill-rule: evenodd; }
.map-province { fill: var(--map-province-label); font-family: var(--font-label); letter-spacing: 0.2em; text-transform: uppercase; pointer-events: none; }
.map-province-minor { letter-spacing: 0.1em; }
.map-route { stroke: var(--map-route); stroke-width: 2.5; stroke-dasharray: 6 4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.map-route-planned { stroke: var(--map-route-planned); stroke-width: 2; stroke-dasharray: 2 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.map-zoom-frame { fill: none; stroke: var(--map-zoom-frame); stroke-width: 1.2; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: all; }
.map-zoom:hover .map-zoom-frame, .map-zoom:focus .map-zoom-frame { stroke: var(--map-zoom-frame-hover); }
.map-marker { fill: var(--map-marker); stroke: var(--map-marker-stroke); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.map-pin:visited .map-marker { fill: var(--map-marker-visited); }
.map-pin:hover .map-marker, .map-pin:focus .map-marker { fill: var(--map-marker-hover); }
.map-label { fill: var(--map-label); font-family: var(--font-heading); stroke: var(--map-label-halo); stroke-width: 3px; paint-order: stroke; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map-pin { text-decoration: none; }
.map-hit { fill: transparent; stroke: none; pointer-events: all; }
.map-pin:hover .map-label, .map-pin:focus .map-label { fill: var(--map-marker-hover); }
.map-pin-highlight { fill: var(--map-highlight); stroke: var(--map-marker-stroke); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.map-locator-ring { fill: none; stroke: var(--map-highlight-ring); stroke-width: 2; vector-effect: non-scaling-stroke; }
.map-pin-dim { fill: var(--map-dim-marker); }
.map-locator .map-land { stroke-width: 1; }

/* ---------- Footer ---------- */
.footer { text-align: center; font-size: 0.85rem; color: var(--footer-text); }
.footer p { margin: 0.3em 0; }
.footer-badge { display: block; margin: 0 auto 6px; border: 1px solid var(--panel-border-mid); background: var(--image-bg); }
.footer-note { font-size: 0.8rem; }

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  body { padding: 6px 4px 20px; font-size: 17px; }
  .panel { padding: 10px 12px; }
  .report-issue { top: 10px; right: 12px; }
  h1 { font-size: 1.7rem; }
  .detail-body { display: block; }
  .detail-body .overview { max-width: none; }
  .sidebar { position: static; margin: 0 0 12px; }
  .portrait { max-width: 200px; margin-left: auto; margin-right: auto; }
  .prevnext { flex-direction: column; text-align: center; }
  .prevnext .prev, .prevnext .next { text-align: center; }
}
