/* =========================================================
   Whitespace Solutions — Base (shared by every page)
   Tokens, reset, typography, layout, buttons, header,
   contact CTA and footer.
   ========================================================= */

/* ---------- Design tokens ---------- */
/* Colours and type scale match the live site (whitespace-web-lilac.vercel.app). */
:root {
  --ink: #15171a;
  --text: #3c4046;
  --muted: #62676e;
  --line: #e2e4e7;
  --line-strong: #c6cad0;
  --panel: #f4f5f6;
  --cell: #eef0f2;
  --cell-dark: #2b2e33;
  --orange: #f2902a;
  --orange-hover: #e07d14;
  --orange-deep: #a9520a;
  --orange-soft: #fff3e6;
  --night: #121417;
  --night-2: #1c1f23;
  --night-line: #2f3338;
  --night-text: #aab0b7;
  --night-muted: #8d939a;
  --white: #ffffff;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Fluid type scale */
  --step--1: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.06rem + 0.3vw, 1.3125rem);
  --step-2: clamp(1.375rem, 1.22rem + 0.7vw, 1.875rem);
  --step-3: clamp(1.75rem, 1.42rem + 1.5vw, 2.875rem);
  --step-4: clamp(2.25rem, 1.6rem + 3vw, 4.25rem);
  --step-5: clamp(2.5rem, 1.6rem + 4.2vw, 5.5rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --container: 1760px;
  --gutter: clamp(16px, 4vw, 72px);
  --section-space: clamp(48px, 6vw, 96px); /* 48px on phones; unchanged from ~1070px up */
  --head-space: clamp(48px, 6vw, 80px);
  --header-h: 76px;
  --tile-gap: 3px;
  /* Full screen height; use instead of 100svh so it still fills the screen under the zoom below */
  --screen-h: 100svh;
}

/* Desktop at 100% browser zoom looked too full: the whole site is drawn at 90%, as the browser's
   own 90% zoom would. Under zoom, 100svh only covers 90% of the screen, so --screen-h makes up
   for it. Phones and tablets keep 100%. */
@media (min-width: 1024px) {
  html {
    --page-zoom: 0.9;
    --screen-h: calc(100svh / var(--page-zoom));
    zoom: var(--page-zoom);
    /* The header stays at 100% (below), so in the page's zoomed pixels it is 76px / 0.9 tall */
    --header-h: calc(76px / var(--page-zoom));
  }

  /* Header and menu keep their full size: at 90% the menu read too small */
  .header {
    zoom: calc(1 / var(--page-zoom));
  }
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  line-height: 1.05;
  font-weight: 700;
}

/* ---------- Typography ---------- */
.display,
.title {
  font-stretch: 100%;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.display {
  font-size: var(--step-5);
  line-height: 0.98;
}

.title {
  font-size: var(--step-4);
  line-height: 1;
}

.subtitle {
  font-size: var(--step-2);
  font-stretch: 100%;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.lead {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--text);
}

.caption {
  font-stretch: 85%;
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Layout ---------- */
.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.section {
  padding-block: var(--section-space);
  border-top: 1px solid var(--line);
}

/* Title left, supporting text right */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

.split--head {
  align-items: end;
  margin-bottom: var(--head-space);
}

.split--head .lead {
  max-width: 480px;
  justify-self: end;
}

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border: 0;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn--dark {
  background: var(--ink);
  color: var(--white);
}

/* Header CTA. Hover: turns orange with ink text, as on the live site. */
.btn--dark {
  transition: background-color 0.25s var(--ease-out), color 0.25s var(--ease-out);
}

.btn--dark:hover,
.btn--dark:focus-visible {
  background: var(--orange);
  color: var(--ink);
}

/* Primary CTA. Hover: an ink panel wipes in from the left and the label turns white
   (on dark sections the panel is white and the label stays ink), as on the live site. */
.btn--orange {
  position: relative;
  isolation: isolate;
  padding: 18px 26px;
  font-size: 18px;
  background: var(--orange);
  color: var(--ink);
  transition: color 0.3s var(--ease-out);
}

.btn--orange::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}

.btn--orange:hover,
.btn--orange:focus-visible {
  color: var(--white);
}

.btn--orange:hover::before,
.btn--orange:focus-visible::before {
  transform: scaleX(1);
}

.dark .btn--orange::before {
  background: var(--white);
}

.dark .btn--orange:hover,
.dark .btn--orange:focus-visible {
  color: var(--ink);
}

.arrow {
  display: inline-block;
  transition: transform 0.45s var(--ease-out);
}

.btn:hover .arrow,
.link-arrow:hover span {
  transform: translateX(4px);
}

.link-underline {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--muted);
}

.link-arrow span {
  transition: transform 0.2s ease;
}

.link-arrow:hover {
  color: var(--ink);
}

/* ---------- Isometric illustrations (rendered by js/isometric.js) ---------- */
.iso svg {
  width: 100%;
  height: 100%;
}

.iso-svg {
  overflow: visible;
}

/* 3D versions (js/iso-gl.js): the canvas covers the svg exactly, and the svg stays as the size
   reference. The svg is hidden while three.js loads and comes back if WebGL fails. */
[data-gl] {
  position: relative;
}

.iso-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* events go to the area around it (e.g. hover on Home) */
}

[data-gl] > .iso-svg {
  visibility: hidden;
}

/* Assemble animation: each cube <g class="c"> slides from (--bx, --by) to (--ax, --ay).
   js/isometric.js sets data-on="false" on render and "true" once the svg is in view. */
.iso-svg .c {
  transform: translate(var(--ax), var(--ay));
  transition:
    transform 1.1s var(--ease-out) var(--d),
    opacity 0.5s linear var(--d);
}

.iso-svg[data-on="false"] .c {
  transform: translate(var(--bx), var(--by));
  opacity: var(--bo);
}

/* GSAP mode (js/motion.js adds html.gsap-motion): GSAP tweens --tx/--ty/--to on each cube,
   so the CSS transition above is switched off. */
.gsap-motion .iso-svg[data-on] .c {
  transform: translate(var(--tx, var(--ax)), var(--ty, var(--ay)));
  opacity: var(--to, 1);
  transition: none;
}

@media print {
  .iso-svg[data-on="false"] .c {
    transform: translate(var(--ax), var(--ay));
    opacity: 1;
  }
}

/* ---------- Header ----------
   After nalarx.com: at the top of the page a plain full-width header; once the page scrolls
   (js/site.js adds .is-scrolled) it narrows into one floating rounded bar. The header itself has no
   background; .is-dark (added while a dark band — .section--dark, .dark — sits under it) switches the
   bar, text, button and logo to their dark versions. */
.header {
  --hb-bg: rgba(255, 255, 255, 0.86);
  --hb-line: rgba(21, 23, 26, 0.08);
  --hb-shadow: 0 10px 30px -12px rgba(21, 23, 26, 0.18);
  --hb-text: var(--text);
  --hb-strong: var(--ink);
  --hb-btn-bg: var(--ink);
  --hb-btn-text: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: 10px;
  color: var(--hb-text);
}

.header.is-dark {
  --hb-bg: rgba(32, 36, 42, 0.8);
  --hb-line: rgba(255, 255, 255, 0.09);
  --hb-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --hb-text: #c3c8ce;
  --hb-strong: var(--white);
  --hb-btn-bg: rgba(255, 255, 255, 0.1);
  --hb-btn-text: var(--white);
}

/* --header-h (76px) = 10px above + 60px bar + 6px below.
   At the top the bar is invisible and spans the container, so logo and button line up with the page. */
.header__inner {
  --ease-bar: cubic-bezier(0.65, 0, 0.35, 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(16px, 2vw, 40px);
  min-height: 60px;
  margin-bottom: 6px;
  padding: 7px 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  transition:
    width 0.5s var(--ease-bar),
    padding 0.5s var(--ease-bar),
    background-color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

/* Scrolled: the bar narrows by --bar-inset on each side and stays centred */
.header.is-scrolled .header__inner {
  --bar-inset: clamp(0px, 5vw, 96px);
  width: min(100% - 2 * var(--gutter) - 2 * var(--bar-inset), var(--container) - 2 * var(--bar-inset));
  padding-inline: clamp(16px, 2vw, 28px) 7px;
}

/* The glass sits on a pseudo-element, not on the bar itself: an element with backdrop-filter
   would stop the Services dropdown (its child) from blurring the page behind it. */
.header__inner::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: var(--hb-bg);
  border: 1px solid var(--hb-line);
  box-shadow: var(--hb-shadow);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  opacity: 0;
  transition: opacity 0.35s ease, background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
  pointer-events: none;
}

.header.is-scrolled .header__inner::before {
  opacity: 1;
}

/* Logo files: assets/images/brand/logo.svg (light bg) and logo-white.svg (dark bg).
   The header carries both and cross-fades between them. */
.logo {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.header .logo img {
  transition: opacity 0.35s ease;
}

.logo .logo__on-dark {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.header.is-dark .logo__on-light {
  opacity: 0;
}

.header.is-dark .logo__on-dark {
  opacity: 1;
}

.logo img {
  width: auto;
  height: 39px;
}

.header .logo img {
  height: 34px;
}

/* Header type and sizes follow the live site: 15px / 550, 44px tall hit areas */
.nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Links sit in the middle of the bar, the button at its right end */
@media (min-width: 901px) {
  .nav {
    flex: 1;
    justify-content: space-between;
  }

  .nav__list {
    margin-inline: auto;
  }
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 550;
  color: var(--hb-text);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.25s ease;
}

.header .btn {
  min-height: 44px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 550;
  letter-spacing: normal;
  border-radius: 999px;
}

.header .btn--dark {
  background: var(--hb-btn-bg);
  color: var(--hb-btn-text);
  box-shadow: inset 0 0 0 1px var(--hb-line);
  transition: background-color 0.35s ease, color 0.35s ease;
}

.header .btn--dark:hover {
  background: var(--orange);
  color: var(--ink);
}

/* Current page: the link turns orange. "Services" is a button, so the service pages mark it
   with .is-current instead. */
.nav__link:hover {
  color: var(--hb-strong);
}

.nav__link[aria-current="page"],
.nav__link.is-current {
  color: var(--orange);
}

.nav__link svg {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

/* Practices panel: 2×2 grid of name + summary, hung just below the header and aligned to the
   container's right edge (same as the live site). The 1px gap shows the --line background as rules. */
.header__inner {
  position: relative;
}

.nav__dropdown {
  position: static;
}

.nav__menu {
  position: absolute;
  top: calc(100% - 4px);
  right: 0;
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  width: min(600px, 100%);
  background: var(--line);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 40px -18px rgba(21, 23, 26, 0.28);
}

.nav__dropdown.is-open .nav__menu {
  display: grid;
}

.nav__dropdown.is-open .nav__link svg {
  transform: rotate(180deg);
}

.nav__menu a {
  display: block;
  height: 100%;
  padding: 18px 18px 20px;
  font-size: 0.9375rem;
  background: var(--white);
  color: var(--ink);
  transition: background-color 0.25s;
}

/* Odd number of items: the last one spans the full row */
.nav__menu li:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.nav__menu a:hover {
  background: var(--panel);
}

.nav__menu strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 650;
  font-stretch: 100%;
}

.nav__menu span {
  display: block;
  font-size: var(--step--1);
  line-height: 1.45;
  color: var(--muted);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav__toggle span {
  width: 22px;
  height: 2px;
  background: var(--hb-strong);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Contact CTA & footer (dark) ---------- */
.dark {
  background: var(--night);
  color: var(--night-text);
}

.dark h2,
.dark h4 {
  color: var(--white);
}

.contact {
  padding-top: var(--section-space);
}

.contact__hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
}

.contact__box {
  max-width: 720px;
  padding: clamp(32px, 4vw, 56px);
  border: 1.5px solid var(--orange);
}

.contact__box p {
  max-width: 440px;
  margin: 28px 0 36px;
  font-size: 18px;
}

.contact__art {
  width: 100%;
}

.footer a:hover {
  color: var(--orange);
}

.footer {
  padding-block: 96px 32px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.7fr 1fr;
  gap: 48px;
}

.footer__brand p {
  max-width: 320px;
  margin-top: 20px;
  font-size: 15px;
}

.footer h4 {
  margin-bottom: 18px;
  font-size: 15px;
  font-weight: 600;
}

.footer ul {
  display: grid;
  gap: 10px;
  font-size: 15px;
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--night-line);
  font-size: 13px;
  color: var(--night-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  :root {
    --header-h: 64px;
  }

  /* 8px above + 52px bar + 4px below */
  .header {
    padding-top: 8px;
  }

  .header__inner {
    min-height: 52px;
    margin-bottom: 4px;
    padding-block: 4px;
  }

  .header.is-scrolled .header__inner {
    --bar-inset: 0px;
    padding-inline: 16px 6px;
  }

  .header .logo img {
    height: 30px;
  }

  .nav__toggle {
    display: flex;
  }

  .nav .nav__link {
    color: var(--text);
  }

  .nav .nav__link:hover {
    color: var(--ink);
  }

  .nav .nav__link[aria-current="page"],
  .nav .nav__link.is-current {
    color: var(--orange);
  }

  .nav .btn--dark {
    background: var(--ink);
    color: var(--white);
  }

  /* Menu panel: a rounded card hung under the bar, as wide as the bar */
  .nav {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    max-height: calc(100svh - var(--header-h) - 24px);
    overflow-y: auto;
    padding: 12px 20px 24px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 18px 40px -18px rgba(21, 23, 26, 0.28);
  }

  .nav.is-open {
    display: flex;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav__list > li > .nav__link {
    width: 100%;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }

  .nav__menu {
    position: static;
    width: auto;
    grid-template-columns: 1fr;
    gap: 0;
    background: var(--white);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .nav__menu a {
    padding: 14px 0 14px 16px;
    border-bottom: 1px solid var(--line);
  }

  .nav .btn {
    justify-content: center;
  }

  .split {
    grid-template-columns: 1fr;
    gap: 32px;
  }


  .split--head .lead {
    justify-self: start;
  }

  .contact__hero {
    grid-template-columns: 1fr;
  }

  .contact__art {
    max-width: 520px;
    margin-inline: auto;
  }
}

@media (max-width: 600px) {
  .footer__grid {
    grid-template-columns: 1fr;
  }

  .btn--orange {
    font-size: 16px;
    padding: 16px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
