/* =====================================================================
   dom-anim.css — the planetary-domiciles animation, INLINED in the page.
   ---------------------------------------------------------------------
   This is anim.css with every rule SCOPED under `.dom-anim`, so the
   animation can live directly inside domiciles.html (no iframe) without
   its generic selectors (body, :root, h1/h2/a/table, .title, .body,
   .eyebrow…) colliding with the shared jabbah site styles.

   The animation's own colour/type tokens are declared on `.dom-anim`
   itself, so they apply to its descendants only and never overwrite the
   site's :root tokens. engine.js and content.js are untouched.

   Layout change requested: the wheel stages run FULL-WIDTH (centred at
   the site shell, like the header and footer), the animation column is
   wider than the text column, and the wheel itself is larger. The
   single-column reading stage stays narrow and centred.
   ===================================================================== */

.dom-anim {
  /* tokens scoped to the animation only */
  --paper:     #f3ecdf;
  --paper-2:   #efe6d5;
  --ink:       #1a1a1a;
  --ink-soft:  rgba(26, 26, 26, 0.45);
  --ink-faint: rgba(26, 26, 26, 0.15);
  --rule:      rgba(26, 26, 26, 0.16);
  --solar:     oklch(0.55 0.12 45);
  --lunar:     oklch(0.52 0.07 248);
  --serif:     "Newsreader", Georgia, serif;
  --sans:      "Noto Sans", system-ui, sans-serif;
  --box-anim:  #e8eef5;
  --box-rule:  #dce3ec;

  color: var(--ink);
  font-family: var(--serif);
}
.dom-anim *, .dom-anim *::before, .dom-anim *::after { box-sizing: border-box; }

/* ---------- stage section (FULL-WIDTH, wheel column wider) ---------- */
.dom-anim .stage {
  display: grid;
  grid-template-columns: 1.7fr 1fr;          /* animation wider than text */
  grid-template-areas:
    "wheel title"
    "wheel body";
  grid-template-rows: auto 1fr;
  align-items: start;
  column-gap: clamp(20px, 2.6vw, 40px);
  row-gap: 0;
  max-width: var(--shell);                   /* = header / footer width */
  margin: 0 auto;
  padding: clamp(24px, 3.5vh, 44px) var(--gutter);
}
.dom-anim .stage + .stage { border-top: none; }

/* the animation (wheel) sits in a faintly-coloured box; the title + text
   sit in a white box. Both span the full height of the stage row. */
.dom-anim .title {
  grid-area: title;
  align-self: stretch;
  background: #ffffff;
  border: 1px solid var(--box-rule);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  padding: clamp(22px, 2.6vw, 34px) clamp(22px, 2.6vw, 36px) 0.5rem;
}
.dom-anim .wheel {
  grid-area: wheel;
  align-self: stretch;
  justify-self: stretch;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(18px, 2.6vh, 32px);
  width: 100%;
  background: var(--box-anim);
  border: 1px solid var(--box-rule);
  border-radius: 10px;
  padding: clamp(24px, 2.8vw, 44px);
}
.dom-anim .body {
  grid-area: body;
  align-self: stretch;
  background: #ffffff;
  border: 1px solid var(--box-rule);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  padding: 0.4rem clamp(22px, 2.6vw, 36px) clamp(22px, 2.6vw, 34px);
}

/* stage carrying a full-width table below the wheel + text */
.dom-anim .stage.has-appendix {
  grid-template-areas:
    "wheel title"
    "wheel body"
    "appendix appendix";
  grid-template-rows: auto auto auto;
}
.dom-anim .appendix {
  grid-area: appendix;
  margin-top: clamp(16px, 2.6vh, 32px);
  background: #ffffff;
  border: 1px solid var(--box-rule);
  border-radius: 10px;
  padding: clamp(22px, 3vw, 36px);
}

/* ---------- single-column reading stage (stays narrow + centred) ---------- */
.dom-anim .stage--text {
  display: block;
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(34px, 6vh, 72px) clamp(26px, 5vw, 54px);
  background: #ffffff;
  border: 1px solid var(--box-rule);
  border-radius: 10px;
}
.dom-anim .stage--text .title,
.dom-anim .stage--text .body {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.dom-anim .stage--text .title { margin-bottom: clamp(20px, 3.4vh, 32px); }
.dom-anim .stage--text .body p { max-width: none; }
.dom-anim .body p.lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 2.3vw, 25px);
  line-height: 1.42;
  color: var(--ink);
  margin-bottom: 20px;
}

/* ---------- type ---------- */
.dom-anim .eyebrow {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--solar);
  margin: 0 0 10px;
  font-weight: 600;
}
.dom-anim .title h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 3vw, 46px);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.02;
  margin: 0;
  color: var(--ink);
}
.dom-anim .body h2 {
  font-family: var(--serif);
  font-size: clamp(20px, 2.1vw, 25px);
  font-weight: 500;
  font-style: italic;
  margin: 26px 0 10px;
  line-height: 1.12;
  color: var(--ink);
}
.dom-anim .body h2:first-child { margin-top: 6px; }
.dom-anim .body p {
  font-family: var(--sans);
  font-size: clamp(15.5px, 1.5vw, 17.5px);
  line-height: 1.66;
  margin: 0 0 14px;
  text-wrap: pretty;
  color: rgba(26, 26, 26, 0.86);
  max-width: 46ch;
}
.dom-anim .body a { color: var(--solar); text-underline-offset: 3px; }
.dom-anim .ruler {
  font-family: var(--sans);
  font-variant: small-caps;
  letter-spacing: 0.03em;
  font-weight: 600;
  color: var(--ink);
}
.dom-anim .ruler.solar { color: var(--solar); }
.dom-anim .ruler.lunar { color: var(--lunar); }

/* ---------- wheel (larger now there is room) ---------- */
.dom-anim .stage-svg {
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1 / 1;
}
.dom-anim .stage-svg svg { width: 100%; height: 100%; display: block; }

.dom-anim .ring        { fill: none; stroke: var(--ink); }
.dom-anim .ring--outer { stroke-width: 2; }
.dom-anim .ring--inner { stroke-width: 1; stroke: var(--ink-soft); }
.dom-anim .cusp        { stroke: var(--ink-soft); stroke-width: 1; }
.dom-anim .cusp-ext    { stroke: var(--ink-soft); stroke-width: 1.75; stroke-dasharray: 4 4; }
.dom-anim .center-dot  { fill: var(--ink); }
.dom-anim .sign-glyph  { color: var(--ink); }

.dom-anim .planet {
  opacity: 0;
  transition: opacity 0.55s ease;
}
.dom-anim .planet.show { opacity: 1; }
.dom-anim .planet-tether {
  stroke: var(--ink-faint);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  opacity: 0;
  transition: opacity 0.5s ease 0.1s;
}
.dom-anim .planet-tether.show { opacity: 1; }

.dom-anim .flow-path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0;
}
.dom-anim .flow-path.draw { opacity: 1; }
.dom-anim .flow-head { opacity: 0; }
.dom-anim .flow-head.draw { opacity: 1; transition: opacity 0.25s ease 0.15s; }

/* ---------- domicile summary table ---------- */
.dom-anim .domicile-table {
  border-collapse: collapse;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  font-family: var(--sans);
}
.dom-anim .domicile-table caption {
  caption-side: top;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(19px, 2.1vw, 24px);
  color: var(--ink);
  margin-bottom: clamp(16px, 2.4vh, 24px);
  text-align: left;
}
.dom-anim .domicile-table th,
.dom-anim .domicile-table td {
  text-align: left;
  padding: 10px 18px;
  border-bottom: 1px solid var(--ink-faint);
  vertical-align: middle;
}
.dom-anim .domicile-table thead th {
  font-size: 11.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 1.5px solid var(--rule);
}
.dom-anim .domicile-table tbody tr:last-child th,
.dom-anim .domicile-table tbody tr:last-child td { border-bottom: none; }
.dom-anim .domicile-table tbody th[scope="row"] { font-weight: 600; }
.dom-anim .cell { display: inline-flex; align-items: center; gap: 11px; }
.dom-anim .cell-glyph { width: 22px; height: 22px; flex: none; color: var(--ink); }
.dom-anim .cell-name { font-size: 16px; font-family: var(--sans); }
.dom-anim .cell.secondary { color: var(--ink-soft); }
.dom-anim .cell.secondary .cell-glyph { color: var(--ink-soft); }

/* ---------- play button ---------- */
.dom-anim .play-btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 11px 30px;
  border-radius: 1px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}
.dom-anim .play-btn:hover:not(:disabled) { background: var(--ink); color: #fff; }
.dom-anim .play-btn:disabled { opacity: 0.34; cursor: default; }

/* ---------- mobile: single column, title above wheel, text below ---------- */
@media (max-width: 760px) {
  .dom-anim .stage {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "wheel"
      "body";
    grid-template-rows: auto auto auto;
    row-gap: clamp(16px, 3vh, 26px);
    text-align: left;
  }
  .dom-anim .stage.has-appendix {
    grid-template-areas:
      "title"
      "wheel"
      "body"
      "appendix";
    grid-template-rows: auto auto auto auto;
  }
  /* stacked: each part becomes its own fully-bordered box */
  .dom-anim .title {
    align-self: auto;
    border-bottom: 1px solid var(--box-rule);
    border-radius: 10px;
    padding-bottom: clamp(18px, 3vw, 26px);
  }
  .dom-anim .body {
    align-self: auto;
    border-top: 1px solid var(--box-rule);
    border-radius: 10px;
    padding-top: clamp(18px, 3vw, 26px);
  }
  .dom-anim .body p { max-width: none; }
  .dom-anim .stage--text { text-align: left; }
  .dom-anim .stage--text .title { border: 0; border-radius: 0; padding-bottom: 0; }
  .dom-anim .stage--text .body { border: 0; border-radius: 0; padding-top: 0; }
  .dom-anim .domicile-table { text-align: left; }
}
