/* ==========================================================================
   Hassan Al Ali Advocates & Legal Consultancy
   Single stylesheet, bidirectional (LTR/RTL) via CSS logical properties.
   Palette derived from the firm's logo: navy #1f2041, gold #986625.
   ========================================================================== */

:root {
  --navy:        #1f2041;
  --navy-900:    #15162e;
  --navy-700:    #2b2d58;
  --navy-500:    #454779;
  --gold:        #986625;
  --gold-400:    #b8843c;
  --gold-200:    #e2c99b;
  --gold-050:    #f7f1e6;

  --ink:         #1a1c28;
  --ink-700:     #3f4356;
  --ink-500:     #6b7186;
  --ink-300:     #a4a9bb;

  --paper:       #ffffff;
  --paper-alt:   #f7f7f9;
  --paper-warm:  #faf7f2;
  --rule:        #e3e4ea;

  --wrap:        1160px;
  --wrap-narrow: 760px;

  --step--1: clamp(0.83rem, 0.80rem + 0.14vw, 0.91rem);
  --step-0:  clamp(1.00rem, 0.96rem + 0.20vw, 1.13rem);
  --step-1:  clamp(1.20rem, 1.12rem + 0.38vw, 1.45rem);
  --step-2:  clamp(1.44rem, 1.30rem + 0.68vw, 1.94rem);
  --step-3:  clamp(1.73rem, 1.50rem + 1.13vw, 2.58rem);
  --step-4:  clamp(2.07rem, 1.70rem + 1.80vw, 3.44rem);

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --arabic: "Almarai", "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif;

  --shadow-sm: 0 1px 2px rgba(21, 22, 46, .06), 0 2px 8px rgba(21, 22, 46, .05);
  --shadow-md: 0 4px 12px rgba(21, 22, 46, .08), 0 12px 32px rgba(21, 22, 46, .07);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* --- base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

body[dir="rtl"] { font-family: var(--arabic); line-height: 1.9; }
body[dir="rtl"] h1, body[dir="rtl"] h2, body[dir="rtl"] h3,
body[dir="rtl"] h4, body[dir="rtl"] .logo__name { font-family: var(--arabic); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.18;
  color: var(--navy);
  margin: 0 0 .5em;
  letter-spacing: -.01em;
}
body[dir="rtl"] h1, body[dir="rtl"] h2, body[dir="rtl"] h3, body[dir="rtl"] h4 {
  letter-spacing: 0; line-height: 1.4; font-weight: 700;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

a { color: var(--navy-700); text-decoration-color: var(--gold-200); text-underline-offset: .18em; }
a:hover { color: var(--gold); }

img { max-width: 100%; height: auto; display: block; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; inset-inline-start: -9999px; top: 0; z-index: 200;
  background: var(--navy); color: #fff; padding: .75rem 1.25rem; border-radius: 0 0 4px 0;
}
.skip:focus { inset-inline-start: 0; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2.5rem, var(--wrap-narrow)); margin-inline: auto; }

.section { padding-block: clamp(3.5rem, 7vw, 6rem); }
.section--alt  { background: var(--paper-alt); }
.section--warm { background: var(--paper-warm); }

.eyebrow {
  font-family: var(--sans);
  font-size: var(--step--1);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin: 0 0 .75rem;
}
body[dir="rtl"] .eyebrow { font-family: var(--arabic); letter-spacing: 0; text-transform: none; }

.lead { font-size: var(--step-1); color: var(--ink-700); line-height: 1.6; }
body[dir="rtl"] .lead { line-height: 1.85; }

.section__head { max-width: 46rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section__head--center { margin-inline: auto; text-align: center; }

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--sans); font-size: var(--step--1); font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  padding: .85rem 1.6rem; border-radius: 2px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
body[dir="rtl"] .btn { font-family: var(--arabic); letter-spacing: 0; text-transform: none; }

.btn--primary { background: var(--gold); color: #fff; }
.btn--primary:hover { background: var(--gold-400); color: #fff; transform: translateY(-1px); }

.btn--ghost { border-color: rgba(255,255,255,.45); color: #fff; }
.btn--ghost:hover { background: rgba(255,255,255,.12); color: #fff; border-color: #fff; }

.btn--outline { border-color: var(--navy); color: var(--navy); }
.btn--outline:hover { background: var(--navy); color: #fff; }

.arrow { display: inline-block; transition: transform .2s var(--ease); }
body[dir="rtl"] .arrow { transform: scaleX(-1); }
.btn:hover .arrow { transform: translateX(3px); }
body[dir="rtl"] .btn:hover .arrow { transform: scaleX(-1) translateX(3px); }

/* --- header -------------------------------------------------------------- */

.topbar {
  background: var(--navy-900); color: rgba(255,255,255,.78);
  font-size: var(--step--1); padding-block: .55rem;
}
.topbar__inner { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; justify-content: space-between; }
.topbar__contact { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.topbar a { color: rgba(255,255,255,.85); text-decoration: none; }
.topbar a:hover { color: var(--gold-200); }

.langswap {
  border: 1px solid rgba(255,255,255,.28); border-radius: 2px;
  padding: .15rem .7rem; text-decoration: none; font-weight: 600;
}
.langswap:hover { border-color: var(--gold-200); }

/* No backdrop-filter here: a filtered ancestor becomes the containing block
   for its position:fixed descendants, which would trap the off-canvas nav
   inside the header and make it overflow the page. The background is opaque
   enough that the blur bought nothing. */
.masthead {
  position: sticky; top: 0; z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.masthead__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 4.75rem; }

.logo { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.logo img { width: 44px; height: auto; }
.logo__text { display: flex; flex-direction: column; line-height: 1.15; }
.logo__name { font-family: var(--serif); font-size: 1.28rem; font-weight: 700; color: var(--navy); }
.logo__sub {
  font-size: .62rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; font-family: var(--sans);
}
body[dir="rtl"] .logo__sub { font-family: var(--arabic); letter-spacing: 0; text-transform: none; font-size: .72rem; }

.nav { display: flex; align-items: center; gap: clamp(1rem, 2.2vw, 2rem); }
.nav a {
  font-size: var(--step--1); font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-700); text-decoration: none; padding-block: .4rem; position: relative;
}
body[dir="rtl"] .nav a { letter-spacing: 0; text-transform: none; font-size: var(--step-0); }
.nav a::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2px;
  background: var(--gold); transform: scaleX(0); transform-origin: center;
  transition: transform .2s var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--navy); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }

.navtoggle {
  display: none; background: none; border: 1px solid var(--rule); border-radius: 2px;
  padding: .5rem .65rem; cursor: pointer; color: var(--navy);
}
.navtoggle svg { display: block; }

@media (max-width: 880px) {
  .navtoggle { display: block; }
  /* Explicit physical offsets: the off-canvas panel is pinned to the right in
     LTR and the left in RTL, and the open state must out-specify both. */
  .nav {
    position: fixed; top: 0; bottom: 0; right: 0; left: auto;
    width: min(20rem, 82vw);
    background: var(--paper); flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 0; padding: 5.5rem 1.75rem 2rem; box-shadow: var(--shadow-md);
    transform: translateX(100%); overflow-y: auto;
    /* visibility keeps the closed panel out of the tab order and out of the
       page's scrollable area; it is delayed so the slide-out stays visible. */
    visibility: hidden;
    transition: transform .28s var(--ease), visibility 0s linear .28s;
  }
  body[dir="rtl"] .nav { right: auto; left: 0; transform: translateX(-100%); }
  .nav[data-open="true"],
  body[dir="rtl"] .nav[data-open="true"] {
    transform: translateX(0);
    visibility: visible;
    transition: transform .28s var(--ease), visibility 0s;
  }
  .nav a { padding-block: .95rem; border-bottom: 1px solid var(--rule); font-size: var(--step-0); }
  .nav a::after { display: none; }
  .navscrim {
    position: fixed; inset: 0; background: rgba(21,22,46,.45);
    opacity: 0; pointer-events: none; transition: opacity .28s var(--ease); z-index: 99;
  }
  .navscrim[data-open="true"] { opacity: 1; pointer-events: auto; }
}

/* --- hero ---------------------------------------------------------------- */

.hero { position: relative; background: var(--navy); color: #fff; overflow: hidden; isolation: isolate; }
.hero__bg {
  position: absolute; inset: 0; z-index: -2;
  background-image: url("../img/hero-courthouse.jpg");
  background-size: cover; background-position: center;
  opacity: .3;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(105deg, var(--navy) 12%, rgba(31,32,65,.82) 55%, rgba(31,32,65,.5) 100%);
}
body[dir="rtl"] .hero::after { background: linear-gradient(255deg, var(--navy) 12%, rgba(31,32,65,.82) 55%, rgba(31,32,65,.5) 100%); }

.hero__inner { padding-block: clamp(4.5rem, 11vw, 8.5rem); max-width: 40rem; }
.hero h1 { color: #fff; margin-bottom: .55em; }
.hero__lead { font-size: var(--step-1); color: rgba(255,255,255,.85); line-height: 1.6; margin-bottom: 2rem; }
body[dir="rtl"] .hero__lead { line-height: 1.85; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .85rem; }
.hero .eyebrow { color: var(--gold-200); }

/* --- page header (interior pages) --------------------------------------- */

.pagehead { background: var(--navy); color: #fff; position: relative; isolation: isolate; overflow: hidden; }
.pagehead::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: url("../img/hero-courthouse.jpg");
  background-size: cover; background-position: center 35%; opacity: .18;
}
.pagehead__inner { padding-block: clamp(3rem, 6vw, 5rem); }
.pagehead h1 { color: #fff; margin-bottom: .3em; }
.pagehead p { color: rgba(255,255,255,.8); max-width: 44rem; margin: 0; }

.crumbs { font-size: var(--step--1); color: rgba(255,255,255,.62); margin-bottom: 1rem; }
.crumbs a { color: rgba(255,255,255,.82); text-decoration: none; }
.crumbs a:hover { color: var(--gold-200); }
.crumbs span { margin-inline: .5rem; opacity: .55; }

/* --- generic grid / cards ------------------------------------------------ */

.grid { display: grid; gap: 1.5rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

.card {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  padding: 1.85rem 1.6rem; display: flex; flex-direction: column;
  text-decoration: none; color: inherit; position: relative;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 2px;
  background: var(--gold); transform: scaleX(0); transform-origin: inline-start;
  transition: transform .25s var(--ease);
}
a.card:hover { border-color: var(--gold-200); box-shadow: var(--shadow-md); transform: translateY(-2px); }
a.card:hover::before { transform: scaleX(1); }
.card h3 { margin-bottom: .45rem; font-size: var(--step-1); }
.card p { color: var(--ink-500); font-size: var(--step--1); line-height: 1.65; margin: 0; }
body[dir="rtl"] .card p { line-height: 1.85; }
.card__more {
  margin-top: auto; padding-top: 1.15rem; font-size: var(--step--1); font-weight: 600;
  color: var(--gold); display: inline-flex; align-items: center; gap: .4rem;
}

/* --- practice index list ------------------------------------------------- */

.arealist { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }

/* --- team ---------------------------------------------------------------- */

.person {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; overflow: hidden;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
a.person:hover { border-color: var(--gold-200); box-shadow: var(--shadow-md); transform: translateY(-2px); }

.person__photo { aspect-ratio: 1; background: var(--navy-900); position: relative; overflow: hidden; }
.person__photo img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.person__mono {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-family: var(--serif); font-size: clamp(2.5rem, 7vw, 3.75rem); font-weight: 600;
  color: var(--gold-200); background: linear-gradient(150deg, var(--navy-700), var(--navy-900));
  letter-spacing: .04em;
}
.person__body { padding: 1.35rem 1.4rem 1.6rem; }
.person__body h3 { margin-bottom: .2rem; font-size: var(--step-1); }
.person__role { font-size: var(--step--1); color: var(--gold); font-weight: 600; margin: 0; }

/* --- article / prose ----------------------------------------------------- */

.prose { max-width: 46rem; }
.prose p { color: var(--ink-700); }
.prose > p:first-of-type { font-size: var(--step-1); color: var(--ink); line-height: 1.6; }
body[dir="rtl"] .prose > p:first-of-type { line-height: 1.85; }

.note {
  border-inline-start: 3px solid var(--gold);
  background: var(--gold-050);
  padding: 1.1rem 1.35rem; border-radius: 0 3px 3px 0; color: var(--ink-700);
  font-size: var(--step--1); margin-top: 2rem;
}
body[dir="rtl"] .note { border-radius: 3px 0 0 3px; }

/* --- profile layout ------------------------------------------------------ */

.profile { display: grid; gap: clamp(2rem, 5vw, 3.5rem); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .profile { grid-template-columns: 19rem minmax(0, 1fr); } }
.profile__aside { align-self: start; position: sticky; top: 6.5rem; }
.profile__photo { border-radius: 3px; overflow: hidden; aspect-ratio: 1; background: var(--navy-900); margin-bottom: 1.25rem; }
.profile__photo img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.profile__contact { font-size: var(--step--1); color: var(--ink-500); }
.profile__contact a { display: block; margin-bottom: .35rem; text-decoration: none; }

@media (max-width: 859px) { .profile__aside { position: static; } }

/* --- offices ------------------------------------------------------------- */

.office {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; padding: 1.75rem 1.6rem;
}
.office--primary { border-color: var(--gold-200); background: var(--gold-050); }
.office h3 { font-size: var(--step-1); margin-bottom: .7rem; }
.office address { font-style: normal; color: var(--ink-700); font-size: var(--step--1); line-height: 1.75; }
.office__links { margin-top: 1rem; font-size: var(--step--1); }
.office__links a { display: block; text-decoration: none; font-weight: 600; margin-bottom: .3rem; }

/* --- credentials --------------------------------------------------------- */

.credgrid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.credgrid figure { margin: 0; }
.credgrid img { border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); }
.credgrid figcaption { font-size: var(--step--1); color: var(--ink-500); margin-top: .5rem; }

/* --- CTA band ------------------------------------------------------------ */

.cta { background: var(--navy); color: #fff; }
.cta__inner {
  padding-block: clamp(3rem, 6vw, 4.5rem);
  display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; justify-content: space-between;
}
.cta h2 { color: #fff; margin-bottom: .35rem; }
.cta p { color: rgba(255,255,255,.78); margin: 0; }

/* --- footer -------------------------------------------------------------- */

.foot { background: var(--navy-900); color: rgba(255,255,255,.68); padding-block: clamp(3rem, 6vw, 4.5rem) 0; font-size: var(--step--1); }
.foot__grid { display: grid; gap: 2.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.foot h4 {
  color: #fff; font-family: var(--sans); font-size: var(--step--1); font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase; margin-bottom: 1.1rem;
}
body[dir="rtl"] .foot h4 { font-family: var(--arabic); letter-spacing: 0; text-transform: none; font-size: var(--step-0); }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: .5rem; }
.foot a { color: rgba(255,255,255,.72); text-decoration: none; }
.foot a:hover { color: var(--gold-200); }
.foot address { font-style: normal; line-height: 1.8; }
.foot__brand .logo__name { color: #fff; }
.foot__brand p { margin-top: 1rem; color: rgba(255,255,255,.6); }
.foot__bar {
  margin-top: clamp(2.5rem, 5vw, 3.5rem); border-top: 1px solid rgba(255,255,255,.12);
  padding-block: 1.5rem; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  color: rgba(255,255,255,.5);
}
.foot__bar ul { display: flex; flex-wrap: wrap; gap: 1.5rem; }

/* --- utilities ----------------------------------------------------------- */

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.mt-auto { margin-top: auto; }

@media print {
  .topbar, .masthead, .cta, .foot, .navtoggle, .hero__actions { display: none !important; }
  body { color: #000; }
  .hero, .pagehead { background: none; color: #000; }
  .hero h1, .pagehead h1 { color: #000; }
}

/* --- contact form -------------------------------------------------------- */

.formwrap { margin-top: .5rem; }

.banner {
  padding: 1rem 1.25rem; border-radius: 3px; margin-bottom: 1.75rem;
  font-size: var(--step--1); border-inline-start: 3px solid;
}
.banner--ok  { background: #eef6ee; border-color: #3f7d46; color: #24512a; }
.banner--err { background: #fbeeee; border-color: #a33a3a; color: #7a2626; }
body[dir="rtl"] .banner { border-radius: 3px; }

.cform__row { display: grid; gap: 0 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }

.field { display: flex; flex-direction: column; gap: .45rem; margin: 0 0 1.25rem; }
.field label { font-size: var(--step--1); font-weight: 600; color: var(--ink-700); }
.req { color: var(--gold); }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field select,
.field textarea {
  font: inherit; font-size: var(--step-0);
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 3px;
  padding: .7rem .85rem; width: 100%;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
body[dir="rtl"] .field input,
body[dir="rtl"] .field select,
body[dir="rtl"] .field textarea { font-family: var(--arabic); }

.field textarea { resize: vertical; min-height: 9rem; line-height: 1.6; }

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(152, 102, 37, .16);
}
/* :user-invalid, not :invalid -- an empty required field is invalid from the
   moment the page loads, which would paint the whole form red before the
   visitor has typed anything. This only flags a field once they have
   actually interacted with it or tried to submit. */
.field input:user-invalid,
.field select:user-invalid,
.field textarea:user-invalid { border-color: #a33a3a; }

.field--check { flex-direction: row; align-items: flex-start; gap: .7rem; }
.field--check input { margin-top: .3rem; flex: none; width: 1.05rem; height: 1.05rem; accent-color: var(--gold); }
.field--check label { font-weight: 400; color: var(--ink-700); }

/* Honeypot: hidden from people, still reachable by naive bots. */
.cform__hp {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.formnote {
  font-size: var(--step--1); color: var(--ink-500);
  border-inline-start: 3px solid var(--gold-200);
  background: var(--gold-050); padding: .9rem 1.15rem; border-radius: 0 3px 3px 0;
}
body[dir="rtl"] .formnote { border-radius: 3px 0 0 3px; }

/* --- legal pages --------------------------------------------------------- */

.prose--legal h2 {
  font-size: var(--step-1); margin-top: 2.5rem;
  padding-top: 1.5rem; border-top: 1px solid var(--rule);
}
.prose--legal h2:first-of-type { margin-top: 1rem; }
.prose--legal > p:first-of-type { font-size: var(--step-0); }
.updated { font-size: var(--step--1); color: var(--ink-500); }
