/* Shared look for every edition. The palette and fonts follow the practice's
   website. The fonts ship beside the page (assets/fonts, SIL Open Font
   License), because fetching them from another server would break edition 1's
   "nothing leaves the page". */

@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/PlayfairDisplay-600.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/Lato-400.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/Lato-700.woff2') format('woff2'); }

:root {
  --ink: #0e1f5c;
  --ink-muted: #3a4e8a;
  --brand: #1a3a8f;
  --brand-deep: #112570;
  --accent: #c9a84c;
  --accent-light: #e8c97a;
  --bg: #f3f5fc;
  --brand-darker: #0c1a52;
  --surface: #ffffff;
  --line: #e2e7f5;
  --error: #b42318;
  --error-bg: #fef3f2;
  --done: #2e7d4f;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: Lato, 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.7 var(--sans); -webkit-text-size-adjust: 100%;
}
main { display: block; }
.screen { max-width: 1100px; margin: 0 auto; padding: 0 5% 8px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: clamp(2rem, 4.2vw, 3rem); color: var(--brand-darker); margin-bottom: .2rem; }
h2 { font-size: 1.5rem; color: var(--brand-darker); }
h3 { font-size: 20px; color: var(--brand-darker); }
p { margin: 0 0 .75rem; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* Headings take focus only to announce a new screen. */
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

/* The practice's header and footer: the home page's own values (its nav,
   .nav-logo, .nav-links, .nav-cta and footer rules), so moving between the
   two pages changes nothing but the content. */
.site-bar { position: relative; z-index: 10; background: var(--brand-darker); border-bottom: 1px solid rgba(201,168,76,0.3); }
.nav-toggle { display: none; width: 44px; height: 44px; min-height: 0; padding: 0; border: 1px solid rgba(201,168,76,0.5); border-radius: 6px;
  background: transparent; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }
.menu-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.bar-inner { height: 100px; padding: 0 5%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { width: 120px; height: 120px; object-fit: contain; }
.brand span { font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1; letter-spacing: -0.01em; color: #fff; }
.site-bar ul { display: flex; gap: 2rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.site-bar nav a { color: rgba(255,255,255,0.75); text-decoration: none; font-size: 15px; letter-spacing: 0.02em; transition: color 0.2s; }
.site-bar nav a:hover, .site-bar nav a[aria-current] { color: var(--accent-light); }
.site-bar nav a.cta { background: var(--accent); color: var(--brand-darker); padding: 10px 24px; border-radius: 4px; font-weight: 700; font-size: 14px; white-space: nowrap; display: inline-block; }
.site-bar nav a.cta:hover { background: var(--accent-light); }

.disclaimer { max-width: 900px; margin: 0 auto 20px; padding: 0 5%; text-align: center; font-size: 14px; color: var(--ink-muted); }
.disclaimer p { margin: 0 0 .35rem; }
.site-foot { background: var(--brand-darker); border-top: 1px solid rgba(201,168,76,0.15); }
.foot-row { padding: 8px 5%; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.foot-brand { display: flex; align-items: center; gap: 12px; }
.foot-brand img { width: 40px; height: 40px; object-fit: contain; }
.foot-brand span { font-family: var(--serif); font-size: 20px; color: #fff; font-weight: 600; }
.foot-brand span span { color: var(--accent); }
.foot-copy { font-size: 13px; color: rgba(255,255,255,0.28); margin: 0; }
/* Shown instead of the tool when the page runs on a host it does not know. */
.moved { max-width: 40rem; margin: 20vh auto; padding: 0 16px; text-align: center; font-size: 18px; }
.foot-links { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.foot-links a { font-size: 13px; color: rgba(255,255,255,0.38); text-decoration: none; transition: color 0.2s; }
.foot-links a:hover { color: var(--accent); }

.intro { padding: 16px 0 0; }
.tagline { font-family: var(--serif); font-size: clamp(1.15rem, 2.6vw, 1.45rem); color: var(--brand); margin: 0 0 .4rem; }
.lead { font-size: 18px; color: var(--ink-muted); margin-bottom: .6rem; }
.privacy {
  background: var(--surface); border-left: 4px solid var(--accent);
  padding: 10px 14px; border-radius: 4px; font-size: .95rem;
}

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 18px 20px; margin: 16px 0; min-width: 0;
}
fieldset.card { padding-top: 18px; }
/* A floated legend sits inside its card like a heading, instead of on the
   card's top border where browsers draw it by default. */
legend {
  float: left; width: 100%; padding: 0; margin: 0 0 10px;
  font-family: var(--serif); font-weight: 600; font-size: 22px; line-height: 1.25; color: var(--brand-darker);
}
legend + * { clear: both; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 20px; }
.grid > [data-when] { display: contents; }
.grid > [data-when][hidden] { display: none !important; }

.field { margin: 12px 0; display: flex; flex-direction: column; gap: 4px; }
.field > label { font-weight: 700; font-size: 16px; }
.field.check label { font-weight: 400; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.field.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
input[type=text], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid #b8c2e0; border-radius: 6px; padding: 10px 12px; min-height: 44px;
}
input[aria-invalid], select[aria-invalid] { border-color: var(--error); background: var(--error-bg); }
.affix { position: relative; }
.affix.usd input { padding-left: 26px; }
.affix.pct input { padding-right: 30px; }
.affix.usd::before, .affix.pct::after {
  position: absolute; top: 50%; transform: translateY(-50%); color: var(--ink-muted); pointer-events: none;
}
.affix.usd::before { content: '$'; left: 12px; }
.affix.pct::after { content: '%'; right: 12px; }
.hint { font-size: 14px; line-height: 1.6; color: var(--ink-muted); }
.error { font-size: .88rem; color: var(--error); font-weight: 700; }
.note { background: var(--bg); border-radius: 6px; padding: 10px 14px; font-size: .92rem; }

.error-summary {
  border: 2px solid var(--error); background: var(--error-bg); border-radius: 8px;
  padding: 14px 18px; margin: 16px 0;
}
.error-summary p { font-weight: 700; margin-bottom: 4px; }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary a { color: var(--error); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 12px; }
button, .button {
  font: inherit; font-weight: 700; border-radius: 6px; padding: 12px 22px; min-height: 44px;
  border: 1px solid var(--brand); background: var(--surface); color: var(--brand);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--brand-deep); }
button.primary:hover, .button.primary:hover { background: var(--accent-light); }

.steps { list-style: none; padding: 0; margin: 16px 0; }
.step {
  display: grid; grid-template-columns: 40px 1fr; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 18px; margin: 12px 0;
}
.rank {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 700;
}
.step.done .rank { background: var(--done); }
.step.advisory { border-color: var(--accent); background: #fffaf0; }
.step.advisory .rank { background: var(--accent); color: var(--brand-deep); }
.step.empty { opacity: .8; }
.step .head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-bottom: 6px; }
.step h3 { margin: 0; }
.figures { text-align: right; }
.amount { font-size: 1.25rem; font-weight: 700; color: var(--brand-deep); display: block; }
.amount.muted { font-size: 1rem; color: var(--ink-muted); }
.cost { font-size: .85rem; color: var(--ink-muted); display: block; }
details.why { font-size: .92rem; color: var(--ink-muted); }
details.why summary, .warnings summary { cursor: pointer; color: var(--brand); font-weight: 700; list-style: none; }
details.why summary::-webkit-details-marker, .warnings summary::-webkit-details-marker { display: none; }
details.why summary::before, .warnings summary::before { content: '▸'; display: inline-block; width: 1em; transition: transform .15s; }
details[open].why summary::before, .warnings details[open] summary::before { transform: rotate(90deg); }
details.why p { border-left: 3px solid var(--line); padding-left: 10px; margin: 6px 0 0; }
.warnings summary { color: var(--brand-darker); font-size: 1rem; }
.warnings details p { margin: 6px 0 4px 1em; }

/* The headline numbers above the picture. */
.stats-wrap { margin: 4px 0 8px; }
.stats { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.stat { flex: 1 1 160px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.stat strong { display: block; font-family: var(--serif); font-size: clamp(1.6rem, 3.2vw, 2.1rem); color: var(--brand-darker); line-height: 1.15; }
.stat span { font-size: 14px; color: var(--ink-muted); }
.stat.gain { background: #eef8f1; border-color: #bfe0cb; }
.stat.gain strong { color: var(--done); }
.stat-arrow { align-self: center; font-size: 1.4rem; color: var(--accent); }
.stats-wrap .hint { margin: 6px 0 0; }

/* The closing invitation. */
.review { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  background: linear-gradient(135deg, #fff8e6, #f6ecd0); border: 1px solid var(--accent); border-radius: 10px; padding: 20px 24px; margin: 20px 0; }
.review h2 { margin-bottom: 4px; }
.review p { margin: 0; color: var(--ink-muted); max-width: 640px; }
.review > div { flex: 1 1 380px; }
.body { min-width: 0; }


.warnings { list-style: none; padding: 0; margin: 0; }
.warnings li { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.warnings li:first-child { border-top: 0; }
.warnings p { font-size: .93rem; }

details.card summary { cursor: pointer; font-weight: 700; }
.table-wrap { overflow-x: auto; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.stamp { font-size: .75rem; color: var(--ink-muted); word-break: break-word; }

/* Step progress on the input screen. */
.progress { list-style: none; display: flex; gap: 8px; padding: 0; margin: 8px 0 4px; counter-reset: none; }
.progress li { flex: 1; }
.progress button {
  width: 100%; justify-content: flex-start; gap: 8px; padding: 10px 12px; font-weight: 700;
  border: 0; border-bottom: 4px solid var(--line); border-radius: 0; background: transparent; color: var(--ink-muted);
}
.progress button:disabled { cursor: default; opacity: 1; }
.progress .num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--line); color: var(--ink); font-size: .85rem; flex: none;
}
.progress li[aria-current] button { border-bottom-color: var(--accent); color: var(--brand-deep); }
.progress li[aria-current] .num { background: var(--accent); color: var(--brand-deep); }
.progress li.done button { border-bottom-color: var(--brand); color: var(--brand); }
.progress li.done .num { background: var(--brand); color: #fff; }
legend:focus { outline: none; }

/* The results cascade (features/toolA/cascade.js). */
/* The panel wears the home page hero: cobalt, a soft glow and a faint gold
   grid (its #home, .hero-bg and .hero-grid). */
.cascade-card {
  border: 0; color: #fff;
  background:
    linear-gradient(rgba(201,168,76,.05) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(201,168,76,.05) 1px, transparent 1px) 0 0 / 56px 56px,
    radial-gradient(ellipse 60% 70% at 92% 45%, rgba(34,72,176,.65) 0%, transparent 65%),
    var(--brand);
}
.cascade-card figcaption { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; color: #fff; margin-bottom: 14px; }
.cascade-card .hint { color: rgba(255,255,255,.75); }
.cascade-card .pipe-wall { stroke: rgba(255,255,255,.22); }
.cascade-card .pipe-flow.muted { stroke: rgba(255,255,255,.6); }
.cascade-card .tile { box-shadow: 0 4px 14px rgba(5,12,40,.35); }
.cascade { position: relative; min-height: 118px; }
.pipes { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.pipe-wall { fill: none; stroke: var(--line); stroke-width: 12; stroke-linecap: round; }
.pipe-flow { fill: none; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 2 10; opacity: 0;
  animation: pipe-on .3s ease forwards, flow 1.2s linear infinite; }
@keyframes pipe-on { to { opacity: 1; } }
@keyframes flow { to { stroke-dashoffset: -24; } }
.pipe-flow.muted { stroke: #b8c2e0; }
.tile {
  position: absolute; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 2px solid var(--line);
  color: var(--ink); text-decoration: none; box-shadow: 0 2px 6px rgba(12,26,82,.08);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(12,26,82,.14); }
.liquid { position: absolute; left: 0; right: 0; bottom: 0; height: 0; opacity: .2; transition: height 1.1s cubic-bezier(.2,.7,.2,1); }
.tile > :not(.liquid) { position: relative; }
.tile-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tile-rank { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; background: var(--brand); }
.tile-name { font-weight: 700; font-size: 15px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-amt { font-size: 1.35rem; color: var(--brand-darker); line-height: 1.1; }
.tile-note { font-size: 12.5px; color: var(--ink-muted); }
.tile.full .tile-note { color: var(--done); font-weight: 700; }
.tile.done { border-color: var(--done); }
.tile.done .tile-rank { background: var(--done); }
.tile.advisory { border-style: dashed; border-color: var(--accent); background: #fffaf0; }
.tile.advisory .tile-rank { background: var(--accent); color: var(--brand-darker); }
.tile.advisory .tile-amt { color: var(--ink-muted); }
/* Stacked on a phone: name on top, amount and note side by side. */
.cascade.stacked .tile { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-content: center; column-gap: 12px; row-gap: 2px; padding: 8px 14px; }
.cascade.stacked .tile-top { grid-column: 1 / -1; }
.cascade.stacked .tile-amt { font-size: 1.2rem; }
.cascade.stacked .tile-note { align-self: center; text-align: right; }
@media (prefers-reduced-motion: reduce) { .liquid { transition: none; } .pipe-flow { animation: none; opacity: 1; } .tile { transition: none; } }
.c0 { background: #1a3a8f; } .c1 { background: #c9a84c; } .c2 { background: #2e7d4f; } .c3 { background: #5b7bd5; }
.c4 { background: #8a5a9e; } .c5 { background: #d9822b; } .c6 { background: #3a9aa8; } .c7 { background: #9aa4c4; }
/* The same eight colours for tile edges and pipes, so a tile, its pipe and
   its numbered card below read as one. */
.edge0 { border-color: #1a3a8f; } .edge1 { border-color: #c9a84c; } .edge2 { border-color: #2e7d4f; } .edge3 { border-color: #5b7bd5; }
.edge4 { border-color: #8a5a9e; } .edge5 { border-color: #d9822b; } .edge6 { border-color: #3a9aa8; } .edge7 { border-color: #9aa4c4; }
.s0 { stroke: #1a3a8f; } .s1 { stroke: #c9a84c; } .s2 { stroke: #2e7d4f; } .s3 { stroke: #5b7bd5; }
.s4 { stroke: #8a5a9e; } .s5 { stroke: #d9822b; } .s6 { stroke: #3a9aa8; } .s7 { stroke: #9aa4c4; }

/* "New" tag on My Next Dollar: pulses three times (under five seconds, per
   WCAG 2.2.2), then holds still; no motion at all for reduced-motion users. */
.new-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent); color: var(--brand-darker); font-size: 10px; font-weight: 700; line-height: 1.6;
  letter-spacing: .08em; text-transform: uppercase; vertical-align: 2px;
  animation: new-pulse 1.5s ease-in-out 3; }
@keyframes new-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(201,168,76,.75); }
  50% { transform: scale(1.12); box-shadow: 0 0 0 7px rgba(201,168,76,0); }
}
@media (prefers-reduced-motion: reduce) { .new-badge { animation: none; } }

/* Between 960px (menu hidden) and 1200px the full-size bar is too wide to
   fit on one line; the home page carries the same rule. */
.site-bar nav a, .brand span { white-space: nowrap; }
@media (max-width: 1200px) {
  .site-bar ul { gap: 1.25rem; }
  .brand span { font-size: 32px; }
  .brand img { width: 96px; height: 96px; }
}
@media (max-width: 1100px) {
  .site-bar ul { gap: 1rem; }
  .brand span { font-size: 28px; }
  .brand img { width: 80px; height: 80px; }
}
@media (max-width: 960px) {
  .site-bar nav { display: none; }
  .bar-inner { height: 90px; }
  .nav-toggle { display: flex; }
  .site-bar.menu-open nav { display: block; position: absolute; top: 100%; left: 0; right: 0;
    padding: 1.25rem 5% 1.5rem; background: var(--brand-darker); border-bottom: 1px solid rgba(201,168,76,0.3); }
  .site-bar.menu-open ul { flex-direction: column; align-items: flex-start; gap: 1.1rem; }
  .site-bar.menu-open nav a { font-size: 17px; }
}
@media (max-width: 600px) {
  .brand span { font-size: 22px; }
  .brand img { width: 56px; height: 56px; }
  .brand { gap: 10px; }
  .foot-row { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .progress button { flex-direction: column; align-items: flex-start; font-size: .8rem; padding: 8px 4px; }
  .step { grid-template-columns: 1fr; }
  .stat-arrow { display: none; }
  .stats { flex-wrap: nowrap; gap: 6px; }
  .stat { flex: 1 1 0; min-width: 0; padding: 8px 8px; }
  .stat strong { font-size: 1.15rem; }
  .stat span { font-size: 12px; line-height: 1.3; display: block; }
  .figures { text-align: left; }
  .actions > * { flex: 1 1 100%; justify-content: center; }
}
@media print {
  .site-bar nav, .actions, .foot-links, .brand img, .foot-brand img { display: none; }
  .site-bar, .site-foot { background: #fff; }
  .brand span, .foot-brand { color: var(--brand-deep); }
  body { background: #fff; }
}
/* Gold and pale grey need dark numbers to stay readable. */
.rank.c1, .tile-rank.c1, .rank.c7, .tile-rank.c7 { color: var(--brand-darker); }
/* On the cobalt panel, the cobalt flow colour would vanish: lighten it. */
.cascade-card .pipe-flow.s0 { stroke: #9db4ff; }
.cascade-card .pipe-flow { stroke-width: 5; }
