/* ------------------------------------------------------------------------
   Support site rules, on top of the FinVentures design system.

   Load order: tokens.css, fv-components.css, then this file.

   tokens.css and fv-components.css are copied unchanged from the design
   system (mtp: static/css/tokens.css and tools/design-system/fv-components.css,
   which is the merchant portal's app.css). Never edit those two here; update
   them from upstream instead, or this site drifts from the portal.

   This file holds only what the design system does not: the page base it
   leaves to each product, and the release-notes blocks. No raw hex values:
   every colour, radius and duration is a token.
   ------------------------------------------------------------------------ */

/* --- Base --------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

/* Header, content, footer: the footer sits at the bottom of a short page. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-body);
  background: var(--surface-subtle);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul {
  margin: 0;
}

/* --- Page column ---------------------------------------------------------
   A public reading site rather than an app, so the portal's sidebar shell
   gives way to a centred column. Its padding is the portal's .content. */

.page {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 48px 64px;
}

.page a {
  color: var(--text-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page a:hover {
  color: var(--text-link-hover);
}

.page a:focus-visible {
  outline: 2px solid var(--fv-navy);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Header ---------------------------------------------------------------
   Flat --fv-navy like the portal's sidebar, and its .nav__row links laid
   out in a row. */

.site-header {
  background: var(--fv-navy);
}

.site-header__inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 48px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
}

/* 80px: the brand guidelines' minimum. No border-radius, which would clip
   the tile's black keyline (the portal's rule for the same asset). */
.site-brand__logo {
  width: 80px;
  height: 80px;
  display: block;
  object-fit: contain;
}

.site-brand:focus-visible,
.site-header .nav__row:focus-visible {
  outline: 2px solid var(--fv-yellow);
  outline-offset: 2px;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-header__contact {
  margin-left: auto;
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  background: var(--fv-navy);
  color: var(--fv-slate-400);
  font-size: 13px;
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 48px;
}

.site-footer__links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-footer__link,
.site-footer__icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  color: var(--fv-slate-400);
  text-decoration: none;
  transition: background var(--motion-fast) var(--ease),
              color var(--motion-fast) var(--ease);
}

.site-footer__icon {
  justify-content: center;
  width: 44px;
  padding: 0;
  font-size: 18px;
}

.site-footer__link:hover,
.site-footer__icon:hover {
  color: var(--fv-white);
  background: var(--fv-navy-800);
}

.site-footer__link:focus-visible,
.site-footer__icon:focus-visible {
  outline: 2px solid var(--fv-yellow);
  outline-offset: 2px;
}

/* --- Release layout -----------------------------------------------------
   Versions on the left, the selected version's notes on the right. The
   versions card sticks while long notes scroll past it. */

.release-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.release-versions {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.release-versions .card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.release-versions__count {
  font-size: 12px;
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}

.version-list {
  list-style: none;
  padding: 8px;
  overflow-y: auto;
}

.version-list__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-body);
  text-decoration: none;
  transition: background var(--motion-fast) var(--ease);
}

.page .version-list__row {
  color: var(--text-body);
  text-decoration: none;
}

.version-list__row:hover {
  background: var(--fv-slate-100);
}

/* Same treatment as the sidebar's active row, inverted for a white card:
   one filled row, with weight as well as colour carrying it. */
.version-list__row.is-active {
  background: var(--fv-slate-100);
}

.version-list__row.is-active .version-list__tag {
  font-weight: var(--weight-bold);
  color: var(--text-heading);
}

.version-list__tag {
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--text-heading);
}

.version-list__date {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Release notes ------------------------------------------------------ */

.release-notes__header {
  padding: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.release-notes__title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.release-notes__title {
  font-size: 24px;
  font-weight: var(--weight-bold);
  color: var(--text-heading);
}

.release-notes__name {
  margin-top: 6px;
  font-size: 16px;
  color: var(--text-body);
}

.release-notes__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-muted);
}

.release-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.release-section:last-of-type {
  border-bottom: none;
}

.release-section__title {
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

.release-section__list {
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-body);
}

.release-section__list li + li {
  margin-top: 8px;
}

.release-section__list li::marker {
  color: var(--fv-slate-400);
}

.release-section__list code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--fv-slate-100);
}

/* --- FAQs --------------------------------------------------------------- */

.faq details {
  border-bottom: 1px solid var(--border-subtle);
}

.faq details:last-child {
  border-bottom: none;
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: var(--weight-semibold);
  color: var(--text-heading);
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

/* A chevron that turns when the answer opens, drawn with borders so it
   needs no icon font. */
.faq summary::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform var(--motion-base) var(--ease);
}

.faq details[open] summary::after {
  transform: rotate(-135deg);
}

.faq summary:hover {
  background: var(--surface-subtle);
}

.faq summary:focus-visible {
  outline: 2px solid var(--fv-navy);
  outline-offset: -2px;
}

.faq details p {
  padding: 0 24px 20px;
  max-width: 72ch;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-body);
}

/* --- Narrow screens -----------------------------------------------------
   Same steps as the portal: 1024px narrows the padding, 680px is phones. */

@media (max-width: 1024px) {
  .page {
    padding: 32px 28px 48px;
  }

  .site-header__inner,
  .site-footer__inner {
    padding-left: 28px;
    padding-right: 28px;
  }
}

/* Below this the notes column gets too narrow beside the versions card, so
   the card stops sticking and becomes a short scrolling list above them. */
@media (max-width: 860px) {
  .release-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .release-versions {
    position: static;
    max-height: none;
  }

  .version-list {
    max-height: 264px;
  }
}

@media (max-width: 680px) {
  .page {
    padding: 20px 16px 40px;
  }

  /* Brand and Contact share the top row; the section links take a full row
     beneath, without icons so all three fit a 360px phone. */
  .site-header__inner {
    gap: 8px 12px;
    padding: 12px 16px;
  }

  .site-brand__logo {
    width: 56px;
    height: 56px;
  }

  .site-header__contact {
    order: 2;
  }

  .site-nav {
    order: 3;
    flex-basis: 100%;
  }

  .site-header .nav__row {
    padding: 8px 12px;
    font-size: 14px;
  }

  .site-nav .nav__icon {
    display: none;
  }

  .site-footer__inner {
    padding: 16px;
  }

  /* The portal's phone rule pads every .card; flush cards pad their own
     rows, so that would double the inset. */
  .card--flush {
    padding: 0;
  }

  .release-notes__header,
  .release-section {
    padding: 18px;
  }

  .faq summary {
    padding: 14px 18px;
  }

  .faq details p {
    padding: 0 18px 18px;
  }
}
