/* Trade As Planned — the 20-Session Starter Plan page (30-09-2026). It replaces the Trading Contract Builder,
   which Marco found "a block of text": one fixed plan, chosen with two taps (account and stop), shown as numbers
   and drawings. It uses the theme's tokens and type (theme.css) and adds only what the plan needs. Motion: press
   feedback on the chips and a short settle on each number that changes; nothing moves with reduced motion. */

:root { --hatch: rgba(179, 38, 30, 0.2); }
@media (prefers-color-scheme: dark) { :root { --hatch: rgba(255, 138, 125, 0.24); } }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.plan-page {
  max-width: 1200px; margin: 0 auto; padding-block: clamp(22px, 4vw, 48px) 0;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px clamp(40px, 5vw, 72px);
}

/* ---------- title and the two taps ---------- */
.intro .kicker { margin: 0 0 8px; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--accent); }
.intro h1 {
  margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(30px, 8vw, 48px); line-height: 1.04;
  letter-spacing: -0.02em; color: var(--ink); text-wrap: balance;
}
.intro .lead {
  margin: 12px 0 0; font-size: clamp(17.5px, 1.5vw, 20px); line-height: 1.5; color: var(--ink-2); max-width: 30em;
  text-wrap: pretty;
}

.picker { position: relative; display: grid; gap: 16px; margin-top: 22px; justify-items: stretch; }
.picker fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.picker legend { padding: 0; margin: 0 0 10px; font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
.picker .hint { margin: 6px 0 0; font-size: 14px; line-height: 1.4; color: var(--ink-3); }
.seg .chips { display: grid; gap: 6px; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); }
.chip-opt { position: relative; display: block; }
.chip-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip-opt span {
  display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--paper); color: var(--ink);
  font-size: 16px; font-weight: 600; line-height: 1.2; text-align: center; font-variant-numeric: tabular-nums;
  transition: background-color 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out, transform 100ms ease-out;
}
.chip-opt:hover span { border-color: var(--ink-3); }
.chip-opt input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.chip-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-opt input:active + span { transform: scale(0.97); }

/* the way out of FTMO sits on the first line, so the plan starts higher on a phone */
.swap {
  position: absolute; top: -9px; right: 0; min-height: 38px; padding: 0 0 0 12px; border: 0; background: none; cursor: pointer;
  font: 600 15.5px/1.3 var(--sans); color: var(--accent);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em;
}
.swap:hover { text-decoration-thickness: 2px; }

.custom { display: grid; gap: 16px; }
.custom .fields { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.custom label { display: grid; gap: 6px; font-size: 14.5px; font-weight: 500; line-height: 1.3; color: var(--ink-2); }
.custom input[type="number"] {
  width: 100%; min-height: 46px; padding: 10px 12px; font: 500 16px/1.2 var(--sans); font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--paper); color: var(--ink);
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
.custom input[type="number"]:hover { border-color: var(--ink-3); }
.custom input[type="number"]:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.custom .hint { font-size: 14px; font-weight: 400; color: var(--ink-3); }

/* ---------- the plan: one ruled page ---------- */
.plan {
  display: grid; gap: 30px; align-content: start; min-width: 0;
  background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--rule);
  padding: clamp(20px, 3.2vw, 36px);
}
.plan-head h2 {
  margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(28px, 2.6vw, 34px); line-height: 1.08;
  letter-spacing: -0.012em; color: var(--ink);
}
.plan-for { margin: 6px 0 0; font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.block h3 { margin: 0 0 4px; font-family: var(--serif); font-weight: 700; font-size: 20px; line-height: 1.2; color: var(--ink); }
.note { margin: 12px 0 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.note b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.rk { font-size: 14.5px; font-weight: 600; color: var(--ink-3); }

/* every trade: four numbers */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; border-top: 1px solid var(--line); }
.tile { display: grid; gap: 2px; align-content: start; min-width: 0; padding: 14px 0 16px; border-bottom: 1px solid var(--line); }
.tile:nth-child(odd) { padding-right: 14px; border-right: 1px solid var(--line); }
.tile:nth-child(even) { padding-left: 16px; }
.tile .k { font-size: 14.5px; font-weight: 600; color: var(--ink-3); }
.tile .v { font-size: 17px; font-weight: 600; line-height: 1.15; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile .v b { font-size: clamp(32px, 9vw, 42px); font-weight: 700; letter-spacing: -0.025em; color: var(--ink); }
.tile .s { font-size: 14.5px; line-height: 1.35; color: var(--ink-3); }
.plan.is-empty .block:not(:first-child), .plan.is-empty .tile .v { opacity: 0.35; }
.toosmall { margin: 12px 0 0; padding: 10px 12px; font-size: 15px; color: var(--bad); background: var(--bad-soft); border-left: 2px solid var(--bad); }

/* every session */
.rows { margin-top: 10px; }
.row {
  display: grid; grid-template-columns: 6.2em minmax(0, 1fr); gap: 2px 14px; align-items: baseline;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.row .rv { font-size: 17px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.row .rv b { font-size: 24px; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }
.row .rs { grid-column: 2; font-size: 14.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dots3 { display: inline-flex; gap: 5px; margin-right: 10px; vertical-align: 2px; }
.dots3 i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }

.dayend { padding-top: 12px; border-top: 1px solid var(--line); }
.dayend .rk { margin: 0; }
.daybar { position: relative; margin: 14px 0 0; padding: 50px 0 44px; }
.daybar .track { position: relative; height: 14px; }
.daybar .firm {
  position: absolute; top: 0; bottom: 0; left: 0; width: var(--lo);
  background: repeating-linear-gradient(135deg, var(--hatch) 0 4px, transparent 4px 9px);
  border-left: 2px solid var(--bad);
}
.daybar .play { position: absolute; top: 0; bottom: 0; left: var(--lo); right: 0; background: var(--accent-soft); }
.daybar .tick { position: absolute; top: -9px; bottom: -9px; width: 2px; margin-left: -1px; background: var(--ink); }
.daybar .tick.lo { left: var(--lo); }
.daybar .tick.zero { left: var(--zero); top: -4px; bottom: -4px; width: 1px; background: var(--ink-3); }
.daybar .tick.hi { left: 100%; margin-left: -2px; }
.daybar .labels { position: absolute; left: 0; right: 0; }
.daybar .labels.top { top: 0; height: 40px; }
.daybar .labels.bottom { bottom: 0; height: 36px; }
.daybar .lab { position: absolute; display: grid; font-size: 14px; line-height: 1.2; color: var(--ink-3); white-space: nowrap; }
.daybar .lab b { font-size: 16.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.daybar .labels.top .lab { bottom: 0; }
.daybar .labels.bottom .lab { top: 0; }
.daybar .lab.lo { left: var(--lo); transform: translateX(-50%); text-align: center; justify-items: center; }
.daybar .lab.hi { right: 0; text-align: right; justify-items: end; }
.daybar .lab.start { left: 0; }
.daybar .lab.zero { left: var(--zero); transform: translateX(-50%); }

/* on a drawdown: the brake as a staircase */
.ladder { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.ladder li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "lk lv" "bar bar";
  align-items: baseline; gap: 6px 12px;
}
.ladder .lk { grid-area: lk; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ladder .lk b { font-weight: 700; color: var(--ink); }
.ladder .lbar {
  grid-area: bar; height: 14px; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent)) left center / var(--w) 100% no-repeat, var(--line-2);
}
.ladder .lv { grid-area: lv; font-size: 14px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ladder .lv b { font-size: 18px; font-weight: 700; color: var(--ink); }
.ladder li.floor { grid-template-areas: "lk lf"; padding-top: 10px; border-top: 2px dashed var(--bad); }
.ladder .lfloor { grid-area: lf; font-size: 14.5px; color: var(--ink-3); }

/* to pass */
.goals { display: grid; margin-top: 10px; }
.goalrow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "gk gk" "gv sq" "gs gs";
  align-items: center; gap: 2px 14px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.goalrow .gk { grid-area: gk; font-size: 14.5px; font-weight: 600; color: var(--ink-3); }
.goalrow .gv { grid-area: gv; }
.goalrow .squares { grid-area: sq; }
.goalrow .gv b { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.goalrow .gs { grid-area: gs; font-size: 14.5px; line-height: 1.4; color: var(--ink-3); }
.goalrow .gs b { color: var(--ink-2); font-weight: 700; }
.squares { display: flex; flex-wrap: wrap; gap: 4px; justify-self: end; }
.squares i { width: 13px; height: 13px; border-radius: 2px; background: var(--accent); }

/* before any change */
.grid20 { display: grid; grid-template-columns: repeat(10, 22px); gap: 6px; margin-top: 12px; }
.grid20 i { width: 22px; height: 22px; border: 1.5px solid var(--ink-3); border-radius: 3px; }

/* the signature */
.signoff { display: grid; gap: 4px; padding-top: 18px; border-top: 2px solid var(--rule); }
.pledge { font-family: var(--serif); font-weight: 700; font-size: 20px; line-height: 1.25; color: var(--ink); }
.signoff input {
  width: 100%; min-height: 52px; padding: 6px 0; border: 0; border-bottom: 1px solid var(--ink-3); border-radius: 0;
  background: transparent; color: var(--accent); font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 28px;
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
.signoff input::placeholder { font-family: var(--sans); font-style: normal; font-weight: 400; font-size: 16px; color: var(--ink-3); opacity: 1; }
.signoff input:focus-visible { outline: 0; border-bottom-color: var(--accent); box-shadow: 0 1px 0 0 var(--accent); }

.plan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: -6px; }
.copied { font-size: 15.5px; font-weight: 600; color: var(--accent); }
.coachnote { margin: -12px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink-3); max-width: 36em; }
.coachnote .privacy { display: inline-block; margin-top: 4px; font-size: 14px; }
#tg[hidden] { display: none; }
@media (max-width: 559px) { .plan-actions .btn { flex: 1 1 100%; justify-content: center; } }

/* ---------- below the plan ---------- */
.why, .faq { max-width: 760px; min-width: 0; }
.why h2, .faq h2 {
  margin: 0 0 6px; padding-top: 18px; border-top: 2px solid var(--rule);
  font-family: var(--serif); font-weight: 700; font-size: clamp(26px, 2.4vw, 32px); line-height: 1.12; letter-spacing: -0.012em;
}
.why ul { list-style: none; margin: 0; padding: 0; }
.why li { padding: 16px 0 18px; border-bottom: 1px solid var(--line); font-size: 17px; line-height: 1.55; color: var(--ink-2); }
.why li:last-child { border-bottom: 0; }
.why li strong { display: block; margin-bottom: 4px; font-family: var(--serif); font-weight: 700; font-size: 19px; line-height: 1.3; color: var(--ink); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 12px 0;
  font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--ink); cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font-size: 24px; font-weight: 400; line-height: 1; color: var(--ink-3); transition: transform 160ms var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 18px; font-size: 16.5px; line-height: 1.6; color: var(--ink-2); max-width: 40em; }

/* ---------- widths ---------- */
@media (max-width: 380px) {
  .chip-opt span { font-size: 15px; }
}
@media (min-width: 720px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile, .tile:nth-child(odd), .tile:nth-child(even) { padding: 14px 16px 16px; border-right: 1px solid var(--line); }
  .tile:first-child { padding-left: 0; }
  .tile:last-child { padding-right: 0; border-right: 0; }
  .tile .v b { font-size: clamp(34px, 3.4vw, 42px); }
  .squares i { width: 15px; height: 15px; }
  .ladder li { grid-template-columns: 10em minmax(0, 1fr) 6em; grid-template-areas: "lk bar lv"; align-items: center; }
  .ladder li.floor { grid-template-columns: 10em minmax(0, 1fr); grid-template-areas: "lk lf"; }
  .goalrow { grid-template-columns: 7em auto minmax(0, 1fr); grid-template-areas: "gk gv sq" ". gs gs"; }
  .grid20 { grid-template-columns: repeat(20, 20px); gap: 5px; }
  .grid20 i { width: 20px; height: 20px; }
}
@media (min-width: 1000px) {
  .plan-page { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); align-items: start; }
  .plan-side { position: sticky; top: 24px; }
  .plan { grid-column: 2; grid-row: 1; }
  .why { grid-column: 1 / -1; grid-row: 2; }
  .faq { grid-column: 1 / -1; grid-row: 3; }
  .intro h1 { font-size: clamp(40px, 3.6vw, 50px); }
}

/* ---------- motion ---------- */
[data-f] { display: inline-block; }
div[data-f], p[data-f] { display: block; }
.goals[data-f] { display: grid; }
.squares[data-f] { display: flex; }
[data-f="streakEnd"] { display: inline; }
[data-f="local"] { display: block; }
[data-f="local"]:empty { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .is-new { animation: plan-settle 220ms var(--ease-out); }
  @keyframes plan-settle { from { opacity: 0.2; transform: translateY(5px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .chip-opt span, .custom input[type="number"], .signoff input, .faq summary::after { transition: none; }
  .chip-opt input:active + span { transform: none; }
}
