/* ==========================================================================
   MEK — Power & Automation
   Arabic-first, bilingual (RTL/LTR) marketing site.
   ========================================================================== */

/* --- Tokens ---------------------------------------------------------------- */
:root {
  --ink: #071528;
  --navy: #00355f;
  --navy-700: #0f4c81;
  --navy-900: #002744;
  --blue: #0051d5;
  --blue-200: #b9cdff;
  --blue-100: #dbe6ff;
  --blue-050: #eef3ff;
  --paper: #f6f7fb;
  --white: #ffffff;
  --line: #d8dfea;
  --line-soft: #e7ebf3;
  --muted: #4b5768;
  --red: #c8102e;
  --green: #22c55e;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 28px 70px -34px rgba(0, 38, 74, 0.55);
  --shadow-soft: 0 12px 32px -22px rgba(0, 38, 74, 0.45);

  --max: 1180px;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  --section: clamp(4.5rem, 9vw, 7.5rem);

  --font-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-en: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font: var(--font-ar);
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[lang="en"] {
  --font: var(--font-en);
}

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: 90px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-inline-size: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

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

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

.skip-link {
  position: fixed;
  inset-block-start: 0.5rem;
  inset-inline-start: 0.5rem;
  z-index: 200;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  translate: 0 -160%;
  transition: translate 0.2s var(--ease);
}

.skip-link:focus-visible {
  translate: 0 0;
  outline-color: #fff;
}

::selection {
  background: var(--blue-100);
  color: var(--ink);
}

/* --- Typography ----------------------------------------------------------- */
h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3 {
  line-height: 1.35;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.15rem, 1.35rem + 3.1vw, 3.9rem);
  font-weight: 700;
  line-height: 1.14;
}

html[lang="ar"] h1 {
  line-height: 1.28;
}

h2 {
  font-size: clamp(1.7rem, 1.25rem + 1.6vw, 2.6rem);
}

h3 {
  font-size: 1.1875rem;
}

p {
  text-wrap: pretty;
}

.lede {
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  line-height: 1.8;
  color: var(--muted);
  max-inline-size: 62ch;
}

/* --- Layout --------------------------------------------------------------- */
.wrap {
  inline-size: min(100% - (var(--gutter) * 2), var(--max));
  margin-inline: auto;
}

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

.section--tight {
  padding-block: clamp(3rem, 6vw, 4.5rem);
}

.section-head {
  display: grid;
  gap: 1rem;
  max-inline-size: 60ch;
  margin-block-end: clamp(2.5rem, 5vw, 4rem);
}

.section-head p {
  color: var(--muted);
}

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    translate 0.2s var(--ease);
}

.btn svg {
  inline-size: 1.05em;
  block-size: 1.05em;
  flex: none;
}

.btn--primary {
  background: var(--blue);
  color: #fff;
}

.btn--primary:hover {
  background: #0046bb;
}

.btn--ghost {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.btn--ghost:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.btn--navy {
  background: var(--navy);
  color: #fff;
}

.btn--navy:hover {
  background: var(--navy-700);
}

.btn--outline {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.btn--outline:hover {
  border-color: var(--navy);
  color: var(--navy);
}

/* --- Header --------------------------------------------------------------- */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  border-block-end: 1px solid var(--line-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-block-size: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex: none;
  margin-inline-end: auto;
}

.brand img {
  inline-size: auto;
  block-size: 40px;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-list a {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: 0.975rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-list a:hover {
  color: var(--navy);
  background: var(--blue-050);
}

.nav-list a[aria-current="page"] {
  color: var(--navy);
  background: var(--blue-050);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
}

.lang-toggle {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  min-inline-size: 3.1rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  color: var(--navy);
}

.lang-toggle:hover {
  border-color: var(--navy);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  inline-size: 44px;
  block-size: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.nav-toggle svg {
  inline-size: 22px;
  block-size: 22px;
}

/* Mobile popover navigation */
@media (max-width: 1000px) {
  .nav-list[popover],
  .nav-list.is-open {
    position: fixed;
    inset: auto;
    inset-block-start: 84px;
    inset-inline: var(--gutter);
    margin: 0;
    padding: 0.75rem;
    inline-size: auto;
    max-inline-size: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-block-size: calc(100dvh - 110px);
    overflow: auto;
  }

  .nav-list[popover] a,
  .nav-list.is-open a {
    padding: 0.8rem 1rem;
    border-radius: 10px;
  }

  .nav-list[popover]::backdrop {
    background: rgba(7, 21, 40, 0.35);
    backdrop-filter: blur(2px);
  }

  .nav-list:not([popover]):not(.is-open) {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .header-inner {
    gap: 0.6rem;
  }

  .header-actions .btn--navy {
    display: none;
  }
}

@supports selector(:popover-open) {
  @media (max-width: 1000px) {
    .nav-list[popover]:not(:popover-open) {
      display: none;
    }
  }
}

/* On wide screens the same list renders inline, even without script. */
@media (min-width: 1001px) {
  .nav-list[popover] {
    display: flex !important;
    position: static;
    inset: auto;
    margin: 0;
    padding: 0;
    flex-direction: row;
    background: transparent;
    border: 0;
    box-shadow: none;
    max-block-size: none;
    overflow: visible;
  }

  .nav-list[popover]::backdrop {
    display: none;
  }
}

/* --- Hero ----------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: clip;
  background: var(--navy-900);
  color: #fff;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 90% at 85% 10%, rgba(0, 81, 213, 0.55) 0%, transparent 55%),
    radial-gradient(90% 70% at 10% 100%, rgba(15, 76, 129, 0.75) 0%, transparent 60%),
    linear-gradient(160deg, #002744 0%, #00355f 55%, #002a4a 100%);
}

/* Engineering grid */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(120% 90% at 50% 20%, #000 30%, transparent 85%);
  opacity: 0.7;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  padding-block: clamp(3.5rem, 7vw, 6rem);
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #a9c1dc;
  margin-block-end: 1.35rem;
}

.hero-meta::before {
  content: "";
  inline-size: 26px;
  block-size: 1px;
  background: var(--blue-200);
  opacity: 0.7;
}

.hero h1 {
  color: #fff;
  max-inline-size: 15ch;
}

.hero-lede {
  margin-block-start: 1.5rem;
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  line-height: 1.85;
  color: #c3d4e8;
  max-inline-size: 46ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-block-start: 2.25rem;
}

.hero-note {
  margin-block-start: 2.25rem;
  padding-block-start: 1.25rem;
  border-block-start: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.9rem;
  color: #9fb6d1;
  max-inline-size: 44ch;
}

/* --- HMI panel ------------------------------------------------------------ */
.hmi {
  position: relative;
  background: linear-gradient(180deg, rgba(9, 30, 55, 0.96), rgba(4, 19, 36, 0.98));
  border: 1px solid rgba(160, 201, 255, 0.22);
  border-radius: 18px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 1.1rem;
  font-size: 0.8rem;
}

.hmi::before {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: -1;
  border-radius: 28px;
  background: radial-gradient(60% 60% at 50% 40%, rgba(0, 81, 213, 0.35), transparent 70%);
  filter: blur(10px);
}

.hmi-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-block-end: 0.85rem;
  border-block-end: 1px solid rgba(160, 201, 255, 0.14);
}

.hmi-dot {
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
  flex: none;
}

.hmi-title {
  font-weight: 500;
  color: #d8e6f7;
}

.hmi-time {
  margin-inline-start: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #7f9cbd;
  letter-spacing: 0.02em;
}

.hmi-chart {
  margin-block: 0.9rem;
  border-radius: 10px;
  background:
    linear-gradient(to right, rgba(160, 201, 255, 0.08) 1px, transparent 1px) 0 0 / 25% 100%,
    linear-gradient(to bottom, rgba(160, 201, 255, 0.08) 1px, transparent 1px) 0 0 / 100% 25%;
  padding: 0.35rem 0.15rem;
}

.hmi-chart svg {
  inline-size: 100%;
  block-size: 108px;
  overflow: visible;
}

.hmi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin-block-end: 0.55rem;
}

.hmi-cell {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(160, 201, 255, 0.12);
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
}

.hmi-cell span {
  display: block;
  font-size: 0.68rem;
  color: #8ba7c6;
  margin-block-end: 0.15rem;
}

.hmi-cell strong {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
  color: #eaf3ff;
  letter-spacing: -0.01em;
}

.hmi-cell small {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: #7f9cbd;
  margin-inline-start: 0.2rem;
}

.hmi-io {
  display: grid;
  gap: 0.3rem;
  padding-block-start: 0.55rem;
  border-block-start: 1px solid rgba(160, 201, 255, 0.14);
}

.hmi-io div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #b6cbe2;
  font-size: 0.75rem;
}

.led {
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  flex: none;
}

.led--on {
  background: var(--green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

.led--run {
  background: #4ea1ff;
  box-shadow: 0 0 8px rgba(78, 161, 255, 0.8);
}

.hmi-io b {
  margin-inline-start: auto;
  font-weight: 500;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: #7f9cbd;
}

/* --- Partners ------------------------------------------------------------- */
.partners {
  border-block-end: 1px solid var(--line-soft);
  background: #fff;
}

.partners-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2.5rem;
  padding-block: 1.5rem;
}

.partners-label {
  font-size: 0.875rem;
  color: var(--muted);
}

.partners-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2.25rem;
  margin-inline-start: auto;
}

.partners-list span {
  font-family: var(--font-en);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: #5f6b7d;
  text-transform: uppercase;
}

/* --- Services ------------------------------------------------------------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-block-start: 1px solid var(--line);
  border-inline-start: 1px solid var(--line);
}

.service {
  padding: clamp(1.5rem, 2.6vw, 2.25rem);
  border-inline-end: 1px solid var(--line);
  border-block-end: 1px solid var(--line);
  transition: background-color 0.25s ease;
}

.service:hover {
  background: var(--blue-050);
}

.service-icon {
  inline-size: 44px;
  block-size: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--blue-050);
  color: var(--navy);
  margin-block-end: 1.1rem;
  border: 1px solid var(--blue-100);
}

.service:hover .service-icon {
  background: #fff;
}

.service-icon svg {
  inline-size: 22px;
  block-size: 22px;
}

.service h3 {
  margin-block-end: 0.6rem;
  color: var(--navy);
}

.service p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.75;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-block-start: 1.1rem;
}

.tags li {
  font-size: 0.75rem;
  color: var(--navy-700);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.service:hover .tags li {
  border-color: var(--blue-100);
}

/* --- Process -------------------------------------------------------------- */
.process {
  background: var(--paper);
  border-block: 1px solid var(--line-soft);
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  counter-reset: step;
}

.step {
  position: relative;
  padding-block-start: 1.75rem;
  border-block-start: 2px solid var(--line);
}

.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  inset-block-start: -1.05rem;
  inset-inline-start: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--blue);
  background: var(--paper);
  padding-inline-end: 0.6rem;
}

.step h3 {
  font-size: 1.05rem;
  margin-block-end: 0.45rem;
  color: var(--navy);
}

.step p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
}

/* --- Work ---------------------------------------------------------------- */
.work-list {
  border-block-start: 1px solid var(--line);
}

.work-item {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1.1fr) minmax(0, 1.6fr);
  gap: clamp(1rem, 3vw, 3rem);
  align-items: start;
  padding-block: clamp(1.6rem, 3vw, 2.4rem);
  border-block-end: 1px solid var(--line);
}

.work-index {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--blue);
  padding-block-start: 0.45rem;
}

.work-item h3 {
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem);
  color: var(--navy);
}

.work-item p {
  color: var(--muted);
  font-size: 0.975rem;
}

.work-item .tags {
  margin-block-start: 0.9rem;
}

/* --- Why ------------------------------------------------------------------ */
.why {
  background: var(--navy);
  color: #fff;
  position: relative;
  overflow: clip;
}

.why::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(70% 60% at 90% 0%, rgba(0, 81, 213, 0.45), transparent 65%);
  pointer-events: none;
}

.why-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}

.why h2 {
  color: #fff;
}

.why .lede {
  color: #b6cbe2;
  margin-block-start: 1.1rem;
}

.why-stat {
  margin-block-start: 2.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
}

.why-stat strong {
  font-size: clamp(3rem, 2rem + 4vw, 4.5rem);
  line-height: 1;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.03em;
}

.why-stat span {
  color: #a9c1dc;
  font-size: 0.95rem;
  max-inline-size: 12ch;
  line-height: 1.5;
}

.pillars {
  display: grid;
  gap: 0;
}

.pillar {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 1rem;
  padding-block: 1.4rem;
  border-block-start: 1px solid rgba(255, 255, 255, 0.16);
}

.pillar:last-child {
  border-block-end: 1px solid rgba(255, 255, 255, 0.16);
}

.pillar svg {
  inline-size: 26px;
  block-size: 26px;
  color: #8fb6e6;
  margin-block-start: 0.15rem;
}

.pillar h3 {
  font-size: 1.05rem;
  color: #fff;
  margin-block-end: 0.3rem;
}

.pillar p {
  font-size: 0.925rem;
  color: #a9c1dc;
  line-height: 1.7;
}

/* --- Facebook updates ------------------------------------------------------ */
.social {
  background: var(--blue-050);
}

.social-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.social .eyebrow {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.social h2 {
  margin-block: 0.6rem;
}

.social .lede {
  color: var(--muted);
}

.social .btn {
  margin-block-start: 1.25rem;
}

.social-feed {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  min-inline-size: 0;
}

.fb-feed {
  inline-size: 100%;
  max-inline-size: 500px;
  block-size: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.feed-fallback {
  color: var(--navy-700);
  font-size: 0.85rem;
}

/* --- Contact -------------------------------------------------------------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}

.contact-details {
  display: grid;
  gap: 0;
  margin-block-start: 2rem;
}

.contact-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 0.9rem;
  row-gap: 0.1rem;
  padding-block: 1rem;
  border-block-start: 1px solid var(--line-soft);
}

.contact-row:last-child {
  border-block-end: 1px solid var(--line-soft);
}

.contact-row dt {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 40px 1fr;
  column-gap: 0.9rem;
  align-items: start;
  font-size: 0.8rem;
  color: var(--muted);
}

.contact-row svg {
  inline-size: 20px;
  block-size: 20px;
  color: var(--navy);
  margin-block-start: 0.2rem;
}

.contact-row dd {
  grid-column: 2;
  margin: 0;
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.contact-row dd a:hover {
  color: var(--blue);
}

.contact-form {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field--full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
}

.field .req {
  color: var(--red);
  margin-inline-start: 0.15rem;
}

.field input,
.field select,
.field textarea {
  inline-size: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea {
  min-block-size: 7.5rem;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #b9c4d6;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 81, 213, 0.16);
}

.field :is(input, select, textarea):user-invalid {
  border-color: var(--red);
  background: #fff7f7;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.field-error {
  font-size: 0.8rem;
  color: var(--red);
  min-block-size: 0;
}

.field-error:empty {
  display: none;
}

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-block-start: 1.4rem;
}

.form-status {
  font-size: 0.9rem;
  color: var(--muted);
}

.form-status[data-state="ok"] {
  color: #15803d;
}

.form-status[data-state="error"] {
  color: var(--red);
}

.hp {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Footer --------------------------------------------------------------- */
.site-footer {
  background: var(--ink);
  color: #c6d2e2;
  padding-block: clamp(3rem, 6vw, 4.5rem) 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr 1.2fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.footer-brand img {
  block-size: 42px;
  inline-size: auto;
}

.footer-brand p {
  margin-block-start: 1.1rem;
  font-size: 0.9rem;
  color: #94a6bd;
  max-inline-size: 34ch;
}

.footer-col h3 {
  font-size: 0.9rem;
  color: #fff;
  margin-block-end: 0.9rem;
  font-weight: 600;
}

.footer-col ul {
  display: grid;
  gap: 0.55rem;
}

.footer-col a {
  font-size: 0.9rem;
  color: #a3b4c9;
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: #fff;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-block-start: clamp(2rem, 4vw, 3rem);
  padding-block-start: 1.25rem;
  border-block-start: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  color: #7f93ab;
}

/* --- Motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    translate: 0 18px;
    transition: opacity 0.7s var(--ease), translate 0.7s var(--ease);
  }

  .js .reveal.is-visible {
    opacity: 1;
    translate: 0 0;
  }

  .hero-copy > * {
    animation: rise 0.9s var(--ease) both;
  }

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

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

  .hero-copy > :nth-child(4) {
    animation-delay: 0.24s;
  }

  .hero-copy > :nth-child(5) {
    animation-delay: 0.32s;
  }

  .hmi {
    animation: rise 1s var(--ease) 0.15s both;
  }

  .hmi-chart .trace {
    stroke-dasharray: 420;
    stroke-dashoffset: 420;
    animation: draw 1.8s var(--ease) 0.5s forwards;
  }

  @keyframes rise {
    from {
      opacity: 0;
      translate: 0 22px;
    }
  }

  @keyframes draw {
    to {
      stroke-dashoffset: 0;
    }
  }
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .hero-grid {
    grid-template-columns: 1fr;
    padding-block: clamp(3rem, 8vw, 4.5rem);
  }

  .hmi {
    max-inline-size: 520px;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .process-grid {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 2.5rem;
  }

  .why-grid,
  .social-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .services-grid {
    grid-template-columns: 1fr;
  }

  .work-item {
    grid-template-columns: 2.5rem 1fr;
  }

  .work-item p,
  .work-item .tags {
    grid-column: 2;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .fb-feed {
    block-size: 460px;
  }

  .hero-note {
    margin-block-start: 1.75rem;
  }

  .partners-list {
    margin-inline-start: 0;
  }
}

@media (max-width: 520px) {
  .process-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .brand img {
    block-size: 34px;
  }
}

/* --- Progressive WebGL hero ---------------------------------------------- */
.hmi-chart {
  position: relative;
  block-size: clamp(220px, 26vw, 280px);
}

.hmi-chart > svg {
  block-size: 100%;
  opacity: 1;
  transition: opacity 0.6s var(--ease);
}

.hero-webgl {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  content-visibility: auto;
  contain-intrinsic-size: auto 450px auto 260px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s var(--ease);
}

.hero-webgl canvas {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  pointer-events: none;
}

.hmi.has-webgl .hero-webgl { opacity: 1; }
.hmi.has-webgl .hmi-chart > svg { opacity: 0; }
.hmi.has-webgl .hmi-cell { background: #102b44; }
.hmi.has-webgl .hmi-cell span { color: #b6cbe2; }
.hmi.has-webgl :is(.hmi-cell small, .hmi-io b, .hmi-time) { color: #a9c1dc; }

/* --- Tactile interaction states ------------------------------------------ */
:is(.btn, .nav-toggle, .lang-toggle, .nav-list a, .service, .service-icon,
    .work-item, .site-footer a, .contact-row, .contact-row a) {
  translate: 0;
  rotate: 0deg;
  scale: 1;
  transition: color 0.25s ease-out, background-color 0.25s ease-out,
    border-color 0.25s ease-out, opacity 0.25s ease-out,
    translate 0.38s var(--ease), scale 0.38s var(--ease);
}

.site-footer a,
.contact-row a { display: inline-block; }

.work-item:hover,
.contact-row:is(:hover, :focus-within) { background-color: var(--blue-050); }

:is(.service, .work-item, .contact-row):active { background-color: #e4edfc; }
:is(.service, .work-item, .contact-row):hover:active { background-color: var(--blue-100); }

.site-footer a:hover { color: #fff; }

:is(.btn, .nav-toggle, .lang-toggle, .nav-list a, .site-footer a, .contact-row a):focus-visible {
  /* Preserve the existing outline; underline remains visible on dark surfaces. */
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 2px;
}

:is(.hero, .site-footer) :is(a, button):focus-visible { outline-color: #b9cdff; }

:is(.btn, .nav-toggle, .lang-toggle, .nav-list a, .site-footer a, .contact-row a):active {
  opacity: 0.9;
}

:is(.btn, .nav-toggle, .lang-toggle, .nav-list a, .site-footer a, .contact-row a):hover:active {
  opacity: 0.96;
}

.nav-list a:active,
.lang-toggle:active,
.nav-toggle:active { background-color: var(--blue-100); }

@media (prefers-reduced-motion: no-preference) {
  .hmi-grid {
    translate: 0;
    rotate: 0deg;
    scale: 1;
    transition: translate 0.6s var(--ease);
  }

  .hmi.has-webgl .hmi-grid { translate: 0 -2px; }

  /* Explicit fallback, then a restrained spring with only 1.2% overshoot. */
  :is(.hero-cta, .form-foot) .btn--primary {
    transition: color 0.25s ease-out, background-color 0.25s ease-out,
      border-color 0.25s ease-out, opacity 0.25s ease-out,
      translate 0.42s ease-out, scale 0.42s ease-out;
    transition: color 0.25s ease-out, background-color 0.25s ease-out,
      border-color 0.25s ease-out, opacity 0.25s ease-out,
      translate 0.42s linear(0, 0.5 25%, 0.85 48%, 1.012 76%, 1),
      scale 0.42s linear(0, 0.5 25%, 0.85 48%, 1.012 76%, 1);
  }

  @media (hover: hover) and (pointer: fine) {
    :is(.btn, .nav-toggle, .lang-toggle, .nav-list a, .site-footer a, .contact-row a):hover {
      translate: 0 -2px;
    }

    :is(.hero-cta, .form-foot) .btn--primary:hover { scale: 1.008; }

    /* Specificity preserves the existing reveal animation's arrival state. */
    .service:hover,
    .js .service.reveal.is-visible:hover { translate: 0 -3px; }
    .service:hover .service-icon { translate: 0 -2px; }
    .work-item:hover,
    .js .work-item.reveal.is-visible:hover { translate: 0 -2px; }
    .contact-row:hover { translate: 0 -1px; }
  }

  :is(.btn, .nav-toggle, .lang-toggle, .nav-list a, .site-footer a, .contact-row a):active {
    translate: 0 1px;
    scale: 0.98;
    transition-duration: 0.12s;
  }

  :is(.service, .work-item, .contact-row):active,
  .js :is(.service, .work-item).reveal.is-visible:active {
    translate: 0 1px;
    scale: 0.997;
  }

  :is(.service, .work-item, .contact-row):hover:active,
  .js :is(.service, .work-item).reveal.is-visible:hover:active {
    translate: 0;
    scale: 0.998;
  }

  :is(.btn, .nav-toggle, .lang-toggle, .nav-list a, .site-footer a, .contact-row a):hover:active,
  :is(.hero-cta, .form-foot) .btn--primary:hover:active {
    translate: 0 1px;
    scale: 0.985;
    transition-duration: 0.12s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-webgl { display: none; }
  .hmi.has-webgl .hmi-chart > svg { opacity: 1; }
  .hmi-chart > svg { transition: none; }
}

/* --- Forced colors -------------------------------------------------------- */
@media (forced-colors: active) {
  .hmi,
  .service-icon,
  .contact-form {
    border: 1px solid CanvasText;
  }

  .nav-list a[aria-current="page"] {
    outline: 2px solid CanvasText;
  }
}
