/* الغيث للحلول الكهربائية والأمنية والشبكات — public site
   Tokens copied from the Al-Ghaith design system (tokens.json). */

:root {
  --brand: #0F5E4F;
  --brand-strong: #0A4A3E;
  --on-brand: #FFFFFF;
  --brand-soft: #E1F2EC;
  --mint: #8FD5C0;
  --night: #10302A;
  --sand: #E8C98A;
  --sand-strong: #F0D7A4;
  --gold: #C9993F;
  --on-sand: #10302A;
  --surface-100: #F6F4EE;
  --surface-200: #FFFFFF;
  --surface-300: #ECE8DE;
  --line: #D8D2C4;
  --line-strong: #8A8676;
  --ink: #10302A;
  --ink-muted: #4F625C;
  --icon-ground: #E1F2EC;
  --signal-fire: #B8432D;
  --signal-ok: #2A7F50;
  --focus: var(--brand);

  --shadow-card: 0 1px 2px rgba(16,48,42,0.06), 0 4px 16px rgba(16,48,42,0.06);
  --shadow-raised: 0 8px 28px rgba(16,48,42,0.12);

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px; --space-16: 64px;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-pill: 999px;

  --font-sans: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  /* constant on the night band, whatever the theme */
  --on-night: #F6F4EE;
  --on-night-muted: #A3B8B1;

  --wrap: 72rem;
  --gutter: clamp(var(--space-4), 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #8FD5C0;
    --brand-strong: #B5E5D6;
    --on-brand: #0B1C18;
    --brand-soft: #143A31;
    --night: #1B3F37;
    --gold: #D9AE5C;
    --surface-100: #0B1C18;
    --surface-200: #12271F;
    --surface-300: #193229;
    --line: #284A40;
    --line-strong: #5E7F75;
    --ink: #E9F1EE;
    --ink-muted: #A3B8B1;
    --icon-ground: #D6EEE6;
    --signal-fire: #E2654E;
    --signal-ok: #4CB782;
    --shadow-card: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-raised: 0 8px 28px rgba(0,0,0,0.5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--surface-100);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 28px;
  font-weight: 400;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-underline-offset: 0.2em; }
h1, h2, h3 { margin: 0; }

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

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.skip {
  position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 10;
  background: var(--brand); color: var(--on-brand); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
}
.skip:focus { top: 1rem; }

.spec { font: 500 13px/20px var(--font-mono); white-space: nowrap; }
[dir="rtl"] .num { direction: ltr; unicode-bidi: isolate; }

/* ---------- buttons (Button component) ---------- */

.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font: 600 14px/20px var(--font-sans);
  border-radius: var(--radius-md);
  padding: var(--space-3) 20px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  min-height: 48px;
  justify-content: center;
  touch-action: manipulation;
  transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out, transform 100ms ease-out;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-sand { background: var(--sand); color: var(--on-sand); }
.btn-sand:hover { background: var(--sand-strong); }
.btn-secondary { background: var(--surface-200); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost-night { background: transparent; color: var(--on-night); border-color: rgba(246,244,238,0.35); }
.btn-ghost-night:hover { border-color: var(--on-night); }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- header ---------- */

.site-head { background: var(--surface-100); border-bottom: 1px solid var(--line); }
.site-head .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  min-height: 72px;
}

/* Logo lockup: mark, الغيث (700, ink), AL-GHAITH (ink-muted), gap space-3 */
.lockup { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--ink); }
.lockup img { width: 40px; height: 40px; flex: none; }
.lockup .name { display: block; font-size: 22px; line-height: 26px; font-weight: 700; }
.lockup .lat { display: block; font-size: 11px; line-height: 14px; letter-spacing: 0.18em; color: var(--ink-muted); font-weight: 600; }

.nav { display: flex; align-items: center; gap: var(--space-4) var(--space-6); font-size: 14px; font-weight: 600; }
/* each link is a 44px-tall target, even though the text is small */
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--space-1);
  color: var(--ink); text-decoration: none; transition: color 150ms ease-out;
}
.nav a:hover { color: var(--brand); }
.nav .lang {
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  min-height: 44px; padding-inline: var(--space-4);
  transition: color 150ms ease-out, border-color 150ms ease-out;
}
.nav .lang:hover { border-color: var(--brand); }
@media (max-width: 56rem) { .nav .opt { display: none; } }

/* ---------- hero: the one night band ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--night);
  color: var(--on-night);
}
@media (prefers-color-scheme: dark) { .hero { background: #10302A; } }

/* the rain pattern: short staggered drops, the brand's own motif */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cg fill='%238FD5C0'%3E%3Crect x='9' y='2' width='6' height='20' rx='3'/%3E%3Crect x='33' y='26' width='6' height='20' rx='3'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 48px 48px;
  opacity: 0.18;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 75%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 75%);
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(var(--space-8), 5vw, 72px);
  align-items: center;
  padding-block: clamp(var(--space-12), 7vw, 96px);
}
@media (max-width: 60rem) { .hero .wrap { grid-template-columns: 1fr; } }

.hero h1 {
  font-size: clamp(34px, 4.6vw, 48px);
  line-height: 1.25;
  font-weight: 700;
  max-width: 15ch;
  text-wrap: balance;
}
[lang="en"] .hero h1 { line-height: 1.12; max-width: 17ch; }
.hero .lede {
  margin: var(--space-6) 0 var(--space-8);
  color: var(--on-night-muted);
  font-size: 18px;
  line-height: 32px;
  max-width: 36ch;
}
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* ---------- the interactive ATS board ---------- */

.board {
  margin: 0;
  background: #0B2420;
  border: 1px solid #284A40;
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.board .hint { margin: 0 0 var(--space-4); font-size: 14px; line-height: 24px; color: var(--on-night-muted); }
.board svg { width: 100%; height: auto; overflow: visible; }
.board text { font-family: var(--font-sans); fill: var(--on-night); }
.board .t-name { font-size: 17px; font-weight: 600; }
.board .t-note { font-size: 12.5px; fill: var(--on-night-muted); }

.board .wire { stroke: #284A40; stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.board .wire.live { stroke: #8FD5C0; stroke-dasharray: 10 8; animation: flow 0.9s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -18; } }

.board .src { cursor: pointer; touch-action: manipulation; }
.board .src:focus { outline: none; }
.board .box { fill: #10302A; stroke: #5E7F75; stroke-width: 1.5; }
.board .src:hover .box { stroke: #8FD5C0; }
.board .src:focus-visible .box { stroke: #E8C98A; stroke-width: 3; }
.board .lamp { fill: #4CB782; }
/* a cut line shows a hollow red ring, not just a colour change */
.board .src.cut .lamp { fill: none; stroke: #E2654E; stroke-width: 2.5; }
.board .src.cut text { opacity: 0.5; }
.board .src.sun.cut .lamp { fill: #5E7F75; } /* night is normal, not a fault */

.board .ats .box { fill: #0F5E4F; stroke: #0F5E4F; }
.board .inv .box { fill: #143A31; stroke: #5E7F75; }
.board .term { fill: none; stroke: #F6F4EE; stroke-width: 1.5; }
.board .term.on { fill: #E8C98A; stroke: #E8C98A; }
.board .blade { stroke: #E8C98A; stroke-width: 4; stroke-linecap: round; }
.board .home .box { fill: none; stroke: #F6F4EE; stroke-dasharray: 4 4; }
.board .bulb { fill: #E8C98A; }

.board .status {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2) var(--space-4);
  margin-top: var(--space-4); padding-top: var(--space-4);
  border-top: 1px solid #284A40;
}
.board output { font-weight: 600; flex: 1 1 16rem; }
.board .reset {
  font: 600 13px/20px var(--font-sans);
  background: none; color: var(--on-night);
  border: 1px solid #5E7F75; border-radius: var(--radius-pill);
  min-height: 44px; padding: 0 var(--space-4); cursor: pointer;
  touch-action: manipulation;
  transition: border-color 150ms ease-out;
}
.board .reset:hover { border-color: #8FD5C0; }

@media (max-width: 34rem) {
  /* phone: stacked, full-width buttons are easier to hit with a thumb */
  .actions { flex-direction: column; align-items: stretch; }
  .board { padding: var(--space-4); }
  .board .t-name { font-size: 23px; }
  .board .t-note { display: none; }
  .board .src .t-name, .board .inv .t-name { transform: translateY(8px); }
  .board .home .t-name { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .board .wire.live { animation: none; stroke-dasharray: none; }
}

/* ---------- sections ---------- */

.section { padding-block: clamp(var(--space-12), 7vw, 88px); }
.section.soft { background: var(--brand-soft); }
.section h2 { font-size: clamp(24px, 3vw, 32px); line-height: 1.35; font-weight: 700; }
.section .intro { margin: var(--space-3) 0 var(--space-8); color: var(--ink-muted); max-width: 56ch; }

/* ServiceCard */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr));
  gap: var(--space-6);
  margin: 0; padding: 0; list-style: none;
}
.card {
  background: var(--surface-200);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
}
.chip {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: var(--icon-ground);
  display: grid; place-items: center;
}
.chip img { width: 28px; height: 28px; }
.card h3 { margin: var(--space-4) 0 var(--space-2); font-size: 18px; line-height: 28px; font-weight: 600; }
.card p { margin: 0; font-size: 14px; line-height: 24px; color: var(--ink-muted); }
.card .spec { margin-top: var(--space-3); color: var(--brand); }
[dir="rtl"] .card .spec { direction: ltr; text-align: right; }

/* ATS close-up + a real installation: two-column feature blocks */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(var(--space-8), 5vw, 72px);
  align-items: start;
}
@media (max-width: 50rem) { .feature { grid-template-columns: 1fr; } }
.feature .intro { margin-bottom: 0; }

.checks { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-3); }
.checks li {
  display: grid; grid-template-columns: 28px 1fr; gap: var(--space-3); align-items: start;
  background: var(--surface-200); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.checks li::before {
  content: "";
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--icon-ground) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F5E4F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 18px no-repeat;
}

.specs {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-200);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.specs caption { text-align: start; font-size: 14px; color: var(--ink-muted); padding-bottom: var(--space-3); }
.specs th, .specs td { padding: var(--space-3) var(--space-4); text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
.specs tr:last-child th, .specs tr:last-child td { border-bottom: 0; }
.specs th { width: 34%; font-weight: 600; font-size: 14px; background: var(--surface-300); }
.specs td { font-size: 15px; }
.specs .spec { color: var(--brand); font-size: 14px; }

/* ---------- our work: filter + masonry of real photos ---------- */

.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-6); }
.filters button {
  font: 600 14px/20px var(--font-sans);
  min-height: 44px; padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-200); color: var(--ink);
  cursor: pointer; touch-action: manipulation;
  transition: background-color 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
}
.filters button:hover { border-color: var(--brand); }
.filters button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

.shots { columns: 3 15rem; column-gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.shot { break-inside: avoid; margin-bottom: var(--space-4); }
.shot figure {
  margin: 0;
  background: var(--surface-200);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.shot a { position: relative; display: block; background: var(--surface-300); }
.shot img { width: 100%; height: auto; transition: transform 250ms ease-out; }
.shot a:hover img { transform: scale(1.03); }
.shot a:focus-visible { outline-offset: -3px; }
.shot figcaption { padding: var(--space-3) var(--space-4); font-size: 14px; line-height: 22px; color: var(--ink-muted); }
.shot .tag { display: block; font-size: 12px; line-height: 18px; font-weight: 600; color: var(--brand); margin-bottom: 2px; }

/* video tiles: a play disc in the middle, length in the corner */
.shot .play {
  position: absolute; inset: 50% auto auto 50%;
  width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: rgba(16, 48, 42, 0.78) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6.5v11l9-5.5z' fill='%23F6F4EE'/%3E%3C/svg%3E") center / 28px no-repeat;
}
.shot .dur {
  position: absolute; bottom: var(--space-2); inset-inline-end: var(--space-2);
  font: 500 12px/18px var(--font-mono);
  background: rgba(16, 48, 42, 0.78); color: #F6F4EE;
  padding: 1px 6px; border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) { .shot img { transition: none; } .shot a:hover img { transform: none; } }

/* phone: two narrow columns instead of one long scroll; chips slide sideways in one row */
@media (max-width: 34rem) {
  .filters {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter);
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; }
  .shots { columns: 2; column-gap: var(--space-2); }
  .shot { margin-bottom: var(--space-2); }
  .shot figure { border-radius: var(--radius-md); }
  .shot figcaption { padding: var(--space-2) var(--space-3); font-size: 13px; line-height: 20px; }
  .shot .play { width: 44px; height: 44px; margin: -22px 0 0 -22px; background-size: 22px; }
}

/* full-screen viewer */
.viewer {
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(8, 22, 19, 0.96); color: #F6F4EE;
}
.viewer::backdrop { background: rgba(8, 22, 19, 0.6); }
.viewer[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.viewer-media { display: grid; place-items: center; min-height: 0; padding: 64px 64px 0; }
/* room left for the close button above and the caption below */
.viewer-media img, .viewer-media video {
  max-width: 100%; max-height: calc(100dvh - 180px);
  width: auto; height: auto; object-fit: contain; border-radius: var(--radius-md);
}
.viewer-cap { margin: 0; padding: var(--space-4) var(--space-6) var(--space-6); text-align: center; font-size: 15px; line-height: 24px; }
.viewer-count { display: block; font: 500 12px/18px var(--font-mono); color: #A3B8B1; }
.viewer-btn {
  position: absolute; width: 48px; height: 48px;
  border-radius: 50%; border: 1px solid rgba(246, 244, 238, 0.35);
  background: rgba(16, 48, 42, 0.8); color: #F6F4EE;
  font: 400 28px/1 var(--font-sans); cursor: pointer; touch-action: manipulation;
}
.viewer-btn:hover { border-color: #F6F4EE; }
.viewer-close { top: var(--space-3); inset-inline-end: var(--space-3); }
.viewer-prev, .viewer-next { top: 50%; margin-top: -24px; }
.viewer-prev { inset-inline-start: var(--space-3); }
.viewer-next { inset-inline-end: var(--space-3); }
[dir="rtl"] .viewer-prev, [dir="rtl"] .viewer-next { transform: scaleX(-1); }
@media (max-width: 34rem) {
  .viewer-media { padding: 64px var(--space-2) 0; }
  .viewer-prev, .viewer-next { top: auto; bottom: var(--space-3); margin: 0; }
  .viewer-cap { padding-inline: 64px; }
}

/* steps: a real sequence, so numbered */
.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: var(--space-8) var(--space-6);
  counter-reset: step;
}
.steps li { counter-increment: step; border-top: 2px solid var(--brand); padding-top: var(--space-4); }
.steps li::before {
  content: counter(step);
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  background: var(--brand); color: var(--on-brand);
  font: 600 15px/1 var(--font-mono);
  margin-bottom: var(--space-3);
}
.steps h3 { font-size: 18px; line-height: 28px; font-weight: 600; margin-bottom: var(--space-1); }
.steps p { margin: 0; color: var(--ink-muted); font-size: 14px; line-height: 24px; }

/* contact */
.contact-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-8); align-items: center;
}
@media (max-width: 46rem) { .contact-grid { grid-template-columns: 1fr; } }
.contact-lines { margin: var(--space-4) 0 0; padding: 0; list-style: none; display: grid; gap: var(--space-1); color: var(--ink-muted); }
.contact-lines b { color: var(--ink); font-weight: 600; }
/* numbers are tap-to-call; padding gives them a comfortable target without changing the line */
.contact-lines a.num { display: inline-block; padding-block: 8px; margin-block: -8px; font-weight: 600; }
/* small pill beside each number that opens a WhatsApp chat */
.contact-lines a.wa {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--space-3);
  margin-inline-start: var(--space-2); margin-block: -4px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600; text-decoration: none; color: var(--brand);
  transition: border-color 150ms ease-out;
}
.contact-lines a.wa:hover { border-color: var(--brand); }
.contact-lines { gap: var(--space-3); }

/* footer: night */
.site-foot { background: var(--night); color: var(--on-night-muted); font-size: 14px; }
@media (prefers-color-scheme: dark) { .site-foot { background: #10302A; } }
.site-foot .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-4) var(--space-8); padding-block: var(--space-8);
}
.site-foot .lockup { color: var(--on-night); }
.site-foot .lockup .lat { color: var(--on-night-muted); }
.site-foot a { color: var(--on-night); }
.site-foot a:not(.lockup) { display: inline-flex; align-items: center; min-height: 44px; }

/* phone: secondary text goes up from 14px so it reads without zooming */
@media (max-width: 34rem) {
  .card p, .steps p { font-size: 15px; line-height: 26px; }
}

/* content the owner still has to fill in */
.todo {
  background: repeating-linear-gradient(-45deg, rgba(232, 201, 138, 0.45) 0 6px, rgba(232, 201, 138, 0.2) 6px 12px);
  outline: 1px dashed #9A7A2E;
  padding: 0 0.25em;
  border-radius: 2px;
  color: var(--ink);
}
