/* Layout: sticky top bar, a two-column hero (name on one side, a live 3D steel model on the other),
   then full-width sections on a faint structural grid. One visual world: a steel drawing at night. */
:root {
  color-scheme: dark;

  /* Color */
  --ink: #0b1522;        /* page ground: blueprint navy */
  --ink-2: #0f1b2b;      /* raised panels */
  --ink-3: #13223a;      /* cards */
  --rule: rgba(150, 182, 214, 0.16);
  --rule-strong: rgba(150, 182, 214, 0.32);
  --text: #e8eef5;
  --muted: #8fa1b5;
  --gold: #f0c674;       /* the signature accent */
  --gold-deep: #c99a3c;
  --cyan: #6fd3e8;       /* CAD annotation colour */
  --green: #35d27a;
  --paper: #f6f8fb;      /* backing for models and drawings */

  /* Type */
  --f-main: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-ar: "Cairo", "Archivo", Tahoma, sans-serif;

  --gutter: clamp(16px, 4vw, 44px);
  --maxw: 1240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: var(--f-main);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* faint structural grid behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 78% 8%, rgba(111, 211, 232, 0.07), transparent 60%),
    radial-gradient(900px 600px at 10% 90%, rgba(240, 198, 116, 0.05), transparent 60%),
    linear-gradient(var(--ink), var(--ink));
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(150, 182, 214, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(150, 182, 214, 0.045) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 100%);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--gold); color: var(--ink); }

.ic { width: 1em; height: 1em; fill: currentColor; flex: none; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  font-stretch: 108%;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--ease), background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.35s;
}
.btn .ic { width: 18px; height: 18px; }
.btn-sm { padding: 10px 16px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }

/* a light sweep runs across the button on hover */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn:hover::after { transform: translateX(120%); }

.btn-gold { background: var(--gold); color: #1a1408; box-shadow: 0 8px 30px -10px rgba(240, 198, 116, 0.55); }
.btn-gold:hover { background: #f6d28c; box-shadow: 0 14px 40px -10px rgba(240, 198, 116, 0.75); transform: translateY(-2px); }

.btn-ghost { border: 1.5px solid var(--rule-strong); color: var(--text); background: rgba(255, 255, 255, 0.02); }
.btn-ghost::after { background: linear-gradient(110deg, transparent 30%, rgba(240, 198, 116, 0.18) 50%, transparent 70%); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }

.btn-wa { background: var(--green); color: #06210f; box-shadow: 0 8px 30px -10px rgba(53, 210, 122, 0.55); }
.btn-wa:hover { background: #4ae08b; transform: translateY(-2px); box-shadow: 0 14px 40px -10px rgba(53, 210, 122, 0.75); }

.link-line {
  position: relative;
  font-weight: 600;
  color: var(--muted);
  padding-bottom: 2px;
  background: linear-gradient(var(--gold), var(--gold)) 0 100% / 0% 1.5px no-repeat,
              linear-gradient(var(--rule-strong), var(--rule-strong)) 0 100% / 100% 1px no-repeat;
  transition: background-size 0.45s var(--ease), color 0.3s;
}
.link-line:hover { color: var(--gold); background-size: 100% 1.5px, 100% 1px; }

/* ============================================================
   Language toggle (same place in both languages)
   ============================================================ */
.lang-toggle {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 16px;
  z-index: 60;
  height: 38px;
  padding: 0 16px;
  border: 1.5px solid var(--gold);
  border-radius: 10px;
  background: rgba(11, 21, 34, 0.85);
  color: var(--gold);
  font-family: var(--f-ar);
  font-weight: 700;
  font-size: 15px;
  backdrop-filter: blur(8px);
  transition: background 0.3s, color 0.3s, transform 0.3s var(--ease);
}
.lang-toggle:hover { background: var(--gold); color: var(--ink); transform: translateY(-1px); }
[dir="rtl"] .lang-toggle { font-family: var(--f-main); }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  height: calc(66px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0 calc(var(--gutter) + 92px);
  border-bottom: 1px solid transparent;
  transition: background 0.4s, border-color 0.4s, backdrop-filter 0.4s;
}
[dir="rtl"] .topbar { padding-left: calc(var(--gutter) + 104px); padding-right: var(--gutter); }
.topbar.scrolled {
  background: rgba(11, 21, 34, 0.78);
  backdrop-filter: blur(14px) saturate(1.2);
  border-color: var(--rule);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
  overflow: visible;
  transition: transform 0.6s var(--ease);
}
.brand-mark .beam {
  fill: rgba(240, 198, 116, 0.12);
  stroke: var(--gold);
  stroke-width: 1.6;
  stroke-linejoin: round;
  transition: fill 0.4s;
}
.brand:hover .brand-mark { transform: rotate(90deg); }
.brand:hover .brand-mark .beam { fill: var(--gold); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 750; font-stretch: 112%; font-size: 15.5px; white-space: nowrap; }
.brand-role { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }

.nav { display: flex; gap: 6px; margin-inline-start: auto; }
.nav a {
  position: relative;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.3s;
}
/* active / hover line drawn like a dimension line with end ticks */
.nav a::before,
.nav a::after {
  content: "";
  position: absolute;
  bottom: 2px;
  height: 1.5px;
  background: var(--gold);
  transition: transform 0.45s var(--ease);
}
.nav a::before { left: 12px; right: 12px; transform: scaleX(0); }
.nav a::after { left: 12px; width: 1.5px; height: 8px; bottom: -1px; transform: scaleY(0); box-shadow: calc(100% - 0px) 0 0 transparent; }
.nav a:hover, .nav a.active { color: var(--text); }
.nav a:hover::before, .nav a.active::before { transform: scaleX(1); }

.topbar-cv .ic { width: 16px; height: 16px; }
.menu-btn { display: none; width: 42px; height: 42px; border-radius: 10px; border: 1.5px solid var(--rule-strong); place-items: center; }
.menu-btn .ic { width: 18px; height: 18px; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  grid-template-areas:
    "copy model"
    "dims dims";
  column-gap: clamp(20px, 4vw, 56px);
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin: 0 auto;
  padding: calc(120px + env(safe-area-inset-top, 0px)) var(--gutter) 40px;
}

.hero-copy { grid-area: copy; align-self: center; min-width: 0; }

.availability {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 12px;
  border: 1px solid rgba(53, 210, 122, 0.4);
  border-radius: 999px;
  background: rgba(53, 210, 122, 0.07);
  color: #cdf3dc;
  font-size: 14px;
  font-weight: 600;
}
.pulse-dot { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { from { transform: scale(1); opacity: 0.8; } to { transform: scale(3); opacity: 0; } }

.hero-name {
  margin: 26px 0 18px;
  font-size: clamp(44px, 5.8vw, 90px);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.9;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero-name .w { display: block; }
.hero-name .w:nth-child(2) {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--gold);
  transition: color 0.6s var(--ease);
}
.hero-name:hover .w:nth-child(2) { color: var(--gold); }

/* name reveal on load */
.js .hero-name .w { animation: rise 1.1s var(--ease) both; }
.js .hero-name .w:nth-child(2) { animation-delay: 0.14s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(40%); filter: blur(8px); }
  to   { opacity: 1; transform: none; filter: none; }
}

.hero-role {
  min-height: 1.6em;
  font-size: clamp(17px, 1.6vw, 21px);
  font-weight: 650;
  font-stretch: 90%;
  color: var(--gold);
}
.caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-inline-start: 4px;
  vertical-align: -0.15em;
  background: var(--gold);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-lead {
  max-width: 46ch;
  margin-top: 14px;
  font-size: 18px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.socials { display: flex; gap: 10px; margin-top: 26px; list-style: none; }
.socials a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.3s, border-color 0.3s, transform 0.35s var(--ease);
}
.socials svg { width: 19px; height: 19px; fill: var(--text); transition: fill 0.3s; }
.socials a:hover { transform: translateY(-4px); }
.socials .s-wa:hover { background: #25d366; border-color: #25d366; }
.socials .s-in:hover { background: #0a66c2; border-color: #0a66c2; }
.socials .s-fb:hover { background: #1877f2; border-color: #1877f2; }
.socials .s-mail:hover { background: var(--gold); border-color: var(--gold); }
.socials .s-mail:hover svg { fill: var(--ink); }

/* ---------- 3D model ---------- */
.hero-model {
  grid-area: model;
  position: relative;
  min-height: 600px;
  margin-inline-end: calc(var(--gutter) * -1);
  border-radius: 22px;
  min-width: 0;
}
#model-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

@media (pointer: fine) {
  .hero-model { cursor: none; }
}
.crosshair { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.25s; }
.hero-model.aim .crosshair { opacity: 1; }
.ch-x, .ch-y { position: absolute; background: rgba(111, 211, 232, 0.45); }
.ch-x { left: 0; right: 0; height: 1px; top: var(--cy, 50%); }
.ch-y { top: 0; bottom: 0; width: 1px; left: var(--cx, 50%); }
.ch-box {
  position: absolute;
  width: 12px;
  height: 12px;
  left: var(--cx, 50%);
  top: var(--cy, 50%);
  border: 1px solid var(--cyan);
  transform: translate(-50%, -50%);
}
.ch-read {
  position: absolute;
  left: var(--cx, 50%);
  top: var(--cy, 50%);
  transform: translate(14px, 12px);
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(11, 21, 34, 0.85);
  border: 1px solid rgba(111, 211, 232, 0.35);
  color: var(--cyan);
  font-size: 12px;
  font-stretch: 80%;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  direction: ltr;
}

/* photo as a drawing "detail" callout, joined to the model by a leader the canvas draws */
.callout {
  position: absolute;
  left: 4%;
  bottom: 6%;
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
}
[dir="rtl"] .callout { left: auto; right: 4%; }
.callout img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 7px rgba(11, 21, 34, 0.9), 0 0 0 8px rgba(111, 211, 232, 0.5), 0 18px 40px rgba(0, 0, 0, 0.5);
}
.callout figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(11, 21, 34, 0.8);
  border: 1px solid var(--rule);
  backdrop-filter: blur(6px);
}
.callout strong { font-size: 15px; font-weight: 700; font-stretch: 108%; }
.callout figcaption > span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.callout .ic { color: var(--gold); width: 12px; height: 12px; }
.js .callout { opacity: 0; transform: scale(0.85); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.js .callout.on { opacity: 1; transform: none; }

/* ---------- key figures as a dimension line ---------- */
.dims {
  grid-area: dims;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 46px;
  padding-top: 26px;
}
.dims::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--rule-strong);
  transform-origin: left;
}
[dir="rtl"] .dims::before { transform-origin: right; }
.js .dims::before { animation: draw 1.4s 0.6s var(--ease) both; }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.dim { position: relative; padding-inline-start: 20px; }
/* architectural tick at each division */
.dim::before {
  content: "";
  position: absolute;
  top: -33px;
  inset-inline-start: 0;
  width: 1.5px;
  height: 14px;
  background: var(--cyan);
  transform: rotate(45deg);
}
.dim:last-child::after {
  content: "";
  position: absolute;
  top: -33px;
  inset-inline-end: 0;
  width: 1.5px;
  height: 14px;
  background: var(--cyan);
  transform: rotate(45deg);
}
.dim-num {
  display: block;
  font-size: clamp(36px, 4.6vw, 62px);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
[dir="rtl"] .dim-num { text-align: right; }
.dim-label { display: block; margin-top: 8px; font-size: 15px; color: var(--muted); }

/* ============================================================
   Sections
   ============================================================ */
.section {
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(80px, 10vw, 140px) var(--gutter) 0;
}

.sec-head { margin-bottom: clamp(32px, 4vw, 54px); }
.sec-head h2,
.contact h2 {
  position: relative;
  display: inline-block;
  font-size: clamp(38px, 5.4vw, 72px);
  font-weight: 800;
  font-stretch: 122%;
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  padding-bottom: 18px;
}
/* a drawn underline with end ticks, like a section title on a sheet */
.sec-head h2::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background:
    linear-gradient(var(--gold), var(--gold)) 0 0 / 100% 2px no-repeat;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.1s var(--ease);
}
[dir="rtl"] .sec-head h2::after { transform-origin: right; }
.sec-head.seen h2::after { transform: scaleX(1); }
.sec-lead { max-width: 62ch; margin-top: 20px; font-size: 18px; color: var(--muted); }

.side-label { margin-bottom: 14px; font-size: 15px; font-weight: 600; color: var(--muted); }

/* gentle entrance, once */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js .reveal.seen { opacity: 1; transform: none; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: start;
}
.about-text {
  font-size: clamp(20px, 2.05vw, 27px);
  line-height: 1.55;
  font-weight: 400;
  color: var(--text);
  max-width: 40ch;
}
.clients { display: flex; flex-wrap: wrap; gap: 4px 0; list-style: none; }
.clients li {
  font-size: 19px;
  font-weight: 700;
  font-stretch: 108%;
  color: #c9d4e0;
  transition: color 0.3s;
}
.clients li:not(:last-child)::after {
  content: "/";
  margin: 0 12px;
  color: var(--rule-strong);
  font-weight: 400;
}
.clients li:hover { color: var(--gold); }
.cv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 30px; }

/* what I design: small outlined tags under the about text */
.scope-label { margin-top: 34px; }
.scope { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; max-width: 62ch; }
.scope li {
  padding: 7px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  font-size: 14.5px;
  line-height: 1.3;
  color: #c9d4e0;
  transition: color 0.3s, border-color 0.3s, background 0.3s, transform 0.4s var(--ease);
}
.scope li:hover { color: var(--gold); border-color: var(--gold); background: rgba(240, 198, 116, 0.06); transform: translateY(-2px); }

/* ---------- Featured ---------- */
.feat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 18px;
}
.feat {
  position: relative;
  display: flex;
  text-align: start;
  border-radius: 18px;
  border: 1px solid var(--rule);
  background: var(--ink-2);
  overflow: hidden;
  transition: border-color 0.4s, transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.feat:hover {
  border-color: rgba(240, 198, 116, 0.6);
  transform: translateY(-5px);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(240, 198, 116, 0.25);
}
.feat-main { grid-row: span 3; flex-direction: column; }
.feat:not(.feat-main) { align-items: stretch; }

.feat-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--rule);
}
.fp { position: relative; display: block; overflow: hidden; background: var(--paper); }
.fp img { width: 100%; aspect-ratio: 1 / 1.05; object-fit: cover; transition: transform 1.2s var(--ease); }
.fp-model img { object-fit: contain; padding: 14px; }
.feat:hover .fp img { transform: scale(1.06); }
.fp em {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-style: normal;
  font-size: 12.5px;
  font-weight: 700;
  background: rgba(11, 21, 34, 0.85);
  color: var(--text);
}
.fp-site em { background: var(--green); color: #06210f; }

.feat-img { position: relative; flex: 0 0 44%; overflow: hidden; background: var(--paper); }
.feat-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.feat:hover .feat-img img { transform: scale(1.08); }

.feat-body { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 20px 22px; min-width: 0; }
.feat-body strong { font-size: 19px; font-weight: 750; font-stretch: 110%; line-height: 1.25; color: var(--text); }
.feat-main .feat-body { padding: 26px 28px 28px; }
.feat-main .feat-body strong { font-size: clamp(24px, 2.6vw, 34px); }
.feat-text { font-size: 15px; color: var(--muted); line-height: 1.5; }
.feat-main .feat-text { font-size: 17px; max-width: 52ch; }
.feat-cta { margin-top: 10px; font-weight: 700; color: var(--gold); }

/* registration marks that grow into the corners on hover */
.feat::before,
.project::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(var(--gold), var(--gold)) top left / 18px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top left / 2px 18px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top right / 18px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top right / 2px 18px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom left / 18px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom left / 2px 18px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom right / 18px 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom right / 2px 18px no-repeat;
  transform: scale(1.04);
  transition: opacity 0.35s, transform 0.5s var(--ease);
}
.feat:hover::before,
.project:hover::before,
.project:focus-visible::before { opacity: 1; transform: scale(1); }

/* ---------- Expertise: cells on a structural grid ---------- */
.exp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--rule-strong);
  border-left: 1px solid var(--rule-strong);
}
[dir="rtl"] .exp-grid { border-left: 0; border-right: 1px solid var(--rule-strong); }
.exp {
  position: relative;
  padding: 34px 30px 36px;
  border-right: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  overflow: hidden;
  transition: background 0.5s;
}
[dir="rtl"] .exp { border-right: 0; border-left: 1px solid var(--rule-strong); }
/* section-cut hatch fades in on hover */
.exp::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: repeating-linear-gradient(135deg, rgba(240, 198, 116, 0.09) 0 1.5px, transparent 1.5px 11px);
  opacity: 0;
  transition: opacity 0.5s;
}
.exp { isolation: isolate; }
.exp:hover::after { opacity: 1; }
.exp:hover { background: rgba(240, 198, 116, 0.03); }
.exp-key { background: linear-gradient(180deg, rgba(240, 198, 116, 0.09), transparent 70%); }
.exp-key::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gold);
}
.exp-tag {
  display: inline-block;
  margin-bottom: 18px;
  padding: 4px 11px;
  border: 1px solid rgba(111, 211, 232, 0.5);
  border-radius: 6px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 650;
  font-stretch: 92%;
}
.exp-key .exp-tag { border-color: var(--gold); background: var(--gold); color: #1a1408; }
.exp h3 { font-size: 21px; font-weight: 750; font-stretch: 108%; line-height: 1.25; margin-bottom: 12px; text-wrap: balance; }
.exp p { font-size: 15.5px; line-height: 1.65; color: var(--muted); }
.exp strong { color: var(--text); font-weight: 650; }

/* ---------- Skills ---------- */
.codes { display: flex; flex-wrap: wrap; gap: 12px; list-style: none; margin-bottom: 46px; }
.code {
  padding: 14px 22px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 12px;
  font-size: clamp(17px, 1.6vw, 21px);
  font-weight: 800;
  font-stretch: 115%;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.015);
  transition: background 0.35s, color 0.35s, border-color 0.35s, transform 0.45s var(--ease);
}
.code:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); transform: translateY(-3px); }
.js .codes .code { opacity: 0; transform: translateY(16px); }
.js .codes.seen .code { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), background 0.35s, color 0.35s, border-color 0.35s; }
.js .codes.seen .code:hover { transform: translateY(-3px); }

/* software schedule: four groups, each a column of a drawing table */
.sw-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 2px solid var(--rule-strong);
  border-bottom: 2px solid var(--rule-strong);
}
.sw-col { min-width: 0; border-inline-end: 1px solid var(--rule); }
.sw-col:last-child { border-inline-end: 0; }
.sw-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule-strong);
  font-size: 15px;
  font-weight: 700;
  font-stretch: 104%;
  color: var(--text);
}
.sw-idx {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
}
.sw-list { list-style: none; }
.sw-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 18px 15px;
  border-bottom: 1px solid var(--rule);
  transition: background 0.3s;
}
.sw-row:last-child { border-bottom: 0; }
.sw-row::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 2px;
  background: var(--gold);
  transform: scaleY(0);
  transition: transform 0.35s var(--ease);
}
.sw-row:hover { background: rgba(240, 198, 116, 0.05); }
.sw-row:hover::before { transform: scaleY(1); }
.sw-name { font-size: 17px; font-weight: 750; font-stretch: 106%; color: var(--gold); line-height: 1.3; }
.sw-use { font-size: 14px; line-height: 1.45; color: var(--muted); }

@media (max-width: 1100px) {
  .sw-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sw-col:nth-child(2) { border-inline-end: 0; }
  .sw-col:nth-child(-n + 2) { border-bottom: 1px solid var(--rule-strong); }
}
@media (max-width: 640px) {
  .sw-table { grid-template-columns: minmax(0, 1fr); }
  .sw-col { border-inline-end: 0; border-bottom: 1px solid var(--rule-strong); }
  .sw-col:last-child { border-bottom: 0; }
  .sw-row { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 4px; }
  .sw-head { padding: 14px 4px; }
  .sw-name { font-size: 15.5px; flex: none; }
  .sw-use { font-size: 13px; text-align: end; }
}

/* ---------- Projects ---------- */
.filters {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 34px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  width: fit-content;
  max-width: 100%;
}
.filter-ink {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  border-radius: 11px;
  background: var(--gold);
  box-shadow: 0 8px 26px -8px rgba(240, 198, 116, 0.6);
  transition: transform 0.55s var(--ease), width 0.55s var(--ease), height 0.55s var(--ease);
}
.filter {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.35s;
}
.filter .ic { width: 12px; height: 12px; }
.filter:hover { color: var(--text); }
.filter.active { color: #1a1408; }
.fcount {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.filter.active .fcount { background: rgba(26, 20, 8, 0.15); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 22px;
}

.project {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--rule);
  background: var(--ink-2);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.4s, transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.project:hover,
.project:focus-visible {
  outline: none;
  border-color: rgba(240, 198, 116, 0.55);
  transform: translateY(-6px);
  box-shadow: 0 30px 50px -28px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(240, 198, 116, 0.2);
}
.project.is-in { animation: tileIn 0.6s var(--ease) both; }
@keyframes tileIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }

.p-media {
  position: relative;
  order: -1;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--paper);
}
.p-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  transition: transform 1.1s var(--ease);
}
.project[data-fit="cover"] .p-media img { object-fit: cover; padding: 0; }
.project:hover .p-media img { transform: scale(1.06); }
.p-count {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(11, 21, 34, 0.86);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.p-count .ic { width: 12px; height: 12px; color: var(--gold); }
.p-open {
  position: absolute;
  inset-inline-start: 12px;
  bottom: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--gold);
  color: #1a1408;
  font-size: 13px;
  font-weight: 750;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s, transform 0.45s var(--ease);
}
.project:hover .p-open,
.project:focus-visible .p-open { opacity: 1; transform: none; }

.project h3 {
  padding: 18px 20px 0;
  font-size: 19px;
  font-weight: 750;
  font-stretch: 106%;
  line-height: 1.3;
  text-wrap: balance;
}
.project-meta { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 20px 0; }
.meta-loc,
.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
}
.meta-loc { color: var(--gold); background: rgba(240, 198, 116, 0.1); }
.meta-loc .pin-icon { width: 10px; height: 12px; fill: currentColor; }
.meta-tag { color: #bccadb; background: rgba(255, 255, 255, 0.05); }
.project .project-description {
  margin: 12px 20px 22px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* calculation note tile */
.project-doc { cursor: default; }
.doc-cover {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(135deg, rgba(240, 198, 116, 0.12) 0 1.5px, transparent 1.5px 12px),
    var(--ink-3);
}
.doc-cover svg { width: 70px; height: 92px; fill: none; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 20px 22px; margin-top: auto; }

/* ---------- Education: a drawing title block ---------- */
.titleblock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 2px solid var(--rule-strong);
  border-radius: 4px;
}
.tb-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 24px;
  border-right: 1px solid var(--rule-strong);
  border-top: 1px solid var(--rule-strong);
  transition: background 0.4s;
}
[dir="rtl"] .tb-cell { border-right: 0; border-left: 1px solid var(--rule-strong); }
.tb-cell:hover { background: repeating-linear-gradient(135deg, rgba(240, 198, 116, 0.07) 0 1.5px, transparent 1.5px 10px); }
.tb-wide { grid-column: 1 / -1; border-top: 0; border-right: 0; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 22px; }
[dir="rtl"] .tb-wide { border-left: 0; }
.tb-cell:nth-child(5) { border-right: 0; }
[dir="rtl"] .tb-cell:nth-child(5) { border-left: 0; }
.tb-key { font-size: 13px; font-weight: 600; font-stretch: 88%; color: var(--muted); }
.tb-wide .tb-key { flex-basis: 100%; }
.tb-val { font-size: 18px; font-weight: 750; font-stretch: 106%; color: var(--text); line-height: 1.3; }
.tb-big { font-size: clamp(24px, 2.8vw, 36px); font-stretch: 118%; color: var(--gold); }
.tb-sub { font-size: 15px; color: var(--muted); }

/* ---------- Contact ---------- */
.contact { padding-bottom: clamp(80px, 9vw, 120px); }
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 90px);
  align-items: start;
}
.contact h2 { padding-bottom: 0; }
.contact-lead { margin-top: 22px; max-width: 44ch; font-size: 18px; color: var(--muted); }
.contact-lines { display: grid; gap: 4px; margin-top: 26px; }
.cline {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  width: fit-content;
  padding: 8px 0;
  font-size: clamp(18px, 1.8vw, 22px);
  font-weight: 650;
  font-stretch: 104%;
  transition: color 0.3s, transform 0.4s var(--ease);
}
.cline .ic { width: 20px; height: 20px; color: var(--gold); }
.cline:hover { color: var(--gold); transform: translateX(6px); }
[dir="rtl"] .cline:hover { transform: translateX(-6px); }

.contact-form {
  display: grid;
  gap: 22px;
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}
.field { display: grid; gap: 8px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--muted); transition: color 0.3s; }
.field:focus-within > span { color: var(--gold); }
.field input,
.field textarea {
  width: 100%;
  padding: 12px 2px;
  border: 0;
  border-bottom: 1.5px solid var(--rule-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  resize: vertical;
  outline: none;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.5s var(--ease), border-color 0.3s;
}
[dir="rtl"] .field input, [dir="rtl"] .field textarea { background-position: 100% 100%; }
.field input:focus,
.field textarea:focus { background-size: 100% 2px; }
.form-status { min-height: 1.4em; font-size: 15px; }
.form-status.ok { color: var(--green); }
.form-status.err { color: #ff9a8a; }
.contact-form button[disabled] { opacity: 0.6; cursor: progress; }

/* ---------- Footer as a title block ---------- */
.footer {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter) calc(28px + env(safe-area-inset-bottom, 0px));
}
.ft-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  border-top: 2px solid var(--rule-strong);
  border-bottom: 2px solid var(--rule-strong);
  border-inline-end: 1px solid var(--rule-strong);
}
.ft-cell:first-child { border-inline-start: 2px solid var(--rule-strong); }
.ft-cell:last-child { border-inline-end: 2px solid var(--rule-strong); }
.ft-cell .tb-val { font-size: 15px; }
.ft-name .tb-val { color: var(--gold); font-size: 17px; }
/* visitors cell: hidden until the count passes 1000 (see main.js) */
.ft-cell[hidden] { display: none; }
.footer:not(.has-visits) .ft-cell:nth-last-child(2) { border-inline-end: 2px solid var(--rule-strong); }
.footer.has-visits { grid-template-columns: 1.3fr 1fr 1fr 1fr 0.8fr; }
.ft-visits .tb-val { color: var(--gold); font-variant-numeric: tabular-nums; }

/* ============================================================
   Project viewer
   ============================================================ */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  background: rgba(6, 11, 19, 0.94);
  backdrop-filter: blur(10px);
  animation: vIn 0.45s var(--ease) both;
}
.viewer[hidden] { display: none; }
@keyframes vIn { from { opacity: 0; } to { opacity: 1; } }

.v-stage {
  position: relative;
  overflow: hidden;
  touch-action: none;
  display: grid;
  place-items: center;
  direction: ltr;
}
.v-img {
  max-width: 92%;
  max-height: 88%;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  transition: opacity 0.25s;
  animation: imgIn 0.5s var(--ease) both;
}
.v-img.loading { opacity: 0.55; }
@keyframes imgIn { from { opacity: 0; scale: 0.97; } to { opacity: 1; scale: 1; } }

.v-nav,
.v-zoom button,
.v-close {
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(19, 34, 58, 0.85);
  border: 1px solid var(--rule);
  color: var(--text);
  transition: background 0.3s, color 0.3s, border-color 0.3s, transform 0.3s var(--ease);
}
.v-nav svg, .v-zoom svg, .v-close svg { width: 16px; height: 16px; fill: currentColor; }
.v-nav:hover, .v-zoom button:hover, .v-close:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.v-nav { position: absolute; top: 50%; width: 50px; height: 50px; transform: translateY(-50%); z-index: 2; }
.v-prev { left: 18px; }
.v-next { right: 18px; }
.v-nav[disabled] { opacity: 0.25; pointer-events: none; }
.v-zoom {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}
.v-zoom button { width: 40px; height: 40px; }
.v-zoom span { min-width: 52px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.v-count {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(19, 34, 58, 0.85);
  border: 1px solid var(--rule);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.v-info {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px 26px calc(26px + env(safe-area-inset-bottom, 0px));
  border-inline-start: 1px solid var(--rule);
  background: var(--ink-2);
  overflow-y: auto;
  animation: panelIn 0.55s var(--ease) both;
}
@keyframes panelIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
[dir="rtl"] .v-info { animation-name: panelInR; }
@keyframes panelInR { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }
.v-close { align-self: flex-end; width: 42px; height: 42px; }
.v-info h3 { font-size: 26px; font-weight: 800; font-stretch: 112%; line-height: 1.2; text-wrap: balance; }
.v-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.v-desc { font-size: 15.5px; line-height: 1.7; color: var(--muted); }
.v-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.v-thumbs button {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
  outline: 2px solid transparent;
  outline-offset: 1px;
  transition: outline-color 0.3s, transform 0.3s var(--ease), opacity 0.3s;
  opacity: 0.7;
}
.v-thumbs button:hover { opacity: 1; transform: translateY(-2px); }
.v-thumbs button.active { outline-color: var(--gold); opacity: 1; }
.v-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.v-projnav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.v-projnav .btn { flex: 1 1 140px; }
.v-hint { font-size: 13px; color: var(--muted); opacity: 0.8; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

/* ============================================================
   Arabic (RTL)
   ============================================================ */
[dir="rtl"] body,
[dir="rtl"] button,
[dir="rtl"] input,
[dir="rtl"] textarea { font-family: var(--f-ar); }
[dir="rtl"] .hero-name { font-family: var(--f-ar); font-stretch: normal; letter-spacing: 0; line-height: 1.15; font-size: clamp(42px, 5.2vw, 80px); }
[dir="rtl"] .hero-name .w:nth-child(2) { -webkit-text-stroke: 0; color: var(--gold); }
[dir="rtl"] .sec-head h2,
[dir="rtl"] .contact h2 { font-family: var(--f-ar); letter-spacing: 0; line-height: 1.3; }
[dir="rtl"] .about-text { line-height: 1.85; }
[dir="rtl"] .project .project-description,
[dir="rtl"] .v-desc,
[dir="rtl"] .exp p { line-height: 1.85; }
[dir="rtl"] .project .project-description { -webkit-line-clamp: 3; }
[dir="rtl"] .fp em { left: auto; right: 12px; }
[dir="rtl"] .feat-cta, [dir="rtl"] .brand-name, [dir="rtl"] .brand-role { font-family: var(--f-ar); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
  .exp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .titleblock { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-cell:nth-child(3), .tb-cell:nth-child(5) { border-right: 0; }
  [dir="rtl"] .tb-cell:nth-child(3), [dir="rtl"] .tb-cell:nth-child(5) { border-left: 0; }
  .viewer { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 900px) {
  .nav, .topbar-cv { display: none; }
  .menu-btn { display: grid; margin-inline-start: auto; }
  .topbar.open { background: rgba(11, 21, 34, 0.97); border-color: var(--rule); }
  .topbar.open .nav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 10px var(--gutter) 20px;
    background: rgba(11, 21, 34, 0.97);
    border-bottom: 1px solid var(--rule);
  }
  .topbar.open .nav a { padding: 12px 0; font-size: 18px; }
  .topbar.open .nav a::before { left: 0; right: auto; width: 40px; }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "model" "dims";
    padding-top: calc(96px + env(safe-area-inset-top, 0px));
  }
  .hero-model { min-height: 380px; margin-top: 26px; }
  .about-grid, .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .feat-grid { grid-template-columns: minmax(0, 1fr); }
  .feat-main { grid-row: auto; }

  .viewer { grid-template-columns: minmax(0, 1fr); grid-template-rows: 60svh auto; overflow-y: auto; }
  .v-info { border-inline-start: 0; border-top: 1px solid var(--rule); overflow: visible; }
  .v-close { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 5; }
  [dir="rtl"] .v-close { right: auto; left: 12px; }
  .v-nav { width: 42px; height: 42px; }
  .v-prev { left: 10px; }
  .v-next { right: 10px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .brand-text { display: none; }
  .topbar { gap: 12px; padding-left: calc(var(--gutter) + 82px); }
  [dir="rtl"] .topbar { padding-left: calc(var(--gutter) + 92px); }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-model { min-height: 330px; }
  .callout img { width: 84px; height: 84px; }
  .callout strong { font-size: 13.5px; }
  .callout figcaption > span { font-size: 12px; }
  .dims { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dim { padding-inline-start: 12px; }
  .dim-label { font-size: 12.5px; }
  .exp-grid { grid-template-columns: minmax(0, 1fr); }
  .exp { padding: 26px 20px 28px; }
  .titleblock { grid-template-columns: minmax(0, 1fr); }
  .tb-cell { border-right: 0 !important; border-left: 0 !important; }
  .feat:not(.feat-main) { flex-direction: column; }
  .feat-img { flex: none; aspect-ratio: 16 / 10; }
  .feat-pair { grid-template-columns: 1fr 1fr; }
  .filters { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .footer, .footer.has-visits { grid-template-columns: 1fr 1fr; }
  .ft-visits { grid-column: span 2; }
  .ft-cell { border-inline-start: 0 !important; border-inline-end: 0 !important; border-bottom-width: 1px; }
  .ft-cell:nth-child(n + 3) { border-top-width: 1px; }
  .v-thumbs { grid-template-columns: repeat(5, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .js .reveal, .js .codes .code, .js .callout { opacity: 1; transform: none; }
}

.project[hidden] { display: none; }

/* ---------- phones: compact 2-column project grid, details open in the viewer ---------- */
@media (max-width: 640px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .project { border-radius: 12px; }
  .project h3 { padding: 10px 11px 0; font-size: 14.5px; line-height: 1.3; }
  .project-meta { padding: 6px 11px 12px; gap: 4px; }
  .project-meta .meta-tag { display: none; }
  .meta-loc { font-size: 11px; padding: 2px 6px; }
  .project .project-description { display: none; }
  .p-media img { padding: 6px; }
  .p-count { top: 7px; inset-inline-end: 7px; padding: 2px 6px; font-size: 11px; }
  .p-open { display: none; }
  .project::before { inset: 6px; }
  .project-doc .project-description { display: block; margin: 0 11px 10px; font-size: 12.5px; -webkit-line-clamp: 4; }
  .doc-actions { padding: 0 11px 12px; gap: 6px; }
  .doc-actions .btn { padding: 8px 10px; font-size: 12.5px; flex: 1; }
  .project-doc .project-meta .meta-tag { display: inline-flex; }

  /* featured: the three smaller tiles become a horizontal row */
  .feat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .feat-main { grid-column: 1 / -1; }
  .feat:not(.feat-main) { flex-direction: column; border-radius: 12px; }
  .feat:not(.feat-main) .feat-img { aspect-ratio: 1; }
  .feat:not(.feat-main) .feat-body { padding: 9px 10px 12px; gap: 3px; }
  .feat:not(.feat-main) .feat-body strong { font-size: 13px; }
  .feat:not(.feat-main) .feat-text { font-size: 11.5px; line-height: 1.35; }
}

/* ===================== CTA: quote + testimonials ===================== */
.btn-quote { background: #ff7a1a; color: #1d0d00; font-weight: 700; box-shadow: 0 8px 30px -10px rgba(255, 122, 26, 0.65); }
.btn-quote:hover { background: #ff9442; transform: translateY(-2px); box-shadow: 0 14px 40px -10px rgba(255, 122, 26, 0.85); }
.topbar-quote .ic { width: 16px; height: 16px; }
.cta-band {
  max-width: var(--maxw);
  margin: clamp(48px, 7vw, 90px) auto 0;
  width: calc(100% - 2 * var(--gutter));
  padding: clamp(22px, 3.5vw, 36px);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  border: 1.5px solid rgba(255, 122, 26, 0.55);
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(255, 122, 26, 0.12), rgba(240, 198, 116, 0.06) 60%, transparent);
}
.cta-copy { flex: 1 1 340px; }
.cta-copy h3 { margin: 0 0 8px; font-size: clamp(20px, 2.4vw, 28px); color: var(--text); }
.cta-copy p { margin: 0; color: var(--muted); line-height: 1.7; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.t-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.t-grid:empty { display: none; }
.t-card { margin: 0; padding: 24px; border: 1px solid var(--rule); border-radius: 16px; background: var(--ink-3); }
.t-card blockquote { margin: 0 0 16px; color: var(--text); line-height: 1.8; }
.t-card blockquote::before { content: "“"; color: var(--gold); font-size: 34px; line-height: 0; vertical-align: -12px; margin-inline-end: 4px; }
.t-card figcaption { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 14px; }
.t-card figcaption strong { color: var(--gold); }
.t-invite { margin-top: 20px; padding: 24px; border: 1px dashed var(--rule-strong); border-radius: 16px; display: flex;
  align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.t-invite p { margin: 0; color: var(--text); flex: 1 1 300px; line-height: 1.7; }
.fab-quote {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 70;
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px;
  background: #ff7a1a; color: #1d0d00; font-weight: 700; font-size: 15px; text-decoration: none;
  box-shadow: 0 10px 30px -8px rgba(255, 122, 26, 0.8);
  transition: transform 0.3s var(--ease), background 0.3s;
}
.fab-quote .ic { width: 20px; height: 20px; }
.fab-quote:hover { background: #ff9442; transform: translateY(-3px); }
@media (max-width: 640px) {
  .topbar-quote { display: none; }
  .fab-quote { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 11px 15px; font-size: 14px; }
  .cta-actions .btn { width: 100%; justify-content: center; }
}

/* ===================== Projects tab + see-all ===================== */
.nav .nav-projects { color: var(--ink); background: var(--gold); padding: 7px 14px; border-radius: 999px; font-weight: 700; }
.nav .nav-projects:hover { background: #f6d28c; color: var(--ink); }
.see-all { display: flex; justify-content: center; margin-top: 28px; }
.nav a.is-active { color: var(--gold); }
.nav .nav-projects.is-active { color: var(--ink); box-shadow: 0 0 0 2px rgba(240, 198, 116, 0.35); }
@media (max-width: 640px) {
  main > .section:first-child { padding-top: 84px; }
  .section { padding-top: 64px; }
  .see-all .btn { width: 100%; justify-content: center; }
}
/* "All projects" link in the featured header (replaces the old button under the grid) */
.featured .sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.link-all { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 1.5px solid var(--gold);
  border-radius: 999px; color: var(--gold); font-weight: 700; font-size: 15px; text-decoration: none; margin-bottom: 14px;
  transition: background 0.3s, color 0.3s; }
.link-all .ic { width: 12px; height: 12px; fill: currentColor; }
[dir="rtl"] .link-all .ic { transform: scaleX(-1); }
.link-all:hover { background: var(--gold); color: var(--ink); }
.featured { padding-bottom: clamp(60px, 8vw, 110px); }
.nav .nav-home { display: inline-flex; align-items: center; gap: 6px; }
.nav .nav-home .ic { width: 15px; height: 15px; fill: currentColor; }

/* ===================== Free tools ===================== */
.tool-card { display: grid; grid-template-columns: 1fr auto; gap: 18px 28px; align-items: center; padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--rule-strong); border-radius: 18px; background: var(--ink-3); }
.tool-card h3 { margin: 0 0 10px; font-size: clamp(18px, 2vw, 23px); color: var(--text); }
.tool-card p { margin: 0; color: var(--muted); line-height: 1.75; }
.tool-tags { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tool-tags li { padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px; font-size: 13px; color: var(--gold); }
.tool-actions { display: flex; flex-direction: column; gap: 10px; }
.tool-actions .btn { justify-content: center; }
.tool-note { grid-column: 1 / -1; font-size: 13px !important; }
@media (max-width: 800px) { .tool-card { grid-template-columns: 1fr; } }
.tools { padding-bottom: clamp(60px, 8vw, 110px); }
.tools-lead { max-width: 760px; color: var(--muted); line-height: 1.8; margin: 0 0 22px; }
.kind-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.kind { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--rule-strong); background: transparent; color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; }
.kind.active { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.kind[hidden] { display: none; }
.tool-list { display: grid; gap: 20px; }
.tool-card[hidden] { display: none; }
.nav .nav-free { color: var(--gold); }

/* ===================== Free resources: 3D column base ===================== */
.tool-visual { grid-template-columns: 300px 1fr; align-items: center; }
.tool-visual .tool-body h3 { font-size: clamp(19px, 2.2vw, 26px); margin-bottom: 18px; }
.tool-visual .tool-actions { flex-direction: row; flex-wrap: wrap; }
.b3d { position: relative; width: 300px; height: 260px; perspective: 900px; }
.b3d-rot { position: absolute; left: 50%; top: 58%; transform-style: preserve-3d;
  transform: rotateX(-24deg) rotateY(35deg); animation: b3d-spin 22s linear infinite; }
.b3d .fc { position: absolute; left: 0; top: 0; display: block; backface-visibility: visible; }
.fc.conc { background: #6b7684; } .fc.conc.t { background: #8a95a3; } .fc.conc.r, .fc.conc.l { background: #56606d; }
.fc.conc.f, .fc.conc.b { background: linear-gradient(180deg, #6b7684, #4c5560); }
.fc.plate { background: #4f9dc9; } .fc.plate.t { background: #7cc3e6; }
.fc.col { background: #2f7fb0; } .fc.col.t { background: #6fd3e8; } .fc.col.r, .fc.col.l { background: #25668e; }
.fc.bolt { background: #c99a3c; } .fc.nut { background: #f0c674; } .fc.nut.r, .fc.nut.l { background: #c99a3c; }
@keyframes b3d-spin { from { transform: rotateX(-24deg) rotateY(35deg); } to { transform: rotateX(-24deg) rotateY(395deg); } }
@media (prefers-reduced-motion: reduce) { .b3d-rot { animation: none; } }
@media (max-width: 800px) {
  .tool-visual { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .tool-visual .tool-actions { justify-content: center; }
  .b3d { width: 260px; height: 240px; }
}
.b3d { height: 300px; }
.b3d-rot { top: 48%; }
@media (max-width: 800px) { .b3d { width: 260px; height: 310px; } }

/* ===================== Mobile: bottom tab bar instead of the ☰ menu ===================== */
.tabbar { display: none; }
@media (max-width: 900px) {
  .menu-btn { display: none !important; }
  .tabbar { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); background: rgba(11, 21, 34, 0.96);
    border-top: 1px solid var(--rule-strong); backdrop-filter: blur(10px); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; color: var(--muted);
    text-decoration: none; font-size: 10.5px; font-weight: 600; line-height: 1.1; text-align: center; }
  .tabbar a .ic { width: 19px; height: 19px; fill: currentColor; }
  .tabbar a.on { color: var(--gold); }
  .tabbar a[href^="projects"] { color: var(--gold); }
  .tabbar a[href^="projects"] .ic { width: 22px; height: 22px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .fab-quote { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
}
@media (max-width: 900px) {
  html:not([dir="rtl"]) .lang-toggle { left: auto; right: 16px; }
}
.link-exp { margin-top: 26px; }
@media (max-width: 900px) {
  .tabbar { grid-template-columns: repeat(5, 1fr); }
  .tabbar a { font-size: 11px; }
  /* quote button: a small round WhatsApp button on phones */
  .fab-quote { width: 54px; height: 54px; padding: 0; justify-content: center; border-radius: 50%; }
  .fab-quote span { display: none; }
  .fab-quote .ic { width: 26px; height: 26px; }
}
@media (max-width: 640px) {
  .dims { gap: 10px; }
  .dim-num { font-size: clamp(26px, 8.2vw, 36px); font-stretch: 100%; white-space: nowrap; }
}
/* phones: show the name next to the logo; the language button sits on the other side */
@media (max-width: 900px) {
  html:not([dir="rtl"]) .topbar { padding-left: var(--gutter); padding-right: calc(var(--gutter) + 150px); }
  [dir="rtl"] .topbar { padding-right: var(--gutter); padding-left: calc(var(--gutter) + 104px); }
  .brand-text { display: flex !important; }
  .brand-name { font-size: 15px; }
  .brand-role { font-size: 11px; }
}
@media (max-width: 360px) { .brand-role { display: none; } }

/* ===================== Navigation colours =====================
   Two separate jobs, two separate colours (same idea as Google / Facebook tabs):
   - GOLD solid pill  = the important action  -> Projects
   - CYAN indicator   = "you are here"        -> the current page (tinted pill + underline) */
.nav .nav-free { color: var(--muted); }
.nav a::before { background: rgba(232, 238, 245, 0.55); }          /* hover line: neutral */
.nav a.is-active { color: var(--text); background: rgba(111, 211, 232, 0.13); border-radius: 999px; }
.nav a.is-active::before { background: var(--cyan); height: 3px; bottom: -6px; left: 18px; right: 18px; border-radius: 3px; transform: scaleX(1); }
.nav .nav-projects.is-active { color: var(--ink); background: var(--gold); box-shadow: none; }
.nav .nav-projects::before { display: none; }
.nav .nav-projects.is-active::before { display: block; }
@media (max-width: 900px) {
  .tabbar a { position: relative; }
  .tabbar a .ic { padding: 4px 16px; box-sizing: content-box; border-radius: 999px; transition: background 0.3s; }
  .tabbar a.on { color: var(--cyan); }
  .tabbar a.on .ic { background: rgba(111, 211, 232, 0.18); }
  .tabbar a.on::before { content: ""; position: absolute; top: -7px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--cyan); }
  .tabbar a[href^="projects"] { color: var(--gold); }
  .tabbar a[href^="projects"] .ic { width: 20px; height: 20px; }
  .tabbar a[href^="projects"].on .ic { background: rgba(111, 211, 232, 0.18); }
}

/* ---- 3D visuals for the online-tool cards ---- */
.b3d .g3 { position: absolute; left: 0; top: 0; transform-style: preserve-3d; display: block; }
.fc.beam { background: #c99a3c; } .fc.beam.t { background: #f0c674; } .fc.beam.web { background: #a07a2c; }
.fc.stub { background: #56606d; } .fc.stub.t { background: #8a95a3; }
.b3d-kf .kseg { animation: kf-buckle 3.6s ease-in-out infinite; }
.b3d-kf .kseg .fc.t, .b3d-kf .kseg .fc.u { display: none; }
@keyframes kf-buckle { 0%, 18%, 100% { translate: 0 0 0; } 50%, 68% { translate: var(--dx) 0 0; } }
.fc.sflg { background: #2f7fb0; } .fc.sflg.t { background: #6fd3e8; } .fc.sflg.r, .fc.sflg.l { background: #25668e; }
.fc.sweb { background: #c99a3c; } .fc.sweb.r, .fc.sweb.l { background: #f0c674; }
.b3d-so .so-wl { animation: so-wl 7s ease-in-out infinite; }
.b3d-so .so-wr { animation: so-wr 7s ease-in-out infinite; }
.b3d-so .so-all { animation: so-depth 7s ease-in-out infinite; }
@keyframes so-wl { 0%, 22%, 100% { translate: 0 0 0; } 45%, 72% { translate: 0 0 -44.5px; } }
@keyframes so-wr { 0%, 22%, 100% { translate: 0 0 0; } 45%, 72% { translate: 0 0 44.5px; } }
@keyframes so-depth { 0%, 100% { scale: 1 1 1; } 30% { scale: 1 .82 1; } 60% { scale: 1 1.06 1; } 85% { scale: 1 .9 1; } }
@media (prefers-reduced-motion: reduce) { .b3d-kf .kseg, .b3d-so .so-wl, .b3d-so .so-wr, .b3d-so .so-all { animation: none; } }
.tool-tags { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.tool-tags li { font-size: 12.5px; color: var(--muted); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 3px 10px; }
.tool-visual .tool-body p.tool-desc { margin: -8px 0 14px; }
@media (max-width: 800px) { .tool-tags { justify-content: center; } }

/* ===================== "Free tools" stands out (cyan outline + live dot), without competing with the gold Projects pill ===================== */
.nav .nav-free { color: var(--cyan); border: 1px solid rgba(111, 211, 232, 0.45); border-radius: 999px; padding-inline-start: 26px; background: rgba(111, 211, 232, 0.06); transition: color .3s, background .3s, border-color .3s; }
.nav .nav-free::after { content: ""; position: absolute; left: 11px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(111, 211, 232, 0.6); animation: navFreePulse 2.2s ease-out infinite; transform: none; bottom: auto; }
[dir="rtl"] .nav .nav-free::after { left: auto; right: 11px; }
.nav .nav-free:hover { color: var(--text); background: rgba(111, 211, 232, 0.14); border-color: var(--cyan); }
.nav .nav-free::before { display: none; }
.nav .nav-free.is-active { color: var(--text); background: rgba(111, 211, 232, 0.16); border-color: var(--cyan); }
@keyframes navFreePulse { 0% { box-shadow: 0 0 0 0 rgba(111, 211, 232, 0.6); } 70% { box-shadow: 0 0 0 7px rgba(111, 211, 232, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 211, 232, 0); } }
@media (prefers-reduced-motion: reduce) { .nav .nav-free::after { animation: none; } }
/* mobile tab bar: Free tools in cyan with the same live dot */
.tabbar a[href$="resources.html"]:not(.on) { color: var(--cyan); position: relative; }
.tabbar a[href$="resources.html"]::after { content: ""; position: absolute; top: 3px; left: calc(50% + 9px); width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: navFreePulse 2.2s ease-out infinite; }
@media (prefers-reduced-motion: reduce) { .tabbar a[href$="resources.html"]::after { animation: none; } }
