/* Components — every color comes from tokens.css. */

/* ── Hue binding: set data-hue on any element to give it a terrain band ── */
[data-hue="moss"] { --h-tint: var(--moss-tint); --h: var(--moss); --h-deep: var(--moss-deep); }
[data-hue="mint"] { --h-tint: var(--mint-tint); --h: var(--mint); --h-deep: var(--mint-deep); }
[data-hue="aqua"] { --h-tint: var(--aqua-tint); --h: var(--aqua); --h-deep: var(--aqua-deep); }
[data-hue="sky"]  { --h-tint: var(--sky-tint);  --h: var(--sky);  --h-deep: var(--sky-deep); }
[data-hue="peri"] { --h-tint: var(--peri-tint); --h: var(--peri); --h-deep: var(--peri-deep); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 10px 20px;
  border: 1px solid var(--rule-firm); border-radius: 0 14px;
  background: var(--surface); color: var(--ink-strong);
  font-size: var(--t3); font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform var(--t-quick) var(--ease-out), background var(--t-quick), border-color var(--t-quick);
}
.btn:hover { transform: translateY(-2px); border-color: var(--ink-soft); }
.btn i { font-size: 20px; }
.btn--primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.btn--primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn--you { border-color: var(--you); color: var(--you-deep); }
.btn--you[aria-pressed="true"] { background: var(--you-deep); border-color: var(--you-deep); color: #fff; }
.btn--you[aria-pressed="true"] i { color: #fff; }
.btn--quiet { border-color: transparent; background: transparent; color: var(--action); padding-inline: var(--s3); }
.btn--quiet:hover { background: var(--surface); border-color: var(--rule); }
.chev { transition: transform var(--t-quick) var(--ease-out); }
a:hover > .chev, button:hover > .chev, .door:hover .chev, .card:hover .chev { transform: translateX(4px); }

/* ── Chips ── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px; border-radius: var(--pill);
  background: var(--h-tint, var(--band)); color: var(--ink-strong);
  font-size: var(--t1); font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--h, var(--ink-soft)); }
.chip--draft { background: var(--surface); border: 1px dashed var(--rule-firm); color: var(--ink-soft); }

/* ── Petal surfaces ── */
.petal {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 0 var(--petal);
}
.petal--lg { border-radius: 0 var(--petal-lg); }
/* Peach's quarter-circle bleed, as a nebula glow in the band's hue. */
.petal--glow::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, var(--h-tint, var(--you-tint)) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Doors: everything is a door (Peach's icon tiles with a chevron) ── */
.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s4); }
.door {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s4) var(--s4) var(--s5);
  min-height: 96px; text-decoration: none; color: var(--ink-strong);
  border: 1px solid var(--rule-firm);
  transition: transform var(--t-quick) var(--ease-out), border-color var(--t-quick);
}
.door:hover { transform: translateY(-3px) rotate(-.4deg); border-color: var(--h-deep, var(--ink-soft)); }
.door > i:first-child { font-size: 34px; color: var(--h-deep, var(--action)); }
.door b { display: block; font-size: var(--t4); font-weight: 650; line-height: 1.3; }
.door small { display: block; font-size: var(--t2); color: var(--ink-soft); margin-top: 2px; line-height: 1.4; }
.door .chev { font-size: 18px; color: var(--ink-soft); }
@media (max-width: 960px) { .doors { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .doors { grid-template-columns: 1fr; } }

/* ── Star marks: dim (unvisited) → glowing (visited) → pink (yours) ── */
.star {
  width: 16px; height: 16px; flex: none;
  color: var(--h, var(--ink-soft));
  opacity: .5;
  transition: opacity var(--t-quick), transform var(--t-quick) var(--ease-out);
}
.is-visited .star { opacity: 1; filter: drop-shadow(0 0 4px var(--h-tint)); }
.is-starred .star { color: var(--you); opacity: 1; filter: drop-shadow(0 0 5px var(--you-tint)); }

/* ── Role card ── */
.card {
  display: flex; align-items: center; gap: var(--s3);
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 0 14px;
  color: var(--ink-strong); text-decoration: none;
  font-size: var(--t3); font-weight: 600; line-height: 1.3;
  transition: transform var(--t-quick) var(--ease-out), border-color var(--t-quick);
}
.card:hover { transform: translateY(-2px) rotate(-.3deg); border-color: var(--h); }
.card .grow { flex: 1; min-width: 0; }
.card .chev { color: var(--ink-soft); font-size: 15px; }
/* Starred: the pink ✦ inside the card says "yours"; the border stays the team's (journey analysis, finding 4). */

/* ── Axis meter: the terrain gradient with you on it ── */
.axis {
  --pos: 50%;
  position: relative; padding-top: 22px;
}
.axis__bar { height: 8px; border-radius: var(--pill); background: var(--terrain); }
.axis__mark {
  position: absolute; top: 12px; left: var(--pos);
  width: 26px; height: 26px; transform: translateX(-50%);
  color: var(--you); filter: drop-shadow(0 1px 0 var(--surface)) drop-shadow(0 0 4px var(--surface));
}
.axis__ends { display: flex; justify-content: space-between; margin-top: 8px; font-size: var(--t1); font-weight: 600; color: var(--ink-soft); letter-spacing: .03em; text-transform: uppercase; }

/* ── Segmented toggle (Web ⇄ Ladder ⇄ List) ── */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--rule-firm); border-radius: var(--pill); background: var(--surface);
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--pill);
  font-size: var(--t2); font-weight: 600; color: var(--ink-soft);
  transition: background var(--t-quick), color var(--t-quick);
}
.seg button i { font-size: 17px; }
.seg button[aria-pressed="true"] { background: var(--ink-strong); color: var(--field); }

/* ── Fields (route planner) — always on a surface, never on the band ── */
.field { display: grid; gap: 6px; }
.field label { font-size: var(--t1); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--rule-firm); border-radius: 0 12px;
  color: var(--ink-strong); font-weight: 500;
}
.field select { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field textarea:focus, .field select:focus { border-color: var(--focus); }

/* ── The next star: one primary step, at most two alternates ── */
.next {
  margin-top: var(--s8);
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s5);
  padding: var(--s5) var(--s6);
  background: var(--surface); border: 1px solid var(--rule-firm); border-radius: 0 var(--petal-lg);
}
.next__label { display: flex; align-items: center; gap: var(--s2); font-size: var(--t1); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.next__label svg { width: 12px; height: 12px; color: var(--you); }
.next__title { font-family: var(--display); font-variation-settings: "SOFT" 100, "opsz" 48; font-size: var(--t6); font-weight: 560; color: var(--ink-strong); margin-top: 4px; }
.next__alts { display: flex; flex-wrap: wrap; gap: var(--s2); grid-column: 1 / -1; padding-top: var(--s3); border-top: 1px solid var(--rule); }
.next__alts:empty { display: none; }
@media (max-width: 640px) {
  .next { grid-template-columns: 1fr; padding: var(--s5); }
  .next .btn--primary { width: 100%; }
}

/* ── Draft notice: structure is real, figures are not in yet ── */
.draft {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s3) var(--s4);
  border: 1px dashed var(--rule-firm); border-radius: 0 12px;
  background: var(--surface); font-size: var(--t2); color: var(--ink-soft);
}
.draft i { font-size: 20px; color: var(--ink-soft); flex: none; }
.draft b { color: var(--ink); }

/* ── Section heads ── */
.eyebrow { font-size: var(--t1); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.section { margin-top: var(--s8); }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.section__head p { color: var(--ink-soft); font-size: var(--t3); max-width: var(--measure); margin-top: var(--s2); }

/* ── Transit line (paths and planned routes) ── */
.transit { position: relative; padding: var(--s5) var(--s5) var(--s4); }
.transit__name { font-weight: 700; color: var(--ink-strong); }
.transit__meta { font-size: var(--t2); color: var(--ink-soft); }
.transit__line {
  --grad: var(--terrain);
  position: relative; margin: var(--s5) 0 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  list-style: none; padding: 0;
}
.transit__line::before {
  content: ""; position: absolute; left: calc(50% / var(--n)); right: calc(50% / var(--n)); top: 9px;
  height: 4px; border-radius: var(--pill); background: var(--grad);
  transform-origin: 0 50%; animation: draw-line 900ms var(--ease-out) both;
}
.transit__stop { position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; padding: 0 4px; }
.transit__stop a { color: var(--ink-strong); text-decoration: none; font-size: var(--t2); font-weight: 600; line-height: 1.3; }
.transit__stop a:hover { text-decoration: underline; }
.transit__stop .node {
  position: relative; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--h);
  animation: pop 400ms var(--ease-out) both; animation-delay: calc(var(--i) * 110ms + 300ms);
}
.transit__stop.is-starred .node { border-color: var(--you); background: var(--you-tint); }
.transit__stop small { font-size: var(--t1); color: var(--ink-soft); }
@media (max-width: 640px) {
  .transit__line { grid-auto-flow: row; grid-auto-columns: auto; gap: var(--s3); }
  .transit__line::before { left: 9px; right: auto; top: 0; bottom: 0; width: 4px; height: auto;
    background: linear-gradient(180deg, var(--moss), var(--mint), var(--aqua), var(--sky), var(--peri)); transform-origin: 50% 0; animation-name: draw-line-v; }
  .transit__stop { grid-template-columns: 22px 1fr; justify-items: start; text-align: left; align-items: center; column-gap: var(--s3); }
  .transit__stop small { grid-column: 2; }
}

/* ── Empty state ── */
.empty { padding: var(--s7) var(--s5); text-align: center; color: var(--ink-soft); }
.empty svg { width: 40px; height: 40px; margin: 0 auto var(--s3); color: var(--you); }
.empty b { display: block; color: var(--ink-strong); font-size: var(--t5); margin-bottom: 4px; }

/* Chevron — a drawn stroke, sized to its text. */
svg.chev { width: 1em; height: 1em; flex: none; }
.door svg.chev { width: 18px; height: 18px; color: var(--ink-soft); }

/* Team stripe: every role card carries its cog's color on its square edge, so membership
   reads anywhere on the page, independent of the star's visited state. */
.card[data-hue], .segcol .card, .transit__stop .card { border-left: 4px solid var(--h); }
.card.is-starred { border-left-color: var(--h); }

/* Strong secondary: a tool's own submit, so the page keeps one primary (the next step). */
.btn--strong { border-color: var(--ink-strong); color: var(--ink-strong); border-width: 1.5px; }
.btn--strong:hover { background: var(--ink-strong); color: var(--field); }
