/* =========================================================================
   copy.css - the two god pages (loaded after theme.css).

   Two parts:
     1. Expiration Deities: the overlap chart of religions (one button and bar
        each), then a gold-and-red line down the left, one dot and one card per
        god, coloured by part of the world. A card opens to tell the whole story.
     2. "Versions of each other": claims with Documented / Debated / Myth badges.
   Colours come from the variables in theme.css (--gold, --red, ...), plus one
   colour per region (below). tests/style.test.mjs checks every small-text colour
   here is readable (4.5:1) and every button is thumb-sized (44px).
   ========================================================================= */

/* The "hidden" attribute always wins on this page (some boxes below set their
   own display, which would otherwise un-hide them). */
.page-copy [hidden] { display: none !important; }

/* One colour per part of the world: the timeline dot, the card's left edge, the
   religion's name on the card, and its bar on the overlap chart. The religion is
   also written on every card and button, so colour is never the only clue. */
.region-near-east { --region: #79a8ff; }  /* lapis lazuli blue - Middle East & Anatolia */
.region-africa { --region: #45d0c0; }     /* Egyptian faience turquoise - Egypt & Nubia */
.region-asia { --region: #ff7eb6; }       /* lotus pink - India, Iran & China */
.region-europe { --region: #c49bff; }     /* Tyrian purple - Europe */
.region-americas { --region: #ffa94d; }   /* marigold - the Americas */
/* Added with batch 2 (Dec 2026): the old labels would be wrong for these religions
   ("Egypt & Nubia" for the Yoruba and Akan, "India, Iran & China" for Japan and the
   steppe), and nothing covered Polynesia. Hues the five above do not use. */
.region-west-africa { --region: #f0e15a; }    /* lemon yellow - West Africa */
.region-northeast-asia { --region: #cfd6e0; } /* moonlight silver - Japan, Mongolia & Siberia */
.region-oceania { --region: #a8e05f; }        /* taro-leaf green - the Pacific */

/* Badge colours (Documented / Debated / Myth). */
.page-copy {
  --documented: #7ddc9a;
  --debated: var(--gold);
  --myth: var(--red-text);
}

/* ---- Top of the page ------------------------------------------------------ */

.cp-jump {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 0;
}
.cp-jump .btn {
  flex-direction: row;
  min-height: 44px;
  padding: 0.5em 1.2em;
  font-size: 1rem;
}

/* No scroll-margin-top anywhere on this page: theme.css's scroll-padding-top on <html>
   already lands every #jump and scrollIntoView just below the sticky header. The two
   ADD UP, so adding one here too would leave an empty band under the header. */
.cp-section-title {
  margin: 36px 0 10px;
  text-align: center;
}

.cp-intro {
  max-width: 70ch;
  margin: 0 auto 22px;
}

.cp-tools { margin: 0 auto 22px; max-width: 860px; }

.cp-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.chip-count {
  font-size: 0.8rem;
  color: var(--muted);
}
.chip[aria-pressed="true"] .chip-count { color: var(--cream); }

.cp-count {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
}

.cp-loading {
  padding: 30px 0;
  text-align: center;
  color: var(--muted);
}

/* ============================ 1. The timeline ============================== */

.god-list {
  position: relative;
  max-width: 860px; /* long stories stay readable on big screens */
  margin: 0 auto;
  padding: 0 0 0 32px;
  list-style: none;
}
/* The line of time down the left. */
.god-list::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--red-hi), var(--gold) 50%, var(--red-hi));
  opacity: 0.7;
}

.god-item {
  position: relative;
  margin: 0 0 24px;
}
/* The dot on the line, in the region's colour. */
.god-item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 12px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  background: var(--region);
  box-shadow: 0 0 0 2px var(--region), 0 0 14px var(--region);
}

/* The big date, copied from the god's "first attested" label: "c. 3500-3000 BCE",
   "14th century BCE", "by the 8th century BCE". */
.god-year {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0 0 6px;
  font-family: var(--font-display);
  line-height: 1;
  color: var(--gold);
}
.god-year-c { font-size: 1rem; color: var(--muted); }
.god-year-num {
  font-size: clamp(2rem, 9vw, 2.8rem);
  text-shadow: 0 0 18px rgba(179, 38, 47, 0.6);
}
.god-year-era { font-size: 1.25rem; color: var(--cream); }
.year-badge { align-self: center; }

.god-card {
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--region);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.god-item.is-open .god-card {
  border-top-color: var(--line-strong);
  border-right-color: var(--line-strong);
  border-bottom-color: var(--line-strong);
}

.god-head {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.god-portrait {
  display: flex;
  width: 96px;
  height: 120px;
}

/* A chibi picture fills its box without ever being stretched or squashed. */
.portrait-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}
/* Still being drawn: a soft glowing frame instead of the picture. */
.portrait-soon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 6px;
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 38%, rgba(179, 38, 47, 0.35), transparent 65%),
    var(--panel-2);
  text-align: center;
}
.portrait-soon-text {
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--cream);
}

.god-name {
  margin: 0 0 2px;
  font-size: clamp(1.3rem, 5vw, 1.6rem);
  overflow-wrap: anywhere;
}
.god-region {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--region);
}
.god-line {
  margin: 0 0 4px;
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.god-line-label {
  font-weight: 700;
  color: var(--gold);
}

/* The devil, small, under the god (the full story is inside the card). */
.god-devil-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(179, 38, 47, 0.45);
  border-radius: 12px;
  background: var(--panel-2);
}
.god-devil-mini .god-line { margin: 0; }
.devil-mini-arts {
  flex: none;
  display: flex;
  gap: 4px;
}
.devil-mini-art {
  display: flex;
  width: 40px;
  height: 48px;
}
.devil-mini-art .portrait-soon { padding: 0; border-width: 1px; border-radius: 8px; }
/* Too small for words: a "?" instead (the name is right beside it). */
.devil-mini-art .portrait-soon-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.devil-mini-art .portrait-soon::after {
  content: "?";
  font-family: var(--font-display);
  color: var(--gold);
}

/* "Read the whole story" / "Show less": a full-width, thumb-sized button. */
.cp-toggle {
  flex-direction: row;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  padding: 0.5em 1.2em;
  font-size: 1rem;
}
.cp-toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); /* a little down-arrow */
  transition: transform 0.2s;
}
.cp-toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }

/* ---- An open card --------------------------------------------------------- */

.god-body {
  margin-top: 16px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.god-facts {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
}
.god-fact dt {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--gold);
}
.god-fact dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.aka-list { margin: 0; padding-left: 1.1em; }
.domain-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.domain-tags li {
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--panel-2);
  font-size: 0.85rem;
}

.god-part { margin-top: 20px; }
.god-part-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: var(--gold);
}
.god-part p { margin: 0 0 0.7em; overflow-wrap: anywhere; }

/* "Show the evidence": the summary line is the tap target (47px tall). */
.evidence summary {
  padding: 10px 0;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
}
.evidence p {
  padding: 10px 14px;
  border-left: 3px solid var(--line-strong);
  border-radius: 0 10px 10px 0;
  background: var(--panel-2);
}

.god-decline {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}

/* The devil gets a faint red glow. */
.god-devil {
  padding: 14px;
  border: 1px solid rgba(179, 38, 47, 0.45);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(142, 27, 34, 0.22), rgba(142, 27, 34, 0.06));
}
.devil-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.25;
  color: var(--cream);
}
.devil-note {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
}
.devil-note.is-true {
  font-style: normal;
  font-weight: 700;
  color: var(--red-text);
}
.devil-portraits {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 12px;
}
.devil-figure {
  width: 132px;
  margin: 0;
  text-align: center;
}
.devil-portrait {
  display: flex;
  width: 120px;
  height: 140px;
  margin: 0 auto 4px;
}
.devil-figure figcaption {
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--muted);
}

.influence-list,
.basis-list {
  margin: 0;
  padding-left: 1.1em;
}
.influence-list li,
.basis-list li {
  margin-bottom: 0.6em;
  overflow-wrap: anywhere;
}
.see-link { font-weight: 700; }
.basis-list { font-size: 0.9rem; }
.basis-list strong { color: var(--gold); }

/* Numbered references: the title is the link, then who wrote it and what it backs up. */
.ref-list {
  margin: 0;
  padding-left: 1.7em;
  font-size: 0.92rem;
  overflow-wrap: anywhere; /* a long title never pushes the page sideways */
}
.ref-list li { margin-bottom: 0.9em; }
.ref-list li::marker {
  font-weight: 700;
  color: var(--gold);
}
.ref-title { font-weight: 700; }
.ref-by,
.ref-supports {
  display: block;
  font-size: 0.85rem;
  line-height: 1.45;
}
.ref-by { color: var(--muted); }
.ref-supports { margin-top: 2px; }
.ref-supports-label { color: var(--gold); }

.god-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 0 0;
}
.god-permalink {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.cp-less {
  flex-direction: row;
  min-height: 44px;
  padding: 0.45em 1.1em;
  font-size: 1rem;
}

/* Bigger screens: bigger pictures. (Keep in step with GOD_BOXES in app.js.) */
@media (min-width: 700px) {
  .god-head { grid-template-columns: 140px minmax(0, 1fr); gap: 18px; }
  .god-portrait { width: 140px; height: 170px; }
}

/* Small phones: a thinner line of time and smaller pictures, so the words get room. */
@media (max-width: 400px) {
  .god-list { padding-left: 24px; }
  .god-list::before { left: 7px; }
  .god-item::before { left: -23px; width: 14px; height: 14px; }
  .god-card { padding: 12px 12px 14px; }
  .god-head { grid-template-columns: 76px minmax(0, 1fr); gap: 10px; }
  .god-portrait { width: 76px; height: 100px; }
  .god-devil, .god-decline { padding: 12px 10px; }
}

/* ===================== 2. Versions of each other ========================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 10px;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.25);
  font-family: var(--font-display);
  font-size: 0.8rem;
  line-height: 1.6;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-documented { color: var(--documented); }
.badge-debated { color: var(--debated); }
.badge-myth { color: var(--myth); }

.badge-key {
  max-width: 70ch;
  margin: 0 auto 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.badge-key-title { margin: 0 0 8px; font-size: 1.15rem; }
.badge-key-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.badge-key-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.version-sections { max-width: 1000px; margin: 0 auto; }
.v-section { margin: 30px 0 0; }
.v-title {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.3rem, 5vw, 1.7rem);
}

.claim-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 900px) {
  .claim-list { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* In the page the title comes first (a screen reader jumping between headings then
   hears the badge right after it); on screen the badge and date sit above the title,
   via "order". Flex items' margins do not merge, so the gaps are set to match. */
.claim-card {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
}
.claim-documented .claim-card { border-top-color: var(--documented); }
.claim-debated .claim-card { border-top-color: var(--debated); }
.claim-myth .claim-card { border-top-color: var(--myth); }

.claim-head {
  order: -1; /* shown above the title, though it comes after it in the page */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 6px;
}
.claim-date { font-size: 0.85rem; color: var(--muted); }
.claim-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--cream);
  overflow-wrap: anywhere;
}
.claim-body { margin-top: 14px; }
.claim-text { overflow-wrap: anywhere; }
.claim-bible { font-size: 0.92rem; }
.claim-sources-title {
  margin: 12px 0 6px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  color: var(--gold);
}

.cp-small-print {
  max-width: 70ch;
  margin: 32px auto 0;
  font-size: 0.8rem;
  text-align: center;
  color: var(--muted);
}
.cp-small-print + .cp-small-print { margin-top: 10px; }

/* ---- The overlap chart of religions (Expiration Deities) ---------------------
   One button per religion: its name and number of gods on the left, its bar on a
   shared line of time on the right, so the overlaps show at a glance. On a phone the
   name sits above its bar. The bar's colour is its part of the world. */
.page-copy { --tl-label-w: 240px; } /* 240 since Dec 2026: "Turkic & Mongol (Tengrism)" needs 233px */
.tl-chart {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 980px;
  margin: 0 auto 14px;
}
.tl-all { align-self: center; margin-bottom: 6px; }
/* Left: a row's border (1px) + padding (8px) + name column + gap (10px); right: its
   padding (10px) + border (1px) - so the marks sit exactly over the bars. */
.tl-axis { padding-left: calc(var(--tl-label-w) + 19px); padding-right: 11px; }
.tl-axis-line {
  position: relative;
  display: block;
  height: 22px;
  border-bottom: 1px solid var(--line-strong);
}
.tl-tick {
  position: absolute;
  bottom: 4px;
  transform: translateX(-50%);
  font-size: 0.72rem;
  white-space: nowrap;
  color: var(--muted);
}
.tl-row {
  display: grid;
  grid-template-columns: var(--tl-label-w) 1fr;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 10px 4px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--cream);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tl-row:hover,
.tl-row:focus-visible { background: rgba(255, 255, 255, 0.05); }
.tl-row[aria-pressed="true"] { border-color: var(--region); background: rgba(255, 255, 255, 0.07); }
.tl-name { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-display); font-size: 0.98rem; }
.tl-track {
  position: relative;
  display: block;
  height: 14px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
}
.tl-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 4px;
  border-radius: 7px;
  background: var(--region);
}
/* Still worshipped today: the bar runs on to the end of the line, solid up to the year
   the content was checked (--solid, set by app.js) and fading into the future after it. */
.tl-bar-open { background: linear-gradient(90deg, var(--region) var(--solid, 95%), rgba(255, 255, 255, 0)); }

/* The pressed religion's own panel: dates, why it ended, sources. */
.tl-about {
  max-width: 860px;
  margin: 6px auto 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--region, var(--gold));
  border-radius: var(--radius);
  background: var(--panel);
}
.tl-about-title { margin: 0; }
.tl-about-area { margin: 2px 0 8px; font-size: 0.9rem; color: var(--region, var(--muted)); }

@media (max-width: 640px) {
  .tl-row { grid-template-columns: 1fr; gap: 4px; }
  .tl-axis { padding-left: 9px; padding-right: 11px; } /* = a row's border + padding, so the marks sit over the bars */
}
/* Too narrow for a mark every 1,000 years to keep its words apart: only every other
   one (2000 BCE, BCE | CE, 2000 CE) is written. tests/style.test.mjs measures it. */
@media (max-width: 700px) {
  .tl-tick-minor { display: none; }
}
