/* Cards by Clara: shared styles for the planner pages. */
/* Cards by Clara theme (join.cardsbyclara.co.uk). Light only, like the main site. */
:root {
  color-scheme: light;
  --page: #d8f0e6; --card: #faf8f3; --surface: #ffffff; --border: #e6e2d8; --input: #f0f0f0;
  --text: #1f2126; --heading: #1e2a32; --muted: #55595f; --brand: #0f5e5a;
  --accent: #0f5e5a; --accent-text: #ffffff; --button: #d9512c; --button-text: #f0f0f0; --link: #c45e39;
  --warn-bg: #fde8e2; --warn-border: #d9512c; --error: #b23a1d;
  /* Chart colours: brand teal and orange plus two contrasting hues, validated for colour-blind separation. */
  --s1: #008a7a; --s2: #d9512c; --s3: #5b7fe0; --s4: #e8a020; --not-started: #dcd8cc; --exam: #1e2a32; --grid: #eeebe3;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font: 16px/1.5 "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 1140px; margin: 24px auto; padding: 32px; background: var(--card); border-radius: 12px; }
@media (max-width: 820px) { main { margin: 0; border-radius: 0; padding: 20px 16px 48px; } }
.brand { margin: 0 0 12px; font-size: 1.6rem; font-weight: 500; }
.brand a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { color: var(--heading); font-weight: 500; }
h1 { font-size: 2.2rem; line-height: 1.15; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 32px 0 8px; }
h3 { font-size: 1rem; margin: 20px 0 4px; }
a { color: var(--link); }
.lead { color: var(--muted); margin: 0 0 24px; }
.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 820px) { .layout { grid-template-columns: minmax(0, 1fr); } }
form { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
label { display: block; font-size: 0.9rem; color: var(--muted); margin: 8px 0 2px; }
input[type="number"], input[type="date"], input[type="text"] { width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: var(--input); color: var(--text); font: inherit; }
input:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row > div { min-width: 0; }
.choice { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 0.95rem; margin: 6px 0; flex-wrap: wrap; }
.modes { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.modes input { position: absolute; opacity: 0; pointer-events: none; }
.modes label { margin: 0; padding: 8px 6px; text-align: center; color: var(--text); cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.modes input:checked + label { background: var(--accent); color: var(--accent-text); }
.modes { background: var(--input); border: 0; }
.modes input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -4px; }
details { border-top: 1px solid var(--border); padding-top: 8px; }
summary { cursor: pointer; font-weight: 600; }
.hint { font-size: 0.8rem; color: var(--muted); margin: 4px 0 0; }
.odds { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 4px; }
.odds th, .odds td { padding: 3px 2px; text-align: center; border: 0; }
.odds th:first-child, .odds td:first-child { text-align: left; color: var(--muted); font-weight: 400; }
.odds input { padding: 4px; text-align: right; }
.odds .total { font-variant-numeric: tabular-nums; color: var(--muted); }
.odds .total.bad { color: var(--exam); font-weight: 600; }
button.secondary { margin-top: 12px; padding: 10px 16px; border: 0; border-radius: 6px; background: var(--button); color: var(--button-text); font: inherit; cursor: pointer; }
.headline { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; font-size: 1.05rem; }
.headline p { margin: 6px 0; }
.warning { background: var(--warn-bg); border-left: 4px solid var(--warn-border); border-radius: 6px; padding: 10px 14px; margin: 12px 0 0; }
.error { color: var(--error); font-weight: 600; }
.table-wrap { overflow-x: auto; }
#monthly { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
#monthly th, #monthly td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
#monthly th:first-child, #monthly td:first-child { text-align: left; }
#monthly th { color: var(--muted); font-weight: 600; }
#monthly tr.after td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.chart { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; height: 420px; }
.phases { margin: 8px 0 0; padding-left: 20px; }
.about { }
.about li { margin: 4px 0; }
footer { color: var(--muted); font-size: 0.85rem; margin-top: 40px; border-top: 1px solid var(--border); padding-top: 16px; }
[hidden] { display: none !important; }

/* Header and navigation */
.site-header { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.site-header .brand { margin: 0; }
.site-header nav { display: flex; gap: 16px; }
.site-header nav a { color: var(--heading); text-decoration: none; font-weight: 500; }
.site-header nav a[aria-current="page"] { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }

/* Subject buttons */
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.presets button { padding: 10px 8px; border: 2px solid var(--brand); border-radius: 8px; background: var(--surface); color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; line-height: 1.25; }
.presets button small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.presets button[aria-pressed="true"] { background: var(--brand); color: var(--accent-text); }
.presets button[aria-pressed="true"] small { color: #d8f0e6; }

/* Minutes / cards switch above the daily chart */
.chart-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 32px 0 8px; }
.chart-heading h2 { margin: 0; }
.toggle { display: inline-flex; background: var(--input); border-radius: 8px; padding: 3px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle label { margin: 0; padding: 4px 12px; border-radius: 6px; color: var(--text); font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.toggle input:checked + label { background: var(--brand); color: var(--accent-text); }
.toggle input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Explainer page */
.prose { }
.prose h2 { margin-top: 36px; }
.prose li { margin: 6px 0; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 44px; margin: 16px 0; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--accent-text); display: grid; place-items: center; font-weight: 600; }
.callout { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin: 16px 0; }
.glossary dt { font-weight: 600; color: var(--heading); margin-top: 12px; }
.glossary dd { margin: 2px 0 0; }
.button-link { display: inline-block; padding: 12px 20px; border-radius: 6px; background: var(--button); color: var(--button-text); text-decoration: none; font-weight: 500; }

/* --- Steps and layout --------------------------------------------------------------------------- */
.step-title { display: none; align-items: center; gap: 8px; font-weight: 600; color: var(--heading); margin: 0 0 8px; }
.stepnum { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--accent-text); font-size: 0.85rem; }
.step { min-width: 0; }
.step .modes { margin-top: 0; }
.presets { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }


/* Three numbered steps across the top, the plan below at full width. */
.layout { grid-template-columns: minmax(0, 1fr); }
form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; align-items: start; }
.step-title { display: flex; }
.step + .step { border-left: 1px solid var(--border); padding-left: 24px; }
#advanced { grid-column: 1 / -1; }
@media (max-width: 820px) {
  form { grid-template-columns: minmax(0, 1fr); }
  .step + .step { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
}

/* Problems shown on the page (see index.html) */
.problem { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 10; background: var(--warn-bg); border-left: 4px solid var(--error); border-radius: 8px; padding: 12px 16px; color: var(--text); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }

/* "Try it" slider above the graphs */
.slider-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-top: 16px; }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.slider-top label { margin: 0; font-weight: 600; color: var(--heading); font-size: 1rem; }
.slider-top output { font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.slider-panel input[type="range"] { width: 100%; margin: 10px 0 2px; accent-color: var(--brand); height: 24px; }

/* "?" explanations next to terms */
.tip-wrap { position: relative; display: inline-block; margin-left: 6px; vertical-align: middle; }
.info { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: var(--brand); color: var(--accent-text); font: 700 0.72rem/18px "Hanken Grotesk", system-ui, sans-serif; cursor: pointer; }
.tip { position: absolute; z-index: 5; top: 24px; left: 0; width: min(280px, 80vw); padding: 10px 12px; border-radius: 8px; background: var(--heading); color: #ffffff; font-size: 0.85rem; font-weight: 400; line-height: 1.4; text-align: left; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.tip[hidden] { display: none; }
label[data-tip]:not(.choice) { display: inline-block; }
.choice[data-tip] { display: inline-flex; max-width: calc(100% - 28px); vertical-align: middle; }
.choice[data-tip] + .tip-wrap { margin-left: 4px; }
