/* =====================================================================
   Tesla Maple Referral — comparison / review aesthetic
   Slab-serif headings + neutral sans body. Cool slate + maple-red accent.
   Bespoke class prefix: .rt-*  (no generic/forbidden names used)
   Light + dark mode. Mobile-first.
   ===================================================================== */

:root {
  /* --- type --- */
  --rt-serif: "Rockwell", "Roboto Slab", "Museo Slab", Georgia, "Times New Roman", serif;
  --rt-sans: system-ui, "Segoe UI", Roboto, Arial, sans-serif;

  /* --- cool slate palette --- */
  --rt-paper: #f6f8fa;
  --rt-surface: #ffffff;
  --rt-surface-2: #eef2f6;
  --rt-line: #d3dbe3;
  --rt-line-strong: #b6c2cd;
  --rt-ink: #1b2733;
  --rt-ink-soft: #45535f;
  --rt-ink-faint: #6b7885;

  /* --- Canadian red-maple accent --- */
  --rt-maple: #c8102e;
  --rt-maple-deep: #9c0c24;
  --rt-maple-tint: #fbe9ec;

  /* --- semantic --- */
  --rt-yes: #1a7f4b;
  --rt-yes-tint: #e4f3ea;
  --rt-no: #b02a37;
  --rt-no-tint: #fbe9eb;
  --rt-warn: #8a5a00;
  --rt-warn-tint: #fbf1dc;

  --rt-radius: 12px;
  --rt-radius-sm: 8px;
  --rt-shadow: 0 1px 2px rgba(27, 39, 51, .06), 0 8px 24px rgba(27, 39, 51, .08);
  --rt-focus: #1b6ec2;
  --rt-maxw: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --rt-paper: #0f151b;
    --rt-surface: #161f28;
    --rt-surface-2: #1d2833;
    --rt-line: #2a3742;
    --rt-line-strong: #3a4a57;
    --rt-ink: #e8edf1;
    --rt-ink-soft: #b7c2cc;
    --rt-ink-faint: #8b98a4;
    --rt-maple: #ff5a72;
    --rt-maple-deep: #ff8494;
    --rt-maple-tint: #2a161b;
    --rt-yes: #4cc98a;
    --rt-yes-tint: #16271f;
    --rt-no: #ff7b86;
    --rt-no-tint: #2a171a;
    --rt-warn: #e0b25a;
    --rt-warn-tint: #2a2413;
    --rt-shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
    --rt-focus: #6fb0ea;
  }
}
/* Explicit theme override wins in both directions (viewer toggle) */
:root[data-theme="light"] {
  --rt-paper:#f6f8fa; --rt-surface:#fff; --rt-surface-2:#eef2f6; --rt-line:#d3dbe3;
  --rt-line-strong:#b6c2cd; --rt-ink:#1b2733; --rt-ink-soft:#45535f; --rt-ink-faint:#6b7885;
  --rt-maple:#c8102e; --rt-maple-deep:#9c0c24; --rt-maple-tint:#fbe9ec;
  --rt-yes:#1a7f4b; --rt-yes-tint:#e4f3ea; --rt-no:#b02a37; --rt-no-tint:#fbe9eb;
  --rt-warn:#8a5a00; --rt-warn-tint:#fbf1dc; --rt-shadow:0 1px 2px rgba(27,39,51,.06),0 8px 24px rgba(27,39,51,.08);
}
:root[data-theme="dark"] {
  --rt-paper:#0f151b; --rt-surface:#161f28; --rt-surface-2:#1d2833; --rt-line:#2a3742;
  --rt-line-strong:#3a4a57; --rt-ink:#e8edf1; --rt-ink-soft:#b7c2cc; --rt-ink-faint:#8b98a4;
  --rt-maple:#ff5a72; --rt-maple-deep:#ff8494; --rt-maple-tint:#2a161b;
  --rt-yes:#4cc98a; --rt-yes-tint:#16271f; --rt-no:#ff7b86; --rt-no-tint:#2a171a;
  --rt-warn:#e0b25a; --rt-warn-tint:#2a2413; --rt-shadow:0 1px 2px rgba(0,0,0,.4),0 10px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--rt-paper);
  color: var(--rt-ink);
  font-family: var(--rt-sans);
  font-size: 17px;
  line-height: 1.62;
  overflow-x: hidden;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

h1, h2, h3, h4 { font-family: var(--rt-serif); line-height: 1.18; color: var(--rt-ink); font-weight: 700; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -.01em; margin: .2em 0 .35em; }
h2 { font-size: clamp(1.45rem, 3.4vw, 2.1rem); margin: 2.2rem 0 .7rem; }
h3 { font-size: clamp(1.15rem, 2.4vw, 1.4rem); margin: 1.6rem 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--rt-maple-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--rt-maple); }
:focus-visible { outline: 3px solid var(--rt-focus); outline-offset: 2px; border-radius: 4px; }
img, svg { max-width: 100%; height: auto; }
strong { font-weight: 700; }
small { color: var(--rt-ink-faint); }

.rt-container { width: 100%; max-width: var(--rt-maxw); margin-inline: auto; padding-inline: 1.1rem; }
.rt-skip {
  position: absolute; left: -999px; top: 0; background: var(--rt-ink); color: #fff;
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 8px 0;
}
.rt-skip:focus { left: 0; }

/* --- masthead --- */
.rt-masthead {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--rt-surface) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rt-line);
}
.rt-masthead__row { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.rt-logo { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--rt-serif); font-weight: 700; font-size: 1.2rem; color: var(--rt-ink); text-decoration: none; }
.rt-logo__mark { width: 26px; height: 26px; flex: 0 0 auto; }
.rt-nav { margin-left: auto; display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.rt-nav a { color: var(--rt-ink-soft); text-decoration: none; font-size: .93rem; padding: .4rem .55rem; border-radius: 6px; }
.rt-nav a:hover, .rt-nav a[aria-current="page"] { background: var(--rt-surface-2); color: var(--rt-ink); }
.rt-langswitch { display: inline-flex; border: 1px solid var(--rt-line-strong); border-radius: 999px; overflow: hidden; margin-left: .3rem; }
.rt-langswitch a { padding: .3rem .6rem; font-size: .82rem; text-decoration: none; color: var(--rt-ink-soft); }
.rt-langswitch a[aria-current="true"] { background: var(--rt-maple); color: #fff; }
.rt-themebtn { margin-left:.2rem; background:var(--rt-surface-2); border:1px solid var(--rt-line); color:var(--rt-ink-soft); width:36px; height:32px; border-radius:8px; cursor:pointer; font-size:1rem; line-height:1; }
.rt-themebtn:hover { color: var(--rt-ink); }

/* --- lede band (review-site style) --- */
.rt-lede { background: linear-gradient(180deg, var(--rt-surface-2), var(--rt-paper)); border-bottom: 1px solid var(--rt-line); }
.rt-lede__grid { display: grid; gap: 1.6rem; padding: 2rem 0 2.4rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .rt-lede__grid { grid-template-columns: 1.15fr .85fr; align-items: start; } }
.rt-lede__intro { padding: 2rem 0 1.4rem; }
.rt-eyebrow { display: inline-flex; align-items: center; gap: .45rem; font-family: var(--rt-sans); font-weight: 600; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: var(--rt-maple-deep); background: var(--rt-maple-tint); padding: .3rem .65rem; border-radius: 999px; }
.rt-lede p.rt-standfirst { font-size: 1.12rem; color: var(--rt-ink-soft); max-width: 42ch; }
.rt-lede p.rt-standfirst--wide { max-width: 58ch; }

/* --- province picker (the choose-your-province hub mechanic) --- */
.rt-pickerlabel { font-family: var(--rt-serif); font-weight: 700; font-size: 1.05rem; color: var(--rt-ink); margin: 1.4rem 0 .7rem; display: flex; align-items: center; gap: .5rem; }
.rt-pickerlabel::before { content: ""; width: 1.4rem; height: 3px; background: var(--rt-maple); border-radius: 2px; }
.rt-picker { display: grid; gap: .9rem; grid-template-columns: 1fr; padding-bottom: .6rem; }
@media (min-width: 560px) { .rt-picker { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .rt-picker { grid-template-columns: repeat(4, 1fr); } }
.rt-pickcell {
  position: relative; display: flex; flex-direction: column; gap: .3rem;
  text-decoration: none; color: inherit; background: var(--rt-surface);
  border: 1px solid var(--rt-line-strong); border-radius: var(--rt-radius);
  padding: 1.1rem 1.1rem 1.15rem; box-shadow: var(--rt-shadow);
  transition: border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.rt-pickcell:hover, .rt-pickcell:focus-visible { border-color: var(--rt-maple); transform: translateY(-3px); }
.rt-pickcell__tag { align-self: flex-start; font-family: var(--rt-serif); font-weight: 700; font-size: .74rem; letter-spacing: .06em; color: #fff; background: var(--rt-maple); border-radius: 6px; padding: .15rem .5rem; }
.rt-pickcell__name { font-family: var(--rt-serif); font-weight: 700; font-size: 1.2rem; color: var(--rt-ink); margin-top: .2rem; }
.rt-pickcell__rule { font-size: .88rem; color: var(--rt-ink-soft); flex: 1 1 auto; }
.rt-pickcell__go { font-size: .85rem; font-weight: 700; color: var(--rt-maple-deep); margin-top: .35rem; }
.rt-pickcell:hover .rt-pickcell__go { color: var(--rt-maple); }

/* --- verdict / result box (the code unit) --- */
.rt-verdict {
  background: var(--rt-surface);
  border: 1px solid var(--rt-line-strong);
  border-radius: var(--rt-radius);
  box-shadow: var(--rt-shadow);
  overflow: hidden;
}
.rt-verdict__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 1rem; background: var(--rt-ink); color: #fff; }
.rt-verdict__head h2, .rt-verdict__head h3 { color: #fff; margin: 0; font-size: 1rem; letter-spacing: .01em; }
.rt-scorebadge { font-family: var(--rt-serif); font-weight: 700; font-size: 1rem; background: var(--rt-maple); color: #fff; border-radius: 8px; padding: .15rem .6rem; }
.rt-verdict__body { padding: 1.1rem 1rem 1.2rem; }
.rt-verdict__label { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--rt-ink-faint); margin: 0 0 .35rem; }
/* code display row — fixed min-height to prevent CLS on rotation */
.rt-codeline { display: flex; align-items: stretch; gap: .5rem; flex-wrap: wrap; }
.rt-codeslot {
  flex: 1 1 12rem; min-height: 56px; display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: clamp(1.3rem, 4vw, 1.75rem); font-weight: 700; letter-spacing: .04em;
  color: var(--rt-ink); background: var(--rt-surface-2);
  border: 2px dashed var(--rt-line-strong); border-radius: var(--rt-radius-sm); padding: .4rem .8rem;
  user-select: all; word-break: break-all;
}
.rt-copybtn {
  flex: 0 0 auto; min-height: 56px; display: inline-flex; align-items: center; gap: .45rem;
  background: var(--rt-maple); color: #fff; border: none; border-radius: var(--rt-radius-sm);
  font-family: var(--rt-sans); font-weight: 700; font-size: 1rem; padding: .4rem 1.1rem; cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.rt-copybtn:hover { background: var(--rt-maple-deep); }
.rt-copybtn:active { transform: translateY(1px); }
.rt-copybtn[data-copied="1"] { background: var(--rt-yes); }
.rt-verdict__actions { margin-top: .9rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.rt-openbtn {
  display: inline-flex; align-items: center; gap: .5rem; text-decoration: none;
  background: #22303c; color: #fff; font-weight: 700; padding: .7rem 1.1rem;
  border: 1px solid #3a4a57; border-radius: var(--rt-radius-sm); font-size: .98rem;
}
.rt-openbtn:hover { background: #2f4150; color: #fff; }
.rt-verdict__foot { margin-top: .9rem; font-size: .82rem; color: var(--rt-ink-faint); display: flex; align-items: center; gap: .4rem; }
.rt-verified { display: inline-flex; align-items: center; gap: .35rem; color: var(--rt-yes); font-weight: 600; }

/* --- generic content band --- */
.rt-band { padding: 1.6rem 0; }
.rt-prose { max-width: 44rem; }
.rt-prose.rt-prose--wide { max-width: 62rem; }

/* --- at-a-glance summary panels --- */
.rt-glance { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 1.2rem 0; }
@media (min-width: 680px) { .rt-glance { grid-template-columns: repeat(3, 1fr); } }
.rt-panel {
  background: var(--rt-surface); border: 1px solid var(--rt-line); border-radius: var(--rt-radius);
  padding: 1.1rem; box-shadow: var(--rt-shadow);
}
.rt-panel h3 { margin-top: 0; }
.rt-stat { font-family: var(--rt-serif); font-size: 1.7rem; font-weight: 700; color: var(--rt-maple-deep); display: block; }
.rt-stat__unit { font-size: .9rem; color: var(--rt-ink-faint); font-family: var(--rt-sans); }

/* --- comparison matrix (the star of a review site) --- */
.rt-matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--rt-line); border-radius: var(--rt-radius); box-shadow: var(--rt-shadow); }
.rt-matrix { width: 100%; border-collapse: collapse; min-width: 40rem; background: var(--rt-surface); font-size: .95rem; }
.rt-matrix caption { text-align: left; padding: .8rem 1rem; font-size: .85rem; color: var(--rt-ink-faint); background: var(--rt-surface-2); border-bottom: 1px solid var(--rt-line); }
.rt-matrix th, .rt-matrix td { padding: .72rem .9rem; text-align: left; border-bottom: 1px solid var(--rt-line); vertical-align: top; }
.rt-matrix thead th { background: var(--rt-ink); color: #fff; font-family: var(--rt-serif); font-weight: 700; position: sticky; top: 0; }
.rt-matrix tbody th { font-weight: 700; color: var(--rt-ink); background: var(--rt-surface-2); }
.rt-matrix tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--rt-surface-2) 45%, transparent); }
.rt-matrix tbody tr:hover td { background: var(--rt-maple-tint); }

/* check / cross indicators */
.rt-yes-i, .rt-no-i, .rt-warn-i { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; }
.rt-yes-i { color: var(--rt-yes); }
.rt-no-i { color: var(--rt-no); }
.rt-warn-i { color: var(--rt-warn); }
.rt-mark { width: 1.05em; height: 1.05em; flex: 0 0 auto; }

/* --- takeaway / callout boxes --- */
.rt-takeaway {
  display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: start;
  border-left: 5px solid var(--rt-maple); background: var(--rt-maple-tint);
  padding: 1rem 1.1rem; border-radius: 0 var(--rt-radius-sm) var(--rt-radius-sm) 0; margin: 1.3rem 0;
}
.rt-takeaway--yes { border-left-color: var(--rt-yes); background: var(--rt-yes-tint); }
.rt-takeaway--no { border-left-color: var(--rt-no); background: var(--rt-no-tint); }
.rt-takeaway--warn { border-left-color: var(--rt-warn); background: var(--rt-warn-tint); }
.rt-takeaway h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.rt-takeaway p { margin: 0; }
.rt-takeaway__ico { width: 26px; height: 26px; margin-top: .15rem; }

/* --- tags --- */
.rt-tagrow { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.rt-tag { font-size: .78rem; font-weight: 600; color: var(--rt-ink-soft); background: var(--rt-surface-2); border: 1px solid var(--rt-line); border-radius: 999px; padding: .22rem .6rem; }

/* --- how-to steps --- */
.rt-steps { list-style: none; counter-reset: step; padding: 0; margin: 1.2rem 0; display: grid; gap: 1rem; }
.rt-steps > li { counter-increment: step; position: relative; padding: 1rem 1rem 1rem 3.4rem; background: var(--rt-surface); border: 1px solid var(--rt-line); border-radius: var(--rt-radius); box-shadow: var(--rt-shadow); }
.rt-steps > li::before { content: counter(step); position: absolute; left: 1rem; top: 1rem; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; background: var(--rt-maple); color: #fff; font-family: var(--rt-serif); font-weight: 700; border-radius: 50%; }
.rt-steps h3 { margin: 0 0 .25rem; }

/* --- province mini grid --- */
.rt-provgrid { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 1.2rem 0; }
@media (min-width: 680px) { .rt-provgrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .rt-provgrid { grid-template-columns: repeat(4, 1fr); } }
.rt-provcell { display: block; text-decoration: none; color: inherit; background: var(--rt-surface); border: 1px solid var(--rt-line); border-radius: var(--rt-radius); padding: 1rem; box-shadow: var(--rt-shadow); transition: border-color .15s ease, transform .1s ease; }
.rt-provcell:hover { border-color: var(--rt-maple); transform: translateY(-2px); }
.rt-provcell h3 { margin: .2rem 0 .3rem; font-size: 1.1rem; }
.rt-provcell p { margin: 0; font-size: .9rem; color: var(--rt-ink-soft); }

/* --- breadcrumb --- */
.rt-crumbs { font-size: .85rem; color: var(--rt-ink-faint); padding: .8rem 0 0; }
.rt-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; }
.rt-crumbs li::after { content: "›"; margin-left: .35rem; color: var(--rt-line-strong); }
.rt-crumbs li:last-child::after { content: ""; }
.rt-crumbs a { color: var(--rt-ink-soft); text-decoration: none; }
.rt-crumbs a:hover { color: var(--rt-maple); }

/* --- FAQ --- */
.rt-faq { display: grid; gap: .6rem; margin: 1.2rem 0; }
.rt-faq details { background: var(--rt-surface); border: 1px solid var(--rt-line); border-radius: var(--rt-radius-sm); padding: .3rem .2rem; }
.rt-faq summary { cursor: pointer; font-weight: 700; font-family: var(--rt-serif); padding: .7rem .9rem; list-style: none; }
.rt-faq summary::-webkit-details-marker { display: none; }
.rt-faq summary::after { content: "+"; float: right; color: var(--rt-maple); font-weight: 700; }
.rt-faq details[open] summary::after { content: "–"; }
.rt-faq details > div { padding: 0 .9rem .8rem; color: var(--rt-ink-soft); }

/* --- blog cards --- */
.rt-postlist { display: grid; gap: 1.2rem; grid-template-columns: 1fr; margin: 1.4rem 0; }
@media (min-width: 720px) { .rt-postlist { grid-template-columns: repeat(2, 1fr); } }
.rt-postcard { display: flex; flex-direction: column; background: var(--rt-surface); border: 1px solid var(--rt-line); border-radius: var(--rt-radius); overflow: hidden; box-shadow: var(--rt-shadow); }
.rt-postcard__media { aspect-ratio: 16 / 9; background: var(--rt-surface-2); border-bottom: 1px solid var(--rt-line); }
.rt-postcard__media svg { width: 100%; height: 100%; display: block; }
.rt-postcard__body { padding: 1rem; }
.rt-postcard h3 { margin: .1rem 0 .4rem; font-size: 1.15rem; }
.rt-postcard h3 a { text-decoration: none; color: var(--rt-ink); }
.rt-postcard h3 a:hover { color: var(--rt-maple); }
.rt-postcard time { font-size: .8rem; color: var(--rt-ink-faint); }

/* --- disclosure / note --- */
.rt-note { font-size: .88rem; color: var(--rt-ink-soft); background: var(--rt-surface-2); border: 1px dashed var(--rt-line-strong); border-radius: var(--rt-radius-sm); padding: .9rem 1rem; margin: 1.2rem 0; }

/* --- news/blog post photo (self-hosted, explicit dimensions -> zero CLS) --- */
.rt-fig { margin: 1.4rem 0; }
.rt-fig img { display: block; width: 100%; height: auto; border-radius: var(--rt-radius); border: 1px solid var(--rt-line); }
.rt-fig figcaption { font-size: .78rem; color: var(--rt-ink-faint); margin-top: .5rem; }
.rt-fig figcaption a { color: inherit; }
.rt-eyebrow--news { background: var(--rt-maple-tint); color: var(--rt-maple-deep); }

/* --- source list --- */
.rt-sources { font-size: .88rem; }
.rt-sources li { margin-bottom: .35rem; }

/* --- footer --- */
.rt-foot { background: var(--rt-ink); color: #cdd6de; margin-top: 3rem; padding: 2rem 0 2.4rem; }
.rt-foot a { color: #eef2f6; }
.rt-foot__cols { display: grid; gap: 1.4rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .rt-foot__cols { grid-template-columns: 1.4fr 1fr 1fr; } }
.rt-foot h4 { color: #fff; font-size: 1rem; margin: 0 0 .5rem; }
.rt-foot ul { list-style: none; margin: 0; padding: 0; }
.rt-foot li { margin-bottom: .3rem; font-size: .92rem; }
.rt-foot__legal { border-top: 1px solid #2c3a46; margin-top: 1.6rem; padding-top: 1.2rem; font-size: .82rem; color: #9fadb8; }
.rt-byline { font-size: .9rem; color: var(--rt-ink-faint); margin: 1rem 0; }
.rt-byline strong { color: var(--rt-ink); }

/* --- sticky mini CTA (mobile) --- */
.rt-stickycta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: none; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .55rem .9rem; background: var(--rt-surface); border-top: 1px solid var(--rt-line-strong);
  box-shadow: 0 -6px 18px rgba(27,39,51,.12);
}
.rt-stickycta .rt-copybtn, .rt-stickycta .rt-codeslot { min-height: 44px; }
.rt-stickycta .rt-codeslot { font-size: 1.1rem; flex: 1 1 6rem; }
@media (max-width: 680px) { .rt-stickycta { display: flex; } body { padding-bottom: 68px; } }

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