/* Arabic-first bilingual, theme, gallery, and responsive navigation layer */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body { transition: background-color .3s ease, color .3s ease; }
html[lang="ar"] body { font-family: var(--arabic); }
html[lang="ar"] .hero h1,
html[lang="ar"] .story-copy h2,
html[lang="ar"] .section-heading h2,
html[lang="ar"] .contact h2,
html[lang="ar"] .service-card h3,
html[lang="ar"] .statement-copy h2,
html[lang="ar"] .testimonial blockquote { font-family: var(--arabic); letter-spacing: -.045em; }
html[lang="ar"] .hero h1 { line-height: 1.18; max-width: 13ch; }
html[lang="ar"] .story-copy h2,
html[lang="ar"] .section-heading h2,
html[lang="ar"] .contact h2 { line-height: 1.3; }
html[lang="ar"] .statement-copy h2 { line-height: 1.22; }
html[dir="rtl"] .eyebrow::before { order: 2; }
html[dir="rtl"] .section-kicker b { margin-left: 0; margin-inline-start: auto; }
html[dir="rtl"] .service-card:hover { padding-left: 0; padding-inline-start: 1rem; }
html[dir="rtl"] .hero-badge { left: auto; inset-inline-start: -34px; }
html[dir="rtl"] .story-arabic { right: auto; inset-inline-end: 1rem; }
html[dir="rtl"] .text-link b { transform: scaleX(-1); }
html[dir="rtl"] body[data-layout="split"] .hero { padding-right: max(4vw, calc((100vw - 1440px)/2)); padding-left: 0; }
html[dir="rtl"] body[data-layout="split"] .hero-image-wrap { border-radius: 0 0 110px 0; }
html[dir="rtl"] body[data-layout="mosaic"] .hero-visual::before { left: auto; right: -7%; }
html[dir="rtl"] body[data-layout="dynamic"] .hero-visual { transform: rotate(-2deg); }

.site-header { grid-template-columns: auto 1fr auto; }
.header-tools { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; }
.utility-button { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: color-mix(in srgb, var(--surface) 88%, transparent); cursor: pointer; font-size: .74rem; font-weight: 800; transition: background .2s ease, transform .2s ease; }
.utility-button:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.theme-toggle span { font-size: 1.1rem; line-height: 1; }
.desktop-nav a { white-space: nowrap; }

.drawer-backdrop,
.mobile-drawer { display: none; }

.gallery-section { padding-top: 2rem; }
.gallery-grid { min-height: 760px; margin-top: 4rem; display: grid; grid-template-columns: 1.2fr .8fr .8fr; grid-template-rows: 1fr 1fr; gap: 1rem; }
.gallery-item { min-width: 0; min-height: 0; margin: 0; overflow: hidden; border-radius: 22px; box-shadow: var(--shadow); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s ease; }
.gallery-item:hover img { transform: scale(1.035); }
.gallery-item-wide { grid-row: 1 / 3; }
.gallery-item-tall { grid-column: 2; grid-row: 1 / 3; }
.gallery-note { min-height: 0; padding: clamp(1.2rem, 3vw, 2.3rem); display: flex; flex-direction: column; justify-content: space-between; border-radius: 22px; color: var(--surface); background: var(--primary); }
.gallery-note span { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--surface) 34%, transparent); border-radius: 50%; font: 600 1.2rem/1 var(--arabic); }
.gallery-note p { margin: 1rem 0 0; font-size: clamp(1.1rem, 1.8vw, 1.5rem); font-weight: 600; }

html[data-theme="dark"] {
  --surface: #0d1211;
  --ink: #f4efe6;
  --primary: var(--brand-accent);
  --accent: color-mix(in srgb, var(--brand-accent) 72%, white);
  --line: color-mix(in srgb, var(--ink) 15%, transparent);
  --muted: color-mix(in srgb, var(--ink) 68%, transparent);
}
html[data-theme="dark"] .site-header { background: color-mix(in srgb, #121817 88%, transparent); border-color: #ffffff18; box-shadow: 0 16px 48px #0007; }
html[data-theme="dark"] .utility-button { background: #ffffff08; }
html[data-theme="dark"] .testimonial,
html[data-theme="dark"] .panel { background: #ffffff06; }
html[data-theme="dark"] .hero::before { opacity: .55; }
html[data-theme="dark"] .hero-image-wrap,
html[data-theme="dark"] .story-image,
html[data-theme="dark"] .gallery-item { box-shadow: 0 28px 80px #0008; }
html[data-theme="dark"] .hero-badge { color: var(--ink); background: #141b19; }
html[data-theme="dark"] .story-image-small { border-color: var(--surface); }
html[data-theme="dark"] .contact-card { color: #0b1210; background: var(--brand-accent); }
html[data-theme="dark"] .contact-card .eyebrow,
html[data-theme="dark"] .contact-card > div > p { color: #0b1210bd; }
html[data-theme="dark"] .contact-card input,
html[data-theme="dark"] .contact-card textarea { color: #101513; background: #ffffff3d; border-color: #10151335; }
html[data-theme="dark"] .contact-card .button { background: #0d1211; color: #f4efe6; }
html[data-theme="dark"] .gallery-note { color: #101513; background: var(--brand-accent); }
html[data-theme="dark"] .gallery-note span { border-color: #10151344; }

@media (max-width: 1100px) {
  .site-header { left: 14px; right: 14px; transform: none; width: auto; grid-template-columns: 1fr auto; gap: .75rem; padding: 10px 12px; }
  .site-header.scrolled { top: 8px; }
  .desktop-nav.site-nav { display: none !important; position: static; opacity: 1; visibility: visible; }
  .site-header .header-cta { display: none; }
  .menu-toggle { width: 40px; height: 40px; display: grid; place-items: center; z-index: auto; }
  .menu-toggle span { grid-area: 1/1; margin: 0; transition: transform .25s ease; }
  .menu-toggle span:first-child { transform: translateY(-4px); }
  .menu-toggle span:last-child { transform: translateY(4px); }
  .nav-open .menu-toggle span:first-child,
  .nav-open .menu-toggle span:last-child { transform: none; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 180; background: #050807a8; backdrop-filter: blur(3px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .28s ease, visibility .28s ease; }
  .mobile-drawer { position: fixed; z-index: 200; inset-block: 0; inset-inline-end: 0; width: min(88vw, 430px); height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 22px max(18px, env(safe-area-inset-bottom)); display: grid; grid-template-rows: auto minmax(0,1fr) auto; color: var(--ink); background: var(--surface); box-shadow: -28px 0 80px #0005; transform: translateX(105%); visibility: hidden; transition: transform .34s cubic-bezier(.22,.85,.31,1), visibility .34s ease; }
  html[dir="ltr"] .mobile-drawer { inset-inline-end: auto; inset-inline-start: 0; transform: translateX(-105%); box-shadow: 28px 0 80px #0005; }
  .nav-open .drawer-backdrop { opacity: 1; visibility: visible; pointer-events: auto; }
  .nav-open .mobile-drawer { transform: translateX(0); visibility: visible; }
  .drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
  .drawer-close { width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: transparent; cursor: pointer; font-size: 1.8rem; line-height: 1; }
  .drawer-nav { min-height: 0; padding: 1.2rem 0; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; overscroll-behavior: contain; }
  .drawer-nav a { min-height: 66px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: .8rem; border-bottom: 1px solid var(--line); }
  .drawer-nav a > span { color: var(--accent); font-size: .68rem; font-family: var(--sans); font-weight: 800; }
  .drawer-nav strong { font: 600 clamp(1.25rem, 4vw, 1.65rem)/1.3 var(--arabic); }
  .drawer-nav small { color: var(--muted); font: 600 .65rem/1 var(--sans); text-transform: uppercase; letter-spacing: .08em; }
  html[lang="en"] .drawer-nav strong { font-family: var(--serif); }
  .drawer-footer { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; padding-top: 1rem; border-top: 1px solid var(--line); }
  .drawer-setting { min-width: 0; min-height: 58px; padding: .75rem; display: grid; gap: .15rem; text-align: start; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: color-mix(in srgb, var(--ink) 3%, var(--surface)); cursor: pointer; }
  .drawer-setting span { color: var(--muted); font-size: .65rem; }
  .drawer-setting strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
  .hero, body[data-layout] .hero { padding-top: 8.8rem; }
  html[dir="rtl"] body[data-layout="split"] .hero { padding-right: 5vw; padding-left: 5vw; }
  html[dir="rtl"] body[data-layout="split"] .hero-image-wrap { border-radius: 20px 80px 20px 20px; }
  html[dir="rtl"] body[data-layout="dynamic"] .hero-visual { transform: none; }
  .gallery-grid { min-height: 650px; grid-template-columns: 1.15fr .85fr; grid-template-rows: 1fr 1fr 160px; }
  .gallery-item-wide { grid-row: 1/3; }
  .gallery-item-tall { grid-column: 2; grid-row: 1/3; }
  .gallery-item:not(.gallery-item-wide):not(.gallery-item-tall) { grid-column: 1; grid-row: 3; }
  .gallery-note { grid-column: 2; grid-row: 3; }
}

@media (max-width: 640px) {
  .site-header { left: 8px; right: 8px; width: auto; }
  .site-header .brand-mark { width: 38px; }
  .site-header .brand-copy strong { max-width: 128px; }
  .header-tools { gap: .28rem; }
  .utility-button, .menu-toggle { width: 36px; height: 36px; border-radius: 10px; }
  .mobile-drawer { width: min(92vw, 390px); padding-inline: 18px; }
  .drawer-nav { justify-content: flex-start; }
  .drawer-nav a { min-height: 64px; }
  .hero, body[data-layout] .hero { padding-top: 7.5rem; }
  html[lang="ar"] .hero h1 { font-size: clamp(2.65rem, 13.8vw, 4.25rem); line-height: 1.22; }
  .gallery-grid { min-height: auto; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 330px 230px 150px; gap: .7rem; }
  .gallery-item-wide { grid-column: 1/3; grid-row: 1; }
  .gallery-item-tall { grid-column: 1; grid-row: 2; }
  .gallery-item:not(.gallery-item-wide):not(.gallery-item-tall) { grid-column: 2; grid-row: 2; }
  .gallery-note { grid-column: 1/3; grid-row: 3; }
  .gallery-note span { width: 42px; height: 42px; }
}

@media (max-height: 650px) and (max-width: 1100px) {
  .drawer-nav { justify-content: flex-start; }
  .drawer-nav a { min-height: 58px; }
  .drawer-header { padding-bottom: .7rem; }
  .drawer-footer { padding-top: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-drawer, .drawer-backdrop { transition: none; }
}
