/* ===========================================================
   PRODUCTS
   -----------------------------------------------------------
   Reuses .service-layout, .service-aside and
   .service-capabilities from services.css so the two pages
   share one section pattern.

   Load order: style.css → page-system.css → services.css →
   this file.
   =========================================================== */


/* ===========================================================
   COMPARISON
   The terms a prospect is deciding between, above the prose.
   =========================================================== */

.product-compare {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--page-line);
}

.product-compare-col {
  display: flex;
  flex-direction: column;
  padding: 30px 32px 30px 0;
  margin-right: 32px;
  border-right: 1px solid var(--page-line);
}

.product-compare-col:last-child {
  padding-right: 0;
  margin-right: 0;
  border-right: 0;
}

.product-compare-num {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--page-orange);
}

.product-compare-name {
  margin: 0 0 22px;
  color: var(--page-navy);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* The short code sits under the name, in mono. */
.product-compare-name span {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--page-muted);
}

.product-compare-specs {
  margin: 0;
}

.product-compare-specs > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--page-line);
}

/*
 * No trailing rule: the column ends on content, not a line
 * hanging in space.
 */
.product-compare-specs > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.product-compare-specs dt {
  flex-shrink: 0;
  color: var(--page-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-compare-specs dd {
  margin: 0;
  text-align: right;
  color: var(--page-navy);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Nothing to push down now, so trim the column's own padding. */
.product-compare-col {
  padding-bottom: 0;
}


/* ===========================================================
   RISK BADGE
   Colour alone must not carry the meaning, so the word is
   always present.
   =========================================================== */

.product-risk {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.product-risk-low {
  background: rgba(30, 126, 52, 0.1);
  color: #1e7e34;
}

.product-risk-mod {
  background: rgba(246, 134, 52, 0.14);
  color: #a8500f;
}

.page-band-ink .product-risk-low {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.page-band-ink .product-risk-mod {
  background: rgba(246, 134, 52, 0.24);
  color: #ffc08e;
}


/* ===========================================================
   TERMS BLOCK
   Sits in the sticky aside of each product section.
   =========================================================== */

.product-terms {
  margin: 28px 0 0;
  border-top: 1px solid var(--page-line);
}

.page-band-ink .product-terms {
  border-top-color: rgba(255, 255, 255, 0.15);
}

.product-terms > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--page-line);
}

.page-band-ink .product-terms > div {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.product-terms dt {
  color: var(--page-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-band-ink .product-terms dt {
  color: rgba(255, 255, 255, 0.55);
}

.product-terms dd {
  margin: 0;
  text-align: right;
  color: var(--page-navy);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.page-band-ink .product-terms dd {
  color: #ffffff;
}

.product-section .service-aside .page-button {
  margin-top: 28px;
}


/* ===========================================================
   DISCLAIMER
   =========================================================== */

.product-disclaimer {
  max-width: 80ch;
  margin: 28px 0 0;
  color: var(--page-muted);
  font-size: 0.82rem;
  line-height: 1.7;
}


/* ===========================================================
   RATE GUIDE TABLE
   -----------------------------------------------------------
   REPLACE the existing "RATE GUIDE" block in
   public/css/pages/products.css with everything below.

   The old .rate-guide-visual and .rate-guide-scroll rules
   styled an uploaded image and are no longer used.
   =========================================================== */

.rate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}

.rate-tables {
  display: grid;
  gap: 32px;
  min-width: 0;
}


/* ---------- Table block ---------- */

.rate-table-block {
  margin: 0;
  min-width: 0;
}

.rate-table-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--page-navy);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.rate-table-caption span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--page-muted);
}

/* ---------- Tabs ---------- */

.rate-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  margin-bottom: 4px;
  background: #ffffff;
  border: 1px solid var(--page-line);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}

.rate-tab {
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--page-muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 200ms var(--page-ease),
    color 200ms var(--page-ease);
}

.rate-tab:hover { color: var(--page-navy); }

.rate-tab.active {
  background: var(--page-navy);
  color: #ffffff;
}

.rate-tab:focus-visible {
  outline: 3px solid var(--color-accent-action);
  outline-offset: 2px;
}

/*
 * Panels only hide once JS confirms the tabs work. Without
 * this gate a script failure would leave two of three rate
 * tables permanently invisible.
 */
.rate-tabs-ready .rate-table-block[hidden] {
  display: none;
}

@media (max-width: 767px) {
  .rate-tablist {
    border-radius: var(--page-radius);
    width: 100%;
  }

  .rate-tab {
    flex: 1 1 auto;
    padding: 9px 12px;
    font-size: 0.8rem;
  }
}

/*
 * Horizontal scroll is focusable so a keyboard user can reach
 * the columns that overflow on a narrow viewport.
 */
.rate-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  border: 1px solid var(--page-line);
  border-radius: var(--page-radius);
}

.rate-scroll:focus-visible {
  outline: 3px solid var(--color-accent-action);
  outline-offset: -3px;
}


/* ---------- Table ---------- */

.rate-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.rate-table thead th {
  padding: 13px 14px;
  background: var(--page-navy);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}

.rate-table thead th.rate-amount-head {
  text-align: left;
}

.rate-table tbody th {
  padding: 13px 14px;
  color: var(--page-navy);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--page-line);
}

.rate-table tbody td {
  padding: 13px 14px;
  color: var(--page-ink);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  border-bottom: 1px solid var(--page-line);
}

.rate-table tbody tr:last-child th,
.rate-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Zebra striping earns its place on a dense numeric grid. */
.rate-table tbody tr:nth-child(odd) th,
.rate-table tbody tr:nth-child(odd) td {
  background: var(--page-surface);
}

.rate-none {
  color: var(--page-muted);
}


/* ---------- Notes ---------- */

.rate-notes {
  padding: 28px;
  background: #ffffff;
  border: 1px solid var(--page-line);
  border-radius: var(--page-radius);
}

.rate-notes-title {
  margin: 0 0 16px;
  color: var(--page-navy);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.rate-notes-list {
  margin: 0 0 22px;
  padding-left: 18px;
}

.rate-notes-list li {
  margin-bottom: 12px;
  color: var(--page-muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.rate-notes-list li:last-child {
  margin-bottom: 0;
}


/* ---------- Empty state ---------- */

.rate-empty {
  margin: 0;
  padding: 26px;
  background: #ffffff;
  border: 1px solid var(--page-line);
  border-radius: var(--page-radius);
  color: var(--page-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}


/* ---------- Screen-reader only ---------- */

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


/* ---------- Responsive ---------- */

@media (max-width: 1023px) {
  .rate-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .rate-notes {
    padding: 22px;
  }

  .rate-table thead th,
  .rate-table tbody th,
  .rate-table tbody td {
    padding: 11px 12px;
  }
}


/* ===========================================================
   CLOSING CTA
   =========================================================== */

.product-cta {
  padding-bottom: calc(var(--page-section-space) + 48px);
}

.product-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}


/* ===========================================================
   RESPONSIVE
   =========================================================== */

@media (max-width: 1023px) {
  /*
   * Stacking turns a comparison into three separate lists, so
   * the columns stay side by side and scroll horizontally
   * instead. Swiping across three products is what makes this
   * section worth having.
   */
  .product-compare {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;

    /*
     * Negative margin lets the row bleed to the viewport edge
     * so the third column is visibly cut off, which signals
     * there is more to scroll.
     */
    margin-inline: calc(var(--page-shell-gutter, 16px) * -1);
    padding-inline: var(--page-shell-gutter, 16px);
  }

  .product-compare::-webkit-scrollbar {
    display: none;
  }

  .product-compare-col {
    flex: 0 0 auto;
    width: 62vw;
    max-width: 260px;
    scroll-snap-align: start;
    padding: 24px 20px 24px 0;
    margin-right: 20px;
    border-right: 1px solid var(--page-line);
    border-bottom: 0;
  }

  .product-compare-col:last-child {
    margin-right: 0;
    padding-right: 0;
    border-right: 0;
  }
}

@media (max-width: 767px) {
  /*
   * Label above value doubles the row height. In a narrow
   * column the values are short enough to stay inline.
   */
  .product-compare-specs > div {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 9px 0;
  }

  .product-compare-specs dd {
    text-align: left;
    font-size: 0.9rem;
  }

  .product-cta-actions .page-button {
    width: 100%;
  }
}

/* ===========================================================
   RATE CALCULATOR
   Append to public/css/pages/products.css
   =========================================================== */

.rate-calc {
  padding: clamp(26px, 3.5vw, 38px);
  background: #ffffff;
  border: 1px solid var(--page-line);
  border-radius: var(--page-radius);
  box-shadow:
    0 2px 2px rgba(3, 54, 105, 0.04),
    0 8px 16px -4px rgba(3, 54, 105, 0.06);
}

.rate-calc-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.rate-calc-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.rate-calc-field label {
  color: var(--page-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rate-calc-field input,
.rate-calc-field select {
  width: 100%;
  padding: 13px 14px;
  color: var(--page-ink);
  background: #ffffff;
  border: 1px solid rgba(3, 54, 105, 0.18);
  border-radius: var(--radius, 6px);
  font: inherit;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  transition:
    border-color 150ms var(--page-ease),
    box-shadow 150ms var(--page-ease);
}

.rate-calc-field input:focus,
.rate-calc-field select:focus {
  outline: none;
  border-color: var(--page-navy);
  box-shadow: 0 0 0 3px rgba(3, 54, 105, 0.12);
}

.rate-calc-field input:disabled,
.rate-calc-field select:disabled {
  background: var(--page-surface);
  color: var(--page-muted);
  cursor: not-allowed;
}


/* ---------- Status ---------- */

.rate-calc-status {
  margin: 16px 0 0;
  color: var(--page-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.rate-calc-status:empty {
  display: none;
}

.rate-calc-status.is-error {
  color: #a63a35;
}


/* ---------- Result ---------- */

.rate-calc-result {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--page-line);
}

.rate-calc-figure {
  padding-right: 24px;
  margin-right: 24px;
  border-right: 1px solid var(--page-line);
}

.rate-calc-figure:last-child {
  padding-right: 0;
  margin-right: 0;
  border-right: 0;
}

.rate-calc-figure-label {
  display: block;
  margin-bottom: 8px;
  color: var(--page-muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rate-calc-figure-value {
  display: block;
  color: var(--page-navy);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* The maturity value is the figure people came for. */
.rate-calc-figure-total .rate-calc-figure-value {
  font-size: 1.6rem;
}


/* ---------- Disclaimer and actions ---------- */

.rate-calc-disclaimer {
  max-width: 90ch;
  margin: 26px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--page-line);
  color: var(--page-muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

.rate-calc-disclaimer strong {
  color: var(--page-ink);
  font-weight: 600;
}

.rate-calc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
}


/* ---------- Responsive ---------- */

@media (max-width: 1023px) {
  .rate-calc-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rate-calc-result {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 0;
  }

  .rate-calc-figure:nth-child(2n) {
    padding-right: 0;
    margin-right: 0;
    border-right: 0;
  }
}

@media (max-width: 620px) {
  .rate-calc-inputs,
  .rate-calc-result {
    grid-template-columns: minmax(0, 1fr);
  }

  .rate-calc-figure {
    padding: 0 0 18px;
    margin: 0;
    border-right: 0;
    border-bottom: 1px solid var(--page-line);
  }

  .rate-calc-figure:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .rate-calc-actions .page-button {
    width: 100%;
  }
}

.product-compare-hint {
  display: none;
  margin: 12px 0 0;
  color: var(--page-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 1023px) {
  .product-compare-hint { display: block; }
}