/* ==========================================================================
   Reviews product terms (/vilkar/, terms.ejs), on top of home.css (tokens, header, footer, pills).
   The layout follows HMOOD 2.0's legal pages (site/src/styles/legal.css): an editorial heading block, then
   the contents beside the full text. Calm reading: every paragraph is visible at once, nothing collapses.
   ========================================================================== */
.rv-terms {
  --t-ink: var(--c-ink);
  --t-text: rgba(25, 23, 23, 0.84);
  --t-muted: rgba(25, 23, 23, 0.62);
  --t-rule: rgba(25, 23, 23, 0.14);
  --t-offset: calc(var(--header-h) + 1.5rem);
  background: var(--c-cream);
}
.rv-terms__page {
  padding-block: calc(var(--header-h) + clamp(2.5rem, 1rem + 5vw, 6.5rem)) clamp(5rem, 3rem + 7vw, 10rem);
  background: var(--c-cream);
  color: var(--t-ink);
}

/* ---------- heading block ---------- */
.rv-terms__hero { container-type: inline-size; display: grid; justify-items: start; }
.rv-terms__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  margin-bottom: clamp(1.25rem, 0.8rem + 1.5vw, 2.5rem);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--t-muted);
  transition: color 0.3s var(--ease-out);
}
.rv-terms__back span { transition: translate 0.5s var(--ease-out); }
@media (hover: hover) {
  .rv-terms__back:hover { color: var(--t-ink); }
  .rv-terms__back:hover span { translate: -4px 0; }
}
.rv-terms__hero .rm-eyebrow { margin-bottom: 0; color: var(--t-muted); }
.rv-terms__title {
  margin-top: clamp(1rem, 0.7rem + 1.2vw, 2rem);
  max-width: 100%;
  font-family: var(--f-display);
  /* «abonnementsvilkår» is one long word: the size follows the column (cqi), so it never breaks or overflows */
  font-size: min(5.25rem, 10cqi);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.055em;
  text-wrap: balance;
}
.rv-terms__meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: clamp(1.5rem, 1rem + 1.6vw, 2.5rem);
  padding-top: 1rem;
  border-top: 1px solid var(--t-rule);
  align-self: stretch;
  font-size: var(--fs-sm);
  color: var(--t-muted);
}
.rv-terms__meta::before { content: ''; flex: none; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--c-red); }
.rm-terms__notice { margin-top: 1rem; padding: 0.9rem 1.1rem; border-radius: var(--radius-md); background: var(--c-paper); box-shadow: inset 0 0 0 1px var(--t-rule); }
.rv-terms__lead { max-width: 40rem; margin-top: clamp(1.25rem, 0.9rem + 1.2vw, 2rem); font-size: var(--fs-lead); line-height: 1.5; color: var(--t-text); }
.rv-terms__refs { margin-top: 1.25rem; font-size: var(--fs-sm); color: var(--t-muted); }
.rv-terms a.rv-terms__inline, .rv-terms__refs a, .rv-terms__doc a {
  color: var(--t-ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--t-rule);
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.4s var(--ease-out);
}
@media (hover: hover) { .rv-terms__refs a:hover, .rv-terms__doc a:hover { text-decoration-color: var(--c-red); } }

/* English readers (?lang=en): a quiet notice between the heading block and the Norwegian text */
.rv-terms__lang-notice { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: baseline; margin-top: clamp(2rem, 1.5rem + 2vw, 3.5rem); padding: 1rem 1.25rem; border-left: 2px solid var(--c-red); border-radius: 0 var(--radius-md) var(--radius-md) 0; background: var(--c-paper); font-size: var(--fs-sm); line-height: 1.5; color: var(--t-text); }
.rv-terms__lang-notice strong { font-weight: 650; color: var(--t-ink); }
.rv-terms__lang-notice + .rv-terms__body { margin-top: clamp(2rem, 1.5rem + 2vw, 3.5rem); }

/* ---------- layout: contents + document (12 columns on desktop, as legal.css) ---------- */
.rv-terms__body { display: grid; gap: 2.5rem; margin-top: clamp(3rem, 2rem + 4vw, 6rem); }
.rv-terms__toc, .rv-terms__doc { min-width: 0; }
.rv-terms__toc { border-block: 1px solid var(--t-rule); }
.rv-terms__toc-title { padding-block: 1rem 0.25rem; font-family: var(--f-body); font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--t-muted); }
.rv-terms__toc ol { display: grid; margin: 0; padding: 0 0 0.75rem; list-style: none; }
.rv-terms__toc a {
  position: relative;
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  min-height: 44px;
  padding-block: 0.6rem;
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--t-muted);
  transition: color 0.3s var(--ease-out);
}
.rv-terms__toc .rv-terms__num { flex: none; min-width: 1.6rem; font-variant-numeric: tabular-nums; color: var(--t-muted); transition: color 0.3s var(--ease-out); }
.rv-terms__toc .rv-terms__name { background: linear-gradient(currentColor, currentColor) left calc(100% + 1px) / 0 1px no-repeat; transition: background-size 0.5s var(--ease-out); }
@media (hover: hover) {
  .rv-terms__toc a:hover { color: var(--t-ink); }
  .rv-terms__toc a:hover .rv-terms__name { background-size: 100% 1px; }
  .rv-terms__toc a:hover .rv-terms__num { color: var(--c-red-text); }
}
.rv-terms__toc a.is-current { color: var(--t-ink); }
.rv-terms__toc a.is-current .rv-terms__num { color: var(--c-red-text); }
.rv-terms__toc a:focus-visible { outline-offset: 2px; }

/* ---------- the document ---------- */
.rv-terms__doc { max-width: 46rem; }
.rv-terms__section { position: relative; padding-block: clamp(1.75rem, 1.3rem + 1.4vw, 2.75rem); border-top: 1px solid var(--t-rule); scroll-margin-top: var(--t-offset); }
.rv-terms__section:first-child { padding-top: clamp(1.25rem, 1rem + 1vw, 2rem); }
.rv-terms__section h2 { margin-bottom: 1rem; font-family: var(--f-display); font-size: clamp(1.3rem, 1.05rem + 0.9vw, 1.8rem); font-weight: 750; line-height: 1.2; letter-spacing: -0.03em; text-wrap: balance; }
.rv-terms__section h2 .rv-terms__num { color: var(--c-red-text); }
.rv-terms__section p { max-width: 68ch; color: var(--t-text); line-height: 1.72; overflow-wrap: break-word; hyphens: manual; }
.rv-terms__section p + p { margin-top: 1rem; }

@media (min-width: 1024px) {
  .rv-terms__body { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: start; }
  /* plain CSS sticky contents: in reach while reading, below the floating header, scrolls on its own if long */
  .rv-terms__toc { grid-column: 1 / 5; position: sticky; top: var(--t-offset); max-height: calc(100vh - var(--t-offset) - 1.5rem); overflow-y: auto; border-bottom: 0; scrollbar-width: thin; }
  .rv-terms__doc { grid-column: 5 / 13; }
  .rv-terms__toc a { min-height: 0; padding-left: 1rem; }
  /* a quiet rail with a red mark at the section being read */
  .rv-terms__toc a::before { content: ''; position: absolute; left: 0; top: 0.55rem; bottom: 0.55rem; width: 2px; border-radius: 2px; background: var(--c-red); transform: scaleY(0); transition: transform 0.6s var(--ease-pill); }
  .rv-terms__toc a.is-current::before { transform: scaleY(1); }
}
@media (min-width: 1280px) {
  .rv-terms__toc { grid-column: 1 / 4; }
  .rv-terms__doc { grid-column: 5 / 12; }
}

/* ---------- motion: the title rises through its word masks once (as the index hero); everything else is there at once ---------- */
@media (prefers-reduced-motion: no-preference) {
  .rv-terms__title .rv-word__inner { animation: rv-rise 1.3s var(--ease-expo) both; animation-delay: calc(0.05s + var(--d, 0s)); }
}
@media (prefers-reduced-motion: reduce) {
  .rv-terms__toc a, .rv-terms__toc .rv-terms__name, .rv-terms__toc a::before { transition: none; }
}
