/* =========================================================
   رایان پایش — Smart building website
   0. Font   1. Tokens   2. Base   3. Layout & utilities   4. Buttons
   5. Header & nav   6. Hero   7. Sections   8. Systems
   9. About   10. Services   11. Process   12. Projects   12b. CTA band
   13. FAQ   14. Contact & form   15. Footer   16. Motion prefs
   17. Depth (tilt, parallax)
   ========================================================= */

/* 0. Font: IRANYekanX (FaNum: digits render in Persian) ---- */
@font-face {
  font-family: "IRANYekanX";
  src: url("assets/fonts/IRANYekanXFaNum-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANYekanX";
  src: url("assets/fonts/IRANYekanXFaNum-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANYekanX";
  src: url("assets/fonts/IRANYekanXFaNum-DemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANYekanX";
  src: url("assets/fonts/IRANYekanXFaNum-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANYekanX";
  src: url("assets/fonts/IRANYekanXFaNum-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* 1. Tokens ------------------------------------------------ */
:root {
  --dusk: #0E2236;          /* evening sky, primary dark */
  --dusk-2: #132C45;
  --glass: #23476A;         /* facade glass */
  --concrete: #DDE2E5;      /* facade panels */
  --paper: #EEF1F2;         /* cool light background */
  --white: #FFFFFF;
  --ink: #0F1E2C;
  --muted: #536474;
  --muted-dark: #A3B6C8;    /* secondary text on dusk */
  --signal: #21C6FD;        /* logo cyan: data, systems */
  --signal-ink: #04709B;    /* cyan for text on light bg */
  --lamp: #F2C46D;          /* warm interior light: "on" state */
  --danger: #E0675A;

  --line-light: rgba(15, 30, 44, 0.14);
  --line-dark: rgba(255, 255, 255, 0.14);

  --font-body: "IRANYekanX", Tahoma, "Segoe UI", sans-serif;
  --font-display: var(--font-body);

  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.25rem;
  --fs-lg: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  --fs-xl: clamp(2.25rem, 1.3rem + 4.4vw, 4.5rem);

  --container: 1240px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(4.5rem, 9vw, 8rem);
  --header-h: 72px;
  --radius: 4px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* 2. Base -------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.9;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.nav-open { overflow: hidden; }

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

img { height: auto; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.45;
}

p { margin: 0; }

a { color: inherit; }

ul, ol { margin: 0; padding: 0; list-style: none; }

figure { margin: 0; }

address { font-style: normal; }

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

::selection { background: var(--signal); color: var(--dusk); }

/* 3. Layout & utilities ------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--white);
  color: var(--ink);
  border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--font-body);
  font-weight: 500;
}

/* 4. Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.6rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 700 1rem/1.4 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.btn--primary { background: var(--signal); color: var(--dusk); }
.btn--primary:hover { background: #5AD6FF; }

.btn--ghost {
  min-height: 44px;
  padding-inline: 1.1rem;
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--white);
}
.btn--ghost:hover { border-color: var(--signal); color: var(--signal); }

/* 5. Header & nav ------------------------------------------ */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  color: var(--white);
  transition: background-color 0.3s, box-shadow 0.3s;
}

.site-header.is-scrolled,
body.nav-open .site-header {
  background: rgba(14, 34, 54, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--line-dark);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand__logo { width: 40px; height: 40px; }

.brand__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1;
}

.site-nav { margin-inline-start: auto; }

.site-nav__list {
  display: flex;
  gap: 0.25rem;
}

.site-nav__list a {
  display: block;
  padding: 0.5rem 0.8rem;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  transition: color 0.2s;
}
.site-nav__list a:hover { color: var(--signal); }

.site-nav__cta-mobile { display: none; }

.nav-toggle {
  display: none;
  position: relative;
  width: 48px;
  height: 48px;
  margin-inline-start: auto;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  color: var(--white);
  cursor: pointer;
}

.nav-toggle__bar {
  position: absolute;
  left: 13px;
  right: 13px;
  height: 2px;
  background: currentColor;
  transition: transform 0.25s var(--ease);
}
.nav-toggle__bar:nth-of-type(2) { top: 19px; }
.nav-toggle__bar:nth-of-type(3) { top: 27px; }

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-of-type(2) { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-of-type(3) { transform: translateY(-4px) rotate(-45deg); }

@media (max-width: 1023px) {
  .site-header__cta { display: none; }
  .nav-toggle { display: block; flex-shrink: 0; }

  /* Keep the fixed mobile menu relative to the viewport, not a filtered header. */
  body.nav-open .site-header {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--dusk);
  }

  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    margin-inline-start: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1.25rem;
    padding: 0.75rem var(--gutter) calc(1rem + env(safe-area-inset-bottom));
    background: var(--dusk);
    overflow-y: auto;
    overscroll-behavior: contain;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s 0.25s;
  }

  body.nav-open .site-nav {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }

  .site-nav__list { flex-direction: column; gap: 0; flex-shrink: 0; }

  .site-nav__list a {
    padding: 0.65rem 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--white);
    border-bottom: 1px solid var(--line-dark);
    border-radius: 0;
  }

  .site-nav__cta-mobile { display: flex; width: 100%; flex-shrink: 0; }
}

/* 6. Hero: scroll-scrubbed video ---------------------------
   The section is tall; a sticky stage holds a canvas that script.js
   paints frame by frame from scroll position. --reveal (0→1) fades
   the slogan in on the last frame. Without JS: one screen showing
   the last frame with the slogan.                                  */
.hero {
  position: relative;
  color: var(--white);
  background: #07131F;
}

.js .hero { height: 400vh; }

.hero__stage {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.js .hero__stage {
  position: sticky;
  top: 0;
}

/* Keeps the transparent header readable over any frame */
.hero__stage::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  height: 140px;
  background: linear-gradient(to bottom, rgba(7, 19, 31, 0.55), transparent);
  pointer-events: none;
}

.hero__canvas,
.hero__fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__fallback { object-fit: cover; }

.hero__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 19, 31, 0.88) 0%, rgba(7, 19, 31, 0.4) 40%, rgba(7, 19, 31, 0) 68%);
  opacity: var(--reveal, 1);
  pointer-events: none;
}

.hero__end {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  padding: 0 var(--gutter) calc(clamp(3rem, 11vh, 7rem) + env(safe-area-inset-bottom));
  text-align: center;
  opacity: var(--reveal, 1);
  transform: translateY(calc((1 - var(--reveal, 1)) * 28px));
}

.js .hero__shade,
.js .hero__end { opacity: var(--reveal, 0); }

.hero__title {
  font-size: var(--fs-xl);
  font-weight: 800;
  line-height: 1.35;
  text-shadow: 0 2px 30px rgba(7, 19, 31, 0.5);
}

.hero__brand {
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 1.1vw, 1.9rem);
  font-weight: 700;
  color: var(--signal);
}

/* Wordless scroll hint, fades out as soon as scrolling starts */
.hero__scroll-cue {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(1.75rem + env(safe-area-inset-bottom));
  z-index: 2;
  width: 26px;
  height: 42px;
  margin-left: -13px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  opacity: calc(1 - var(--cue, 0));
  pointer-events: none;
}

.js .hero__scroll-cue { display: block; }

.hero__scroll-cue::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--white);
  animation: cue 1.6s var(--ease) infinite;
}

@keyframes cue {
  0% { transform: translateY(0); opacity: 1; }
  80% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

@media (max-width: 767px) {
  .js .hero { height: 320vh; }
}

/* 7. Sections ---------------------------------------------- */
.section { padding-block: var(--section-y); }

.section--paper { background: var(--paper); }
.section--white { background: var(--white); }
.section--dusk { background: var(--dusk); color: var(--white); }

.section-head {
  max-width: 44rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-title {
  font-size: var(--fs-lg);
  font-weight: 800;
  line-height: 1.45;
  text-wrap: balance; /* no single word left alone on the last line */
}

.section-lead {
  max-width: 38em;
  margin-top: 1rem;
  color: var(--muted);
}

.section--dusk .section-lead { color: var(--muted-dark); }

/* 8. Systems (interactive building) ------------------------ */
.systems__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.systems__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
}

.systems__tab {
  min-height: 44px;
  padding: 0.45rem 1rem;
  font: 500 0.95rem/1.4 var(--font-body);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-light);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.systems__tab:hover { border-color: var(--dusk); }
.systems__tab[aria-selected="true"] {
  background: var(--dusk);
  border-color: var(--dusk);
  color: var(--white);
}

.systems__panels { margin-top: 2rem; min-height: 15rem; }

.systems__panel h3 { font-size: var(--fs-md); }
.systems__panel > p { margin-top: 0.5rem; color: var(--muted); }
.systems__panel:focus-visible { outline-offset: 8px; }

.check-list { margin-top: 1.25rem; }

.check-list li {
  position: relative;
  padding-block: 0.6rem;
  padding-inline-start: 1.75rem;
  border-top: 1px solid var(--line-light);
}

.check-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.2rem;
  top: 1.35rem;
  width: 8px;
  height: 8px;
  background: var(--signal);
  border-radius: 50%;
}

.systems__caption {
  margin-top: 0.75rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* Building photo with system overlays (coordinates match the 1254×1254 photo) */
.building {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--concrete);
  aspect-ratio: 1 / 1;
}

.building__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.5s var(--ease);
}

/* Lighting view cross-fades to the same building with its lights on; other views dim slightly */
.building__photo--lit {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}
.building[data-active="lights"] .building__photo--lit { opacity: 1; }
.building:not([data-active="lights"]) .building__photo { filter: saturate(0.75) brightness(0.88); }

.building__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.layer {
  opacity: 0;
  transition: opacity 0.45s var(--ease);
}

.building[data-active="climate"] .layer--climate,
.building[data-active="access"] .layer--access,
.building[data-active="cameras"] .layer--cameras,
.building[data-active="energy"] .layer--energy { opacity: 1; }

/* Plain tint (no blend mode): the overlay is transformed for depth, which isolates blending */
.tint { fill: var(--signal); opacity: 0.2; }

.tag rect,
.label rect { fill: var(--dusk); opacity: 0.92; }
.tag text { fill: var(--white); font: 700 32px var(--font-body); }
.label text { fill: var(--white); font: 700 34px var(--font-body); }
.tag--energy text { direction: ltr; unicode-bidi: isolate; }

.pin { fill: var(--signal); stroke: var(--white); stroke-width: 4; }
.pin-ring { fill: none; stroke: var(--signal); stroke-width: 4; }

.cone { fill: url(#g-cone); }
.cam { fill: var(--dusk); stroke: var(--white); stroke-width: 3; }
.cam-lens { fill: var(--signal); }

.meter { fill: var(--dusk); stroke: var(--white); stroke-width: 3; }
.meter-screen { fill: var(--signal); }
.flow {
  fill: none;
  stroke: var(--signal);
  stroke-width: 7;
  stroke-dasharray: 18 14;
  stroke-linecap: round;
}
.flow--thin { stroke-width: 5; stroke-dasharray: none; }

.building[data-active="energy"] .flow { animation: flow 1.2s linear infinite; }
.building[data-active="access"] .pin-ring { animation: pulse 1.8s var(--ease) infinite; transform-box: fill-box; transform-origin: center; }

@keyframes flow { to { stroke-dashoffset: -64; } }
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}

@media (max-width: 959px) {
  .systems__grid { grid-template-columns: minmax(0, 1fr); }
  .systems__figure { order: -1; }
  .systems__intro { display: contents; }
  .systems__intro > .section-title { order: -3; }
  .systems__intro > .section-lead { order: -2; margin-bottom: 0.5rem; }
  .systems__tabs { margin-top: 0; }
  .systems__panels { margin-top: 0; min-height: 0; }
}

@media (max-width: 599px) {
  .systems__tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .systems__tab:last-child { grid-column: 1 / -1; }
}

/* 9. About ------------------------------------------------ */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 2.5rem clamp(2.5rem, 6vw, 6rem);
  align-items: center;
}

/* Desktop: photos on the right (first RTL column), text on the left.
   Text stays first in the HTML so it is read first and comes first on mobile. */
.about__collage { grid-column: 1; grid-row: 1; }
.about__text { grid-column: 2; grid-row: 1; }
.about__text > p:not(.about__statement) { text-align: justify; }

.about__text > p:not(.about__statement) {
  max-width: 34em;
  margin-top: 1rem;
  color: var(--muted);
}

.about__statement {
  margin: 1.25rem 0 1.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 1rem + 1.2vw, 1.85rem);
  font-weight: 500;
  line-height: 1.7;
  color: var(--signal-ink);
}

/* About photo: a single image, inset slightly from the right to keep air around it */
.about__collage { padding-bottom: 2%; }

.about__img { display: block; object-fit: cover; }

.about__img--main {
  width: 92%;
  margin-inline-start: 8%;
  aspect-ratio: 3 / 2;
  border-radius: 20px;
  box-shadow: 0 16px 44px -24px rgba(14, 34, 54, 0.28);
}

.about__principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  margin: clamp(3rem, 6vw, 5rem) 0 0;
}

.about__principles > div {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-light);
}

.about__principles dt {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.about__principles dd {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--muted);
}

@media (max-width: 959px) {
  .about__grid { grid-template-columns: minmax(0, 1fr); }
  .about__collage,
  .about__text { grid-column: auto; grid-row: auto; }
}

@media (max-width: 599px) {
  .about__img--main { border-radius: 14px; }
}

@media (max-width: 767px) {
  .about__principles { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
}

/* 10. Services: dark grid with a pointer spotlight -----------
   The grid's 1px gaps show the list's background, so the lines are
   painted by .services__grid itself. script.js §11 sets --x/--y on
   the grid (pointer position) and --cx/--cy on each cell, so:
     • grid lines near the pointer glow cyan
     • a soft light sits inside the cell under the pointer
   Cells also rise in once, one after another, when the grid first
   scrolls into view (.is-revealed). On touch screens the cell in the
   middle of the screen gets .is-current, styled like :hover.        */
.services__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem 4rem;
  align-items: end;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.services__head .section-lead { margin-top: 0; }

.services__grid {
  --x: -9999px;
  --y: -9999px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(360px circle at var(--x) var(--y), rgba(33, 198, 253, 0.75), transparent 45%),
    rgba(255, 255, 255, 0.09);
}

.service {
  --cx: -9999px;
  --cy: -9999px;
  position: relative;
  padding: clamp(1.75rem, 3vw, 2.5rem);
  background: var(--dusk);
  overflow: hidden;
  isolation: isolate;
}

/* Inner light under the pointer */
.service::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(420px circle at var(--cx) var(--cy), rgba(33, 198, 253, 0.1), transparent 55%);
}

/* Accent line that draws across the top of the hovered cell (from the right, RTL) */
.service::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(to left, var(--signal), rgba(33, 198, 253, 0));
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.5s var(--ease);
}

.service:hover::after,
.service.is-current::after { transform: scaleX(1); }

.service__icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(33, 198, 253, 0.35);
  border-radius: 15px;
  background: rgba(33, 198, 253, 0.08);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease),
              box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}

.service__icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--signal);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.35s var(--ease);
}

.service:hover .service__icon,
.service.is-current .service__icon {
  background: var(--signal);
  border-color: var(--signal);
  box-shadow: 0 0 0 6px rgba(33, 198, 253, 0.12), 0 10px 30px -6px rgba(33, 198, 253, 0.6);
  transform: translateY(-4px);
}

.service:hover .service__icon svg,
.service.is-current .service__icon svg { stroke: var(--dusk); }

.service__title {
  margin-top: 1.4rem;
  font-size: 1.15rem;
}

.service__desc {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--muted-dark);
  transition: color 0.35s var(--ease);
}

.service:hover .service__desc,
.service.is-current .service__desc { color: rgba(255, 255, 255, 0.86); }

/* One-time staggered entrance (only when JS is running) */
.js .services__grid .service {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}

.js .services__grid.is-revealed .service {
  opacity: 1;
  transform: none;
}

@media (max-width: 959px) {
  .services__head { grid-template-columns: minmax(0, 1fr); }
  .services__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 599px) {
  .services__grid { grid-template-columns: minmax(0, 1fr); border-radius: 14px; }
}

/* 11. Process: scroll-driven timeline ----------------------
   Without JS every step is lit. script.js adds .is-enhanced (dims
   steps that are not reached yet) and, on desktop, .is-scroll-driven
   (tall section + sticky stage so scrolling advances the line).   */
.process {
  position: relative;
  color: var(--ink);
  background: var(--paper);
}

.process__sticky { padding-block: var(--section-y); }

.process.is-scroll-driven { height: 260vh; }

.process.is-scroll-driven .process__sticky {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding-block: calc(var(--header-h) + 2rem) 3rem;
}


.process__timeline { position: relative; }

/* Track + fill; position is measured by script.js, CSS gives the desktop fallback */
.process__line {
  position: absolute;
  top: 69px;
  inset-inline: 10%;
  height: 2px;
  background: rgba(15, 30, 44, 0.12);
  pointer-events: none;
}

.process__line-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, var(--signal), #7FE3FF);
  box-shadow: 0 0 10px rgba(33, 198, 253, 0.45);
  transform: scaleX(var(--fill, 1));
  transform-origin: right center;
  transition: transform 0.25s linear;
}

.process__steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.5rem;
  text-align: center;
}

.process__step {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.process__num {
  height: 20px;
  margin-bottom: 14px;
  font: 500 0.8rem/20px var(--font-body);
  color: var(--signal-ink);
}

.process__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border: 1.5px solid var(--signal);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 6px rgba(33, 198, 253, 0.1), 0 6px 24px rgba(33, 198, 253, 0.3);
}

.process__icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--signal-ink);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.process__title {
  margin-top: 1.5rem;
  font-size: var(--fs-md);
  font-weight: 800;
}

.process__en {
  margin-top: 0.15rem;
  font: 500 0.72rem/1.6 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--signal-ink);
}

.process__desc {
  max-width: 15rem;
  margin-top: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--muted);
}

/* State change between dim and lit */
.process__num,
.process__icon,
.process__icon svg,
.process__title,
.process__en,
.process__desc {
  transition: color 0.5s var(--ease), opacity 0.5s var(--ease), border-color 0.5s var(--ease),
              box-shadow 0.5s var(--ease), stroke 0.5s var(--ease);
}

.process.is-enhanced .process__step:not(.is-active) .process__icon {
  border-color: var(--line-light);
  box-shadow: none;
}
.process.is-enhanced .process__step:not(.is-active) .process__icon svg { stroke: rgba(15, 30, 44, 0.3); }
.process.is-enhanced .process__step:not(.is-active) .process__title { color: rgba(15, 30, 44, 0.35); }
.process.is-enhanced .process__step:not(.is-active) .process__en,
.process.is-enhanced .process__step:not(.is-active) .process__num,
.process.is-enhanced .process__step:not(.is-active) .process__desc { opacity: 0.35; }

/* Below 1024px: a vertical timeline, steps light up as they reach mid-screen */
@media (max-width: 1023px) {
  .process__line {
    top: 36px;
    inset-inline: 36px auto;
    width: 2px;
    height: auto;
    bottom: 0;
  }

  .process__line-fill {
    transform: scaleY(var(--fill, 1));
    transform-origin: center top;
  }

  .process__steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
    text-align: start;
  }

  .process__step {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    column-gap: 1.25rem;
    align-items: start;
  }

  .process__icon { grid-column: 1; grid-row: 1 / span 4; }

  .process__num,
  .process__title,
  .process__en,
  .process__desc { grid-column: 2; }

  .process__num { grid-row: 1; margin: 0; justify-self: start; }
  .process__title { margin-top: 0.1rem; }
  .process__en { justify-self: start; }
  .process__desc { max-width: 30rem; margin-top: 0.4rem; }
}

/* 12. Projects: expanding cards ---------------------------
   Desktop: a row of six cards. The active card (first by default)
   is wide; hovering a card widens it and keeps the rest equal.
   Below 1024px: a vertical stack; tapping a card opens it.       */
/* Spacing between cards lives inside each card (not a flex gap), so the
   pointer is always over some card and the hover state never flickers. */
.project-cards {
  display: flex;
  height: clamp(440px, 62vh, 560px);
  margin-inline: -6px;
}

.project-card {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  color: var(--white);
  cursor: pointer;
  outline: none;
  transition: flex-grow 0.6s var(--ease), height 0.5s var(--ease);
}

.project-card__frame {
  position: absolute;
  inset: 0 6px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--dusk);
}

.project-card:focus-visible .project-card__frame { outline: 3px solid var(--signal); outline-offset: 3px; }

.project-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}

.project-card__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(14, 34, 54, 0.95) 0%, rgba(14, 34, 54, 0.7) 40%, rgba(14, 34, 54, 0.1) 75%);
  pointer-events: none;
}

.project-card__body {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  padding: 1.25rem 1rem;
}

.project-card__title {
  font-size: 1rem;
  line-height: 1.6;
}

.project-card__title span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted-dark);
}

/* Details keep a fixed width so text does not re-wrap while the card animates */
.project-card__details {
  width: min(26rem, calc(100vw - 5rem));
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s var(--ease), max-height 0.5s var(--ease);
}

.project-card__details > p {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.85);
}

.project-card__specs { margin: 1rem 0 0; }

.project-card__specs > div {
  display: flex;
  gap: 1rem;
  padding-block: 0.45rem;
  font-size: 0.9rem;
  border-top: 1px solid var(--line-dark);
}

.project-card__specs dt { min-width: 4.5rem; color: var(--muted-dark); }
.project-card__specs dd { margin: 0; font-weight: 500; }

/* Expanded state */
.project-card.is-active { flex-grow: 4; }
.project-card.is-active .project-card__body { padding: 2rem; }
.project-card.is-active .project-card__title { font-size: 1.5rem; }
.project-card.is-active .project-card__details {
  max-height: 22rem;
  opacity: 1;
  transition-delay: 0.2s;
}

/* Hover takes over from the active card on pointer devices */
@media (hover: hover) and (min-width: 1024px) {
  .project-cards:has(.project-card:hover) .project-card { flex-grow: 1; }
  .project-cards:has(.project-card:hover) .project-card:hover { flex-grow: 4; }
  .project-card:hover .project-card__img { transform: scale(1.04); }

  .project-cards:has(.project-card:hover) .project-card:not(:hover) .project-card__body { padding: 1.25rem 1rem; }
  .project-cards:has(.project-card:hover) .project-card:not(:hover) .project-card__title { font-size: 1rem; }
  .project-cards:has(.project-card:hover) .project-card:not(:hover) .project-card__details {
    max-height: 0;
    opacity: 0;
    transition-delay: 0s;
  }

  .project-card:hover .project-card__body { padding: 2rem; }
  .project-card:hover .project-card__title { font-size: 1.5rem; }
  .project-card:hover .project-card__details {
    max-height: 22rem;
    opacity: 1;
    transition-delay: 0.2s;
  }
}

@media (max-width: 1023px) {
  .project-cards {
    flex-direction: column;
    height: auto;
    margin: -6px 0;
  }

  .project-card__frame { inset: 6px 0; }

  .project-card {
    flex: none;
    height: 104px;
  }

  .project-card__frame::after { background: linear-gradient(to top, rgba(14, 34, 54, 0.92) 0%, rgba(14, 34, 54, 0.6) 100%); }

  .project-card__body { padding: 1rem 1.25rem; }


  .project-card.is-active { height: clamp(432px, 72vw, 532px); }
  .project-card.is-active .project-card__frame::after { background: linear-gradient(to top, rgba(14, 34, 54, 0.96) 0%, rgba(14, 34, 54, 0.88) 60%, rgba(14, 34, 54, 0.2) 100%); }
  .project-card.is-active .project-card__body { padding: 1.5rem 1.25rem; }
  .project-card.is-active .project-card__title { font-size: 1.3rem; }
}

/* 12b. CTA band --------------------------------------------- */
.cta-band {
  position: relative;
  display: flex;
  align-items: center;
  min-height: clamp(420px, 64vh, 620px);
  padding-block: 4rem;
  overflow: hidden;
  color: var(--white);
  background: var(--dusk);
  isolation: isolate;
}

/* Image is taller than the band so script.js §10 can shift it with scroll */
.cta-band__media {
  position: absolute;
  inset: -12% 0;
  z-index: -2;
}

.cta-band__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
  will-change: transform;
}

.cta-band::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Light shading only behind the text so the photo reads across the whole row */
  background: linear-gradient(to left, rgba(7, 19, 31, 0.84) 0%, rgba(7, 19, 31, 0.62) 34%, rgba(7, 19, 31, 0.22) 55%, rgba(7, 19, 31, 0) 72%);
}

.cta-band__title {
  max-width: 14em;
  text-shadow: 0 2px 24px rgba(7, 19, 31, 0.6);
  text-wrap: balance;
  font-size: var(--fs-lg);
  font-weight: 800;
  line-height: 1.45;
}

.cta-band__text {
  max-width: 30em;
  text-shadow: 0 1px 12px rgba(7, 19, 31, 0.8);
  margin: 1rem 0 2rem;
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 767px) {
  .cta-band::before { background: linear-gradient(to top, rgba(7, 19, 31, 0.94) 0%, rgba(7, 19, 31, 0.75) 55%, rgba(7, 19, 31, 0.35) 100%); }
  .cta-band { align-items: flex-end; }
  .cta-band .btn { width: 100%; }
}

/* 13. FAQ -------------------------------------------------- */
.faq__grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: 2rem clamp(2rem, 6vw, 6rem);
  align-items: start;
}

.faq__list { border-bottom: 1px solid var(--line-light); }

.faq__item { border-top: 1px solid var(--line-light); }

.faq__item summary {
  position: relative;
  display: block;
  padding-block: 1.25rem;
  padding-inline-end: 2.5rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.faq__item summary::-webkit-details-marker { display: none; }

.faq__item summary::before,
.faq__item summary::after {
  content: "";
  position: absolute;
  inset-inline-end: 0.35rem;
  top: 50%;
  width: 14px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s var(--ease);
}
.faq__item summary::after { transform: rotate(90deg); }
.faq__item[open] summary::after { transform: rotate(0deg); }

.faq__item summary:hover { color: var(--signal-ink); }

.faq__item p {
  max-width: 40em;
  padding-bottom: 1.5rem;
  color: var(--muted);
}

@media (max-width: 959px) {
  .faq__grid { grid-template-columns: minmax(0, 1fr); }
}

/* 14. Contact & form --------------------------------------- */
.contact { background: var(--dusk-2); }

.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  gap: clamp(2.5rem, 6vw, 6rem);
}

.contact__info { margin-top: 2.5rem; }

.contact__info p {
  display: flex;
  gap: 1rem;
  padding-block: 0.8rem;
  border-top: 1px solid var(--line-dark);
}

.contact__info span {
  min-width: 3.5rem;
  color: var(--muted-dark);
}

.contact__info a {
  text-decoration: none;
  overflow-wrap: anywhere;
}
.contact__info a:hover { color: var(--signal); }

.contact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--dusk);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
}

.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field--full { grid-column: 1 / -1; }

.field label { font-size: 0.95rem; font-weight: 500; }
.field__optional { color: var(--muted-dark); font-weight: 400; }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.9rem;
  font: 400 1rem/1.6 var(--font-body);
  color: var(--white);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  transition: border-color 0.2s, background-color 0.2s;
}

.field input[dir="ltr"] { text-align: left; }

.field textarea { resize: vertical; min-height: 7rem; }

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted-dark) 50%), linear-gradient(135deg, var(--muted-dark) 50%, transparent 50%);
  background-position: 1.1rem 50%, 1.45rem 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
.field select option { color: var(--ink); background: var(--white); }

.field input::placeholder,
.field textarea::placeholder { color: rgba(255, 255, 255, 0.4); }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--signal);
  background-color: rgba(255, 255, 255, 0.08);
}

.field input[aria-invalid="true"] { border-color: var(--danger); }

.field__error {
  font-size: var(--fs-sm);
  color: #FFB1A8;
}

.contact-form__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 0.5rem;
}

.contact-form__status { font-size: 0.95rem; color: var(--muted-dark); }
.contact-form__status.is-success { color: var(--signal); }

@media (max-width: 959px) {
  .contact__grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 599px) {
  .contact-form { grid-template-columns: minmax(0, 1fr); }
  .contact-form__footer .btn { width: 100%; }
}

/* 15. Footer ----------------------------------------------- */
.site-footer {
  padding-block: 2.5rem calc(2.5rem + env(safe-area-inset-bottom));
  color: var(--muted-dark);
  background: var(--dusk);
  border-top: 1px solid var(--line-dark);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 2rem;
}

.site-footer .brand { color: var(--white); }
.site-footer .brand__logo { width: 32px; height: 32px; }

.site-footer__nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }

.site-footer__nav a {
  display: inline-block;
  padding-block: 0.5rem;
  text-decoration: none;
}
.site-footer__nav a:hover { color: var(--signal); }

.site-footer__copy { font-size: var(--fs-sm); }

@media (max-width: 767px) {
  .site-footer__inner { flex-direction: column; align-items: flex-start; }
}

/* 17. Depth (level 1 3D) -----------------------------------
   script.js §9 adds .can-tilt on mouse devices (not with reduced
   motion) and sets per element: --rx/--ry (tilt), --mx/--my (-0.5…0.5
   pointer position) and --gx/--gy (glare position).               */
.can-tilt [data-tilt] {
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition: transform 0.6s var(--ease);
}

.can-tilt [data-tilt].is-tilting { transition-duration: 0.15s; transition-timing-function: linear; }

/* Soft light reflection that follows the pointer */
.can-tilt .building::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.2), transparent 50%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

.can-tilt .is-tilting::after { opacity: 1; }

/* Systems photo: the photo sits deeper, the markers float in front */
.can-tilt .building__photo {
  transform: translate(calc(var(--mx, 0) * -8px), calc(var(--my, 0) * -8px)) scale(1.04);
  transition: filter 0.5s var(--ease), opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.can-tilt .building__overlay {
  transform: translate(calc(var(--mx, 0) * 10px), calc(var(--my, 0) * 10px)) scale(1.04);
  transition: transform 0.6s var(--ease);
  filter: drop-shadow(0 6px 10px rgba(7, 19, 31, 0.35));
}

.can-tilt .is-tilting .building__photo,
.can-tilt .is-tilting .building__overlay { transition-duration: 0.15s; }

/* Project cards: the card under the pointer lifts */
.can-tilt .project-card:hover .project-card__frame {
  --lift: -6px;
  box-shadow: 0 22px 40px -20px rgba(14, 34, 54, 0.55);
}

.can-tilt .project-card__frame { transition: transform 0.6s var(--ease), box-shadow 0.4s var(--ease); }

/* Hero: canvas zoom is driven from script.js §4 */
.hero__canvas { transform-origin: 50% 55%; }

/* 16. Motion preferences ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
