/* The landing page's working demonstrations: the parts of the planner the tour on the
 * landing page lets a visitor use (globe search, the balance chart, the spending donut,
 * housing, compare, the checklist). js/showcase.js and js/landing-globe.js drive them;
 * landing.css places them in the tour and recolours them per theme.
 *
 * Everything renders in its FINAL state by default. Motion exists only inside
 * `prefers-reduced-motion: no-preference`, so the demos work whether or not it runs.
 */

/* ==========================================================================
   The demonstrations
   ========================================================================== */
/* --- shared figure furniture --------------------------------------------- */
.fig-head{display:flex;align-items:center;justify-content:space-between;gap:1rem;font-size:.9375rem;font-weight:600;letter-spacing:-.025em;margin-bottom:1.25rem}
.fig-dim{font-size:.8125rem;font-weight:400;color:var(--landing-muted);letter-spacing:0}
.fig-btn{border:1px solid transparent;background:var(--cta);color:var(--cta-ink);border-radius:5rem;padding:.5rem 1rem;font-size:.8125rem;font-weight:500;min-height:2.5rem}
.fig-btn:hover:not(:disabled){background:var(--cta-hover)}
.fig-btn:disabled{opacity:.45;cursor:default}
.fig-chip{display:inline-flex;align-items:center;gap:.4rem;font-size:.8125rem;padding:.4rem .85rem;border-radius:5rem;border:1px solid var(--card-edge);background:var(--card);margin-top:1rem}
.fig-chip-warn{border-color:var(--warn-edge);background:var(--warn-bg);color:var(--warn)}
.fig-chip-warn::before{content:'✕';font-size:.6875rem}
.fig-chip-ok{border-color:var(--ok-edge);background:var(--ok-bg);color:var(--ok)}
.fig-chip-ok::before{content:'✓';font-size:.6875rem}
.fig-chip-place{position:absolute;left:50%;bottom:1rem;transform:translateX(-50%);margin:0;font-weight:500;box-shadow:0 .5rem 1rem -.5rem color-mix(in srgb,var(--shadow) 30%,transparent)}
.row-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row-value{font-variant-numeric:tabular-nums;font-weight:500}
.fig-note,.fig-empty{font-size:.8125rem;color:var(--landing-muted);margin-top:1rem;line-height:1.7}

/* Sliders, in the planner's capsule style. */
.fig-controls{margin-top:1.25rem;padding-top:1.1rem;border-top:1px solid var(--landing-line);display:grid;grid-template-columns:1fr 1fr;gap:1rem 2rem}
.fig-controls label{display:grid;grid-template-columns:1fr auto;gap:.4rem .75rem;font-size:.8125rem;color:var(--landing-muted)}
.ctl-value{font-size:.9375rem;font-weight:600;color:var(--landing-ink);font-variant-numeric:tabular-nums;text-align:right}
.fig-controls input[type=range],.row-slider{grid-column:1/-1;-webkit-appearance:none;appearance:none;width:100%;height:1.5rem;background:transparent;cursor:pointer}
/* The planner's capsule slider, so the two match. --p (how far along) is kept up to date by
   landing.js. */
input[type=range]:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:99px}
input[type=range]::-webkit-slider-runnable-track{height:.75rem;border-radius:99px;border:1px solid var(--field-edge);background:linear-gradient(to right,color-mix(in srgb,var(--accent) 75%,var(--card)) var(--p,0%),var(--track) var(--p,0%))}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:.875rem;height:1.25rem;margin-top:-.3125rem;border-radius:.4375rem;background:var(--card);border:1px solid var(--field-edge);box-shadow:0 1px 3px color-mix(in srgb,var(--landing-ink) 22%,transparent)}
input[type=range]::-moz-range-track{height:.75rem;border-radius:99px;border:1px solid var(--field-edge);background:var(--track)}
input[type=range]::-moz-range-progress{height:.75rem;border-radius:99px;background:color-mix(in srgb,var(--accent) 75%,var(--card))}
input[type=range]::-moz-range-thumb{width:.875rem;height:1.25rem;border-radius:.4375rem;background:var(--card);border:1px solid var(--field-edge)}

/* --- destination ---------------------------------------------------------- */
.globe-search{position:relative;margin-bottom:1rem}
#globe-input{width:100%;font:inherit;font-size:.9375rem;padding:.7rem 1rem;min-height:3rem;border:1px solid var(--field-edge);border-radius:.85rem;background:var(--field);color:var(--landing-ink)}
#globe-input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.globe-hits{position:absolute;top:calc(100% + .35rem);left:0;right:0;z-index:5;margin:0;padding:.3rem;list-style:none;background:var(--field);border:1px solid var(--field-edge);border-radius:.85rem;box-shadow:0 1rem 2rem -.75rem color-mix(in srgb,var(--shadow) 35%,transparent);max-height:15rem;overflow-y:auto}
.globe-hits li{display:flex;align-items:baseline;justify-content:space-between;gap:.75rem;padding:.55rem .7rem;border-radius:.55rem;font-size:.875rem;cursor:pointer}
.globe-hits li small{color:var(--landing-muted);font-size:.75rem}
.globe-hits li:hover,.globe-hits li.is-active{background:var(--tint)}
.globe-holder{position:relative;display:grid;place-items:center;min-height:20rem;padding-bottom:2.5rem}
#globe-canvas{width:min(100%,24rem);height:auto;aspect-ratio:1;touch-action:pan-y;cursor:grab}
#globe-canvas:active{cursor:grabbing}
.globe-loading{font-size:.8125rem;color:var(--landing-muted)}

/* --- the runway ----------------------------------------------------------- */
.fig-chart{display:block;width:100%;height:auto;aspect-ratio:300/118}
.chart-danger{fill:var(--warn);opacity:.07}
.chart-zero{stroke:var(--landing-muted);opacity:.6}
.chart-area{fill:var(--accent);opacity:.14}
.chart-line{stroke:var(--accent);stroke-width:3}
.chart-dot{fill:var(--accent)}.chart-dot.is-low{fill:var(--warn)}
.fig-axis{display:flex;justify-content:space-between;font-size:.75rem;color:var(--landing-muted);margin-top:.4rem;font-variant-numeric:tabular-nums}

/* --- where it goes -------------------------------------------------------- */
.fig-donut-row{display:flex;align-items:center;gap:2rem}
.fig-donut{flex:none;width:13rem;height:13rem}
.ring-seg{transform:rotate(calc(-90deg + var(--seg-rot,0deg)));transform-origin:70px 70px;stroke-dasharray:var(--seg-len,0) var(--seg-gap,9999)}
.donut-mid{font-size:16px;font-weight:600;fill:var(--landing-ink);letter-spacing:-.04em}
.donut-sub{font-size:8px;fill:var(--landing-muted)}
.fig-legend{list-style:none;margin:0;padding:0;flex:1;min-width:0;display:flex;flex-direction:column;gap:.3rem}
.fig-legend li{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:auto auto;align-items:center;gap:0 .6rem;font-size:.8125rem}
.fig-legend .dot{grid-column:1;grid-row:1}
.fig-legend .row-label{grid-column:2;grid-row:1;cursor:pointer}
.fig-legend .row-value{grid-column:3;grid-row:1;font-size:.8125rem}
.row-slider{grid-column:1/-1;grid-row:2;height:1.2rem;margin-bottom:.15rem}
.dot{flex:none;width:.65rem;height:.65rem;border-radius:3px}

/* --- housing -------------------------------------------------------------- */
.fig-places{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.4rem;min-height:1px}
.fig-places li{display:flex;align-items:center;gap:.75rem;font-size:.9375rem;padding:.7rem .85rem;border-radius:.7rem;background:var(--tint)}
.place-bar{flex:none;width:4px;height:1.75rem;border-radius:2px;background:var(--accent)}
.fig-places li:nth-child(2) .place-bar{background:var(--pop)}
.fig-places li:nth-child(3) .place-bar{background:var(--c3)}
.place-tag{font-size:.6875rem;color:var(--landing-muted);border:1px solid var(--card-edge);background:var(--card);border-radius:5rem;padding:.2rem .6rem;white-space:nowrap}
.fig-verdict{margin-top:1.25rem;padding-top:1rem;border-top:1px solid var(--landing-line);display:flex;align-items:baseline;gap:.75rem;font-size:.8125rem;color:var(--landing-muted)}
.fig-verdict strong{font-size:1.6rem;font-weight:600;letter-spacing:-.04em;color:var(--landing-ink);font-variant-numeric:tabular-nums}
.fig-delta{margin-left:auto;color:var(--warn);font-weight:600}
.fig-delta.delta-up{color:var(--ok)}

/* --- compare -------------------------------------------------------------- */
.fig-table{width:100%;border-collapse:collapse;font-size:.875rem}
.fig-table th,.fig-table td{padding:.7rem .5rem;text-align:right;font-weight:400}
.fig-table thead th{font-size:.8125rem;font-weight:600;letter-spacing:-.02em;border-bottom:1px solid var(--landing-line);padding-bottom:.75rem}
.fig-table tbody th{text-align:left;color:var(--landing-muted)}
.fig-table td{font-variant-numeric:tabular-nums}
.fig-table .col-win{color:var(--accent);font-weight:600}
.fig-table .col-new{color:var(--pop);font-weight:600}
.fig-table .row-total th,.fig-table .row-total td{border-top:1px solid var(--landing-line);font-weight:600;padding-top:.8rem}
.fig-table .row-total td{font-size:1.05rem}

/* --- checklist ------------------------------------------------------------ */
.fig-progress{height:.4rem;border-radius:5rem;background:var(--track);overflow:hidden;margin-bottom:1.1rem}
.fig-progress i{display:block;height:100%;width:100%;border-radius:5rem;background:linear-gradient(90deg,var(--accent),var(--pop));transform-origin:left;transform:scaleX(0)}
.fig-tasks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.2rem}
.fig-tasks label{display:flex;align-items:center;gap:.75rem;font-size:.9375rem;line-height:1.4;cursor:pointer;padding:.45rem .5rem;border-radius:.5rem;position:relative}
.fig-tasks label:hover{background:var(--tint)}
.task-box{position:absolute;opacity:0;width:1px;height:1px}
.tick{flex:none;width:1.25rem;height:1.25rem;border-radius:.35rem;border:1.5px solid var(--field-edge);display:grid;place-items:center;color:transparent;background:var(--field)}
.tick svg{width:.9rem;height:.9rem}
.task-box:checked + .tick{background:var(--accent);border-color:var(--accent);color:var(--cta-ink)}
.task-box:focus-visible + .tick{outline:2px solid var(--accent);outline-offset:2px}
.task-box:checked ~ .task-text{color:var(--landing-muted);text-decoration:line-through;text-decoration-color:var(--landing-muted)}

/* ==========================================================================
   MOTION
   ========================================================================== */
@media (prefers-reduced-motion:no-preference){
  /* The donut and the balance line follow their controls, so they ease rather than jump. */
  .ring-seg{transition:stroke-dasharray .35s cubic-bezier(.2,.8,.2,1),opacity .25s ease}
  .chart-dot{transition:cx .3s cubic-bezier(.2,.8,.2,1),cy .3s cubic-bezier(.2,.8,.2,1),fill .3s ease}
  .fig-progress i{transition:transform .5s cubic-bezier(.2,.8,.2,1)}
  .tick,.task-text{transition:background .2s ease,border-color .2s ease,color .2s ease}

  /* A listing slides in above the ones already there. */
  .place-new{opacity:0;transform:translateY(-.5rem)}
  .fig-places li{transition:opacity .4s ease,transform .4s cubic-bezier(.2,.8,.2,1)}
  .col-arriving{opacity:0;transform:translateX(.75rem)}
  .fig-table .col-new{transition:opacity .45s ease calc(var(--row-i,0)*.08s),transform .45s cubic-bezier(.2,.8,.2,1) calc(var(--row-i,0)*.08s)}
}

/* ==========================================================================
   Narrow screens
   ========================================================================== */
@media (max-width:40rem){
  .fig-controls{grid-template-columns:1fr}
  .fig-donut-row{flex-direction:column;gap:1rem}
  .fig-donut{width:10rem;height:10rem}
  .fig-legend{width:100%}
  .fig-table th,.fig-table td{padding:.5rem .25rem}
  .fig-table thead th{font-size:.6875rem}
  .fig-table{font-size:.8125rem}
  .place-tag{display:none}
  .globe-holder{min-height:16rem}
}
