/* AlSeraj Almuodea quick links
   Tokens from alseraj-brand/alseraj-tokens.css (dark theme): brand green #2c3930, night #161b18,
   gold #d1be96 > #b99b77 > #a57c5c, sand #eaddd5, ink #f4efe6. Type: 29LT Bukra in print, Tajawal on the web.
   Links are hexagon cells: six around one, as the six triangles sit around the element's centre. */

:root {
  --night: #161b18;
  --night-2: #1d2520;
  --green: #2c3930;
  --gold-light: #d1be96;
  --gold: #b99b77;
  --gold-deep: #a57c5c;
  --ink: #f4efe6;
  --muted: #c4bcae;
  --gl: 209, 190, 150; /* gold-light as an rgb triplet for glows */

  --font: "Tajawal", "Segoe UI", Tahoma, system-ui, sans-serif;
  --radius: 2px;
  --gutter: clamp(1rem, 4.5vw, 2.75rem);
  --measure: 70rem;
  --bar: 3.5rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--night);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100svh;
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
  overflow-x: clip;
}

::selection { background: rgba(var(--gl), 0.32); color: var(--ink); }

/* Night green, with warm light pooling from the top like a lamp over the page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(85% 52% at 50% -10%, rgba(var(--gl), 0.17) 0%, rgba(var(--gl), 0) 70%),
    radial-gradient(70% 45% at 100% 0%, rgba(53, 68, 58, 0.85) 0%, rgba(53, 68, 58, 0) 75%),
    linear-gradient(180deg, var(--green) 0%, var(--night-2) 42%, var(--night) 100%);
}

/* Fine grain so the gradients never band */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* The brand pattern, faint like the print on the business cards. It sits under the 3D layer. */
.pattern {
  position: absolute;
  inset: 0 0 auto;
  height: 115svh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.075;
  background: url("../img/pattern.svg") 50% 0 / 220px auto repeat;
  -webkit-mask-image: radial-gradient(75% 62% at 50% 0%, #000 25%, transparent 100%);
  mask-image: radial-gradient(75% 62% at 50% 0%, #000 25%, transparent 100%);
}

[lang="ar"] * { letter-spacing: 0 !important; }

a { color: inherit; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* ---------- 3D scene ---------- */

.scene {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100lvh;
  z-index: 0;
  display: block;
  pointer-events: none;
}

main,
.band,
.footer { position: relative; z-index: 1; }

/* ---------- Top bar: dark green with the thin gold rule from the stationery ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--bar);
  padding: env(safe-area-inset-top) var(--gutter) 0;
  background: rgba(22, 27, 24, 0.8);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  backdrop-filter: blur(14px) saturate(130%);
  border-bottom: 1px solid var(--gold-deep);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgba(244, 239, 230, 0.25);
  flex: none;
}

.is-open .status-dot {
  background: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(var(--gl), 0.16), 0 0 12px 1px rgba(var(--gl), 0.85);
}

.is-open .status-text { color: var(--ink); }

.lang {
  appearance: none;
  min-height: 36px;
  min-width: 44px;
  padding: 0 0.9rem;
  border: 1px solid rgba(var(--gl), 0.42);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.3s, background-color 0.3s;
}

.lang:hover { border-color: var(--gold-light); background: rgba(var(--gl), 0.1); }

/* ---------- Hero ---------- */

/* With motion on, the hero holds still for a short stretch while the element parts and clears out. */
.hero { position: relative; }
.motion .hero { height: 160svh; }
/* The cells start rising during the last part of the hold, once the triangles are already off screen. */
.motion #links { margin-top: -30svh; padding-top: 1.5rem; }

.hero-pin {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.1rem, 3svh, 2.1rem);
  padding: calc(var(--bar) + 1.5rem) var(--gutter) 1.25rem;
  text-align: center;
}

.motion .hero-pin {
  position: sticky;
  top: 0;
  height: 100svh;
}

.hero-stage {
  width: min(58vw, 32svh, 330px);
  aspect-ratio: 1;
  flex: none;
}

.no-webgl .hero-stage,
.no-webgl .footer-stage {
  background: url("../img/alseraj-icon.svg") 50% 50% / 88% auto no-repeat;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 2.4svh, 1.5rem);
  width: 100%;
}

.wordmark {
  position: relative;
  width: min(80vw, 500px);
  margin: 0;
  --glow: 0.3;
}

.wordmark-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 calc(var(--glow) * 22px) rgba(var(--gl), calc(var(--glow) * 0.6)));
}

.scanbar {
  position: absolute;
  top: -12%;
  bottom: -12%;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: #fff6e4;
  box-shadow: 0 0 10px 2px rgba(var(--gl), 0.9), 0 0 42px 8px rgba(165, 124, 92, 0.5);
  opacity: 0;
  pointer-events: none;
}

.hero-sub {
  max-width: 36ch;
  margin: 0;
  font-size: clamp(1.0625rem, 0.6vw + 0.92rem, 1.3125rem);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: rgba(244, 239, 230, 0.86);
  text-wrap: balance;
}

[lang="ar"] .hero-sub { font-weight: 400; line-height: 1.75; }

.cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.625rem;
  width: min(100%, 36rem);
  margin-top: 0.25rem;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 52px;
  padding: 0 1.15rem;
  border: 1px solid rgba(var(--gl), 0.34);
  border-radius: var(--radius);
  background: rgba(44, 57, 48, 0.6);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.35s, background-color 0.35s, box-shadow 0.35s, transform 0.35s var(--ease), filter 0.35s;
}

.btn:hover { border-color: var(--gold-light); background: rgba(var(--gl), 0.1); }
.btn:active { transform: scale(0.98); }

/* Ringed icons: the ring is part of each glyph, as in the brand kit */
.btn-icon {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  fill: currentColor;
  color: var(--gold-light);
}

.btn-primary {
  --btn-gold: linear-gradient(120deg, #d9c8a3 0%, #b99b77 100%); /* the light half of the gold, so text stays above 4.5:1 */
  border-color: transparent;
  background: var(--btn-gold);
  color: var(--green);
  font-weight: 700;
  box-shadow: 0 14px 40px -16px rgba(var(--gl), 0.65);
}

.btn-primary .btn-icon { color: var(--green); }

.btn-primary:hover {
  border-color: transparent;
  background: var(--btn-gold);
  filter: brightness(1.07);
  box-shadow: 0 16px 52px -12px rgba(var(--gl), 0.8);
}

.btn.is-done { border-color: var(--gold-light); }

@media (max-width: 559px) {
  .cta .btn-primary { flex: 1 1 100%; }
  .cta .btn:not(.btn-primary) { flex: 1 1 0; padding: 0 0.8rem; }
}

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 0.75rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.3s;
}

.more-link svg { width: 1rem; height: 1rem; color: var(--gold); }
.more-link:hover { color: var(--ink); }

/* Short phones: keep the whole hero on one screen */
@media (max-height: 720px) {
  .hero-stage { width: min(50vw, 25svh, 300px); }
  .wordmark { width: min(66vw, 420px); }
  .hero-sub { font-size: 1rem; }
  .hero-pin { gap: 0.9rem; }
}

/* Hidden until the intro timeline takes over (class removed by script, or after 6s as a safety net) */
.intro .topbar,
.intro .wordmark-img,
.intro .hero-sub,
.intro .cta,
.intro .more-link { visibility: hidden; }

/* ---------- Sections ---------- */

.section {
  max-width: var(--measure);
  margin-inline: auto;
  display: grid;
  justify-items: center;
  gap: clamp(1.75rem, 4.5vw, 3rem);
  padding: clamp(3rem, 9svh, 6rem) var(--gutter) clamp(2rem, 6svh, 4rem);
  text-align: center;
}

.section-head { display: grid; gap: 0.35rem; }

.section-title {
  margin: 0;
  font-size: clamp(1.625rem, 1.6vw + 1.1rem, 2.375rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--gold-light);
}

[lang="ar"] .section-title { line-height: 1.45; }

.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

/* ---------- Hive: hexagon cells placed on a flat-top grid (units of the cell radius R) ---------- */

.hive {
  --flip: 1;
  position: relative;
  width: calc(var(--w) * var(--R));
  height: calc(var(--h) * var(--R));
  margin: 0;
  padding: 0;
  list-style: none;
}

[dir="rtl"] .hive { --flip: -1; }

/* Seven cells: one centre, six around it */
.hive--flower { --R: clamp(54px, 18.2vw, 118px); --w: 5; --h: 5.196; --ox: 2.5; --oy: 2.598; }

/* A zigzag of --n cells: down the screen on phones, across it once there is room.
   Each cell carries its index (--i); every second cell steps sideways (down the screen) or down (across it). */
.hive--zig {
  --R: clamp(78px, 25.2vw, 104px);
  --w: 3.5;
  --h: calc(0.866 * (var(--n) - 1) + 1.732);
  --ox: 1;
  --oy: 0.866;
}
[dir="rtl"] .hive--zig { --ox: 2.5; }
.hive--zig .cell { --odd: 0; --cx: calc(var(--odd) * 1.5); --cy: calc(var(--i) * 0.866); }
.hive--zig .cell:nth-child(even) { --odd: 1; }

/* Across the screen: four cells from 640px, seven from 1000px */
@media (min-width: 640px) {
  .hive--row-sm {
    --w: calc(1.5 * (var(--n) - 1) + 2);
    --h: 2.598;
    --R: clamp(70px, calc((min(100vw, 70rem) - 5.5rem) / (1.5 * (var(--n) - 1) + 2.3)), 112px);
  }
  [dir="rtl"] .hive--row-sm { --ox: calc(var(--w) - 1); }
  .hive--row-sm .cell { --cx: calc(var(--i) * 1.5); --cy: calc(var(--odd) * 0.866); }
}

@media (min-width: 1000px) {
  .hive--row-lg {
    --w: calc(1.5 * (var(--n) - 1) + 2);
    --h: 2.598;
    --R: clamp(70px, calc((min(100vw, 70rem) - 5.5rem) / (1.5 * (var(--n) - 1) + 2.3)), 112px);
  }
  [dir="rtl"] .hive--row-lg { --ox: calc(var(--w) - 1); }
  .hive--row-lg .cell { --cx: calc(var(--i) * 1.5); --cy: calc(var(--odd) * 0.866); }
}

/* Range cells carry a name only, so the type can be larger */
.cell--range .cell-title { font-size: calc(clamp(0.9375rem, calc(var(--R) * 0.19), 1.1875rem) * var(--fit, 1)); }

.cell {
  position: absolute;
  width: calc(2 * var(--R));
  height: calc(1.7320508 * var(--R));
  left: calc((var(--ox) + var(--flip) * var(--cx)) * var(--R) - var(--R));
  top: calc((var(--oy) + var(--cy)) * var(--R) - 0.8660254 * var(--R));
}

.cell-link {
  --x: 50%;
  --y: 40%;
  appearance: none;
  position: absolute;
  inset: 0;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--R) * 0.05 * var(--fit, 1));
  margin: 0;
  padding: 0 calc(var(--R) * 0.26);
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  /* the hit area is the hexagon itself, so neighbouring cells never steal a tap */
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  -webkit-tap-highlight-color: transparent;
}

.cell-shape {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.hx-fill {
  fill: url(#g-cell);
  stroke: #263129;
  stroke-width: 12;
  stroke-linejoin: round; /* soft corners, as the brand hexagon */
  transition: fill 0.4s;
}

.hx-line {
  fill: none;
  stroke: rgba(185, 155, 119, 0.55);
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.4s, stroke-width 0.4s;
}

/* Warm light that follows the pointer inside the cell */
.cell-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at var(--x) var(--y), rgba(var(--gl), 0.24), rgba(var(--gl), 0) 62%);
  opacity: 0;
  transition: opacity 0.45s;
}

.cell-icon {
  width: calc(var(--R) * 0.44 * var(--fit, 1));
  height: calc(var(--R) * 0.44 * var(--fit, 1));
  flex: none;
  margin-bottom: calc(var(--R) * 0.02);
  fill: currentColor;
  color: var(--gold);
  transition: color 0.35s, filter 0.35s;
}

.cell-title {
  max-width: 100%;
  font-size: calc(clamp(0.8rem, calc(var(--R) * 0.2), 1.0625rem) * var(--fit, 1));
  font-weight: 700;
  line-height: 1.25;
}

.cell-detail {
  max-width: 100%;
  font-size: calc(clamp(0.6875rem, calc(var(--R) * 0.155), 0.875rem) * var(--fit, 1));
  line-height: 1.4;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cell-link:hover::after,
.cell-link:focus-visible::after,
.cell.is-lit .cell-link::after { opacity: 1; }

.cell-link:hover .hx-line,
.cell.is-lit .hx-line { stroke: var(--gold-light); stroke-width: 1.8; }

.cell-link:hover .cell-icon,
.cell-link:focus-visible .cell-icon,
.cell.is-lit .cell-icon {
  color: var(--gold-light);
  filter: drop-shadow(0 0 8px rgba(var(--gl), 0.6));
}

/* A cell that cannot fit its detail line at a readable size shows icon and name only */
.cell.is-compact .cell-detail {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.cell.is-compact .cell-icon {
  width: calc(var(--R) * 0.34 * var(--fit, 1));
  height: calc(var(--R) * 0.34 * var(--fit, 1));
}

/* Small phones: the flower cells keep icon and name only; the number or handle stays for screen readers */
@media (max-width: 479px) {
  .hive--flower .cell-detail {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* The clip hides outlines, so keyboard focus shows on the cell's own gold line */
.cell-link:focus-visible { outline: none; }
.cell-link:focus-visible .hx-line { stroke: #fff3d9; stroke-width: 3; }

/* The centre cell is the lit one: WhatsApp, in gold */
.cell--main { filter: drop-shadow(0 16px 34px rgba(var(--gl), 0.3)); }
.cell--main .cell-link { color: var(--green); }
.cell--main .hx-fill { fill: url(#g-gold); stroke: #c9b189; }
.cell--main .hx-line { stroke: rgba(44, 57, 48, 0.35); }
.cell--main .cell-icon,
.cell--main .cell-link:hover .cell-icon,
.cell--main.is-lit .cell-icon { color: var(--green); filter: none; }
.cell--main .cell-detail { color: rgba(44, 57, 48, 0.82); font-weight: 500; }
.cell--main .cell-link::after { background: radial-gradient(circle at var(--x) var(--y), rgba(255, 250, 238, 0.45), rgba(255, 250, 238, 0) 60%); }
.cell--main .cell-link:hover .hx-line,
.cell--main.is-lit .hx-line { stroke: rgba(44, 57, 48, 0.55); }

/* Showroom cells */
.cell--branch .cell-link { gap: calc(var(--R) * 0.06 * var(--fit, 1)); padding: 0 calc(var(--R) * 0.3); }
.cell--branch .cell-title { font-size: calc(clamp(0.875rem, calc(var(--R) * 0.17), 1.125rem) * var(--fit, 1)); }
.cell--branch .cell-detail { font-size: calc(clamp(0.75rem, calc(var(--R) * 0.13), 0.9375rem) * var(--fit, 1)); }

.cell-go {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: calc(var(--R) * 0.04 * var(--fit, 1));
  font-size: calc(clamp(0.75rem, calc(var(--R) * 0.125), 0.875rem) * var(--fit, 1));
  font-weight: 700;
  color: var(--gold);
  transition: color 0.35s;
}

.cell-go svg { width: 0.95em; height: 0.95em; }
[dir="rtl"] .cell-go svg { transform: scaleX(-1); }
/* Range cells: just the arrow under the name */
svg.cell-go { width: calc(var(--R) * 0.17 * var(--fit, 1)); height: calc(var(--R) * 0.17 * var(--fit, 1)); margin-top: calc(var(--R) * 0.03); }
[dir="rtl"] svg.cell-go { transform: scaleX(-1); }
.cell--branch .cell-link:hover .cell-go,
.cell--branch.is-lit .cell-go { color: var(--gold-light); }

/* ---------- Pattern band, as at the foot of the stationery ---------- */

.band {
  height: clamp(56px, 9vw, 84px);
  margin-top: clamp(2rem, 6svh, 4rem);
  background: url("../img/pattern.svg") 50% 50% / auto 100% repeat-x;
  opacity: 0.5;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

/* ---------- Footer ---------- */

.footer {
  max-width: var(--measure);
  margin-inline: auto;
  display: grid;
  justify-items: center;
  gap: 1.5rem;
  padding: clamp(3rem, 8svh, 5rem) var(--gutter) max(2.5rem, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
}

.footer-stage {
  width: clamp(140px, 34vw, 200px);
  aspect-ratio: 1;
}

.footer-text p { margin: 0 0 0.35rem; }

.footer-name {
  color: var(--ink);
  font-size: 1.375rem;
  font-weight: 700;
}

.footer-small {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1rem;
  margin-top: 1.25rem !important;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(165, 124, 92, 0.5);
  font-size: 0.875rem;
  color: rgba(196, 188, 174, 0.85);
}

.footer-small a { color: var(--gold-light); text-underline-offset: 3px; }
.footer-small a:hover { color: var(--ink); }

@media (min-width: 880px) {
  .footer {
    grid-template-columns: auto 1fr;
    justify-items: start;
    align-items: center;
    column-gap: 3rem;
    text-align: start;
  }
  .footer-small { justify-content: flex-start; }
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
