/* Covered-calls page. Tokens and base components come from ../styles.css; this adds the
   series palette and the few pieces only this page has. */

:root {
  /* categorical, fixed order: hold, covered call, collar, weekly call, cash-secured put.
     Validated on the page surface (#fcfcfb): all checks pass; aqua, yellow and magenta are
     under 3:1, so every line is direct-labeled and every number is also in a table. */
  --s-hold: #2a78d6;
  --s-cc: #eb6834;
  --s-collar: #1baf7a;
  --s-weekly: #eda100;
  --s-put: #e87ba4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s-hold: #3987e5;   /* stepped for the dark surface (#1d1f22): all checks pass */
    --s-cc: #d95926;
    --s-collar: #199e70;
    --s-weekly: #c98500;
    --s-put: #d55181;
  }
}
:root[data-theme="dark"] {
  --s-hold: #3987e5;
  --s-cc: #d95926;
  --s-collar: #199e70;
  --s-weekly: #c98500;
  --s-put: #d55181;
}

.back {
  color: var(--accent); text-decoration: none; font-size: 12px; font-weight: 500;
}
.back::before { content: "← "; }
.back:hover { text-decoration: underline; }

.cc-intro { padding-block: 26px 4px; }
.lede {
  font-family: "Newsreader", ui-serif, Georgia, serif;
  font-size: 18px; line-height: 1.45; margin: 0 0 8px; max-width: 64ch;
}
.lede strong { font-weight: 500; }

.panel h2 + .sub { margin-bottom: 14px; }
.panel h3 { font-size: 14px; font-weight: 600; margin: 26px 0 10px; }
.panel h3.window-head {
  font-family: "Newsreader", ui-serif, Georgia, serif;
  font-size: 18px; font-weight: 500; margin: 38px 0 2px;
  padding-top: 20px; border-top: 1px solid var(--line);
}
.panel h3.window-head + .sub { margin-bottom: 12px; }

/* the head-to-head table: metric rows, one column per book */
table.duel th.book { text-align: right; }
table.duel td.best { font-weight: 600; }
.key { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-hold { background: var(--s-hold); }
.sw-covered_call { background: var(--s-cc); }
.sw-collar { background: var(--s-collar); }
.sw-weekly_call { background: var(--s-weekly); }
.sw-cash_put { background: var(--s-put); }
#backtest nav.tabs { margin: 14px 0 4px; }
td.metric { color: var(--ink-2); }
.key .short { display: none; }
td.metric .why { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* multi-series chart */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 2px 0 8px; font-size: 12px;
          color: var(--ink-2); }
svg.lines .grid { stroke: var(--line-soft); stroke-width: 1; }
svg.lines .axis-text { fill: var(--muted); font-size: 10px;
                       font-family: "JetBrains Mono", ui-monospace, monospace; }
svg.lines .start { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
svg.lines .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.lines .series.hold, svg.lines .dot.hold { stroke: var(--s-hold); }
svg.lines .series.covered_call, svg.lines .dot.covered_call { stroke: var(--s-cc); }
svg.lines .series.collar, svg.lines .dot.collar { stroke: var(--s-collar); }
svg.lines .series.weekly_call, svg.lines .dot.weekly_call { stroke: var(--s-weekly); }
svg.lines .series.cash_put, svg.lines .dot.cash_put { stroke: var(--s-put); }
svg.lines .end-label { fill: var(--ink-2); font-size: 11px; font-weight: 500; }
svg.lines .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
svg.lines .dot { fill: var(--surface); stroke-width: 2; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
/* on a phone the readout sits under the plot rather than floating over the dots it describes */
.tooltip.readout { position: static; display: flex; flex-wrap: wrap; gap: 4px 14px;
                   margin-top: 6px; box-shadow: none; pointer-events: none; }
.tooltip.readout .tt-row { gap: 6px; }
svg.lines { display: block; touch-action: pan-y; }

/* spacing between the stacked blocks of a window */
.panel .notice { margin: 12px 0 14px; }
.panel .chart-card { margin-top: 16px; }

/* forward books */
.books { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.bookcard { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
            padding: 14px 15px; }
.bookcard .kpi-value { margin-top: 2px; }
.bookcard .kpi-note { margin-top: 4px; }

@media (max-width: 560px) {
  .lede { font-size: 16.5px; }
  /* the head-to-head has to fit a phone: labels wrap, the explanations go, cells tighten */
  table.duel td.metric { white-space: normal; min-width: 104px; }
  table.duel td.metric .why { display: none; }
  table.duel th, table.duel td { padding: 9px 8px; }
  table.duel .spacer { padding: 0; }  /* same specificity as the rule above, so restate it */
  table.duel .key .long { display: none; }
  table.duel .key .short { display: inline; }
}

/* month by month: the sign carries gain or loss; colour only repeats it */
.months h4 { margin: 18px 0 6px; font-size: 13px; color: var(--ink-2); }
table.duel td.gain { color: var(--buy); }
table.duel td.loss { color: var(--sell); }
table.duel td .chg { display: block; color: var(--muted); font-size: 11.5px; }

/* the rules and plain-terms glossary at the foot of the page */
.rules dl { margin: 8px 0 22px; }
.rules dt { font-weight: 600; margin-top: 12px; }
.rules dd { margin: 2px 0 0; color: var(--ink-2); line-height: 1.5; max-width: 72ch; }
