/* ==========================================================================
   FateHalo — reading tools
   Styles for the three guided reading pages: Astrology, Tarot, Chinese
   Divination. Loaded only by services.html, astrology.html, tarot.html and
   bazi.html, after style.css. Reuses the tokens defined in style.css.
   ========================================================================== */

/* ---------------------------------------------------------- 3-up step strip */
.steps--3 { grid-template-columns: repeat(3, 1fr); }

/* ------------------------------------------------------------- choice cards */
.choices {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 0;
  border: 0;
}
.choices--2 { grid-template-columns: repeat(2, 1fr); }

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px 24px 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease),
              transform 0.3s var(--ease);
}
.choice:hover { border-color: var(--gold-500); transform: translateY(-2px); }
.choice input { position: absolute; opacity: 0; width: 0; height: 0; }

.choice__tick {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background 0.24s var(--ease), border-color 0.24s var(--ease);
}
.choice__tick svg { width: 12px; height: 12px; color: #fff; opacity: 0; transition: opacity 0.24s var(--ease); }

.choice__num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--gold-500);
  margin-bottom: 12px;
}
.choice__name {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 6px;
}
.choice__meta {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.choice__desc { font-size: 0.9rem; color: var(--ink-soft); margin: 0; }

.choice:has(input:checked) { border-color: var(--gold-600); box-shadow: var(--shadow-md); }
.choice:has(input:checked) .choice__tick { background: var(--gold-600); border-color: var(--gold-600); }
.choice:has(input:checked) .choice__tick svg { opacity: 1; }
.choice:has(input:focus-visible) { outline: 2px solid var(--gold-500); outline-offset: 3px; }

/* JS fallback for browsers without :has() — readings.js mirrors the checked state */
.choice.is-checked { border-color: var(--gold-600); box-shadow: var(--shadow-md); }
.choice.is-checked .choice__tick { background: var(--gold-600); border-color: var(--gold-600); }
.choice.is-checked .choice__tick svg { opacity: 1; }

/* ------------------------------------------------------- instant readout box */
.readout {
  display: grid;
  gap: 18px;
  padding: 22px 24px;
  background: var(--gold-050);
  border: 1px solid rgba(201, 164, 76, 0.42);
  border-radius: var(--radius-sm);
}
.readout[hidden] { display: none; }
.readout__head {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-600);
}
.readout__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.readout__item { display: grid; gap: 4px; }
.readout__k { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.readout__v { font-family: var(--font-display); font-size: 1.24rem; font-weight: 500; color: var(--ink); }
.readout__note { font-size: 0.8rem; color: var(--muted); margin: 0; }

/* ------------------------------------------------------------- inline notice */
.notice {
  display: none;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid rgba(169, 134, 58, 0.45);
  border-radius: var(--radius-sm);
  background: var(--gold-050);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.notice.is-visible { display: flex; }
.notice svg { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; color: var(--gold-600); }

/* ---------------------------------------------------------------- draw panel */
/* .card sets height:100% so equal-height cards line up inside a grid. The draw
   panel lives inside the stepped tool form (.form is a grid) and grows when a
   spread is dealt — inheriting height:100% there stretches it past its own
   content box, and it bleeds down over the next step's heading. It must hug
   its content instead. */
.drawpanel {
  height: auto;
  min-height: 0;
  background: var(--navy-900);
  border-color: transparent;
  padding: clamp(24px, 3vw, 38px);
}
.drawpanel:hover { transform: none; box-shadow: none; border-color: transparent; }

.drawbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-bottom: 30px;
}
.drawbar__hint { font-size: 0.875rem; color: rgba(255, 255, 255, 0.6); margin: 0; }

/* ------------------------------------------------- card tiles (the deck view) */
.spread {
  list-style: none;
  margin: 0 0 34px;
  padding: 0;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}
.spread[hidden] { display: none; }

.tc {
  display: grid;
  gap: 9px;
  align-content: start;
}
.tc__pos {
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.52);
  min-height: 2.4em;
}
.tc__pos b { color: var(--gold-400); font-weight: 500; }

.tc__card {
  position: relative;
  aspect-ratio: 3 / 5;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 16px 14px;
  text-align: center;
  background: linear-gradient(158deg, var(--navy-700), var(--navy-900));
  border: 1px solid rgba(201, 164, 76, 0.55);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(8, 13, 28, 0.35);
  animation: tcDeal 0.62s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 110ms);
}
.tc__card::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(201, 164, 76, 0.22);
  border-radius: calc(var(--radius) - 3px);
  pointer-events: none;
}
.tc__num {
  font-family: var(--font-display);
  font-size: 0.86rem;
  letter-spacing: 0.2em;
  color: var(--gold-400);
}
.tc__name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 500;
  line-height: 1.24;
  color: #fff;
}
.tc__suit { font-size: 1.05rem; color: var(--gold-400); letter-spacing: 0.1em; }
.tc__flag {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.tc__card.is-reversed .tc__name { transform: rotate(180deg); }

@keyframes tcDeal {
  from { opacity: 0; transform: translateY(16px) rotateY(-16deg); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ spread list */
.spreadlist { display: grid; gap: 16px; }
.spreadrow {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-on-dark);
}
.spreadrow:last-child { border-bottom: 0; padding-bottom: 0; }
.spreadrow__n {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold-400);
}
.spreadrow__label { color: rgba(255, 255, 255, 0.86); font-size: 0.95rem; }
.spreadrow__hint { color: rgba(255, 255, 255, 0.5); font-size: 0.82rem; text-align: right; }

/* ---------------------------------------------------- dark-section adjustments */
.section--navy .choice,
.section--dark .choice { background: rgba(255, 255, 255, 0.04); border-color: var(--line-on-dark); }
.section--navy .choice__name,
.section--dark .choice__name { color: #fff; }
.section--navy .choice__desc,
.section--dark .choice__desc { color: rgba(255, 255, 255, 0.66); }
.section--navy .choice__meta,
.section--dark .choice__meta { color: rgba(255, 255, 255, 0.5); }
.section--navy .choice__tick,
.section--dark .choice__tick { border-color: rgba(255, 255, 255, 0.28); }
.section--navy .choice:has(input:checked),
.section--dark .choice:has(input:checked) { border-color: var(--gold-400); background: rgba(201, 164, 76, 0.08); }
.section--navy .choice.is-checked,
.section--dark .choice.is-checked { border-color: var(--gold-400); background: rgba(201, 164, 76, 0.08); }

/* ---------------------------------------------------------- ledger / summary */
.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.ledger li {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 18px;
  padding: 14px 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.ledger__k {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 3px;
}
.ledger__v { color: var(--ink); }
.ledger__v em { color: var(--muted); font-style: normal; }

/* ------------------------------------------------ place combobox (birth) */
/* The two birth-data forms suggest places from the offline index.  The list is
   drawn by the page rather than by a native <datalist> — a datalist is painted
   by the browser, so it cannot be styled, does not refresh while an IME
   composition is still open, and behaves differently in every engine. */
.combo { position: relative; }

.combo .input { padding-right: 46px; }

.combo__caret {
  position: absolute;
  top: 0;
  right: 4px;
  height: 100%;
  width: 40px;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.26s var(--ease), transform 0.26s var(--ease);
}
.combo__caret svg { display: block; width: 13px; height: 8px; }
.combo.is-open .combo__caret { color: var(--gold-600); transform: rotate(180deg); }

.combo__list {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: min(330px, 48vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.combo__list[hidden] { display: none; }

.combo__opt {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
}
.combo__opt b { font-weight: 500; color: var(--gold-600); }
.combo__zh { font-size: 0.88rem; color: var(--muted); }
.combo__cc {
  margin-left: auto;
  padding-left: 10px;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.combo__opt.is-active { background: var(--gold-050); }
.combo__none {
  padding: 10px 12px;
  font-size: 0.84rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- small helpers */
.toolnote {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 10px 0 0;
}
.section--navy .toolnote,
.section--dark .toolnote { color: rgba(255, 255, 255, 0.55); }

.pathgrid { display: grid; gap: 24px; grid-template-columns: repeat(3, 1fr); }

.path { display: flex; flex-direction: column; }
.path__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.path__n {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  color: var(--gold-500);
}
.path__tag {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.path .check-list { margin-bottom: 22px; }
.path .btn { margin-top: auto; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .readout__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 980px) {
  .choices, .choices--2, .pathgrid, .steps--3 { grid-template-columns: 1fr; }
  .spreadrow { grid-template-columns: 34px 1fr; }
  .spreadrow__hint { grid-column: 2; text-align: left; }
  .ledger li { grid-template-columns: 1fr; gap: 4px; }
  .readout__grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .spread { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .tc__name { font-size: 1rem; }
  .choice { padding: 22px 20px; }
}
