/*
 * AERISIO theme — global base styles.
 *
 * Brand tokens (--brand-color, --primary-font, --content-width, …) are injected
 * per page from THEME FIELDS in the base layout <head> (they need HubL to read
 * theme.* values). Static layout tokens that are not marketer-editable live here.
 * Modules add their own scoped CSS; this file is only reset + brand typography.
 */

:root {
  --gutter: clamp(20px, 5vw, 64px);
  --section-pad: clamp(56px, 7vw, 100px);
  /* Height of the sticky header. The hero subtracts this so a full-height hero
     fits within the viewport instead of bleeding below the fold. Keep in sync
     with .site-header__inner min-height. */
  --header-height: 64px;
  /* Shared corner radius for boxed surfaces — cards, stat tiles, CTA form inputs
     and the CTA button. Change here to update them all consistently. */
  --radius: 10px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* Offset every in-page anchor jump by the fixed header so targets aren't
     hidden underneath it (applies to nav links, the hero CTA, and any /page#id). */
  scroll-padding-top: calc(var(--header-height) + 8px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ── Scroll reveal ─────────────────────────────────────────────────────────
   Content sections fade + rise into view as they scroll in. Enabled only when
   JS adds html.reveal-ready (set pre-paint in the base <head>) and motion is
   allowed — so no-JS / reduced-motion shows everything immediately, and there's
   no flash of hidden content. Opt a module out by giving its section
   [data-reveal="off"] (the "Animate in on scroll" field). The hero has its own
   intro, so it's excluded. */
@media (prefers-reduced-motion: no-preference) {
  html.reveal-ready
    main
    section:not([data-aerisio-hero]):not([data-reveal='off'])
    :is(
      h1,
      h2,
      h3,
      h4,
      p,
      ul,
      ol,
      blockquote,
      img,
      table,
      .btn,
      .reveal-block
    ):not(.reveal-block *):not(.card-reveal *) {
    transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  }

  /* Hidden until .revealed is added. Keeping :not(.revealed) in the hide rule
     (rather than a separate reveal rule) means revealing simply stops matching —
     no specificity fight. Individual content elements are revealed as each
     scrolls into view, so text below a large image animates when the text
     itself appears (not when the section's top edge does). .reveal-block is an
     opt-in hook for non-text blocks whose content is injected later (e.g. the
     CTA form) — animate the server-rendered wrapper, not the async child. */
  html.reveal-ready
    main
    section:not([data-aerisio-hero]):not([data-reveal='off'])
    :is(
      h1,
      h2,
      h3,
      h4,
      p,
      ul,
      ol,
      blockquote,
      img,
      table,
      .btn,
      .reveal-block
    ):not(.revealed):not(.reveal-block *):not(.card-reveal *) {
    opacity: 0;
    transform: translateY(24px);
  }
}

body {
  margin: 0;
  font-family: var(--primary-font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--brand-color);
  background: var(--background-color);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
  /* Honor manual line breaks typed into title fields (allowNewLine) while still
     wrapping normally. Titles without breaks are unaffected. */
  white-space: pre-line;
}

h1 {
  font-size: clamp(26px, 4vw, 56px);
}

h2 {
  font-size: clamp(22px, 2.6vw, 32px);
}

h3 {
  font-size: clamp(18px, 2vw, 22px);
}

p {
  margin: 0 0 1em;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* Centered content column */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Section vertical rhythm */
.section {
  padding-block: var(--section-pad);
}

.section--surface {
  background: var(--surface-color);
}

.section--dark {
  background: var(--dark-bg-color);
  color: var(--dark-text-color);
}

/* Eyebrow / label */
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted-text-color);
}

/* Buttons — same shared brand corner radius as cards/tiles (--radius) */
.btn {
  display: inline-block;
  padding: 14px 26px;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  border: 1px solid var(--brand-color);
  border-radius: var(--radius);
  background: var(--brand-color);
  color: var(--background-color);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: transparent;
  color: var(--brand-color);
  text-decoration: none;
}

.btn--ghost {
  background: transparent;
  color: var(--brand-color);
}

.btn--ghost:hover {
  background: var(--brand-color);
  color: var(--background-color);
}

hr {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 0;
}

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

/* ── Site header ─────────────────────────────────────────────────────────── */
/* Fixed overlay (like the old site): always-visible white bar on desktop; on
   mobile it's transparent over a dark hero and turns white on scroll / menu-open
   (see the mobile block + the aerisio-has-hero body class set in base.hubl.html). */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--background-color);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.25s ease, border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.site-header--scrolled {
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.07);
}

/* The header is fixed, so content needs to clear it — except on pages that open
   with a full-bleed hero, which slides up under the (transparent/overlay) bar. */
#content {
  padding-top: var(--header-height);
}

body.aerisio-has-hero #content {
  padding-top: 0;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-height);
}

.site-header__logo img {
  height: 28px;
  width: auto;
}

.site-header__nav ul {
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header__nav a {
  font-size: 15px;
  font-weight: 500;
}

.site-header__lang {
  font-size: 14px;
}

/* Language switcher — CSS-only dropdown (<details>) */
.langdd {
  position: relative;
}

.langdd__current {
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 2px;
  text-transform: uppercase;
}

.langdd__current::-webkit-details-marker {
  display: none;
}

.langdd__current::after {
  content: ' ▾';
  color: var(--muted-text-color);
}

.langdd[open] .langdd__current::after {
  content: ' ▴';
}

.langdd__menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin: 8px 0 0;
  padding: 6px 0;
  min-width: 64px;
  list-style: none;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  z-index: 120;
}

.langdd__menu a {
  display: block;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--brand-color);
}

.langdd__menu a:hover {
  background: var(--surface-color);
  text-decoration: none;
}

.langdd__menu a[aria-current='true'] {
  font-weight: 700;
}

/* ── Site footer ─────────────────────────────────────────────────────────── */
.site-footer {
  padding-block: var(--section-pad);
  background: var(--background-color);
  border-top: 1px solid var(--border-color);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.site-footer__logo img {
  height: 24px;
  width: auto;
}

/* The footer-content module renders inside a HubSpot wrapper div; make it
   transparent so its nav + legal sit as direct children of the flex column. */
.site-footer__inner > .hs_cos_wrapper {
  display: contents;
}

.site-footer__nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__nav a {
  color: var(--brand-color);
  font-size: 14px;
}

.site-footer__legal {
  margin: 0;
  color: var(--muted-text-color);
  font-size: 13px;
}

/* Hamburger (CSS-only checkbox toggle — no JS) */
.site-header__hamburger {
  display: none;
}

@media (max-width: 767px) {
  .site-header__nav {
    display: none;
  }

  .site-header__hamburger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    margin-left: auto;
    cursor: pointer;
    z-index: 110;
  }

  .site-header__hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--brand-color);
    transform-origin: center;
    transition: transform 0.3s ease, opacity 0.2s ease;
  }

  /* Animate the three bars into an X when open (checkbox precedes the label). */
  .site-header__toggle:checked ~ .site-header__hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .site-header__toggle:checked ~ .site-header__hamburger span:nth-child(2) {
    opacity: 0;
  }

  .site-header__toggle:checked ~ .site-header__hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Full-height overlay menu below the sticky top stack. Offset by
     --topbar-height (announcement banner + header), measured in JS on the v2
     layout; falls back to the header height on pages with no banner. */
  .site-header__toggle:checked ~ .site-header__nav {
    display: flex;
    position: fixed;
    inset: var(--topbar-height, var(--header-height)) 0 0 0;
    height: calc(100vh - var(--topbar-height, var(--header-height)));
    height: calc(100dvh - var(--topbar-height, var(--header-height)));
    background: var(--background-color);
    padding: 32px var(--gutter);
    overflow-y: auto;
    z-index: 105;
    animation: aerisio-menu-in 0.25s ease;
  }

  .site-header__toggle:checked ~ .site-header__nav ul {
    flex-direction: column;
    gap: 22px;
    width: 100%;
  }

  .site-header__toggle:checked ~ .site-header__nav a {
    font-size: 20px;
  }

  /* ── Transparent-over-hero (mobile only) ──────────────────────────────────
     On pages that open with a dark hero (body.aerisio-has-hero, set in
     base.hubl.html), the bar is transparent with a white logo until the user
     scrolls (>40px) or opens the menu, then turns white — like the old site. */
  body.aerisio-has-hero .site-header {
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
  }

  body.aerisio-has-hero .site-header__logo img {
    filter: brightness(0) invert(1);
  }

  body.aerisio-has-hero .site-header__hamburger span {
    background: #fff;
  }

  body.aerisio-has-hero .langdd__current {
    color: #fff;
  }

  body.aerisio-has-hero .site-header--scrolled,
  body.aerisio-has-hero .site-header:has(.site-header__toggle:checked) {
    background: var(--background-color);
    border-bottom-color: var(--border-color);
  }

  body.aerisio-has-hero .site-header--scrolled .site-header__logo img,
  body.aerisio-has-hero
    .site-header:has(.site-header__toggle:checked)
    .site-header__logo
    img {
    filter: none;
  }

  body.aerisio-has-hero .site-header--scrolled .site-header__hamburger span,
  body.aerisio-has-hero
    .site-header:has(.site-header__toggle:checked)
    .site-header__hamburger
    span {
    background: var(--brand-color);
  }

  body.aerisio-has-hero .site-header--scrolled .langdd__current,
  body.aerisio-has-hero
    .site-header:has(.site-header__toggle:checked)
    .langdd__current {
    color: var(--brand-color);
  }
}

@keyframes aerisio-menu-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Blog (Resources) — listing + post ─────────────────────────────────────
   Native HubSpot blog templates; styled with theme tokens only. */
.blog-index__head {
  max-width: 720px;
  margin-bottom: 48px;
}

.blog-index__title {
  margin-top: 8px;
}

.blog-index__intro {
  color: var(--muted-text-color);
  font-size: 18px;
  margin: 0;
}

/* Featured (newest) article */
.blog-feature {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 56px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--border-color);
}

.blog-feature:hover {
  text-decoration: none;
}

.blog-feature__media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
}

.blog-feature__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.blog-feature:hover .blog-feature__media img {
  transform: scale(1.03);
}

.blog-feature__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.blog-feature__title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.blog-feature__summary {
  color: var(--muted-text-color);
  font-size: 17px;
}

/* Article grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 32px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blog-card:hover {
  text-decoration: none;
}

.blog-card__media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 4px;
}

.blog-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.blog-card:hover .blog-card__media img {
  transform: scale(1.03);
}

.blog-card__title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.blog-card:hover .blog-card__title {
  color: var(--brand-color);
}

.blog-card__summary {
  color: var(--muted-text-color);
  font-size: 15px;
}

.blog-card__meta {
  margin-top: auto;
  font-size: 13px;
  color: var(--muted-text-color);
}

/* Pagination */
.blog-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 64px;
}

.blog-pager__count {
  font-size: 14px;
  color: var(--muted-text-color);
}

/* Contact CTA under the Resources listing (FR-2026-08-18 #1) — mirrors the
   CtaBanner module's surface-background rendering, since the blog listing has
   no drag-drop area to drop the module into. */
.blog-cta {
  text-align: center;
}

.blog-cta__inner {
  max-width: 42rem;
}

.blog-cta__heading {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.2;
}

.blog-cta__body {
  margin: 0.6em auto 0;
  max-width: 40ch;
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.5;
  opacity: 0.9;
}

.blog-cta__actions {
  margin: 1.6em 0 0;
}

@media (max-width: 900px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .blog-feature {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .blog-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Blog post ─────────────────────────────────────────────────────────── */
.blog-post__container {
  max-width: 760px;
}

.blog-post__back {
  display: inline-block;
  margin-bottom: 20px;
}

.blog-post__back:hover {
  color: var(--brand-color);
  text-decoration: none;
}

.blog-post__title {
  margin-bottom: 12px;
}

.blog-post__meta {
  color: var(--muted-text-color);
  font-size: 14px;
  margin: 0 0 32px;
}

.blog-post__hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: 40px;
}

/* Prose — HubSpot rich-text post body */
.blog-post__body {
  font-size: 18px;
  line-height: 1.7;
}

.blog-post__body h2 {
  margin-top: 1.6em;
}

.blog-post__body h3 {
  margin-top: 1.4em;
}

.blog-post__body img {
  margin: 1.5em 0;
}

.blog-post__body ul,
.blog-post__body ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
}

.blog-post__body li {
  margin-bottom: 0.4em;
}

.blog-post__body blockquote {
  margin: 1.5em 0;
  padding-left: 20px;
  border-left: 3px solid var(--brand-color);
  color: var(--muted-text-color);
  font-style: italic;
}

.blog-post__body a {
  color: var(--brand-color);
  text-decoration: underline;
}

/* ── Sequential (staggered) reveal ──────────────────────────────────────────
   Opt-in per CardGrid ("Reveal cards one by one"). Items marked [data-stagger]
   fade in as the section scrolls into view, offset by --card-i so the heading,
   then each card, appear one after another. Normal section spacing (no pinning).
   Same JS-gated hide-until-revealed pattern as the per-element reveal. */
@media (prefers-reduced-motion: no-preference) {
  html.reveal-ready [data-stagger] {
    transition: opacity 1.02s ease,
      transform 1.02s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: calc(var(--card-i, 0) * 0.18s);
  }

  html.reveal-ready [data-stagger]:not(.revealed) {
    opacity: 0;
    transform: translateY(24px);
  }
}

/* ── Card reveal + content cascade ──────────────────────────────────────────
   A card (.card-reveal) has its OWN reveal timing, separate from the generic
   per-element reveal above, so the box can appear quickly and NOT mask the row
   cascade with a long box-opacity fade (the "whole card at once" bug). The box
   fades/rises fast (0.45s); its inner rows then cascade in one after another —
   PARENT-driven (keyed on .card-reveal.revealed), not per-row intersection, so
   every row (even one low in a tall card) starts the moment the card appears.
   Row 0 (the title) rises together with the box, so the empty card background is
   never shown by itself; role/body/bullets follow at a clearly-staged step. */
@media (prefers-reduced-motion: no-preference) {
  html.reveal-ready .card-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.54s ease,
      transform 0.54s cubic-bezier(0.22, 1, 0.36, 1);
  }

  html.reveal-ready .card-reveal.revealed {
    opacity: 1;
    transform: none;
  }

  html.reveal-ready .card-reveal [data-card-item] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.66s ease,
      transform 0.66s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: calc(var(--card-i, 0) * 0.216s);
  }

  html.reveal-ready .card-reveal.revealed [data-card-item] {
    opacity: 1;
    transform: none;
  }
}

/* Each split heading line is its own row (inherits the heading's alignment). */
.reveal-line {
  display: block;
}
