/* ==========================================================================
   rateshop.ca — design system
   Palette, type stack, radii and shadows ported verbatim from
   temp.rateshop.ca/css/site.css so the two properties stay visually identical.
   Indigo #080394 + gold #F9BB06 sampled from the Rateshop logotype.
   Gold carries CTAs. Indigo carries structure and links.
   Green means money saved. Red only ever means an error.
   ========================================================================== */

:root {
  --ink: #080733;
  --ink-2: #12114A;
  --ink-3: #232263;
  --brand: #080394;
  --brand-deep: #05024A;
  --brand-soft: #EEEEFF;
  --gold: #F9BB06;
  --gold-deep: #C99406;
  --gold-soft: #FFF6E0;
  --gold-text: #8E6800;
  --mint: #0E9E6E;
  --mint-soft: #E6F6F0;
  --amber: #F9BB06;
  --error: #E11B18;
  /* The logotype red is a signal colour, not a text colour — at 4.27:1 on
     error-soft it fails WCAG AA. This darkened variant reads 5.93:1 and is
     what any error *text* uses. Borders and icons keep --error. */
  --error-text: #B81411;
  --error-soft: #FDEEEF;
  --paper: #F4F5FA;
  --line: #E3E4EF;
  --muted: #5B5F7D;
  --white: #fff;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(8,7,51,.06), 0 2px 8px rgba(8,7,51,.05);
  --shadow: 0 4px 12px rgba(8,7,51,.07), 0 14px 38px rgba(8,7,51,.09);
  --shadow-lg: 0 10px 30px rgba(8,7,51,.12), 0 30px 70px rgba(8,7,51,.16);
  --ease: cubic-bezier(.22,.61,.36,1);
  --display: 'Bricolage Grotesque', 'Public Sans', system-ui, sans-serif;
  --body: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --wrap: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0; background: var(--white); color: var(--ink);
  font-family: var(--body); font-size: 16.5px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--display); line-height: 1.12; letter-spacing: -.025em; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 2.9vw, 2.35rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 2.2vw, 1.75rem); }
h3 { font-size: 1.2rem; letter-spacing: -.015em; }
p  { margin: 0 0 1rem; }
a  { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .small { font-size: .86rem; }
.muted { color: var(--muted); }
.mono  { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num   { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.money-saved { color: var(--mint); font-weight: 700; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.section { padding: clamp(3rem, 6vw, 5.5rem) 0; }
.section-paper { background: var(--paper); }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 62ch; }

.eyebrow {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .8rem; display: block;
}

/* -------------------------------------------------- header */
.site-head {
  position: sticky; top: 0; z-index: 60; background: rgba(255,255,255,.88);
  backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line);
  transition: box-shadow .25s;
}
.head-inner { display: flex; align-items: center; gap: 1.6rem; height: 74px; }
/* The logotype is artwork, not type. Height is fixed and width follows, so the
   lockup keeps its proportions at every breakpoint. */
.logo { display: inline-flex; align-items: center; flex: 0 0 auto; }
.logo img { display: block; height: 40px; width: auto; }
.logo:hover { text-decoration: none; }
@media (max-width: 480px) { .logo img { height: 32px; } }
.mainnav { display: flex; align-items: center; gap: .2rem; margin-left: auto; }
.mainnav a, .mainnav .navbtn {
  display: flex; align-items: center; gap: .3rem; padding: .55rem .8rem; border-radius: 9px;
  font-weight: 600; font-size: .93rem; background: none; border: 0; cursor: pointer;
  color: var(--ink); transition: background .16s, color .16s;
}
.mainnav a:hover, .mainnav .navbtn:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.mainnav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.head-cta { margin-left: .6rem; }
.navtoggle { display: none; }

@media (max-width: 900px) {
  .mainnav { position: fixed; inset: 74px 0 auto; flex-direction: column; align-items: stretch;
    background: #fff; border-bottom: 1px solid var(--line); padding: .8rem 1.25rem 1.25rem; gap: .2rem; display: none; }
  .mainnav.open { display: flex; }
  .navtoggle { display: inline-flex; margin-left: auto; background: none; border: 1.5px solid var(--line);
    border-radius: 9px; padding: .5rem .7rem; font-weight: 700; cursor: pointer; }
  .head-cta { margin-left: .6rem; padding: .7rem 1.1rem; font-size: .9rem; }
}

/* -------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--gold); --btn-fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  background: var(--btn-bg); color: var(--btn-fg);
  padding: .95rem 1.6rem; border: 0; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: .97rem; letter-spacing: -.01em; text-align: center;
  font-family: var(--body); text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s;
  box-shadow: 0 4px 14px rgba(201,148,6,.30);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(201,148,6,.38); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.btn-lg { padding: 1.15rem 2rem; font-size: 1.04rem; }
.btn-sm { padding: .6rem 1.1rem; font-size: .88rem; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn-brand { --btn-bg: var(--brand); --btn-fg: #fff; box-shadow: 0 4px 14px rgba(8,3,148,.28); }
.btn-brand:hover { box-shadow: 0 8px 26px rgba(8,3,148,.34); }
.btn-dark { --btn-bg: var(--ink); --btn-fg: #fff; box-shadow: 0 4px 14px rgba(8,7,51,.25); }
.btn-dark:hover { box-shadow: 0 8px 26px rgba(8,7,51,.3); }
.btn-block { width: 100%; }

/* -------------------------------------------------- cards + grid */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.card-flat:hover { transform: none; box-shadow: none; border-color: var(--line); }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,.95fr); gap: 2.4rem; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* -------------------------------------------------- pills / badges */
.pill {
  display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem;
  border-radius: 999px; font-size: .76rem; font-weight: 700; letter-spacing: .01em;
  background: var(--brand-soft); color: var(--brand);
}
.pill-gold { background: var(--gold-soft); color: var(--gold-text); }
.pill-mint { background: var(--mint-soft); color: #076C4B; }
.pill-line { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }

/* -------------------------------------------------- rate board */
.rateboard { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: #fff; }
.rateboard-head {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--paper);
}
.rateboard-head .stamp { margin-left: auto; font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.filters button {
  border: 0; background: #fff; box-shadow: inset 0 0 0 1px var(--line);
  padding: .42rem .85rem; border-radius: 999px; font-weight: 600; font-size: .84rem;
  font-family: var(--body); color: var(--ink); cursor: pointer; transition: .16s;
}
.filters button:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.filters button[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.rate-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.rate-table th {
  text-align: left; font-family: var(--mono); font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  padding: .8rem 1.25rem; border-bottom: 1px solid var(--line);
}
.rate-table td { padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rate-table tr:last-child td { border-bottom: 0; }
.rate-table tbody tr:hover { background: var(--paper); }
.rate-table .rate { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.06rem; letter-spacing: -.03em; }
.rate-table .lender { font-weight: 700; }
.rate-table .lender small { display: block; font-weight: 500; color: var(--muted); font-size: .78rem; }
.rate-table td.right, .rate-table th.right { text-align: right; }
.rateboard-foot { padding: .9rem 1.25rem; font-size: .8rem; color: var(--muted); background: var(--paper); border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  .rate-table thead { display: none; }
  .rate-table tr { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
  .rate-table td { border: 0; padding: 0; }
  .rate-table td[data-label]::before { content: attr(data-label) " "; font-size: .72rem; color: var(--muted); font-family: var(--mono); }
}

/* -------------------------------------------------- calculator shell */
.calc { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.85fr); gap: 1.6rem; align-items: start; }
@media (max-width: 900px) { .calc { grid-template-columns: 1fr; } }
.calc-inputs { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.6rem; }
.calc-out {
  background: var(--ink); color: #fff; border-radius: var(--radius-lg); padding: 1.6rem;
  position: sticky; top: 92px; box-shadow: var(--shadow);
}
.calc-out .eyebrow { color: #9A9CC4; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .35rem; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.field input, .field select {
  width: 100%; padding: .8rem .9rem; border-radius: 10px; border: 1.5px solid var(--line);
  font-family: var(--mono); font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--ink); background: #fff;
}
.field input:focus, .field select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.result-big { font-family: var(--mono); font-size: clamp(2rem,5vw,2.9rem); font-weight: 700; letter-spacing: -.04em; line-height: 1; margin: .3rem 0 .2rem; }
.result-rows { margin-top: 1.2rem; border-top: 1px solid rgba(255,255,255,.14); }
.result-rows div { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid rgba(255,255,255,.09); font-size: .92rem; }
.result-rows div:last-child { border-bottom: 0; }
.result-rows span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; }
.result-rows .is-total { color: var(--gold); }

/* LTV meter */
.ltv-meter { height: 8px; border-radius: 999px; background: rgba(255,255,255,.16); overflow: hidden; margin: .5rem 0 .3rem; }
.ltv-meter i { display: block; height: 100%; background: var(--gold); border-radius: 999px; transition: width .3s var(--ease); }
.ltv-meter.is-high i { background: var(--error); }

/* -------------------------------------------------- gates */
.gate {
  background: linear-gradient(180deg, var(--gold-soft), #fff);
  border: 1px solid var(--gold); border-radius: var(--radius-lg); padding: 1.6rem;
}
.gate h3 { margin-bottom: .35rem; }
.gate .btn { margin-top: .4rem; }
.gate-note { font-size: .78rem; color: var(--gold-text); margin-top: .7rem; }

/* -------------------------------------------------- tables (generic) */
.data-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.data-table th { text-align: left; font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.data-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.data-table td.right, .data-table th.right { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.data-table tr:last-child td { border-bottom: 0; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }

/* -------------------------------------------------- misc */
.breadcrumb { font-size: .82rem; color: var(--muted); padding: 1rem 0 0; }
.breadcrumb a { color: var(--muted); }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: 1.1rem 0; }
.faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq p { margin: .8rem 0 0; color: var(--muted); }
.linklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: .1rem 1rem; }
.linklist a { padding: .35rem 0; display: block; font-size: .93rem; }
.callout { border-left: 3px solid var(--brand); background: var(--brand-soft); padding: 1rem 1.2rem; border-radius: 0 var(--radius) var(--radius) 0; }
.callout-gold { border-left-color: var(--gold-deep); background: var(--gold-soft); }
.stat { text-align: center; }
.stat b { display: block; font-family: var(--mono); font-size: 1.9rem; letter-spacing: -.04em; }
.stat span { font-size: .82rem; color: var(--muted); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; position: fixed; background: #fff; padding: .7rem 1rem; border-radius: 8px; z-index: 99; box-shadow: var(--shadow); }

/* -------------------------------------------------- footer */
.site-foot { background: var(--ink); color: #9A9CC4; padding: clamp(3rem,5vw,4.5rem) 0 2rem; font-size: .9rem; }
.foot-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 2.4rem; padding-bottom: 2.4rem; border-bottom: 1px solid rgba(255,255,255,.1); }
@media (max-width: 800px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.site-foot h4 { color: #fff; font-size: .74rem; font-family: var(--mono); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 1rem; }
.site-foot a { display: block; padding: .3rem 0; transition: color .16s; color: #9A9CC4; }
.site-foot a:hover { color: #fff; text-decoration: none; }
.site-foot .logo { margin-bottom: .2rem; }
.site-foot .logo img { height: 40px; }
.foot-legal { padding-top: 1.6rem; font-size: .78rem; line-height: 1.7; color: #7A7CA6; }

/* Google Preferred Sources. Sits between the link columns and the province
   list, where it reads as a subscribe affordance rather than an advert. */
.preferred-source {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: 1.4rem 0; border-bottom: 1px solid rgba(255,255,255,.1);
}
.preferred-source p { margin: 0; font-size: .88rem; color: #9A9CC4; max-width: 34ch; }
.preferred-source [google-add-preferred-source-btn] { margin-left: auto; min-height: 44px; }
.preferred-source img { display: block; height: 44px; width: auto; max-width: 100%; }
@media (max-width: 700px) {
  .preferred-source [google-add-preferred-source-btn] { margin-left: 0; }
}
.foot-provinces { padding: 1.4rem 0; border-bottom: 1px solid rgba(255,255,255,.1); font-size: .8rem; }
.foot-provinces a { display: inline-block; padding: .2rem .55rem .2rem 0; }

/* -------------------------------------------------- lender directory */
.lender-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1px; background: var(--line);
}
.lender-card {
  background: #fff; padding: 1.15rem 1.25rem; display: block; color: var(--ink);
  transition: background .16s;
}
.lender-card:hover { background: var(--brand-soft); text-decoration: none; }
.lender-card h3 { font-size: 1rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
.lender-card .pill { margin: 0 .3rem .45rem 0; font-size: .68rem; padding: .18rem .5rem; }
.lender-card p { margin: .3rem 0 0; }
.lender-card[hidden] { display: none; }

/* ------------------------------------------------------------------ ratings */
/* A star is a grey track with a gold overlay clipped to a percentage width, so
   3.4 and 3.6 look different. The zero state is the track alone — no gold at
   all — because a lender with no reviews must not read as a low score either. */
.stars { display: inline-flex; gap: .12em; vertical-align: -.12em; }
.star {
  position: relative; width: 1em; height: 1em; display: block;
  background: var(--line);
  -webkit-mask: var(--star-mask) center / contain no-repeat;
          mask: var(--star-mask) center / contain no-repeat;
}
.star i { position: absolute; inset: 0; display: block; background: var(--gold); width: 0; }
:root { --star-mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.6l3.1 6.9 7.4.8-5.5 5 1.5 7.3L12 17.9 5.5 21.6 7 14.3l-5.5-5 7.4-.8z'/%3E%3C/svg%3E"); }
.stars-sm { font-size: .82rem; }
.stars-empty .star { background: var(--line); }

.rating-line { display: flex; align-items: center; gap: .5rem; margin: .5rem 0 0; flex-wrap: wrap; }
.rating-line strong { font-family: var(--mono); font-size: .95rem; }
.rating-line em { font-style: italic; }
.rating-big { font-size: 1.35rem; margin: 1rem 0 1.4rem; }
.rating-big strong { font-size: 1.1rem; }
a.rating-jump { display: inline-block; text-decoration: none; color: inherit; }
a.rating-jump:hover .rating-line em,
a.rating-jump:hover .rating-line strong { text-decoration: underline; }

.review-statement {
  font-size: 1.02rem; line-height: 1.6; color: var(--ink);
  border-left: 3px solid var(--gold); padding-left: 1rem; margin: 1rem 0 1.4rem;
  max-width: 62ch;
}

.crits { display: grid; gap: 1.1rem; margin: 1.4rem 0 2rem; }
@media (min-width: 700px) { .crits { grid-template-columns: 1fr 1fr; gap: 1.1rem 2rem; } }
.crit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.crit-label { font-weight: 600; font-size: .95rem; }
.crit-score { font-family: var(--mono); font-size: .9rem; }
.crit-meter { height: 6px; border-radius: 3px; background: var(--line); margin: .4rem 0 .35rem; overflow: hidden; }
.crit-meter i { display: block; height: 100%; background: var(--gold); }
.crit-meter.is-empty i { background: transparent; }
.crit-prompt { margin: 0; }

.gate-review .field-stars { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .3rem .8rem; }
.gate-review .field-stars label { grid-area: 1 / 1; margin: 0; }
.gate-review .field-stars output { grid-area: 1 / 2; font-family: var(--mono); font-size: .85rem; color: var(--muted); }
.gate-review .field-stars input[type=range] { grid-area: 2 / 1 / 3 / 3; width: 100%; accent-color: var(--gold); }
