/* ==========================================================================
   Mighty Decision — Design System
   1. Tokens   2. Base   3. Layout   4. Components   5. Sections   6. Motion
   ========================================================================== */

/* 1. Tokens --------------------------------------------------------------- */
:root {
  /* Typography */
  --font-sans: "Geist", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", "IBM Plex Sans Arabic", "Iowan Old Style", Georgia, serif;
  --font-mono: "Geist Mono", "IBM Plex Sans Arabic", ui-monospace, "SF Mono", Menlo, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: clamp(1.75rem, 1.2rem + 2vw, 2.75rem);
  --text-3xl: clamp(2.25rem, 1.3rem + 3.6vw, 4rem);
  --text-4xl: clamp(2.75rem, 1.2rem + 6.4vw, 6.25rem);

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 136px;

  /* Shape */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 160ms;
  --dur-med: 320ms;
  --dur-slow: 720ms;

  --container: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 68px;
}

/* Color — dark (default) */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07090b;
  --surface: #0c1013;
  --surface-2: #12171b;
  --surface-3: #192026;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.17);
  --text: #edf1f3;
  --text-2: #b6c0c8;
  --muted: #84909a;
  --brand: #3bbbdc;
  --brand-strong: #7bd6ee;
  --brand-soft: rgba(59, 187, 220, 0.13);
  --brand-line: rgba(59, 187, 220, 0.38);
  --on-brand: #04161c;
  --inverse: #edf1f3;
  --on-inverse: #07090b;
  --success: #4ad29a;
  --danger: #ff7a85;
  --shadow: 0 40px 120px -40px rgba(0, 0, 0, 0.9);
  --logo-filter: none;
}

/* Color — light */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f7;
  --surface: #ffffff;
  --surface-2: #eff1f2;
  --surface-3: #e4e8ea;
  --line: rgba(9, 20, 28, 0.1);
  --line-strong: rgba(9, 20, 28, 0.2);
  --text: #0a0f13;
  --text-2: #36424b;
  --muted: #5d6a74;
  --brand: #0b7a99;
  --brand-strong: #075f78;
  --brand-soft: rgba(11, 122, 153, 0.09);
  --brand-line: rgba(11, 122, 153, 0.35);
  --on-brand: #ffffff;
  --inverse: #0a0f13;
  --on-inverse: #ffffff;
  --success: #12845a;
  --danger: #c5283a;
  --shadow: 0 40px 100px -50px rgba(9, 20, 28, 0.35);
  --logo-filter: invert(1);
}

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

* {
  margin: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--dur-med) ease, color var(--dur-med) ease;
}

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

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

h1,
h2,
h3 {
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

::selection {
  background: var(--brand);
  color: var(--on-brand);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--inverse);
  color: var(--on-inverse);
  font-weight: 500;
  transition: top var(--dur-fast) ease;
}

.skip-link:focus {
  top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 3. Layout --------------------------------------------------------------- */
.container {
  width: min(var(--container), 100% - var(--gutter) * 2);
  margin-inline: auto;
}

.section {
  padding-block: clamp(72px, 10vw, var(--space-10));
  border-top: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--space-6) var(--space-8);
  align-items: end;
  margin-bottom: clamp(40px, 6vw, 72px);
}

.section-head h2 {
  font-size: var(--text-3xl);
}

.section-head p {
  color: var(--text-2);
  font-size: var(--text-lg);
  max-width: 46ch;
}

.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--brand-strong);
}

/* 4. Components ----------------------------------------------------------- */

/* Label — mono overline with index */
.label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.label b {
  font-weight: 500;
  color: var(--brand);
}

.label::after {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--line-strong);
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease,
    color var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn svg {
  width: 16px;
  height: 16px;
  transition: transform var(--dur-med) var(--ease-out);
}

.btn:hover svg {
  transform: translateX(3px);
}

.btn-primary {
  background: var(--inverse);
  color: var(--on-inverse);
}

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

.btn-secondary {
  border-color: var(--line-strong);
  background: transparent;
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--muted);
}

.btn-lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: var(--text-md);
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  color: var(--text-2);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* Tag */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface);
}

.tag-brand {
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 var(--success);
  animation: pulse 2.4s ease-out infinite;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-med) ease, border-color var(--dur-med) ease;
}

.site-header.is-stuck,
.site-header.is-open {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom-color: var(--line);
}

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.brand img {
  height: 50px;
  width: auto;
  filter: var(--logo-filter);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-links a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-2);
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Language switcher */
.lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  direction: ltr;
}

.lang button {
  height: 100%;
  min-width: 32px;
  padding: 0 8px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1;
  color: var(--muted);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.lang button:hover {
  color: var(--text);
}

.lang button[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
}

.theme-toggle .i-sun,
:root[data-theme="light"] .theme-toggle .i-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .i-sun {
  display: block;
}

.menu-toggle {
  display: none;
}

/* 5. Sections ------------------------------------------------------------- */

/* Hero */
.hero {
  position: relative;
  padding-top: clamp(48px, 8vw, 104px);
  padding-bottom: clamp(56px, 8vw, 104px);
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: calc(var(--header-h) * -1) 0 0;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 78% 0%, var(--brand-soft), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 72px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 50% 0 / 72px 100%;
  -webkit-mask-image: radial-gradient(90% 75% at 50% 0%, #000 30%, transparent 85%);
  mask-image: radial-gradient(90% 75% at 50% 0%, #000 30%, transparent 85%);
}

.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: var(--space-6) var(--space-8);
  align-items: end;
}

.hero h1 {
  font-size: var(--text-4xl);
  line-height: 0.96;
  letter-spacing: -0.05em;
  margin-top: var(--space-5);
}

.hero h1 .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.hero h1 .line > span {
  display: block;
}

.hero-copy {
  color: var(--text-2);
  font-size: var(--text-lg);
  max-width: 44ch;
  margin-bottom: var(--space-6);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Hero stage — brief turns into product */
.stage {
  position: relative;
  margin-top: clamp(40px, 6vw, 80px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stage-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.stage-dots {
  display: flex;
  gap: 6px;
}

.stage-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
}

.stage-url {
  flex: 1;
  min-width: 0;
  max-width: 420px;
  margin-inline: auto;
  height: 28px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  direction: ltr;
}

.stage-url svg {
  width: 11px;
  height: 11px;
  flex: none;
  color: var(--success);
}

.stage-body {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  min-height: 440px;
}

.brief {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5);
  border-inline-end: 1px solid var(--line);
}

.brief-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.brief-text {
  flex: 1;
  font-size: var(--text-xl);
  line-height: 1.3;
  letter-spacing: -0.02em;
  min-height: 5.2em;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-inline-start: 2px;
  vertical-align: -0.12em;
  background: var(--brand);
  animation: blink 1s steps(2, start) infinite;
}

.brief-steps {
  display: grid;
  gap: 2px;
}

.brief-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  transition: color var(--dur-med) ease;
}

.brief-steps li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  transition: background-color var(--dur-med) ease, border-color var(--dur-med) ease;
}

.brief-steps li.is-done {
  color: var(--text);
}

.brief-steps li.is-done::before {
  background: var(--brand);
  border-color: var(--brand);
}

.canvas {
  position: relative;
  background:
    radial-gradient(var(--line) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--bg);
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  padding: var(--space-5);
  display: grid;
  gap: 14px;
  visibility: hidden;
}

.scene.is-on {
  visibility: visible;
}

.scene [data-b] {
  opacity: 0;
}

.scene.is-on [data-b] {
  animation: rise var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 75ms);
}

.scene.is-out [data-b] {
  animation: fall 280ms ease-in both;
}

/* Skeleton primitives used inside scenes */
.sk {
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

.sk-line {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
}

.sk-panel {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px;
}

.sk-accent {
  background: var(--brand);
}

.sk-text {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Scene: website */
.scene-site {
  grid-template-rows: auto 1fr auto;
}

.s-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.s-nav .sk-line {
  width: 44px;
}

.s-nav .sk-line:first-child {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  margin-inline-end: auto;
}

.s-nav .pill {
  width: 72px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--inverse);
}

.s-hero {
  align-self: center;
  display: grid;
  gap: 12px;
}

.s-hero .big {
  font-size: clamp(22px, 3.2vw, 40px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.s-hero .sk-line {
  width: 58%;
}

.s-hero .sk-line + .sk-line {
  width: 40%;
}

.s-cta {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.s-cta i {
  width: 96px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--brand);
}

.s-cta i + i {
  background: transparent;
  border: 1px solid var(--line-strong);
}

.s-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.s-cards .sk-panel {
  display: grid;
  gap: 8px;
}

.s-cards .thumb {
  height: 46px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-soft), var(--surface-3));
}

/* Scene: platform */
.scene-app {
  grid-template-columns: 132px minmax(0, 1fr);
}

.a-side {
  display: grid;
  align-content: start;
  gap: 10px;
}

.a-side .row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
}

.a-side .row.on {
  background: var(--brand-soft);
}

.a-side .row i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--surface-3);
}

.a-side .row.on i {
  background: var(--brand);
}

.a-side .row .sk-line {
  flex: 1;
}

.a-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  min-width: 0;
}

.a-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.a-kpis strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.a-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 120px;
}

.a-chart i {
  flex: 1;
  height: var(--h);
  border-radius: 4px 4px 0 0;
  background: var(--surface-3);
  transform-origin: bottom;
}

.scene.is-on .a-chart i {
  animation: grow 900ms var(--ease-out) both;
  animation-delay: calc(500ms + var(--n) * 60ms);
}

.a-chart i.hi {
  background: var(--brand);
}

.a-rows {
  display: grid;
  gap: 8px;
}

.a-rows div {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.6fr;
  gap: 12px;
}

/* Scene: AI */
.scene-ai {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.c-chat {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  min-width: 0;
}

.c-thread {
  display: grid;
  align-content: end;
  gap: 10px;
}

.bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.45;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
}

.bubble.me {
  justify-self: end;
  background: var(--inverse);
  color: var(--on-inverse);
  border-color: transparent;
}

.c-input {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 6px 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.c-input .sk-line {
  flex: 1;
  max-width: 120px;
}

.c-input i {
  margin-inline-start: auto;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--brand);
}

.c-flow {
  display: grid;
  align-content: center;
  gap: 0;
}

.node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
}

.node i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.node span {
  margin-inline-start: auto;
}

.wire {
  width: 1px;
  height: 18px;
  margin-inline-start: 24px;
  background: var(--brand-line);
}

/* Marquee */
.marquee {
  border-top: 1px solid var(--line);
  padding-block: 22px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 48s linear infinite;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee ul {
  display: flex;
  align-items: center;
  flex: none;
}

.marquee li {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-inline-end: 28px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.marquee li::after {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--brand);
  transform: rotate(45deg);
}

/* Services — hairline grid */
.grid-lines {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--line);
  gap: 1px;
}

.service {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  padding: var(--space-6) var(--space-5);
  background: var(--bg);
  transition: background-color var(--dur-med) ease;
}

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

.service-num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.service-icon {
  width: 40px;
  height: 40px;
  margin: var(--space-6) 0 var(--space-7);
  color: var(--brand);
  transition: transform var(--dur-slow) var(--ease-out);
}

.service:hover .service-icon {
  transform: translateY(-4px) rotate(-4deg);
}

.service h3 {
  font-size: var(--text-xl);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0 0 var(--space-3);
}

.service p {
  color: var(--text-2);
  font-size: var(--text-sm);
}

.service-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: var(--space-5);
}

/* Foundations — the system on display */
.foundations {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-4);
}

.spec {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.spec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.spec-color {
  grid-column: span 7;
}

.spec-type {
  grid-column: span 5;
}

.spec-shape {
  grid-column: span 4;
}

.spec-motion {
  grid-column: span 3;
}

.spec-components {
  grid-column: span 5;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
  flex: 1;
}

.swatch {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.swatch i {
  display: block;
  flex: 1;
  min-height: 112px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--c);
  transition: background-color var(--dur-med) ease;
}

.swatch span {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-rows {
  display: grid;
}

.type-rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
  border-top: 1px solid var(--line);
}

.type-rows > div:first-child {
  border-top: 0;
  padding-top: 0;
}

.type-rows small {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.t-display {
  font-size: 40px;
  letter-spacing: -0.045em;
  line-height: 1;
  font-weight: 500;
}

.t-serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 34px;
  line-height: 1;
}

.t-body {
  font-size: var(--text-md);
  color: var(--text-2);
}

.t-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scale {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 96px;
}

.scale i {
  flex: 1;
  height: var(--s);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: 3px;
}

.radii {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: var(--space-5);
}

.radii i {
  aspect-ratio: 1;
  border-top: 1.5px solid var(--text);
  border-left: 1.5px solid var(--text);
  border-top-left-radius: var(--r);
  background: var(--surface-2);
}

.curve {
  position: relative;
  height: 96px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  overflow: hidden;
}

.curve svg {
  width: 100%;
  height: 100%;
  color: var(--brand);
}

.track {
  position: relative;
  height: 28px;
  margin-top: var(--space-5);
  border-radius: var(--radius-full);
  background: var(--surface-2);
}

.track i {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  animation: slide 2.6s var(--ease-out) infinite alternate;
}

.kit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.kit + .kit {
  margin-top: var(--space-4);
}

.field {
  flex: 1;
  min-width: 160px;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.field::placeholder {
  color: var(--muted);
}

.field:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: transparent;
}

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  transition: background-color var(--dur-med) ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transition: transform var(--dur-med) var(--ease-out), background-color var(--dur-med) ease;
}

.switch[aria-checked="true"] {
  background: var(--brand);
  border-color: transparent;
}

.switch[aria-checked="true"]::after {
  transform: translateX(18px);
  background: var(--on-brand);
}

.kit-note {
  font-size: var(--text-sm);
  color: var(--text-2);
}

/* Process */
.process {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  counter-reset: step;
}

.step {
  position: relative;
  padding: var(--space-6) 0 0;
  padding-inline-end: var(--space-5);
  border-top: 1px solid var(--line-strong);
  counter-increment: step;
}

.step::before {
  content: "";
  position: absolute;
  top: -4px;
  inset-inline-start: 0;
  width: 7px;
  height: 7px;
  background: var(--brand);
  transform: rotate(45deg);
}

.step::after {
  content: "0" counter(step);
  display: block;
  position: absolute;
  top: var(--space-6);
  inset-inline-end: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.step h3 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 2.25rem;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.step p {
  color: var(--text-2);
  font-size: var(--text-sm);
  max-width: 30ch;
}

/* Work mosaic */
.mosaic {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-4);
}

.work {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--dur-med) ease, transform var(--dur-slow) var(--ease-out);
}

.work:hover {
  border-color: var(--line-strong);
  transform: translateY(-4px);
}

.work-wide {
  grid-column: span 8;
}

.work-half {
  grid-column: span 6;
}

.work-cover {
  position: relative;
  height: 220px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.work-wide .work-cover {
  height: 300px;
}

.work-cover svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--brand);
  transition: transform 1.2s var(--ease-out);
}

.work:hover .work-cover svg {
  transform: scale(1.05);
}

.work-cover .tag {
  position: absolute;
  top: var(--space-4);
  inset-inline-start: var(--space-4);
}

.work-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-3);
  padding: var(--space-5);
}

.work-body h3 {
  font-size: var(--text-xl);
  letter-spacing: -0.03em;
}

.work-wide .work-body h3 {
  font-size: var(--text-2xl);
}

.work-body p {
  color: var(--text-2);
  font-size: var(--text-sm);
  max-width: 56ch;
}

.work-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  transition: color var(--dur-fast) ease;
}

.work-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.work {
  position: relative;
}

.work-link svg {
  width: 16px;
  height: 16px;
  color: var(--text);
  transition: transform var(--dur-med) var(--ease-out);
}

.work:hover .work-link {
  color: var(--brand-strong);
}

.work:hover .work-link svg {
  transform: translate(3px, -3px);
}

/* Contact */
.contact {
  position: relative;
  padding: clamp(32px, 6vw, 80px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(70% 120% at 100% 0%, var(--brand-soft), transparent 60%),
    var(--surface);
  overflow: hidden;
}

.contact h2 {
  font-size: var(--text-4xl);
  line-height: 0.96;
  letter-spacing: -0.05em;
  max-width: 12ch;
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--space-7) var(--space-8);
  align-items: start;
  margin-top: clamp(32px, 5vw, 64px);
}

.contact-lead {
  color: var(--text-2);
  font-size: var(--text-lg);
  max-width: 44ch;
}

/* Form */
.form {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.form-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.form-field label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-field label span {
  text-transform: none;
  letter-spacing: 0;
}

.form .field {
  width: 100%;
  min-width: 0;
  background: var(--surface);
}

textarea.field {
  height: auto;
  min-height: 112px;
  padding-block: 12px;
  line-height: 1.5;
  resize: vertical;
}

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

.form-trap {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-2);
  cursor: pointer;
}

.form-check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand);
}

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
}

.form-foot .btn[disabled] {
  opacity: 0.6;
  pointer-events: none;
}

.form-status {
  flex: 1;
  min-width: 180px;
  font-size: var(--text-sm);
  color: var(--text-2);
}

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

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

.contact-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  margin-top: var(--space-6);
  border-top: 1px solid var(--line);
}

.contact-meta div {
  padding-top: var(--space-5);
}

.contact-meta dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.contact-meta dd {
  font-size: var(--text-lg);
  overflow-wrap: anywhere;
}

.contact-meta a:hover {
  color: var(--brand-strong);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-8) var(--space-6);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
  gap: var(--space-7);
}

.footer-brand img {
  height: 44px;
  width: auto;
  filter: var(--logo-filter);
  margin-bottom: var(--space-4);
}

.footer-brand p {
  color: var(--muted);
  font-size: var(--text-sm);
  max-width: 34ch;
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-4);
}

.footer-col li + li {
  margin-top: 10px;
}

.footer-col a {
  font-size: var(--text-sm);
  color: var(--text-2);
  transition: color var(--dur-fast) ease;
}

.footer-col a:hover {
  color: var(--text);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Text pages (privacy) */
.page-hero {
  padding-bottom: clamp(40px, 6vw, 72px);
}

.page-title {
  font-size: var(--text-4xl);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.page-meta {
  margin-top: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.prose {
  max-width: 720px;
  margin-inline-start: max(var(--gutter), (100% - var(--container)) / 2);
}

.prose h2 {
  font-size: var(--text-xl);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: var(--space-7) 0 var(--space-3);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p,
.prose li {
  color: var(--text-2);
  font-size: var(--text-lg);
  line-height: 1.65;
}

.prose p + p,
.prose ul + p {
  margin-top: var(--space-4);
}

.prose ul {
  margin-top: var(--space-3);
  padding-inline-start: 1.2em;
  list-style: disc;
}

.prose li + li {
  margin-top: 6px;
}

.prose li::marker {
  color: var(--brand);
}

.prose strong {
  color: var(--text);
  font-weight: 500;
}

.prose a,
.error-main p a,
.form-check a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--brand-line);
  text-underline-offset: 3px;
}

.prose a:hover,
.error-main p a:hover,
.form-check a:hover {
  color: var(--brand-strong);
  text-decoration-color: currentColor;
}

/* Error pages */
.error-page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.error-page .site-header {
  position: static;
}

.error-main {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--space-5);
  padding-block: var(--space-8);
}

.error-code {
  font-size: clamp(6rem, 26vw, 18rem);
  font-weight: 500;
  line-height: 0.8;
  letter-spacing: -0.07em;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
}

.error-main h1 {
  font-size: var(--text-3xl);
  max-width: 16ch;
}

.error-main p {
  color: var(--text-2);
  font-size: var(--text-lg);
  max-width: 48ch;
}

/* 6. Motion --------------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: calc(var(--d, 0) * 80ms);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

.js .hero h1 .line > span {
  transform: translateY(105%);
  animation: line-up 1s var(--ease-out) forwards;
  animation-delay: calc(120ms + var(--l, 0) * 110ms);
}

@keyframes line-up {
  to {
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@keyframes grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
  }
  100% {
    box-shadow: 0 0 0 8px transparent;
  }
}

@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

@keyframes slide {
  to {
    left: calc(100% - 24px);
  }
}

/* Languages -------------------------------------------------------------- */
.i18n-pending body {
  visibility: hidden;
}

/* Right-to-left (Arabic): mirror what logical properties cannot. */
[dir="rtl"] .marquee-track {
  animation-name: marquee-rtl;
}

@keyframes marquee-rtl {
  to {
    transform: translateX(50%);
  }
}

[dir="rtl"] .btn svg,
[dir="rtl"] .work-link svg {
  transform: scaleX(-1);
}

[dir="rtl"] .btn:hover svg {
  transform: scaleX(-1) translateX(3px);
}

[dir="rtl"] .work:hover .work-link svg {
  transform: scaleX(-1) translate(3px, -3px);
}

[dir="rtl"] .switch[aria-checked="true"]::after {
  transform: translateX(-18px);
}

/* Arabic script: letters must stay joined, and need more vertical room. */
:root[lang="ar"] {
  --font-mono: "IBM Plex Sans Arabic", "Geist Mono", ui-monospace, monospace;
}

:root[lang="ar"] * {
  letter-spacing: 0 !important;
}

:root[lang="ar"] body {
  line-height: 1.8;
}

:root[lang="ar"] h1,
:root[lang="ar"] h2,
:root[lang="ar"] h3 {
  font-weight: 600;
  line-height: 1.3;
}

:root[lang="ar"] .hero h1,
:root[lang="ar"] .contact h2,
:root[lang="ar"] .page-title {
  line-height: 1.25;
}

:root[lang="ar"] .hero h1 .line {
  padding-bottom: 0.22em;
}

:root[lang="ar"] .serif,
:root[lang="ar"] .step h3,
:root[lang="ar"] .t-serif {
  font-family: var(--font-sans);
  font-style: normal;
}

:root[lang="ar"] .step h3 {
  font-size: 1.75rem;
  font-weight: 600;
}

:root[lang="ar"] .brief-text,
:root[lang="ar"] .s-hero .big,
:root[lang="ar"] .t-display,
:root[lang="ar"] .t-serif {
  line-height: 1.5;
}

:root[lang="ar"] .label,
:root[lang="ar"] .tag,
:root[lang="ar"] .marquee li,
:root[lang="ar"] .spec-head,
:root[lang="ar"] .form-field label,
:root[lang="ar"] .contact-meta dt,
:root[lang="ar"] .footer-col h4 {
  font-size: var(--text-sm);
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1080px) {
  .grid-lines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .process {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: var(--space-7);
  }

  .spec-color,
  .spec-type,
  .spec-components {
    grid-column: span 12;
  }

  .spec-shape,
  .spec-motion {
    grid-column: span 6;
  }

  .work,
  .work-half {
    grid-column: span 6;
  }

  .work-wide {
    grid-column: span 12;
  }
}

@media (max-width: 860px) {
  .hero-top,
  .section-head,
  .contact-grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .stage-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .brief {
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

  .brief-text {
    min-height: 3.9em;
    font-size: var(--text-lg);
  }

  .brief-steps {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
  }

  .canvas {
    height: 380px;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-3) var(--gutter) var(--space-5);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    display: none;
  }

  .site-header.is-open .nav-links {
    display: flex;
  }

  .nav-links a {
    padding: 14px 0;
    font-size: var(--text-lg);
    color: var(--text);
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }

  .nav-cta {
    display: none;
  }

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

  .footer-brand {
    grid-column: 1 / -1;
  }
}

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

  .service {
    min-height: 0;
  }

  .service-icon {
    margin-bottom: var(--space-6);
  }

  .spec-shape,
  .spec-motion,
  .work,
  .work-half {
    grid-column: span 12;
  }

  .swatches {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .work-cover,
  .work-wide .work-cover {
    height: 190px;
  }

  .scene {
    padding: var(--space-4);
  }

  .scene-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .a-side {
    display: none;
  }

  .scene-ai {
    grid-template-columns: minmax(0, 1fr);
  }

  .c-flow {
    display: none;
  }

  .stage-url {
    max-width: none;
  }

  .hero-actions .btn,
  .form-foot .btn {
    flex: 1;
  }

  .contact-meta,
  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .form {
    padding: var(--space-4);
  }

  .t-display {
    font-size: 32px;
  }
}

@media (max-width: 400px) {
  .nav {
    gap: var(--space-3);
  }

  .brand img {
    height: 40px;
  }

  .lang button {
    min-width: 28px;
    padding: 0 6px;
  }
}

@media (max-width: 350px) {
  .site-header .theme-toggle {
    display: none;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .marquee-track {
    animation: none;
  }
}
