/* Sara Duct — preview redesign.
   Palette taken from the logo: duct blue fading to galvanized sage. */
:root {
  --plate: #0e2131;      /* deep steel, dark sections */
  --plate-2: #16314a;
  --duct: #2d5e86;       /* logo blue */
  --duct-bright: #6fa3cf;
  --zinc: #90aab5;       /* logo mid tone */
  --sage: #79999a;       /* logo lower tone */
  --galv: #e6ecee;       /* galvanized sheet */
  --white: #ffffff;
  --ink: #13293a;
  --muted: #45606f;
  --line: #c9d5da;
  --line-dark: rgba(230, 236, 238, 0.18);

  --font-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-display: "Archivo", "IBM Plex Sans Arabic", "Segoe UI", sans-serif;

  --step-0: clamp(1.05rem, 0.98rem + 0.3vw, 1.2rem);
  --step-1: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.2vw, 2.2rem);
  --step-3: clamp(2.1rem, 1.5rem + 2.6vw, 3.6rem);
  --step-4: clamp(2.6rem, 1.6rem + 4.6vw, 5.8rem);

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1240px;
  --cut: clamp(28px, 5vw, 72px); /* angled slab edge, echoing the logo segments */
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-ar);
  font-size: var(--step-0);
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}
html[lang="en"] body { font-family: "IBM Plex Sans Arabic", "Segoe UI", sans-serif; line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; }
html[lang="en"] h1, html[lang="en"] h2 { font-family: var(--font-display); font-variation-settings: "wdth" 112; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }

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

.skip {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100;
  background: var(--white); color: var(--ink); padding: 10px 16px; border-radius: 6px;
}
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--duct-bright); outline-offset: 3px; border-radius: 4px; }

/* ---------- Header ---------- */
.bar {
  position: fixed; inset-inline: 0; top: 0; z-index: 50;
  color: var(--white);
  transition: background-color .35s var(--ease), box-shadow .35s var(--ease), color .35s;
}
.bar.is-solid { background: rgba(14, 33, 49, 0.94); box-shadow: 0 1px 0 var(--line-dark); backdrop-filter: blur(8px); }
.bar .wrap { display: flex; align-items: center; gap: 20px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-inline-end: auto; }
.brand img { width: 46px; height: 46px; background: var(--white); border-radius: 10px; padding: 4px; }
.brand b { display: block; font-size: 1.15rem; line-height: 1.1; }
.brand small { display: block; font-size: .8rem; opacity: .8; line-height: 1.3; }
.nav { display: flex; gap: 6px; }
.nav a {
  text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: 8px; font-size: 1rem;
}
.nav a:hover, .nav a[aria-current="page"] { background: rgba(255,255,255,.12); }
.tools { display: flex; gap: 8px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: .92rem; font-weight: 600; color: inherit;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.35);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; min-height: 42px;
}
.chip:hover { background: rgba(255,255,255,.2); }
.chip svg { width: 18px; height: 18px; flex: none; }
.chip[aria-pressed="true"] { background: var(--white); color: var(--plate); border-color: var(--white); }
.menu-btn { display: none; }

@media (max-width: 940px) {
  .menu-btn { display: inline-flex; }
  .nav {
    position: absolute; top: 100%; inset-inline: 0; flex-direction: column; gap: 0;
    background: var(--plate); padding: 8px var(--gutter) 20px; display: none;
    box-shadow: 0 12px 30px rgba(0,0,0,.25);
  }
  .bar.menu-open .nav { display: flex; }
  .bar.menu-open { background: var(--plate); }
  .nav a { padding: 14px 4px; font-size: 1.15rem; border-bottom: 1px solid var(--line-dark); border-radius: 0; }
  .brand small { display: none; }
}
@media (max-width: 560px) {
  .chip .label { display: none; }
  .chip { padding: 8px 11px; }
  .chip.lang .label { display: inline; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 700; font-size: 1.05rem; text-decoration: none;
  padding: 15px 26px; border-radius: 10px; min-height: 54px; cursor: pointer; border: 2px solid transparent;
  transition: transform .2s var(--ease), background-color .2s;
}
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--white); color: var(--plate); }
.btn-solid:hover { background: var(--galv); }
.btn-line { border-color: rgba(255,255,255,.7); color: var(--white); }
.btn-line:hover { background: rgba(255,255,255,.12); }
.btn-blue { background: var(--duct); color: var(--white); }
.btn-blue:hover { background: #244e70; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh; color: var(--white);
  display: grid; grid-template-rows: 1fr auto; overflow: hidden; isolation: isolate;
  background: var(--plate);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), 0 100%);
}
.hero-media { position: absolute; inset: 0; z-index: -2; }
.hero-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; animation: slide 24s infinite, drift 24s infinite;
}
.hero-media img:nth-child(1) { opacity: 1; animation-delay: 0s; }
.hero-media img:nth-child(2) { animation-delay: 8s; }
.hero-media img:nth-child(3) { animation-delay: 16s; }
@keyframes slide {
  0% { opacity: 0; } 4% { opacity: 1; } 33% { opacity: 1; } 38% { opacity: 0; } 100% { opacity: 0; }
}
@keyframes drift {
  0% { transform: scale(1.02) translate3d(0,0,0); } 38% { transform: scale(1.14) translate3d(-1.5%, -1%, 0); } 100% { transform: scale(1.14) translate3d(-1.5%, -1%, 0); }
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(14,33,49,.72) 0%, rgba(14,33,49,.35) 38%, rgba(14,33,49,.88) 100%),
    linear-gradient(90deg, rgba(14,33,49,.55), rgba(14,33,49,0) 70%);
}
html[dir="rtl"] .hero::before {
  background:
    linear-gradient(180deg, rgba(14,33,49,.72) 0%, rgba(14,33,49,.35) 38%, rgba(14,33,49,.88) 100%),
    linear-gradient(270deg, rgba(14,33,49,.55), rgba(14,33,49,0) 70%);
}
.hero-content { align-self: center; padding-top: 120px; padding-bottom: 40px; }
.hero-maker { font-size: var(--step-1); font-weight: 600; color: var(--galv); margin-bottom: 18px; }
.hero h1 { font-size: var(--step-4); max-width: 15ch; text-wrap: balance; }
html[lang="en"] .hero h1 { max-width: 16ch; }
.hero-lede { font-size: var(--step-1); max-width: 40ch; margin-top: 22px; color: #dfe8ec; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

/* the nameplate: a riveted steel tag listing the factory's real figures */
.nameplate {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line-dark);
  padding-bottom: calc(var(--cut) + 18px);
}
.nameplate div { padding: 22px 18px 6px; border-inline-start: 1px solid var(--line-dark); }
.nameplate div:first-child { border-inline-start: 0; padding-inline-start: 0; }
.nameplate strong {
  display: block; font-family: var(--font-display); font-variation-settings: "wdth" 118;
  font-weight: 800; font-size: var(--step-3); line-height: 1; font-variant-numeric: tabular-nums;
}
.nameplate > div > span { display: block; margin-top: 8px; color: #cfdbe1; font-size: 1rem; }
@media (max-width: 760px) {
  .nameplate { grid-template-columns: repeat(2, 1fr); }
  .nameplate div:nth-child(3) { border-inline-start: 0; padding-inline-start: 0; }
  .nameplate div:nth-child(n+3) { border-top: 1px solid var(--line-dark); }
}

/* ---------- Generic sections ---------- */
.section { padding-block: clamp(72px, 10vw, 140px); }
.section-head { max-width: 760px; margin-bottom: clamp(36px, 5vw, 60px); }
.section-head h2 { font-size: var(--step-3); text-wrap: balance; }
.section-head p { margin-top: 16px; font-size: var(--step-1); color: var(--muted); max-width: 52ch; }
.dark .section-head p { color: #c6d4db; }
.dark { background: var(--plate); color: var(--white); }

/* ---------- Approvals ---------- */
.approvals { padding-top: clamp(60px, 8vw, 110px); }
.tags { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 860px) { .tags { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .tags { grid-template-columns: 1fr; } }
.tag {
  position: relative; padding: 22px 22px 20px; border-radius: 6px;
  background: linear-gradient(160deg, #f4f7f8, #dfe6e9);
  border: 1px solid var(--line);
}
.tag::before, .tag::after {
  content: ""; position: absolute; top: 12px; width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #8a9aa3);
  box-shadow: 0 1px 0 rgba(0,0,0,.15);
}
.tag::before { inset-inline-start: 12px; }
.tag::after { inset-inline-end: 12px; }
.tag b { display: block; font-size: 1.15rem; margin-top: 8px; }
.tag span { display: block; color: var(--muted); font-size: .98rem; }
.tag code {
  display: block; margin-top: 10px; font-family: var(--font-display); font-variation-settings: "wdth" 100;
  font-weight: 700; font-size: 1.35rem; color: var(--duct); letter-spacing: .02em; direction: ltr; text-align: start;
}

/* ---------- Products ---------- */
.products-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.product {
  grid-column: span 4; display: flex; flex-direction: column;
  text-decoration: none; color: var(--ink); background: var(--white);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  transition: border-color .25s, transform .35s var(--ease);
}
.product:hover { border-color: var(--duct); transform: translateY(-4px); }
.product figure { margin: 0; background: var(--white); aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 18px; border-bottom: 1px solid var(--line); }
.product figure img { max-height: 100%; width: auto; object-fit: contain; mix-blend-mode: multiply; }
.product .meta { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product h3 { font-size: var(--step-1); }
.product .pdf { margin-top: auto; padding-top: 10px; color: var(--duct); font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.product .pdf svg { width: 18px; height: 18px; }
.product.feature { grid-column: span 8; flex-direction: row; }
.product.feature figure { flex: 1.3; aspect-ratio: auto; border-bottom: 0; border-inline-end: 1px solid var(--line); }
.product.feature .meta { flex: 1; padding: 28px; justify-content: center; }
.product.feature h3 { font-size: var(--step-2); }
.product.feature p { color: var(--muted); }
.product.side { grid-column: span 4; }
.pdf-pair { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 10px; }
.pdf-pair a { color: var(--duct); font-weight: 600; }
@media (max-width: 980px) {
  .product, .product.side { grid-column: span 6; }
  .product.feature { grid-column: span 12; }
}
@media (max-width: 620px) {
  .product, .product.side, .product.feature { grid-column: span 12; }
  .product.feature { flex-direction: column; }
  .product.feature figure { border-inline-end: 0; border-bottom: 1px solid var(--line); aspect-ratio: 4/3; }
}

/* ---------- 3D damper ---------- */
.damper {
  position: relative; overflow: hidden;
  background:
    radial-gradient(60% 70% at 70% 50%, #1f4565 0%, rgba(14,33,49,0) 70%),
    var(--plate);
  clip-path: polygon(0 var(--cut), 100% 0, 100% calc(100% - var(--cut)), 0 100%);
  padding-block: calc(var(--cut) + clamp(60px, 8vw, 110px));
}
html[dir="rtl"] .damper { background: radial-gradient(60% 70% at 30% 50%, #1f4565 0%, rgba(14,33,49,0) 70%), var(--plate); }
.damper .wrap { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(28px, 5vw, 70px); align-items: center; }
.damper h2 { font-size: var(--step-3); }
.damper p { color: #cbd8de; margin-top: 18px; max-width: 46ch; }
.materials { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; padding: 0; list-style: none; }
.materials li { border: 1px solid var(--line-dark); border-radius: 999px; padding: 6px 14px; font-size: .98rem; color: var(--galv); }
.stage { position: relative; aspect-ratio: 1 / 1; width: 100%; max-width: 620px; justify-self: center; touch-action: pan-y; cursor: grab; }
.stage:active { cursor: grabbing; }
.stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.stage .fallback { position: absolute; inset: 12%; object-fit: contain; background: var(--white); border-radius: 16px; padding: 20px; }
.stage.ready .fallback { display: none; }
.stage-hint { text-align: center; color: #9fb4be; font-size: .95rem; margin-top: 6px; }
@media (max-width: 860px) {
  .damper .wrap { grid-template-columns: 1fr; }
  .stage { max-width: 460px; }
}

/* ---------- Factory ---------- */
.factory .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 80px); align-items: start; }
.factory-photo { position: sticky; top: 100px; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 5; }
.factory-photo img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.08); transition: transform 1.2s var(--ease); }
.factory-photo.in img { transform: scale(1); }
.factory h2 { font-size: var(--step-3); }
.factory .body p { margin-top: 18px; color: var(--muted); }
.factory .body p.lead { color: var(--ink); font-size: var(--step-1); }
.offices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 28px; }
.offices div { border-inline-start: 3px solid var(--duct); padding: 4px 14px; }
.offices b { display: block; }
.offices span { color: var(--muted); font-size: .98rem; }
.vision { margin-top: 40px; padding: 26px; background: var(--galv); border-radius: 12px; }
.vision h3 { font-size: var(--step-1); }
.vision p { margin-top: 10px !important; }
.values { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 0; }
.values li { padding: 16px 0; border-top: 1px solid var(--line); }
.values b { display: block; font-size: 1.1rem; }
.values span { color: var(--muted); }
@media (max-width: 860px) {
  .factory .wrap { grid-template-columns: 1fr; }
  .factory-photo { position: relative; top: 0; aspect-ratio: 16 / 10; }
}

/* ---------- Projects ---------- */
.projects { background: var(--galv); }
.projects .head-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.rail-controls { display: flex; gap: 10px; margin-bottom: clamp(36px, 5vw, 60px); }
.rail-controls button {
  width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; color: var(--ink);
  display: grid; place-items: center; cursor: pointer;
}
.rail-controls button:hover { background: var(--ink); color: var(--white); }
.rail-controls svg { width: 22px; height: 22px; }
html[dir="ltr"] .rail-controls svg { transform: scaleX(-1); }
.rail {
  --edge: max(var(--gutter), calc((100% - var(--max)) / 2));
  display: flex; gap: 18px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--edge);
  padding-bottom: 18px; scrollbar-width: thin; overscroll-behavior-x: contain;
}
.rail::before, .rail::after { content: ""; flex: 0 0 calc(var(--edge) - 18px); }
.rail figure { flex: 0 0 min(78vw, 520px); margin: 0; scroll-snap-align: start; position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 10; background: var(--plate); }
.rail img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.rail figure:hover img { transform: scale(1.05); }
.rail figcaption {
  position: absolute; inset-inline: 0; bottom: 0; padding: 50px 20px 16px; color: var(--white);
  background: linear-gradient(0deg, rgba(14,33,49,.9), rgba(14,33,49,0));
}
.rail figcaption b { display: block; font-size: var(--step-1); line-height: 1.25; }
.rail figcaption span { font-size: .95rem; opacity: .85; }

/* ---------- Clients ---------- */
.logos { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); }
.logos figure { margin: 0; aspect-ratio: 3 / 2; display: grid; place-items: center; padding: 18px; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.logos img { max-height: 92px; width: auto; object-fit: contain; }
.logos figcaption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Call band ---------- */
.call {
  position: relative; color: var(--white); isolation: isolate; overflow: hidden;
  clip-path: polygon(0 var(--cut), 100% 0, 100% 100%, 0 100%);
  padding-block: calc(var(--cut) + clamp(70px, 9vw, 120px)) clamp(70px, 9vw, 120px);
}
.call > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.call::before { content: ""; position: absolute; inset: 0; background: rgba(14,33,49,.82); z-index: -1; }
.call h2 { font-size: var(--step-3); max-width: 18ch; }
.call-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 40px; }
.call-grid a {
  display: block; text-decoration: none; padding: 22px; border: 1px solid rgba(255,255,255,.3); border-radius: 12px;
  background: rgba(14,33,49,.4); transition: background-color .2s;
}
.call-grid a:hover { background: rgba(255,255,255,.1); }
.call-grid span { display: block; color: #c6d4db; font-size: .98rem; }
.call-grid b { display: block; font-size: var(--step-1); direction: ltr; text-align: start; margin-top: 4px; word-break: break-word; }
@media (max-width: 860px) { .call-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.foot { background: var(--plate); color: #c6d4db; padding-block: 56px 36px; font-size: 1rem; }
.foot .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.foot b { color: var(--white); display: block; margin-bottom: 10px; font-size: 1.05rem; }
.foot a { text-decoration: none; display: block; padding: 3px 0; }
.foot a:hover { color: var(--white); text-decoration: underline; }
.foot .ltr { direction: ltr; text-align: start; }
.foot .copy { grid-column: 1 / -1; border-top: 1px solid var(--line-dark); padding-top: 22px; font-size: .92rem; }
@media (max-width: 760px) { .foot .wrap { grid-template-columns: 1fr; } }

/* ---------- Contact page ---------- */
.page-hero {
  position: relative; color: var(--white); isolation: isolate; overflow: hidden;
  padding-block: 170px clamp(80px, 10vw, 130px);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), 0 100%);
}
.page-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; animation: drift 30s ease-out forwards; }
.page-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(14,33,49,.8), rgba(14,33,49,.7)); }
.page-hero h1 { font-size: var(--step-4); }
.page-hero p { font-size: var(--step-1); margin-top: 16px; color: #dfe8ec; max-width: 44ch; }
.contact-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.panel { border: 1px solid var(--line); border-radius: 14px; padding: clamp(22px, 3vw, 36px); }
.panel.primary { background: var(--plate); color: var(--white); border-color: var(--plate); }
.panel h2 { font-size: var(--step-2); }
.panel .role { color: var(--muted); margin-top: 4px; }
.panel.primary .role { color: #c6d4db; }
.address { margin-top: 18px; font-size: var(--step-1); line-height: 1.6; }
.lines { display: grid; gap: 10px; margin-top: 22px; }
.lines a {
  display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 600; font-size: var(--step-1);
  padding: 12px 16px; border-radius: 10px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
}
.panel:not(.primary) .lines a { background: var(--galv); border-color: var(--line); color: var(--ink); }
.lines a:hover { border-color: var(--duct-bright); }
.lines svg { width: 22px; height: 22px; flex: none; }
.lines .v { direction: ltr; unicode-bidi: isolate; word-break: break-word; }
.regions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
.regions .panel h3 { font-size: var(--step-1); }
@media (max-width: 860px) { .contact-grid, .regions { grid-template-columns: 1fr; } }

/* ---------- Reveal on scroll (only when motion is welcome) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0s); }
  .js [data-reveal].in { opacity: 1; transform: none; }
  .hero-content > * { animation: rise 1s var(--ease) both; }
  .hero-content > *:nth-child(2) { animation-delay: .12s; }
  .hero-content > *:nth-child(3) { animation-delay: .24s; }
  .hero-content > *:nth-child(4) { animation-delay: .36s; }
  @keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-media img { animation: none !important; opacity: 0; }
  .hero-media img:first-child { opacity: 1; }
  .page-hero > img { animation: none; }
  .factory-photo img { transform: none; }
}
