@import url("https://fonts.googleapis.com/css2?family=Caladea:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;500;600;700&display=swap");

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-height); }
body {
  margin: 0;
  font-family: var(--type-family-body);
  color: var(--color-ink);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Hero images (skyline, panel) are real <img> elements inside their wrappers: they fill the wrapper and crop, never stretch. */
.skyline img, .panel img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.skyline img { object-position: var(--skyline-focus-x) 100%; }
.logo img { width: 100%; height: 100%; }

/* ---------- Page shell ---------- */
.page {
  position: relative;
  background: var(--color-bg);
  overflow: clip;
}

/* Decorative layers (behind content) */
/* Skyline: sits --skyline-offset (40px) below the bottom edge of the hero, so the section wrapper crops its lowest 40px.
   Full width up to --skyline-max-width (2000px), height follows the image proportion. Wider than 2000px it stays centered at 2000px. */
.skyline {
  position: absolute;
  left: 50%;
  bottom: calc(var(--skyline-offset) * -1);
  width: 100%;
  max-width: var(--skyline-max-width);
  height: clamp(
    var(--skyline-min-height),
    calc(100vw * var(--skyline-ratio)),
    calc(var(--skyline-max-width) * var(--skyline-ratio))
  );
  transform: translateX(-50%);
  z-index: 0;
  border-radius: 0;
}

/* Panel: full height of the hero, keeps its proportion at every size, pinned to the right edge.
   Below the tablet breakpoint it slides off the right edge, reaching 25% out (--panel-shift-max) at the smallest width. */
.panel {
  --panel-progress: 0; /* 0 = fully in, 1 = fully shifted */
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  aspect-ratio: var(--panel-aspect);
  z-index: 0;
  border-radius: 0;
  transform: translateX(calc(var(--panel-progress) * var(--panel-shift-max)));
}
/* Progress = how far the screen has shrunk between the start and end widths, as a 0 to 1 number.
   tan(atan2(a, b)) is a way to divide two lengths in CSS; browsers without it keep the panel in place. */
@supports (width: calc(tan(atan2(10px, 5px)) * 1px)) {
  .panel {
    --panel-progress: clamp(
      0,
      tan(atan2(
        calc(var(--panel-shift-start) - 100vw),
        calc(var(--panel-shift-start) - var(--panel-shift-end))
      )),
      1
    );
  }
}

/* ---------- Buttons [Figma 102:12389] ----------
   Each variant has a Default and a Hover state. The style guide shows the hover state with the extra class .is-hover. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-16);
  border: var(--border-button) solid var(--color-ink);
  border-radius: var(--radius-button);
  font: var(--type-weight-semibold) var(--type-size-14)/var(--type-line-height-body) var(--type-family-body);
  letter-spacing: var(--type-tracking-14);
  white-space: nowrap;
  cursor: pointer;
  transition: opacity var(--duration-base) var(--ease), background var(--duration-base) var(--ease), color var(--duration-base) var(--ease), border-color var(--duration-base) var(--ease);
}
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.btn--primary { background: var(--color-ink); color: var(--color-ivory); }
.btn--primary:hover, .btn--primary.is-hover { background: var(--color-ink-hover); border-color: var(--color-ink-hover); }
.btn--secondary { background: var(--color-bg); color: var(--color-ink); }
.btn--secondary:hover, .btn--secondary.is-hover { background: var(--color-secondary-hover); border-color: var(--color-ink-hover); }
.btn--outline { background: transparent; color: var(--color-ink); }   /* same as secondary, but see-through (for use on any section colour) */
.btn--outline:hover, .btn--outline.is-hover { background: var(--color-outline-hover); border-color: var(--color-ink-hover); }
.btn--light { background: transparent; color: var(--color-ivory); border-color: var(--color-ivory); letter-spacing: var(--type-tracking-03); }   /* for dark sections */
.btn--light:hover, .btn--light.is-hover { background: var(--color-ivory); color: var(--color-ink); }
.btn--nav {
  background: var(--color-ink);
  color: var(--color-ivory);
  border: 0;
  padding: var(--space-8) var(--space-16);
  font-feature-settings: "ss02" 1, "salt" 1, "cv08" 1;
}
.btn--nav:hover, .btn--nav.is-hover { background: var(--color-ink-hover); }

/* ---------- Header ---------- */
.header-slot { height: var(--header-height); }   /* keeps the space when the header becomes fixed */
.header {
  position: relative;   /* scrolls away with the page. The home page adds .is-fixed once the "Trusted by" bar has scrolled out of view (js/main.js, data-sticky-after) */
  z-index: 20;
  height: var(--header-height);
  padding: var(--space-24) var(--header-padding-x);
  transition: background var(--duration-base) var(--ease);
}
.header.is-fixed {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--color-bg);
  box-shadow: 0 1px 0 rgba(23, 27, 32, 0.08);
}
@media (prefers-reduced-motion: no-preference) {
  .header.is-fixed { animation: header-in 300ms var(--ease) both; }
}
@keyframes header-in { from { transform: translateY(-100%); } to { transform: none; } }
.header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-24);
}
.logo { width: 181px; height: 22px; flex: none; display: block; }
.menu { display: flex; align-items: center; gap: var(--space-40); }
.menu__link {
  font: var(--type-weight-semibold) var(--type-size-14)/var(--type-line-height-body) var(--type-family-body);
  letter-spacing: var(--type-tracking-14);
  white-space: nowrap;
  color: var(--color-ink);
  transition: color var(--duration-fast) var(--ease);
}
.menu__link:hover, .menu__link.is-hover { color: var(--color-ink-hover); }
.menu__link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; border-radius: 2px; }

.menu-toggle {
  display: none;
  width: 44px; height: 44px;
  margin-right: -10px;
  background: none; border: 0;
  color: var(--color-ink);
  cursor: pointer;
  position: relative;
}
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
  position: absolute; left: 11px; width: 22px; height: 2px;
  background: currentColor; border-radius: 1px;
  transition: transform var(--duration-base) var(--ease), opacity var(--duration-fast);
}
.menu-toggle span { top: 21px; }
.menu-toggle span::before, .menu-toggle span::after { content: ""; left: 0; }
.menu-toggle span::before { top: -7px; }
.menu-toggle span::after { top: 7px; }
.menu-toggle[aria-expanded="true"] span { background: transparent; }
.menu-toggle[aria-expanded="true"] span::before { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span::after { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--hero-pad-top) var(--hero-pad-x) var(--hero-pad-bottom);
}
.hero__grid {
  width: 100%;
  max-width: var(--hero-max-width);
  display: grid;
  grid-template-columns: var(--hero-columns);
  gap: var(--hero-gap);
}
.hero__main { display: flex; flex-direction: column; gap: var(--space-40); align-items: flex-start; }
.hero__copy { display: flex; flex-direction: column; gap: var(--space-24); width: 100%; }
.hero__title {
  font-family: var(--type-family-display);
  font-weight: var(--type-weight-regular);
  font-size: var(--type-size-h1);
  line-height: var(--type-line-height-h1);
  letter-spacing: var(--type-tracking-minus-1);
}
.hero__title em { font-style: normal; color: var(--color-accent); }
.hero__sub {
  font: var(--type-weight-medium) var(--type-size-18)/var(--type-line-height-28) var(--type-family-body);
  letter-spacing: var(--type-tracking-0);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-20); width: 100%; }
.hero__aside { min-height: 144px; } /* reserved column from the Figma layout */

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__aside { display: none; }
  .hero { --hero-pad-bottom: 11rem; }
  .skyline { height: clamp(260px, 52vw, 680px); --skyline-focus-x: var(--skyline-focus-x-small); bottom: calc((var(--skyline-offset) - var(--skyline-lift-tablet)) * -1); }
}

/* Accent button [Figma 102:12389]: the call to action (Contact form). Inter 600, 16 / 24, 16px padding, full width inside a form.
   Hover: lighter on a light surface (default), darker on a dark surface (add .btn-accent--on-dark). */
.btn-accent {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
  background: var(--color-cta);
  border: 1px solid var(--color-cta);
  border-radius: var(--radius-button);
  color: var(--color-cta-text);
  font: var(--type-weight-semibold) var(--type-size-16)/var(--type-line-height-24) var(--type-family-body);
  letter-spacing: var(--type-tracking-03);
  cursor: pointer;
  transition: background var(--duration-base) var(--ease), border-color var(--duration-base) var(--ease);
}
.btn-accent:hover, .btn-accent.is-hover { background: var(--color-cta-hover-light); border-color: var(--color-cta-hover-light); }
.btn-accent--on-dark:hover, .btn-accent--on-dark.is-hover { background: var(--color-cta-hover-dark); border-color: var(--color-cta-hover-dark); }
.btn-accent:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.btn-accent:disabled { opacity: 0.6; cursor: default; }

/* Text button: underlined link used for quiet actions (e.g. "Back to the homepage") */
.btn-text {
  font: var(--type-weight-semibold) var(--type-size-14)/var(--type-line-height-body) var(--type-family-body);
  letter-spacing: var(--type-tracking-14);
  color: var(--color-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color var(--duration-base) var(--ease);
}
.btn-text:hover, .btn-text.is-hover { color: var(--color-ink-hover); }
.btn-text:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; border-radius: 2px; }

/* ---------- Hamburger menu (1024px and below) ---------- */
@media (max-width: 1024px) {
  .menu-toggle { display: block; }
  .menu {
    position: absolute;
    top: var(--header-height);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-8) var(--header-padding-x) var(--space-24);
    background: var(--color-bg);
    box-shadow: 0 12px 24px rgba(23, 27, 32, 0.08);
    display: none;
  }
  .menu.is-open { display: flex; }
  .menu__link { padding: var(--space-16) 0; font-size: 16px; border-bottom: 1px solid rgba(23, 27, 32, 0.12); }
  .menu .btn--nav { margin-top: var(--space-16); padding: var(--space-12) var(--space-16); }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .header { --header-padding-x: 24px; }
  .logo { width: 148px; height: 18px; }
  .panel { transform: translateX(calc(var(--panel-progress) * var(--panel-shift-max) + var(--panel-nudge-mobile))); }
  .hero { --hero-pad-bottom: 13rem; }
  .hero__main { gap: var(--space-24); }
  .hero__sub { font-size: 16px; line-height: 24px; }
  .hero__actions { flex-direction: column; gap: var(--space-12); }
  .hero__actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Style page ---------- */
/* The light demo sections (key numbers, method, outputs, client cases, impact) use 60px padding here instead of the 100px / 120px of the live page. */
#motion-demo, #method-demo, #outputs-demo, #cases-demo, #impact-demo {
  --outputs-pad-x: min(60px, 6.944vw);
  --outputs-pad-y: min(60px, 8.333vw);
  --stats-pad-x: min(60px, 6.944vw);
  --stats-pad-y: min(60px, 8.333vw);
}
.sg { max-width: 1160px; margin: 0 auto; padding: var(--space-80) var(--space-24) var(--space-120); position: relative; z-index: 1; }
.sg__back { font-size: var(--type-size-14); font-weight: var(--type-weight-medium); }
.sg__back:hover { color: var(--color-accent); }
.sg h1 { font: var(--type-weight-regular) var(--type-size-h1)/var(--type-line-height-h1) var(--type-family-display); letter-spacing: var(--type-tracking-minus-1); margin: var(--space-24) 0 var(--space-12); }
.sg > h2 { font: var(--type-weight-semibold) 18px/28px var(--type-family-body); margin: var(--space-80) 0 var(--space-24); padding-bottom: var(--space-12); border-bottom: 1px solid rgba(23, 27, 32, 0.15); }
.sg .muted { opacity: 0.65; font-size: var(--type-size-14); line-height: 1.6; }
.sg code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-16); }
.sg-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* the six surfaces: 3 x 2 as in Figma */
@media (max-width: 640px) { .sg-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.swatch { border: 1px solid rgba(23, 27, 32, 0.15); border-radius: var(--radius-button); overflow: hidden; background: #fff; }
.swatch__chip { height: 88px; border-bottom: 1px solid rgba(23, 27, 32, 0.1); }
.swatch__meta { padding: var(--space-12); font-size: 13px; line-height: 1.4; }
.swatch__meta code { display: block; opacity: 0.6; margin-top: 2px; word-break: break-all; }
.sg-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-20); }
.type-row { display: grid; grid-template-columns: 200px 1fr; gap: var(--space-16); align-items: baseline; padding: var(--space-16) 0; border-bottom: 1px solid rgba(23, 27, 32, 0.1); }
.type-row code { opacity: 0.6; line-height: 1.5; }
.space-row { display: grid; grid-template-columns: 200px 1fr; gap: var(--space-16); align-items: center; padding: 6px 0; }
.space-row i { display: block; height: 12px; background: var(--color-accent); border-radius: 2px; max-width: 100%; }
.box { width: 96px; height: 96px; display: grid; place-items: center; background: #fff; border: 1px solid rgba(23, 27, 32, 0.15); font-size: 12px; }
.sg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sg-table th, .sg-table td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid rgba(23, 27, 32, 0.1); vertical-align: top; }
.sg-table th { font-weight: var(--type-weight-semibold); }
@media (max-width: 768px) {
  .type-row, .space-row { grid-template-columns: 1fr; gap: 4px; }
  .sg { padding-top: var(--space-40); }
}
