/* Riverain Partners: site styles (v4: faded photo background). No external requests, no cookies. */

@font-face {
  font-family: "Montserrat";
  src: url("fonts/montserrat-400.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("fonts/montserrat-600.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-400.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-500.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand palette: "Colour Palette" slide in the Template slides branding deck */
  --ink: #172220;
  --sage: #639f95;
  --sand: #c89b65;
  --slate: #4a5855;
  --teal: #31565d;
  --terracotta: #bf6a5c;
  --mist: #f2f6f5;
  --mint: #d6eae6;
  --cream: #faf2e8;

  /* Roles (contrast ratios are WCAG, against the background they sit on) */
  --page: #f9fbfa;              /* home page and page headers: halfway between the brand mist and white (Cosmo, 11 Nov) */
  --paper: #ffffff;             /* reading pages and the footer */
  --text: var(--ink);           /* 15.0:1 on mist, 16.3:1 on white */
  --text-muted: var(--slate);   /* 6.8:1 on mist, 7.5:1 on white */
  --label: var(--teal);         /* 7.4:1 on mist */
  --link: #3f7369;              /* sage, darkened for text: 5.4:1 on white, 5.0:1 on mist */
  --line: rgba(23, 34, 32, 0.28);
  --rule: #dde3e1;              /* hairlines */
  --focus: var(--teal);

  --font-display: "Montserrat", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-text: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(1.5rem, 5vw, 4.5rem);
  --header-top: var(--pad);                 /* space above the logo on the home page */
  --logo-w: clamp(184px, 18vw, 264px);      /* home logo width: holds its own against the statement (Cosmo, 5 Nov) */
  --hero-gap: clamp(2.5rem, 7vh, 4.5rem);   /* space between the logo and the statement */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: rgba(99, 159, 149, 0.3);
}

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

/* ---------- Home ---------- */

.home {
  background: var(--page);
  color: var(--text);
  color-scheme: light;
}

.page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* The photo across the whole page, faded by a mist wash so the text stays crisp. The wash is
   strongest behind the text: on the left in the left layout, at the top in the centred layout
   and on portrait screens. */
.backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.backdrop img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  /* Left layout: full mist behind the text column (gutter + 46rem), then the photo comes through */
  background: linear-gradient(90deg,
    rgb(242 246 245 / 0.95) 0,
    rgb(242 246 245 / 0.9) calc(var(--pad) + 46rem),
    rgb(242 246 245 / 0.62) calc(var(--pad) + 46rem + 22vw),
    rgb(242 246 245 / 0.48) 100%);
}

.layout-centre .backdrop::after {
  background: linear-gradient(180deg, rgb(242 246 245 / 0.64) 0%, rgb(242 246 245 / 0.56) 100%);
}

/* The logo, statement and contact details at the top. With MIST = "text" they have their own mist
   behind them, which fades out below the contact details. In the left layout on landscape screens
   the block fills the space above the status line and the wash comes from the backdrop instead. */
.content {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.layout-left .content {
  flex: 1 0 auto;
}

.mist-text.layout-centre .content {
  padding-bottom: 8rem;
  background: linear-gradient(180deg,
    rgb(242 246 245 / 0.8) 0%,
    rgb(242 246 245 / 0.8) calc(100% - 8rem),
    rgb(242 246 245 / 0.35) calc(100% - 4rem),
    rgb(242 246 245 / 0) 100%);
}

.site-header {
  padding: var(--header-top) var(--pad) 0;
}

.brand {
  display: inline-block;
}

.brand img {
  width: var(--logo-w);
}

.hero {
  padding: var(--hero-gap) var(--pad) 0;
}

/* Left layout: the statement sits in the middle of the page and the status line at the bottom */
.layout-left .hero {
  margin-block: auto;
  padding-bottom: clamp(2.5rem, 8vh, 5rem);
}

.statement {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.1875rem, 0.95rem + 0.6vw, 1.5rem);   /* 19px on phones to 24px on laptops (smaller, Cosmo 5 Nov; was 21-29px) */
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 clamp(2rem, 5vh, 3.25rem);
  max-width: 25em;
  text-wrap: balance;
}

.rule {
  width: 3rem;
  height: 2px;
  margin: 0 0 1.5rem;
  border: 0;
  background: var(--sage);   /* the logo's sage (Cosmo, 5 Nov; was sand) */
}

/* Email and phone: no label and no underline; they turn sage on hover */
/* 15px: clearly below the tagline (Cosmo, 5 Nov; was 17px). Padding keeps the tap targets at least 28px tall. */
.contact p {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
}

.contact a {
  display: inline-block;
  padding: 0.125rem 0;
  text-decoration: none;
  transition: color 0.2s ease;
}

.contact a:hover {
  color: var(--link);
}

.site-footer {
  position: relative;
  z-index: 1;
  padding: 1.75rem var(--pad) 2rem;
  border-top: 1px solid var(--rule);
  background: var(--paper);
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.site-footer p {
  margin: 0 0 0.6rem;
  max-width: 46rem;
  text-wrap: pretty;
}

.site-footer p a {
  color: var(--text);
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin-top: 1rem;
}

.legal-links a {
  padding-block: 0.25rem;   /* taps of at least 24px (WCAG 2.5.8) */
  color: var(--text);
  transition: color 0.2s ease;
}

.legal-links a:hover {
  color: var(--link);
}

.legal-links a[aria-current="page"] {
  text-decoration: none;
  color: var(--text-muted);
}

/* On the home page the status line sits at the bottom of the screen, on the faded background */
.home .site-footer {
  margin-top: auto;
  background: none;
  border-top: 0;
}

/* MIST = "text": a mist behind the status line too, fading out upwards */
.home.mist-text .site-footer {
  padding-top: 4.5rem;
  background: linear-gradient(0deg,
    rgb(242 246 245 / 0.8) 0%,
    rgb(242 246 245 / 0.8) calc(100% - 4.5rem),
    rgb(242 246 245 / 0) 100%);
}

/* Centred layout: everything centred, including the logo */
.layout-centre .site-header,
.layout-centre .hero,
.layout-centre .site-footer {
  text-align: center;
}

.layout-centre .statement,
.layout-centre .rule,
.layout-centre .site-footer p {
  margin-left: auto;
  margin-right: auto;
}

.layout-centre .statement {
  max-width: 26em;
}

.layout-centre .hero {
  margin-left: auto;
  margin-right: auto;
}

.layout-centre .legal-links {
  justify-content: center;
}

/* No line above the status text: the sand line under the statement is the only separator (Cosmo, 5 Nov).
   The extra top padding keeps the gap the old hairline gave on short screens. */
.home.layout-centre .site-footer {
  padding-top: 3.25rem;
}

.home.layout-centre.mist-text .site-footer {
  padding-top: 6rem;
}

/* CENTRE_RULE: the sand line sits at the vertical centre of the screen. The statement's row is at least as tall as
   the space between the logo and the centre, with the statement at its foot; on short screens the row grows to fit
   the logo and statement, and the line moves lower. The logo stays at the top. */
.rule-centre .site-header .brand {
  vertical-align: top;   /* no gap under the logo, so the header is exactly --header-top plus the logo's height */
}

.rule-centre .hero {
  display: grid;
  grid-template-rows: minmax(max(0px, calc(50vh - var(--header-top) - var(--logo-w) * 87 / 421 - var(--hero-gap) - 1px)), auto) auto auto;   /* older browsers */
  grid-template-rows: minmax(max(0px, calc(50svh - var(--header-top) - var(--logo-w) * 87 / 421 - var(--hero-gap) - 1px)), auto) auto auto;
}

.rule-centre .statement {
  align-self: end;
}

/* Even mist: one even fade across the whole screen, with no extra mist behind the text */
.mist-even .backdrop::after,
.mist-even.layout-centre .backdrop::after {
  background: rgb(242 246 245 / 0.74);
}

.mist-even.layout-centre .content {
  padding-bottom: 0;
  background: none;
}

@media (min-width: 821px) and (max-height: 780px) {
  :root {
    --header-top: 2.25rem;
    --hero-gap: 2rem;
  }

  .site-footer {
    padding-top: 1.25rem;
    padding-bottom: 1.4rem;
  }
}

/* Portrait screens (phones, upright tablets): both layouts put the text at the top and the status
   line at the bottom, with the picture showing in between */
@media (orientation: portrait) {
  /* More space above the logo on phones and upright tablets, closer to the desktop look (Cosmo, 5 Nov):
     40-72px depending on the screen's height (was 24px on phones) */
  :root {
    --header-top: clamp(2.5rem, 6vh, 4.5rem);   /* older browsers */
  }

  @supports (height: 1svh) {
    :root {
      --header-top: clamp(2.5rem, 6svh, 4.5rem);
    }
  }

  .layout-centre .backdrop::after,
  .layout-left .backdrop::after {
    background: linear-gradient(180deg, rgb(242 246 245 / 0.62) 0%, rgb(242 246 245 / 0.5) 100%);
  }

  .mist-even.layout-centre .backdrop::after,
  .mist-even.layout-left .backdrop::after {
    background: rgb(242 246 245 / 0.74);
  }

  .layout-left .content {
    flex: 0 0 auto;
  }

  .mist-text.layout-centre .content,
  .mist-text.layout-left .content {
    padding-bottom: 6rem;
    background: linear-gradient(180deg,
      rgb(242 246 245 / 0.82) 0%,
      rgb(242 246 245 / 0.82) calc(100% - 6rem),
      rgb(242 246 245 / 0) 100%);
  }

  .layout-left .hero {
    margin-block: 0;
    padding-bottom: 0;
  }

  .statement {
    text-wrap: pretty;
  }
}

/* Large screens: let the gutter, logo and headline grow a little, keeping the 1440px proportions */
@media (min-width: 1800px) {
  :root {
    --pad: clamp(4.5rem, 3.6vw, 6rem);
  }

  :root {
    --logo-w: clamp(264px, 14.6vw, 300px);
  }

  .statement {
    font-size: clamp(1.5rem, 0.375rem + 1vw, 1.75rem);
  }
}

/* ---------- Document pages (legal information, privacy notice) ---------- */

.doc {
  background: var(--paper);
  color: var(--text);
  color-scheme: light;
}

.doc-header {
  background: var(--page);
  border-bottom: 1px solid var(--rule);
  padding: 1.4rem var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Logo, headings, text and footer share the reading column's edges */
.doc-header,
.doc .site-footer {
  padding-left: max(var(--pad), calc((100% - 46rem) / 2 + var(--pad)));
  padding-right: max(var(--pad), calc((100% - 46rem) / 2 + var(--pad)));
}

.doc-header .brand img {
  width: clamp(156px, 13vw, 200px);
}

/* Centred layout: logo in the middle of the header, Home link on the right */
.layout-centre .doc-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}

.layout-centre .doc-header .brand {
  grid-column: 2;
}

.layout-centre .doc-header nav {
  grid-column: 3;
  justify-self: end;
}

.doc-header nav a {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
  position: relative;
}

/* A larger tap area without moving the underline (WCAG 2.5.8) */
.doc-header nav a::after {
  content: "";
  position: absolute;
  inset: -0.5rem;
}

.doc-header nav a:hover {
  border-bottom-color: var(--sage);
}

.doc-main {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--pad) clamp(3rem, 7vw, 5rem);
}

.doc-main h1 {
  font-family: var(--font-display);
  font-weight: 600;                                  /* Montserrat SemiBold, as the deck's titles */
  font-size: clamp(1.75rem, 1.35rem + 1.3vw, 2.25rem);   /* 28-36px (was 32-44px in Poppins Light) */
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.doc-main .meta {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin: 0 0 2rem;
}

/* The privacy notice has no date line, so its contents box needs space of its own below the title */
.doc-main h1 + .toc {
  margin-top: 1.5rem;
}

.toc {
  margin: 0 0 2.5rem;
  padding: 1.1rem 1.35rem 1.2rem;
  background: var(--mist);
  border-radius: 8px;
}

.toc-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem !important;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.6rem !important;
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
  column-gap: 2.5rem;
}

.toc li {
  font-size: 0.9375rem !important;
  line-height: 1.5 !important;
  margin: 0 0 0.35rem !important;
  break-inside: avoid;
}

.doc-main h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.35;
  margin: 2.5rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1.5rem;
}

.doc-main p,
.doc-main li {
  font-size: 1.03rem;
  line-height: 1.7;
}

.doc-main p {
  margin: 0 0 1rem;
}

.doc-main ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.doc-main li {
  margin-bottom: 0.4rem;
}

.doc-main a {
  color: var(--link);
}

.doc-main strong {
  font-weight: 500;
}

/* Company particulars on the legal information page */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 2rem;
  margin: 0 0 1rem;
  font-size: 1.03rem;
  line-height: 1.6;
}

.facts dt {
  color: var(--text-muted);
}

.facts dd {
  margin: 0;
}

.draft-flag {
  background: #fff6db;
  border: 1px solid #e6cf85;
  color: #5a4710;
  padding: 0.8rem 1rem;
  border-radius: 6px;
  font-size: 0.9375rem !important;
  line-height: 1.5 !important;
  margin: 0 0 2rem !important;
}

@media (max-width: 600px) {
  .toc ol {
    columns: 1;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .facts dd {
    margin-bottom: 0.75rem;
  }
}

/* ---------- Not found ---------- */

.notfound .hero {
  max-width: 40rem;
}

.notfound .statement {
  margin-bottom: 1.5rem;
}

.notfound .back a {
  color: var(--text);
}

/* ---------- Motion (only when the visitor has not asked for less) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .home .hero > *,
  .home .site-footer {
    animation: rise 0.9s var(--ease) both;
  }

  .home .hero > :nth-child(2) {
    animation-delay: 0.12s;
  }

  .home .hero > :nth-child(3) {
    animation-delay: 0.22s;
  }

  /* The footer fades in place. Rising from 10px lower would push it past the bottom of the screen for a
     moment, flashing a scrollbar and nudging the centred page sideways on Windows (Cosmo, 17 Nov). */
  .home .site-footer {
    animation-name: fade;
    animation-delay: 0.32s;
  }

  .home .backdrop img {
    animation: fade 1.6s var(--ease) both;
  }

  @keyframes fade {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* ---------- Print ---------- */

@media print {
  .backdrop,
  .doc-header nav,
  .toc {
    display: none;
  }

  .home,
  .doc-header {
    background: #ffffff !important;
  }

  .home .hero > *,
  .home .site-footer {
    animation: none !important;
  }

  .doc-main a,
  .site-footer a {
    color: #000000;
  }
}

/* ---------- Robustness ---------- */

/* Long words such as the email address wrap rather than scroll sideways at large text sizes */
.contact a,
.facts dd,
.doc-main a {
  overflow-wrap: anywhere;
}

/* Very large text or page zoom on small phones: long words wrap instead of pushing the page sideways */
body {
  overflow-wrap: break-word;
}

.statement {
  overflow-wrap: anywhere;   /* otherwise the home grid sizes its column to the longest word */
}

/* Windows high-contrast mode: keep the logo on a light plate so its ink half stays visible */
@media (forced-colors: active) {
  .brand img {
    forced-color-adjust: none;
    background: #f2f6f5;
    outline: 6px solid #f2f6f5;
  }
}
