/* Stephen John Lawyers — refinements layered over the compiled design tokens.
   Keeps the quiet-authority identity: paper, navy, brass, oxblood; thin rules; 2px radius. */

:root { --sjl-ease: cubic-bezier(.22,.61,.36,1); --sjl-header-h: 121px; }
@media (max-width: 767.98px) { :root { --sjl-header-h: 80px; } }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--sjl-header-h) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* ---------- Focus: one calm brass ring everywhere ---------- */
:where(a, button, select, input, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 2px;
}
.bg-primary :where(a, button):focus-visible { outline-color: var(--brass); }

/* ---------- Header ---------- */
header.sticky { transition: box-shadow .3s var(--sjl-ease); }
header.sticky.sjl-scrolled { box-shadow: 0 1px 0 color-mix(in oklab, var(--border) 70%, transparent), 0 18px 40px -30px var(--primary); }

/* Current page: a hairline in brass beneath the active desktop link */
nav[aria-label="Primary"] > a { position: relative; }
nav[aria-label="Primary"] > a::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 2px; height: 1px;
  background: var(--brass); transform: scaleX(0); transform-origin: inline-start; transition: transform .35s var(--sjl-ease);
}
nav[aria-label="Primary"] > a:hover::after,
nav[aria-label="Primary"] > a[data-status="active"]::after,
nav[aria-label="Primary"] > a[aria-current="page"]::after { transform: scaleX(1); }
nav[aria-label="Primary"] > a[data-status="active"],
nav[aria-label="Primary"] > a[aria-current="page"] { color: var(--primary-foreground); }
[data-sjl-services] svg { transition: transform .25s var(--sjl-ease); }
[data-sjl-services][aria-expanded="true"] { color: var(--primary-foreground); }
[data-sjl-services][aria-expanded="true"] svg { transform: rotate(180deg); }

/* ---------- Services dropdown (light, bordered, three columns) ---------- */
.sjl-services { position: relative; }
.sjl-panel {
  position: absolute; top: calc(100% + 18px); inset-inline-start: -40px; z-index: 50;
  width: min(820px, calc(100vw - 48px)); padding: 40px;
  background: var(--card); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 30px 70px -40px var(--primary), 0 1px 0 var(--border);
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .22s var(--sjl-ease), transform .22s var(--sjl-ease);
}
.sjl-panel::before { /* invisible bridge so the pointer can cross the gap */
  content: ""; position: absolute; left: 0; right: 0; top: -20px; height: 20px;
}
.sjl-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }
.sjl-panel[hidden] { display: block; visibility: hidden; }
.sjl-panel.is-open[hidden] { visibility: visible; }
.sjl-panel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.sjl-panel-head { font-family: var(--font-body); font-size: .72rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
[dir="rtl"] .sjl-panel-head { letter-spacing: 0; font-size: .85rem; }
.sjl-panel-desc { margin-top: 10px; font-size: .84rem; line-height: 1.6; color: var(--muted-foreground); padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.sjl-panel-col ul { margin-top: 14px; display: grid; gap: 2px; }
.sjl-panel-col a {
  display: block; padding: 7px 0; font-size: .92rem; color: var(--foreground);
  border-bottom: 1px solid transparent; transition: color .2s, padding-inline-start .25s var(--sjl-ease);
}
.sjl-panel-col a:hover, .sjl-panel-col a:focus-visible { color: var(--accent); padding-inline-start: 6px; }
.sjl-panel-foot { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.sjl-panel-all { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.15rem; color: var(--primary); }
.sjl-panel-all svg { color: var(--brass); transition: transform .25s var(--sjl-ease); }
.sjl-panel-all:hover svg { transform: translateX(4px); }
[dir="rtl"] .sjl-panel-all:hover svg { transform: translateX(-4px) scaleX(-1); }

/* ---------- Language selector (listbox) ---------- */
.sjl-lang { position: relative; }
[data-sjl-lang] svg:first-child { color: var(--brass); }
.sjl-lang-list {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 60; min-width: 220px;
  background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 24px 50px -32px var(--primary); padding: 6px;
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .18s var(--sjl-ease), transform .18s var(--sjl-ease);
}
.sjl-lang-list[hidden] { display: block; visibility: hidden; }
.sjl-lang-list.is-open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
.sjl-lang-list a {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 14px;
  padding: 10px 12px; border-radius: 2px; font-size: 1rem; line-height: 1.5; color: var(--foreground);
}
.sjl-lang-list a:hover, .sjl-lang-list a:focus-visible { background: var(--muted); outline-offset: -2px; }
.sjl-lang-list a > span:first-child { font-size: 1.02rem; }
.sjl-lang-list a[lang="ur"] > span:first-child { font-family: "Noto Nastaliq Urdu","Noto Naskh Arabic",serif; line-height: 2; }
.sjl-lang-list a[lang="ps"] > span:first-child { font-family: "Noto Naskh Arabic",serif; }
.sjl-lang-list a[lang="zh-Hans"] > span:first-child { font-family: "Noto Sans SC",sans-serif; }
.sjl-lang-en { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); font-family: "Be Vietnam Pro",sans-serif; }
.sjl-lang-list a svg { grid-column: 3; color: var(--brass); }
.sjl-lang-list [aria-selected="true"] a { color: var(--primary); }
.sjl-lang-list [aria-selected="true"] a > span:first-child { font-weight: 500; }

/* ---------- Mobile / tablet menu overlay ---------- */
.sjl-overlay {
  position: fixed; inset: 0; top: var(--sjl-header-h); z-index: 35; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--background); border-top: 1px solid var(--border);
  opacity: 0; transform: translateY(-8px); transition: opacity .25s var(--sjl-ease), transform .25s var(--sjl-ease);
}
.sjl-overlay[hidden] { display: block; visibility: hidden; pointer-events: none; }
.sjl-overlay.is-open { opacity: 1; transform: none; visibility: visible; pointer-events: auto; }
@media (min-width: 1024px) { .sjl-overlay { display: none !important; } }
.sjl-overlay-inner { max-width: 1240px; margin: 0 auto; padding: 20px 24px 140px; }
@media (min-width: 768px) { .sjl-overlay-inner { padding: 28px 40px 160px; } }
.sjl-overlay-top { display: flex; align-items: center; justify-content: space-between; }
.sjl-overlay-brand { display: none; }
.sjl-overlay-close { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; margin-inline-start: auto; color: var(--primary); }
.sjl-m-primary { margin-top: 0; display: grid; }
.sjl-m-primary a {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--border);
  font-family: var(--font-display); font-size: 1.9rem; line-height: 1.15; color: var(--primary);
}
html[lang="ur"] .sjl-m-primary a { font-size: 1.5rem; line-height: 2; }
html[lang="ps"] .sjl-m-primary a { font-size: 1.6rem; line-height: 1.8; }
.sjl-m-primary a[aria-current="page"] { color: var(--accent); }
.sjl-m-groups { margin-top: 40px; display: grid; gap: 32px; }
@media (min-width: 640px) { .sjl-m-groups { grid-template-columns: repeat(3, 1fr); gap: 32px; } }
.sjl-m-head { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
[dir="rtl"] .sjl-m-head { letter-spacing: 0; font-size: .85rem; }
.sjl-m-group ul { margin-top: 12px; display: grid; }
.sjl-m-group a { display: block; padding: 10px 0; font-size: 1rem; color: var(--foreground); border-bottom: 1px solid color-mix(in oklab, var(--border) 60%, transparent); }
.sjl-m-actions { margin-top: 44px; display: grid; gap: 20px; }
.sjl-m-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; padding: 0 28px;
  background: var(--primary); color: var(--primary-foreground); font-size: .95rem; font-weight: 500; letter-spacing: .02em;
}
.sjl-m-cta svg { color: var(--brass); }
.sjl-m-contact { display: grid; gap: 8px; font-size: .95rem; }
.sjl-m-contact a { color: var(--muted-foreground); }
.sjl-m-contact a:first-child { font-family: var(--font-display); font-size: 1.6rem; color: var(--primary); }
body.sjl-locked { overflow: hidden; }
[data-sjl-menu] svg { transition: transform .25s var(--sjl-ease); }

/* ---------- Brand marks reused in overlay / utility pages ---------- */
.sjl-brand-name { font-family: "Cormorant Garamond",serif; font-size: 1.65rem; font-weight: 500; letter-spacing: -.01em; color: var(--primary); line-height: 1; }
.sjl-brand-sub { display: block; margin-top: 4px; font-family: "Be Vietnam Pro",sans-serif; font-size: .6rem; font-weight: 500; letter-spacing: .42em; color: var(--brass); }

/* ---------- Selects: visible affordance (chevron), calm focus ---------- */
.sjl-select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b08a4a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 16px;
  padding-inline-end: 44px !important; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
[dir="rtl"] .sjl-select { background-position: left 16px center; }
.sjl-select:focus, .sjl-select:focus-visible { border-color: var(--brass); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brass) 25%, transparent); outline: none; }
#finder { font-size: 1.2rem; line-height: 1.4; }
html[lang="ur"] #finder { line-height: 2; padding-top: 6px; padding-bottom: 6px; }

/* Inputs: softer, consistent focus */
input.border-input, textarea.border-input, select.border-input { transition: border-color .2s, box-shadow .2s; }
input.border-input:focus, textarea.border-input:focus, select.border-input:focus { box-shadow: 0 0 0 3px color-mix(in oklab, var(--brass) 25%, transparent); outline: none; }
input.border-input:user-invalid, textarea.border-input:user-invalid { border-color: var(--destructive); }
.sjl-form-note { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--brass); background: color-mix(in oklab, var(--brass) 10%, var(--card)); font-size: .9rem; line-height: 1.6; color: var(--foreground); }

/* ---------- Buttons: give the primary actions a little life ---------- */
a.bg-primary, button.bg-primary, a.bg-primary-foreground { transition: background-color .22s var(--sjl-ease), color .22s, transform .22s var(--sjl-ease); }
a.bg-primary:active, button.bg-primary:active, a.bg-primary-foreground:active { transform: translateY(1px); }
.group:hover .rtl-flip { transform: translateX(4px); }
[dir="rtl"] .group:hover .rtl-flip { transform: translateX(-4px) scaleX(-1); }

/* ---------- Hero: calmer first screen on phones, especially tall scripts ---------- */
@media (max-width: 639.98px) {
  main > section:first-child h1 { font-size: 2.55rem; line-height: 1.06; }
  html[lang="ur"] main > section:first-child h1 { font-size: 1.95rem !important; line-height: 1.85 !important; }
  html[lang="ps"] main > section:first-child h1 { font-size: 2.15rem !important; line-height: 1.6 !important; }
  html[lang="zh-Hans"] main > section:first-child h1 { font-size: 2.3rem; line-height: 1.25; }
  main > section:first-child form { margin-top: 36px; }
}
@media (min-width: 640px) and (max-width: 1023.98px) {
  html[lang="ur"] main > section:first-child h1 { font-size: 2.6rem !important; }
  html[lang="ps"] main > section:first-child h1 { font-size: 2.9rem !important; line-height: 1.5 !important; }
}
/* Hero image: a touch more presence on large screens */
@media (min-width: 1024px) {
  main > section:first-child img[loading="eager"] { transition: filter .6s var(--sjl-ease); }
  main > section:first-child:hover img[loading="eager"] { filter: grayscale(10%); }
}

/* ---------- Images: a consistent, gentle treatment ---------- */
img.grayscale-\[35\%\], .sjl-portrait { filter: grayscale(35%) contrast(1.02); transition: filter .5s var(--sjl-ease); }
li:hover .sjl-portrait { filter: grayscale(0%); }

/* ---------- Page rhythm ---------- */
details.group summary { padding-block: 2px; }
details.group summary > span { transition: transform .25s var(--sjl-ease); }
details.group > p { animation: sjl-fade .3s var(--sjl-ease); }
@keyframes sjl-fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { details.group > p { animation: none; } .sjl-panel, .sjl-lang-list, .sjl-overlay { transition: none; } }

/* Office list on Contact: let addresses breathe, align to the start */
main dl > div, main .sjl-office { text-align: start; }

/* Footer links: hairline underline on hover rather than a bare colour change */
footer a:not(.group):not([class*="font-serif"]) { text-decoration-color: transparent; text-underline-offset: 4px; text-decoration-line: underline; transition: color .2s, text-decoration-color .2s; }
footer a:not(.group):not([class*="font-serif"]):hover { text-decoration-color: var(--brass); }

/* Fixed phone bar: slightly taller touch targets with icons intact */
.fixed.inset-x-0.bottom-0 > a { min-height: 56px; }
.fixed.inset-x-0.bottom-0 > a:active { background: var(--muted); }
.fixed.inset-x-0.bottom-0 > a.bg-primary:active { background: var(--accent); }

/* Translation-review notice: quieter, with a brass hairline */
div[role="note"] { background: var(--muted); border-bottom-color: color-mix(in oklab, var(--brass) 40%, var(--border)); }

/* ---------- Root language page / 404 ---------- */
.sjl-root { background: var(--background); color: var(--foreground); font-family: var(--font-body); }
.sjl-root-main { min-height: 100svh; display: grid; align-content: center; justify-items: start; gap: 24px; max-width: 640px; margin: 0 auto; padding: 48px 24px; }
.sjl-root-brand { font-size: 2.1rem; }
.sjl-root-h1 { font-family: var(--font-display); font-size: 2.6rem; line-height: 1.1; color: var(--primary); font-weight: 500; }
.sjl-root-note { color: var(--muted-foreground); font-size: 1rem; line-height: 1.7; }
.sjl-root-list { width: 100%; display: grid; border-top: 1px solid var(--primary); }
.sjl-root-list a {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; column-gap: 18px;
  padding: 18px 4px; border-bottom: 1px solid var(--border); color: var(--primary); font-size: 1.35rem; font-family: var(--font-display);
  transition: padding-inline-start .25s var(--sjl-ease), color .2s;
}
.sjl-root-list a:hover { padding-inline-start: 14px; color: var(--accent); }
.sjl-root-list a svg { color: var(--brass); }
.sjl-root-list a[lang="ur"] > span:first-child { font-family: "Noto Nastaliq Urdu","Noto Naskh Arabic",serif; line-height: 2; }
.sjl-root-list a[lang="ps"] > span:first-child { font-family: "Noto Naskh Arabic",serif; }
.sjl-root-list a[lang="zh-Hans"] > span:first-child { font-family: "Noto Serif SC",serif; }
.sjl-root-list a[lang="vi"] > span:first-child, .sjl-root-list a[lang="en"] > span:first-child { font-family: "Cormorant Garamond",serif; }

/* ---------- Print ---------- */
@media print {
  header.sticky, .fixed.inset-x-0.bottom-0, .sjl-overlay, div[role="note"] { display: none !important; }
  footer { background: none !important; color: var(--foreground) !important; }
}
