/* =============================================================
   KLMS General Contracting - Master Stylesheet
   نظام تصميم موحّد للموقع كاملاً (عربي + إنجليزي)
   ============================================================= */

/* ---------- 1. Design Tokens ---------- */
:root {
  /* ── Light mode (default) ── */
  --bg-primary:   #F8F6F1;
  --bg-secondary: #F0EDE6;
  --bg-tertiary:  #E8E5DE;
  --bg-card:      #FAFAF8;
  --bg-elevated:  #FFFFFF;

  --accent:       #D4A656;
  --accent-light: #E5C078;
  --accent-dark:  #B08A40;
  --accent-soft:  rgba(212, 166, 86, 0.12);
  --accent-border: rgba(212, 166, 86, 0.28);
  /* WCAG AA–safe gold for text on light bg (~5.5:1 on #F8F6F1) */
  --accent-text:  #7A5C1E;

  --text-primary:   #1A1814;
  --text-secondary: #4A4540;
  --text-muted:     #5F5A55;
  --text-on-accent: #1A1814;

  --border:        rgba(26, 24, 20, 0.10);
  --border-strong: rgba(26, 24, 20, 0.18);
  --divider:       rgba(26, 24, 20, 0.06);

  /* Semantic: Header */
  --header-bg:          rgba(248, 246, 241, 0.92);
  --header-bg-scrolled: rgba(248, 246, 241, 0.98);
  --header-shadow:      rgba(26, 24, 20, 0.12);

  /* Semantic: Dropdown */
  --dropdown-shadow: rgba(26, 24, 20, 0.14);
  --dropdown-bg:     #FAFAF8;

  /* Semantic: Hero decorations */
  --hero-glow-primary:   rgba(212, 166, 86, 0.10);
  --hero-glow-secondary: rgba(212, 166, 86, 0.03);
  --hero-grid-color:     rgba(26, 24, 20, 0.04);

  /* Semantic: Image scrims — always dark, both themes */
  --scrim:       rgba(14, 14, 14, 0.60);
  --scrim-strong: rgba(14, 14, 14, 0.95);
  --scrim-light:  rgba(14, 14, 14, 0.30);

  /* Semantic: Footer — always dark, both themes */
  --footer-bg: #0D0D0D;

  /* Semantic: CTA section gradients */
  --cta-glow: rgba(212, 166, 86, 0.06);

  /* Typography */
  --font-ar-display: 'El Messiri', 'Tajawal', 'Segoe UI', sans-serif;
  --font-ar-body: 'Tajawal', 'Segoe UI', sans-serif;
  --font-en-display: 'Fraunces', 'Times New Roman', serif;
  --font-en-body: 'Manrope', system-ui, sans-serif;

  /* Spacing */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --space-3xl: 9rem;

  /* Layout */
  --container: 1320px;
  --container-narrow: 960px;
  --header-h: 90px;

  /* Transitions */
  --t-fast: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 280ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-pill: 999px;
}

/* ── Dark mode overrides ── */
:root[data-theme="dark"] {
  --bg-primary:   #0E0E0E;
  --bg-secondary: #161616;
  --bg-tertiary:  #1F1F1F;
  --bg-card:      #1A1A1A;
  --bg-elevated:  #242424;

  --accent-text:  #D4A656;

  --text-primary:   #F5F2E8;
  --text-secondary: #B8B5AC;
  --text-muted:     #7A7770;
  --text-on-accent: #0E0E0E;

  --border:        rgba(245, 242, 232, 0.08);
  --border-strong: rgba(245, 242, 232, 0.16);
  --divider:       rgba(245, 242, 232, 0.05);

  --header-bg:          rgba(14, 14, 14, 0.92);
  --header-bg-scrolled: rgba(14, 14, 14, 0.98);
  --header-shadow:      rgba(0, 0, 0, 0.50);

  --dropdown-shadow: rgba(0, 0, 0, 0.50);
  --dropdown-bg:     #1A1A1A;

  --hero-glow-primary:   rgba(212, 166, 86, 0.15);
  --hero-glow-secondary: rgba(212, 166, 86, 0.05);
  --hero-grid-color:     rgba(245, 242, 232, 0.02);

  --cta-glow: rgba(212, 166, 86, 0.05);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ar-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
html[lang="en"] body { font-family: var(--font-en-body); line-height: 1.65; }
html[lang="ar"], html[dir="rtl"] body { direction: rtl; text-align: right; }
html[lang="en"], html[dir="ltr"] body { direction: ltr; text-align: left; }

img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; transition: color var(--t-fast); }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--bg-primary); }

/* ---------- 3. Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ar-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3,
html[lang="en"] h4, html[lang="en"] h5, html[lang="en"] h6 {
  font-family: var(--font-en-display);
  font-weight: 500;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 5.5vw, 4.5rem); line-height: 1.05; }
h2 { font-size: clamp(2rem, 3.8vw, 3rem); }
h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }

p { color: var(--text-secondary); }
.lead { font-size: 1.15rem; color: var(--text-primary); }

.accent { color: var(--accent-text); }
.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-text);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}
.eyebrow::before {
  content: '';
  width: 2.5rem;
  height: 1px;
  background: var(--accent);
}

/* ---------- 4. Layout Utilities ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: var(--container-narrow); margin: 0 auto; padding: 0 1.5rem; }
.section { padding: var(--space-2xl) 0; }
.section-sm { padding: var(--space-xl) 0; }
.section-lg { padding: var(--space-3xl) 0; }

.grid { display: grid; gap: var(--space-md); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.text-center { text-align: center; }
.text-balance { text-wrap: balance; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.95rem 1.8rem;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  border-radius: var(--r-sm);
  transition: all var(--t-base);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}
.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px var(--accent);
}
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-ghost {
  background: transparent;
  color: var(--accent-text);
  padding: 0.5rem 0;
}
.btn-ghost:hover { color: var(--accent-light); gap: 1rem; }

.btn-lg { padding: 1.1rem 2.2rem; font-size: 1rem; }
.btn-sm { padding: 0.65rem 1.2rem; font-size: 0.85rem; }

.btn .arrow { transition: transform var(--t-base); }
html[dir="rtl"] .btn:hover .arrow { transform: translateX(-4px); }
html[dir="ltr"] .btn:hover .arrow { transform: translateX(4px); }

/* ---------- 6. Header / Navigation ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: all var(--t-base);
}
.site-header.scrolled {
  background: var(--header-bg-scrolled);
  box-shadow: 0 4px 30px var(--header-shadow);
}
.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.logo img {
  height: 56px;
  width: auto;
  object-fit: contain;
}
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.logo-text .logo-main {
  font-family: var(--font-en-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent-text);
  letter-spacing: 0.05em;
}
.logo-text .logo-sub {
  font-family: var(--font-ar-display);
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-item { position: relative; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: color var(--t-fast);
  position: relative;
}
.nav-link:hover { color: var(--accent-text); }
.nav-link.active { color: var(--accent-text); }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -0.3rem;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--accent);
}
.nav-caret { font-size: 0.7rem; opacity: 0.7; }

/* Button reset — allows <button class="nav-link"> to look identical to <a class="nav-link"> */
button.nav-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  text-align: inherit;
}

/* Active indicator for dropdown triggers (parent item active when a child page is current) */
.nav-item.active > button.nav-link { color: var(--accent-text); }
.nav-item.active > button.nav-link::after {
  content: '';
  position: absolute;
  bottom: -0.3rem;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--accent);
}

/* Mobile-only CTA inside the nav panel — hidden on desktop */
.nav-cta-mobile { display: none; }

.dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  min-width: 260px;
  padding: 0.6rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--t-base);
  box-shadow: 0 20px 50px var(--dropdown-shadow);
}
html[dir="rtl"] .dropdown { right: 0; }
html[dir="ltr"] .dropdown { left: 0; }
.nav-item.dropdown-open > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown a {
  display: block;
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}
.dropdown a:hover {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: all var(--t-fast);
}
.lang-switch:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
}
.menu-toggle span {
  position: relative;
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
}
.menu-toggle span::before,
.menu-toggle span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  transition: transform var(--t-base);
}
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }
.menu-toggle.active span { background: transparent; }
.menu-toggle.active span::before { top: 0; transform: rotate(45deg); }
.menu-toggle.active span::after { top: 0; transform: rotate(-45deg); }

/* ---------- 7. Hero Sections ---------- */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + 3rem) 0 3rem;
  overflow: hidden;
  background: var(--bg-primary);
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at top right, var(--hero-glow-primary), transparent 50%),
    radial-gradient(ellipse at bottom left, var(--hero-glow-secondary), transparent 50%);
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--hero-grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--hero-grid-color) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: center;
}
.hero-content { max-width: none; }
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--accent-border);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}
.hero-tag .dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hero-title {
  margin-bottom: 1.5rem;
  font-weight: 700;
}
.hero-title .gold { color: var(--accent-text); }
.hero-subtitle {
  font-size: clamp(1.05rem, 1.3vw, 1.2rem);
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 600px;
  line-height: 1.75;
}
.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.stat-item .stat-num {
  font-family: var(--font-ar-display);
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  font-weight: 700;
  color: var(--accent-text);
  line-height: 1;
}
.stat-item .stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Hero images panel */
.hero-images {
  display: flex;
  gap: 0.75rem;
  align-self: stretch;
  min-height: 480px;
  max-height: 680px;
}
.hero-img {
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
}
/* <picture> must fill the slot so the inner img's height:100% has a definite parent */
.hero-img picture {
  display: block;
  width: 100%;
  height: 100%;
}
.hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--t-slow);
}
.hero-img:hover img { transform: scale(1.04); }
.hero-img--main {
  flex: 0 0 58%;
  box-shadow: 0 0 0 1px rgba(212, 166, 86, 0.15), 0 24px 64px rgba(0,0,0,0.35);
}
.hero-img-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.hero-img-col .hero-img {
  flex: 1;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

/* Hero image entrance animations */
@keyframes hero-clip-reveal {
  from { clip-path: inset(0 0 100% 0 round var(--r-lg)); }
  to   { clip-path: inset(0 0 0%   0 round var(--r-lg)); }
}
@keyframes hero-img-scale-in {
  from { transform: scale(1.08); }
  to   { transform: scale(1); }
}
.hero-img--main {
  animation: hero-clip-reveal 0.9s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both;
}
.hero-img--main img {
  animation: hero-img-scale-in 0.9s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both;
}
.hero-img-col .hero-img:first-child {
  animation: hero-clip-reveal 0.75s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both;
}
.hero-img-col .hero-img:first-child img {
  animation: hero-img-scale-in 0.75s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both;
}
.hero-img-col .hero-img:last-child {
  animation: hero-clip-reveal 0.75s cubic-bezier(0.4, 0, 0.2, 1) 0.6s both;
}
.hero-img-col .hero-img:last-child img {
  animation: hero-img-scale-in 0.75s cubic-bezier(0.4, 0, 0.2, 1) 0.6s both;
}

/* Page Hero (smaller, for inner pages) */
.page-hero {
  position: relative;
  padding: calc(var(--header-h) + 5rem) 0 4rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, var(--hero-glow-primary), transparent 60%);
}
.page-hero-inner {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a:hover { color: var(--accent-text); }
.breadcrumb-sep { opacity: 0.5; }
.page-hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.5rem);
  margin-bottom: 1rem;
}
.page-hero p {
  font-size: 1.1rem;
  max-width: 700px;
  color: var(--text-secondary);
}

/* ---------- 8. Section Headers ---------- */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 3.5rem;
  flex-wrap: wrap;
}
.section-head .head-text { max-width: 720px; }
.section-head h2 { margin: 0.8rem 0 1rem; }
.section-head p { color: var(--text-secondary); font-size: 1.05rem; }

/* ---------- 9. Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 2rem;
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}
.card:hover {
  border-color: var(--accent-border);
  transform: translateY(-4px);
  background: var(--bg-elevated);
}
.card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  color: var(--accent);
}
.card-title {
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
}
.card-desc { color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 0.95rem; }

/* Sub-units listed inside an org-structure department card */
.org-units { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.org-units li {
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding-inline-start: 0.9rem;
  position: relative;
}
.org-units li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.6em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-text);
  font-size: 0.9rem;
  font-weight: 600;
  transition: gap var(--t-base);
}
.card-link:hover { gap: 0.8rem; }

/* Service Card variant */
.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0;
  overflow: hidden;
  transition: all var(--t-base);
  display: flex;
  flex-direction: column;
}
.service-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-6px);
}
.service-card-num {
  font-family: var(--font-en-display);
  font-size: 4rem;
  color: var(--accent-dark);  /* solid in light mode — ~3.1:1 on #FAFAF8 large text */
  opacity: 1;
  line-height: 1;
  padding: 1.5rem 2rem 0;
  font-weight: 500;
}
:root[data-theme="dark"] .service-card-num {
  color: var(--accent);
  opacity: 0.18;
}
.service-card-body { padding: 0.5rem 2rem 2rem; flex-grow: 1; display: flex; flex-direction: column; }
.service-card h3 { margin-bottom: 0.8rem; font-size: 1.4rem; }
.service-card p { color: var(--text-secondary); margin-bottom: 1.5rem; flex-grow: 1; font-size: 0.95rem; }
.service-card .card-link { margin-top: auto; }

/* Project Card */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all var(--t-base);
  position: relative;
}
.project-card:hover { border-color: var(--accent-border); transform: translateY(-6px); }
.project-image {
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-tertiary));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.project-image .placeholder {
  color: var(--accent);
  opacity: 0.3;
  font-size: 3rem;
}
.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Photo scrim — only over a real photograph, never over the brand plate */
.project-image:not(.project-image--brand)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--scrim), transparent 50%);
  pointer-events: none;
}

/* Brand plate — stands in wherever a photograph does not exist yet.
   The KLMS mark sits as a centred seal on a blueprint-grid surface. */
.project-image--brand,
.chairman-plate {
  background:
    radial-gradient(120% 90% at 50% 0%, var(--accent-soft) 0%, transparent 62%),
    linear-gradient(150deg, var(--bg-elevated) 0%, var(--bg-tertiary) 100%);
}
.project-image--brand::before,
.chairman-plate::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.6;
  pointer-events: none;
}
.project-image.project-image--brand img {
  position: relative;
  width: auto;
  height: auto;
  max-width: 40%;
  max-height: 54%;
  object-fit: contain;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 1px var(--border-strong), 0 10px 30px rgba(0, 0, 0, 0.18);
  transition: transform var(--t-base);
}
.project-card:hover .project-image--brand img { transform: scale(1.05); }
.project-body { padding: 1.8rem; }
.project-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--accent-text);
  margin-bottom: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}
.project-meta span:not(:first-child)::before {
  content: '•';
  margin: 0 0.4rem;
  opacity: 0.5;
}
.project-card h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.project-card .project-location { color: var(--text-muted); font-size: 0.9rem; }
.project-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.project-actions a {
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  transition: all var(--t-fast);
}
.project-actions a:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

/* Sector Card (different style) */
.sector-card {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  padding: 2rem;
  transition: all var(--t-base);
  cursor: pointer;
}
.sector-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--bg-elevated) 0%, var(--bg-card) 58%);
}
/* Oversized ghost index number — the visual anchor in place of a photograph.
   Renders only on cards that declare data-index. */
.sector-card::after {
  content: attr(data-index);
  position: absolute;
  top: 0.25rem;
  inset-inline-start: 1.5rem;
  font-family: var(--font-en-display);
  font-size: clamp(4rem, 8vw, 7.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  opacity: 0.14;
  pointer-events: none;
  transition: opacity var(--t-base);
}
/* Scale the ghost number to its own card, not the viewport, so it never
   crowds the title when grid-4 squeezes the cards down. */
@supports (font-size: 1cqw) {
  .sector-card { container-type: inline-size; }
  .sector-card::after { font-size: clamp(3.5rem, 38cqw, 7.5rem); }
}
.sector-card:hover::after { opacity: 0.22; }
.sector-card .sector-content {
  position: relative;
  z-index: 1;
  width: 100%;
}
.sector-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.sector-card p { color: var(--text-secondary); font-size: 0.9rem; }
/* Gold rule that extends on hover, in place of a call-to-action arrow */
.sector-card .sector-content::after {
  content: '';
  display: block;
  width: 28px;
  height: 1px;
  margin-top: 1.4rem;
  background: var(--accent);
  transition: width var(--t-base);
}
a.sector-card:hover .sector-content::after { width: 60px; }
.sector-card:hover {
  border-color: var(--accent);
  transform: translateY(-6px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.12);
}

/* ---------- 10. Forms ---------- */
.form-group { margin-bottom: 1.5rem; }
.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.95rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all var(--t-fast);
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-elevated);
}
.form-textarea { resize: vertical; min-height: 140px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ---------- 11. Footer ---------- */
/* Footer is always dark — override theme vars within its scope */
.site-footer {
  --text-primary:   #F5F2E8;
  --text-secondary: #B8B5AC;
  --text-muted:     #888582;  /* bumped from #7A7770 → 4.5:1+ on #0D0D0D */
  --border:         rgba(245, 242, 232, 0.08);
  --border-strong:  rgba(245, 242, 232, 0.16);
  --accent-text:    #D4A656;
  color: var(--text-secondary);
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 5rem 0 2rem;
  margin-top: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 3rem;
  margin-bottom: 3rem;
}
.footer-brand .logo { margin-bottom: 1rem; }
.footer-brand p { color: var(--text-muted); font-size: 0.92rem; max-width: 320px; }
.footer-col h3 {
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.2rem;
  font-weight: 600;
}
.footer-col ul li { margin-bottom: 0.7rem; }
.footer-col ul a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  transition: color var(--t-fast);
}
.footer-col ul a:hover { color: var(--accent); }

.social-links { display: flex; gap: 0.6rem; margin-top: 1.5rem; }
.social-links a {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--t-fast);
}
.social-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- 12. CTA Section ---------- */
.cta-section {
  background:
    linear-gradient(135deg, var(--cta-glow), transparent),
    var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 5rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--cta-glow) 1px, transparent 1px),
    linear-gradient(90deg, var(--cta-glow) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}
.cta-section .container { position: relative; z-index: 1; }
.cta-section h2 { margin-bottom: 1rem; }
.cta-section p { font-size: 1.1rem; margin-bottom: 2rem; max-width: 600px; margin-inline: auto; }

/* ---------- 13. Quote Pull ---------- */
.pull-quote {
  position: relative;
  padding: 3rem 0;
  margin: 3rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.pull-quote::before {
  content: '"';
  position: absolute;
  font-family: var(--font-en-display);
  font-size: 8rem;
  color: var(--accent);
  opacity: 0.15;
  top: -1rem;
  line-height: 1;
}
html[dir="rtl"] .pull-quote::before { right: -1rem; }
html[dir="ltr"] .pull-quote::before { left: -1rem; }
.pull-quote blockquote {
  font-family: var(--font-ar-display);
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  line-height: 1.6;
  color: var(--text-primary);
  font-weight: 500;
  max-width: 880px;
  margin: 0 auto;
}
html[lang="en"] .pull-quote blockquote {
  font-family: var(--font-en-display);
  font-style: italic;
}

/* ---------- 14. Policy / Numbered List ---------- */
.policy-list { display: flex; flex-direction: column; gap: 1.5rem; }
.policy-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 2rem 2.5rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: start;
  transition: all var(--t-base);
}
.policy-item:hover {
  border-color: var(--accent-border);
  background: var(--bg-elevated);
}
.policy-num {
  font-family: var(--font-en-display);
  font-size: 3rem;
  color: var(--accent-text);
  line-height: 1;
  font-weight: 500;
}
.policy-item h3 { margin-bottom: 0.6rem; font-size: 1.3rem; }
.policy-item p { color: var(--text-secondary); }

/* ---------- 15. Sub-service list (with bullet) ---------- */
.sub-list { padding-inline-start: 0; margin-top: 1.5rem; }
.sub-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--divider);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.sub-list li::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}
.sub-list li:last-child { border-bottom: none; }

/* ---------- 16. Service Detail Page ---------- */
.service-detail {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 4rem;
  margin-top: 3rem;
}
.service-detail-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  align-self: start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 2rem;
}
.service-detail-sidebar h4 { margin-bottom: 1.2rem; color: var(--accent-text); }
.service-detail-sidebar ul li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--divider);
}
.service-detail-sidebar ul li:last-child { border-bottom: none; }
.service-detail-sidebar ul a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  transition: color var(--t-fast);
}
.service-detail-sidebar ul a:hover,
.service-detail-sidebar ul a.active { color: var(--accent-text); }

/* ---------- 17. Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  margin-top: 3rem;
}
.contact-info { display: flex; flex-direction: column; gap: 1.5rem; }
.contact-item {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--t-base);
}
.contact-item:hover { border-color: var(--accent-border); }
.contact-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.contact-item h4 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; letter-spacing: 0.1em; text-transform: uppercase; }
.contact-item a, .contact-item span { color: var(--text-primary); font-size: 1.05rem; }
.contact-item a:hover { color: var(--accent-text); }

/* ---------- 18. Mobile Responsive ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .service-detail { grid-template-columns: 1fr; }
  .service-detail-sidebar { position: static; }
  .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}

@media (max-width: 860px) {
  :root { --header-h: 70px; }
  .main-nav { display: none; }
  .menu-toggle { display: flex; }
  .main-nav.mobile-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    /* bottom:0 removed — backdrop-filter on parent makes it the containing block,
       so bottom:0 collapses to the header's own bottom edge (~65px panel).
       Use explicit dvh-based height instead. */
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    z-index: 999;
    background: var(--bg-primary);
    padding: 2rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 2rem));
    gap: 0.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-top: 1px solid var(--border);
  }
  .main-nav.mobile-open .nav-link {
    padding: 1rem 0;
    border-bottom: 1px solid var(--divider);
    font-size: 1.05rem;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .main-nav.mobile-open .nav-caret {
    display: inline-block;
    transition: transform var(--t-base);
    font-size: 0.8rem;
  }
  .main-nav.mobile-open .nav-item.dropdown-open > .nav-link .nav-caret {
    transform: rotate(180deg);
  }
  .main-nav.mobile-open .dropdown {
    position: static;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transform: none;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--r-sm);
    box-shadow: none;
    padding: 0 0 0 1.5rem;
    min-width: auto;
    transition: max-height 0.32s ease, opacity 0.22s ease, padding 0.22s ease;
    margin-bottom: 0;
  }
  .main-nav.mobile-open .nav-item.dropdown-open > .dropdown {
    opacity: 1;
    visibility: visible;
    max-height: 500px;
    padding: 0.5rem 0 0.75rem 1.5rem;
    margin-bottom: 0.25rem;
  }
  .main-nav.mobile-open .dropdown a {
    padding: 0.6rem 0.5rem;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--divider);
    display: block;
  }
  .main-nav.mobile-open .dropdown a:last-child {
    border-bottom: none;
  }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-images { display: none; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { justify-content: center; text-align: center; }
  .section { padding: 4rem 0; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .policy-item { grid-template-columns: 1fr; gap: 1rem; padding: 1.5rem; }
  .policy-num { font-size: 2.2rem; }
  .logo img { height: 44px; }
  .logo-text .logo-main { font-size: 1.1rem; }
  .logo-text .logo-sub { font-size: 0.65rem; }
  .header-actions .btn { display: none; }

  /* Mobile CTA button — shown inside the open nav panel */
  .main-nav.mobile-open .nav-cta-mobile {
    display: block;
    width: 100%;
    padding-top: 1.25rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
  }
  .main-nav.mobile-open .nav-cta-mobile .btn {
    display: block;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; }
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.8rem; }
}

/* ---------- 19. Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.8s var(--t-base) backwards; }
.fade-up:nth-child(2) { animation-delay: 0.1s; }
.fade-up:nth-child(3) { animation-delay: 0.2s; }
.fade-up:nth-child(4) { animation-delay: 0.3s; }

[data-reveal] {
  opacity: 0;
  transform: translateY(30px);
  /* transition removed — GSAP handles animation timing */
}
[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

/* ---------- 20. Map Placeholder ---------- */
.map-wrapper {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
  background: var(--bg-card);
}
.map-wrapper iframe { width: 100%; height: 100%; border: none; }

/* ---------- 21. Page Transition Overlay ---------- */
#klms-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  opacity: 0;
  pointer-events: none;
}

/* ---------- 22. WhatsApp Float ---------- */
.whatsapp-float {
  position: fixed;
  bottom: 1.75rem;
  inset-inline-end: 1.75rem;
  z-index: 999;
  width: 58px;
  height: 58px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  transition: transform var(--t-base), box-shadow var(--t-base);
  animation: wa-pulse 3s ease-in-out infinite;
}
.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(37, 211, 102, 0.65);
}
.whatsapp-float svg { color: #fff; display: block; }
@keyframes wa-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4); }
  50%       { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4), 0 0 0 10px rgba(37, 211, 102, 0.12); }
}

/* ---------- 22. Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .hero-img--main,
  .hero-img-col .hero-img,
  .hero-img--main img,
  .hero-img-col .hero-img img {
    animation: none !important;
    clip-path: none !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- 23. Theme Toggle Button ---------- */
.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}
/* Light mode: show sun, hide moon */
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }
/* Dark mode: show moon, hide sun */
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- 24. Chairman Layout ---------- */
.chairman-figure {
  margin: 0;
}
.chairman-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--r-lg);
  display: block;
  object-fit: cover;
}
/* Portrait stand-in until the chairman photograph is supplied.
   Replace the whole .chairman-plate div with a plain <img> when it arrives. */
.chairman-plate {
  aspect-ratio: 4 / 5;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.chairman-figure .chairman-plate img {
  position: relative;
  width: 46%;
  height: auto;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 1px var(--border-strong), 0 10px 30px rgba(0, 0, 0, 0.18);
}
.chairman-figure figcaption {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.chairman-name {
  font-family: var(--font-ar-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}
.chairman-role {
  font-size: 0.875rem;
  color: var(--accent-text);
  margin-top: 0.25rem;
  letter-spacing: 0.05em;
}

/* ---------- 25. Theme Transition (only on explicit toggle) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.theme-transitioning,
  html.theme-transitioning *,
  html.theme-transitioning *::before,
  html.theme-transitioning *::after {
    transition:
      background-color 0.25s ease,
      color 0.25s ease,
      border-color 0.25s ease,
      box-shadow 0.25s ease !important;
  }
}

/* ---------- 26. Certificate Cards ---------- */
.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all var(--t-base);
  display: flex;
  flex-direction: column;
}
.cert-card:hover { border-color: var(--accent-border); transform: translateY(-6px); }

.cert-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg-elevated);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0;
  margin: 0;
  cursor: zoom-in;
  overflow: hidden;
}
.cert-thumb picture,
.cert-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cert-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

.cert-body {
  padding: 1.6rem 1.8rem 1.8rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.cert-issuer {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}
.cert-card h3 { font-size: 1.15rem; margin-bottom: 1.1rem; line-height: 1.4; }

.cert-fields { margin: 0 0 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; }
.cert-fields > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.84rem;
  border-bottom: 1px dashed var(--divider);
  padding-bottom: 0.4rem;
}
.cert-fields dt { color: var(--text-muted); margin: 0; flex-shrink: 0; }
.cert-fields dd { color: var(--text-primary); margin: 0; font-weight: 500; text-align: end; }

.cert-actions { display: flex; gap: 0.6rem; margin-top: auto; flex-wrap: wrap; }
.cert-actions .btn { flex: 1; }

/* ---------- 27. Certificate Lightbox ---------- */
.cert-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  /* --t-base bundles duration+easing already, so the visibility delay below
     is a literal 280ms match rather than var(--t-base) (invalid in that slot). */
  transition: opacity var(--t-base), visibility 0s linear 280ms;
}
.cert-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  /* `visibility` omitted from this list on purpose — see the note on
     .jgal-lightbox.is-open. Listing it costs the dialog its opening focus. */
  transition: opacity var(--t-base);
}
.cert-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: var(--scrim-strong);
  border: none;
  padding: 0;
  cursor: default;
}
.cert-lightbox-panel {
  position: relative;
  max-width: min(90vw, 900px);
  max-height: 90vh;
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.96);
  transition: transform var(--t-base);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}
.cert-lightbox.is-open .cert-lightbox-panel { transform: scale(1); }
.cert-lightbox-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  background: #fff;
}
.cert-lightbox-caption {
  padding: 1rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.cert-lightbox-close {
  position: absolute;
  top: 0.75rem;
  inset-inline-end: 0.75rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(14, 14, 14, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast);
  z-index: 1;
}
.cert-lightbox-close:hover { background: rgba(14, 14, 14, 0.85); }
.cert-lightbox-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 480px) {
  .cert-body { padding: 1.3rem 1.4rem 1.5rem; }
  .cert-fields > div { flex-direction: column; gap: 0.15rem; }
  .cert-fields dd { text-align: start; }
}

/* ---------- 26. Justified Gallery (catalogue) ---------- */
/* Cell widths and heights are set inline by catalogue.js so each row
   fills the container exactly; the flex container only handles wrapping. */
.jgal {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}
.jgal__item {
  position: relative;
  padding: 0;
  border: none;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-secondary);
  cursor: zoom-in;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.jgal__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.jgal__item:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 34px -8px rgba(212, 166, 86, 0.35);
}
.jgal__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.jgal-sentinel { width: 100%; height: 1px; }

.jgal-noscript {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  background: var(--bg-card);
}

/* No-JS fallback grid on the project pages. The track minimum is an explicit
   180px, never `auto` — an auto minimum lets a failed image fall back to its
   width attribute as min-content and blow the grid past its container, which
   is exactly what broke the old hardcoded `repeat(3, 1fr)` gallery. */
.jgal-fallback {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 1rem;
}
.jgal-fallback img {
  display: block;
  width: 100%;
  height: auto;          /* keep each photo's own shape — no forced crop */
  border-radius: var(--r-sm);
  background: var(--bg-secondary);
}

/* Lightbox — mirrors .cert-lightbox, plus prev/next navigation. */
.jgal-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  /* --t-base bundles duration+easing already, so the visibility delay below
     is a literal 280ms match rather than var(--t-base) (invalid in that slot). */
  transition: opacity var(--t-base), visibility 0s linear 280ms;
}
.jgal-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  /* `visibility` is deliberately NOT in this transition list. Listing it —
     even at 0s/0s — makes the change transition-governed, so the computed
     value stays `hidden` for one more frame. An invisible element silently
     refuses focus(), which left the open dialog unfocused and the keyboard
     user stranded on <body> behind it. Omitting it applies visibility at
     once, so catalogue.js can focus the close button synchronously.
     The base rule above still delays re-hiding until the fade-out ends. */
  transition: opacity var(--t-base);
}
.jgal-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: var(--scrim-strong);
  border: none;
  padding: 0;
  cursor: default;
}
.jgal-lightbox__panel {
  position: relative;
  max-width: min(92vw, 780px);
  max-height: 92vh;
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.96);
  transition: transform var(--t-base);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}
.jgal-lightbox.is-open .jgal-lightbox__panel { transform: scale(1); }
.jgal-lightbox__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  background: var(--bg-secondary);
}
.jgal-lightbox__caption {
  padding: 0.9rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.jgal-lightbox__close,
.jgal-lightbox__nav {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(14, 14, 14, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast);
  z-index: 1;
}
.jgal-lightbox__close { top: 0.75rem; inset-inline-end: 0.75rem; }
.jgal-lightbox__nav { top: 50%; transform: translateY(-50%); }
.jgal-lightbox__nav--prev { inset-inline-start: 0.75rem; }
.jgal-lightbox__nav--next { inset-inline-end: 0.75rem; }
/* The chevrons are drawn pointing left/right; flip them in RTL so
   "previous" always points back toward the start of the sequence. */
[dir="rtl"] .jgal-lightbox__nav svg { transform: scaleX(-1); }
.jgal-lightbox__close:hover,
.jgal-lightbox__nav:hover { background: rgba(14, 14, 14, 0.85); }
.jgal-lightbox__close:focus-visible,
.jgal-lightbox__nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 600px) {
  .jgal-lightbox { padding: 1rem; }
  .jgal-lightbox__nav { width: 36px; height: 36px; }
}
