/* Transit chart workbench (js/transits/transit-desk.js): the top of the Transits tab, and later the guest landing pages.
   Row 1 reuses the Charts tab grid: the chart card takes one of three columns (the natal chart card's size, same card,
   title bar and toggle row: css/reading.css section 4) and the date / "At a glance" panel the other two. The sections
   (Active houses, Over natal, Sign dominance) stack below. Layout follows the desk's own width (container queries), so
   the desk fits the Transits tab, a chat card or a landing page column alike. */

.transit-desk { container: tdesk / inline-size; display: grid; gap: 12px; }
.transit-desk .transits-heading { margin-bottom: 0; }
.tdesk-status { margin: 0; }
/* The upcoming-transits timeline below the desk starts a new block. */
.transits-heading--timeline { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--gold-line); }

/* 1. Chart card + panel ---------------------------------------------------------------------------------------------- */
.tdesk-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 14px; }
.tdesk-chart { grid-column: 1; }
.tdesk-panel { grid-column: 2 / -1; display: grid; align-content: start; gap: 16px; min-width: 0; padding: 16px 18px; border-radius: 15px; }
/* Transits tab: its panel has 18px padding that the Charts tab doesn't, so widen the chart column by it to keep the
   chart exactly the natal cards' size ((tab width - 2 gaps) / 3). */
@container tdesk (min-width: 701px) {
  #transits-panel .tdesk-top { grid-template-columns: calc((100% + 2 * 18px - 2 * 14px) / 3) minmax(0, 1fr); }
}
@container tdesk (max-width: 700px) {
  .tdesk-top { grid-template-columns: minmax(0, 1fr); }
  .tdesk-chart, .tdesk-panel { grid-column: 1; }
}
/* The image fills the square like the natal chart images; a small spinner while a new chart is drawn. */
.tdesk-image { display: block; width: 100%; height: 100%; border-radius: 10px; object-fit: contain; }
.tdesk-chart .chart-visualization-content { position: relative; }
.tdesk-chart .chart-visualization-content.is-busy::after {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border: 2px solid rgb(229 191 57 / 35%);
  border-top-color: var(--yellow-deep);
  border-radius: 50%;
  content: "";
  animation: person-action-spin .8s linear infinite;
}
.tdesk-chart .chart-visualization-content.is-busy .tdesk-image { opacity: .6; }

.tdesk-label { display: block; margin-bottom: 7px; color: var(--gold-label); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

/* Date stepper: ‹ date › and Now (only when away from now); the date opens the date and time inputs. */
.tdesk-when-block { display: grid; gap: 10px; }
.tdesk-when-block .tdesk-label { margin-bottom: -3px; }
.tdesk-stepper { display: flex; align-items: center; gap: 6px; }
.tdesk-arrow,
.tdesk-date,
.tdesk-now { border: 1px solid var(--gold-border); background: #fffefa; color: var(--ink); font: inherit; cursor: pointer; }
.tdesk-arrow { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 50%; font-size: 20px; line-height: 1; }
.tdesk-date { min-width: 0; height: 38px; flex: 1 1 auto; padding: 0 14px; border-radius: 12px; font-size: 14px; font-weight: 800; letter-spacing: -.02em; }
.tdesk-date[aria-expanded="true"] { border-color: var(--gold-border-strong); background: #fff8e0; }
.tdesk-now { height: 38px; padding: 0 16px; border-color: var(--yellow-deep); border-radius: 999px; background: var(--yellow); font-size: 11px; font-weight: 800; }
.tdesk-arrow:hover:not(:disabled), .tdesk-date:hover:not(:disabled) { border-color: var(--gold-border-strong); background: #fff8e0; }
.tdesk-now:hover:not(:disabled) { background: var(--yellow-deep); }
.tdesk-arrow:focus-visible, .tdesk-date:focus-visible, .tdesk-now:focus-visible { outline: 2px solid #b39a30; outline-offset: 2px; }
.tdesk-editor { display: flex; flex-wrap: wrap; gap: 8px; }
.tdesk-field { display: grid; flex: 1 1 140px; gap: 3px; }
.tdesk-field > span { color: #8b867c; font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tdesk-field input,
.tdesk-ayanamsa select,
.tdesk-attribute-select select {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid #e8e2d7;
  border-radius: 9px;
  background: #fffefa;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
}
.tdesk-field input:focus-visible,
.tdesk-ayanamsa select:focus-visible,
.tdesk-attribute-select select:focus-visible { outline: 2px solid #b39a30; outline-offset: 1px; }
.tdesk-units { display: flex; align-items: center; gap: 8px; }
.transit-desk button:disabled,
.transit-desk input:disabled,
.transit-desk select:disabled { cursor: not-allowed; opacity: .5; }

/* At a glance: one line per section; a click opens it. */
.tdesk-glance-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tdesk-glance-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  background: var(--surface-paper-bg);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tdesk-glance-row:hover:not(:disabled) { border-color: var(--gold-border-strong); }
.tdesk-glance-row:focus-visible { outline: 2px solid #b39a30; outline-offset: 2px; }
.tdesk-glance-icon { width: 26px; height: 26px; flex: 0 0 26px; font-size: 12px; }
.tdesk-glance-text { display: grid; min-width: 0; flex: 1; gap: 1px; }
.tdesk-glance-text small { color: #8b867c; font-size: 9.5px; }
.tdesk-glance-text strong { overflow: hidden; font-size: 12.5px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.tdesk-glance-go { color: var(--gold-ink); font-size: 18px; }

.tdesk-footnote { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; margin: 0; padding-top: 10px; border-top: 1px solid var(--gold-line); color: #8b867c; font-size: 10px; }
.tdesk-ayanamsa { display: inline-flex; align-items: center; gap: 8px; }

/* 2. Sections (stacked) ---------------------------------------------------------------------------------------------- */
.tdesk-sections { display: grid; gap: 10px; }
.tdesk-section-body { display: grid; gap: 12px; padding: 0 2px; }
.tdesk-section-intro { margin: 0; color: #77736b; font-size: 10.5px; line-height: 1.55; }
.tdesk-section-content { display: grid; gap: 10px; min-width: 0; }
.tdesk-section-content:empty { display: none; }
.tdesk-loading { margin: 0; color: #8b867c; font-size: 10.5px; }

/* 2a. Active houses: 12 houses across, a row per reference; houses down when narrow (same markup, column flow). */
/* Header (house titles) is one dark band with gold text, the row titles (Ascendant, Moon, Sun, Combined) gold
   surface-header bars, and each cell a colour-only box (score on hover), 70% of its slot. No column gap, so the header
   band is continuous; the boxes' own margins space them. */
.tdesk-houses-scroll { overflow-x: auto; }
.tdesk-houses { display: grid; grid-template-columns: 96px repeat(12, minmax(30px, 1fr)); gap: 6px 0; min-width: 500px; }
.tdesk-house-corner,
.tdesk-house-head {
  display: grid;
  min-height: 30px;
  place-items: center;
  background: var(--surface-dark-bg);
  color: #f5d653;
  font-size: 10.8px;
  font-weight: 800;
  letter-spacing: .04em;
}
.tdesk-house-corner { justify-items: start; padding-left: 12px; border-radius: 10px 0 0 10px; color: rgb(245 214 83 / 70%); font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; }
.tdesk-house-head:nth-child(13) { border-radius: 0 10px 10px 0; }
.tdesk-house-label {
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  padding: 0 10px;
  border: 1px solid var(--gold-border);
  border-radius: 9px;
  background: var(--surface-header-bg);
  box-shadow: var(--surface-raise);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 800;
}
.tdesk-house-label-short { display: none; }
.tdesk-house-label.is-reference { border-color: var(--gold-border-strong); }
.tdesk-house-label.is-reference::after { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--yellow-deep); content: ""; }
.tdesk-house-cell { width: 70%; height: 22px; place-self: center; border: 1px solid transparent; border-radius: 6px; }
.tdesk-house-cell.is-low { background: #dce9de; }
.tdesk-house-cell.is-moderate { background: #f4e2a3; }
.tdesk-house-cell.is-high { background: #edb9b3; }
.tdesk-house-cell.is-very-high { background: #b8554c; }
.tdesk-house-cell.is-reference { border-color: rgb(37 37 35 / 22%); }
.tdesk-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: #77736b; font-size: 10px; }
.tdesk-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.tdesk-legend-item i { width: 12px; height: 12px; border-radius: 4px; }
.tdesk-legend-item.is-low i { background: #dce9de; }
.tdesk-legend-item.is-moderate i { background: #f4e2a3; }
.tdesk-legend-item.is-high i { background: #edb9b3; }
.tdesk-legend-item.is-very-high i { background: #b8554c; }
@container tdesk (max-width: 560px) {
  /* Narrow: houses run down (the header band becomes the left column), Asc / Moon / Sun / All across. */
  .tdesk-houses { grid-template-columns: 46px repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(13, auto); grid-auto-flow: column; gap: 0 6px; min-width: 0; }
  .tdesk-house-corner { justify-items: center; padding-left: 0; border-radius: 10px 10px 0 0; }
  .tdesk-house-head { min-height: 32px; }
  .tdesk-house-head:nth-child(13) { border-radius: 0 0 10px 10px; }
  .tdesk-house-label { justify-content: center; margin: 0 0 6px; padding: 0 4px; font-size: 10px; }
  .tdesk-house-label.is-reference::after { margin-left: 0; }
  .tdesk-house-label-long { display: none; }
  .tdesk-house-label-short { display: inline; }
}

/* 2b. Over natal: plain sentences, closest orb first; close contacts get a gold dot. */
.tdesk-natal-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.tdesk-natal-group { display: grid; align-content: start; gap: 8px; min-width: 0; }
.tdesk-natal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-size: 11.5px; }
.tdesk-natal-list { display: grid; margin: 0; padding: 0; list-style: none; }
.tdesk-natal-item { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; padding: 8px 4px 8px 16px; border-bottom: 1px solid var(--gold-line); font-size: 11.5px; }
.tdesk-natal-item:last-child { border-bottom: 0; }
.tdesk-natal-item.is-tight { background: radial-gradient(circle at 5px 50%, var(--yellow-deep) 3px, transparent 3.5px); }
.tdesk-natal-sentence { color: #5d594f; }
.tdesk-natal-sentence strong { color: var(--ink); font-weight: 750; }
.tdesk-retro { color: #a8564f; font-weight: 700; }
.tdesk-natal-meta { color: #8b867c; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.tdesk-natal-item.is-tight .tdesk-natal-meta { color: var(--gold-ink); font-weight: 700; }

/* 2c. Sign dominance: chips on wide desks, a select when narrow; one thin bar per option. */
.tdesk-attribute-select { display: none; align-items: center; gap: 8px; }
.tdesk-attribute-chips button { font-size: 9px; }
@container tdesk (max-width: 560px) {
  .tdesk-attribute-chips { display: none; }
  .tdesk-attribute-select { display: flex; }
}
.tdesk-dominance { display: grid; margin: 0; padding: 0; list-style: none; }
.tdesk-dominance-row {
  display: grid;
  grid-template-columns: minmax(80px, 140px) minmax(80px, 1fr) 36px minmax(0, 1.2fr);
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--gold-line);
  font-size: 11.5px;
}
.tdesk-dominance-row:last-child { border-bottom: 0; }
.tdesk-dominance-name { overflow: hidden; color: var(--ink); font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.tdesk-dominance-row.is-leading .tdesk-dominance-name { color: var(--gold-ink); }
.tdesk-dominance-bar { height: 6px; overflow: hidden; border-radius: 999px; background: #f0ebdd; }
.tdesk-dominance-bar i { display: block; height: 100%; border-radius: inherit; background: var(--gold-bar); }
.tdesk-dominance-score { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.tdesk-dominance-planets { color: #6f6b63; font-size: 10.5px; }
@container tdesk (max-width: 560px) {
  .tdesk-dominance-row { grid-template-columns: minmax(0, 1fr) 36px; grid-template-areas: "name score" "bar bar" "planets planets"; gap: 5px 10px; }
  .tdesk-dominance-name { grid-area: name; }
  .tdesk-dominance-score { grid-area: score; }
  .tdesk-dominance-bar { grid-area: bar; }
  .tdesk-dominance-planets { grid-area: planets; }
}

@media (prefers-reduced-motion: reduce) {
  .tdesk-chart .chart-visualization-content.is-busy::after { animation: none; }
}
