/* Public site. Visual design ported from reference/amin-naimi-site-preview.html (phase 3).
   Every page is complete server HTML; html.js (set by the inline script in base.html) switches on
   the enhanced behaviour driven by static/js/site.js. Without JavaScript the same markup works as
   ordinary pages: open dropdown, scrollable layers, a plain image list and info section.

   Layouts (phase 4, CLAUDE.md 6.2): mobile <= 640px, tablet 641-1024px (portrait and landscape,
   plus touch tablets wider than 1024px in landscape), desktop >= 1025px, and landscape phones
   (height <= 500px). Heights use dvh after a vh fallback; fixed bars and buttons keep clear of
   the notch / Dynamic Island through env(safe-area-inset-*). */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn/Vazirmatn-Variable-subset.2ab4d7065b28.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
/* Latin only: Persian/Arabic text in "mono" places falls through to Vazirmatn. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono/JetBrainsMono-Regular-latin.caf0dfde4e44.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F;
}

:root {
  --bg: #ffffff;
  --ink: #17140f;
  --ink-soft: #6f6759;
  --line: #e6e1d2;
  --accent: #8a6a34;
  --chip: #000000;
  --surface: #f4f1ea;
  --pad: clamp(20px, 5vw, 56px);
  --mono: "JetBrains Mono", "Vazirmatn", ui-monospace, monospace;
  --ease-curtain: cubic-bezier(.65, .05, .36, 1);
  /* Safe areas (notch, Dynamic Island, home indicator); 0 elsewhere. Physical sides on purpose. */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --pad-l: max(var(--pad), var(--sal));
  --pad-r: max(var(--pad), var(--sar));
  /* Logo chip (412 x 317 artwork) and the language switch under it. */
  --mark-w: 158px;
  --mark-top: 24px;
  --mark-h: calc(var(--mark-w) * 317 / 412);
  --header-h: 88px;
  --spot-r: 200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  line-height: 1.6;
  text-align: start;
  -webkit-font-smoothing: antialiased;
}
/* A layer is open: the page underneath must not scroll (nor rubber-band on iOS). overflow alone
   does not stop iOS Safari, so the body is fixed in place; site.js stores the scroll position in
   --scroll-lock and restores it when the last layer closes (or the "Ask the designer" panel:
   body.ask-lock). */
body.has-view, body.ask-lock {
  position: fixed;
  inset-inline: 0;
  top: var(--scroll-lock, 0px);
  overflow: hidden;
}
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.mono { font-family: var(--mono); letter-spacing: .03em; }
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: var(--pad); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  inset-inline-start: 1rem;
  top: -10rem;
  z-index: 300;
  padding: .5rem 1rem;
  background: var(--ink);
  color: #fff;
}
.skip-link:focus { top: 1rem; }

/* Covered by a layer anyway: not rendered, so the lazy logo is not even downloaded. */
body.has-view .chrome { display: none; }

/* ---- logo chip (fixed top-left, as in the preview) ------------------------------------ */
.mark {
  position: fixed;
  top: calc(var(--mark-top) + var(--sat));
  left: calc(24px + var(--sal));
  /* An explicit height: WebKit adds the padding on top of an aspect-ratio box here. */
  width: var(--mark-w);
  height: var(--mark-h);
  background: var(--chip);
  border-radius: 6px;
  padding: 14px;
  z-index: 80;
  display: block;
}
.mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.mark.animating { transition: transform 5s ease-in-out; }

/* ---- language switch: FA · EN · AR ---------------------------------------------------- */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  direction: ltr; /* always FA · EN · AR in this order */
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
}
.lang-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px; /* touch target */
  min-height: 44px;
  padding: 2px 1px;
  color: var(--ink-soft);
  text-decoration: underline 1px transparent;
  text-underline-offset: 7px;
  transition: color .2s ease, text-decoration-color .2s ease;
}
.lang-switch a:focus-visible, .lang-switch a:active { color: var(--ink); }
.lang-switch a[aria-current="true"] { color: var(--ink); text-decoration-color: var(--accent); }
.lang-switch { gap: 0; }
.lang-switch .lang-sep { color: var(--line); }
/* The corner under the logo: the language switch, then the music button (when there is music). */
.corner-tools {
  position: fixed;
  top: calc(var(--mark-top) + var(--mark-h) + var(--sat)); /* just under the logo chip */
  left: calc(24px + var(--sal));
  z-index: 80;
  display: flex;
  align-items: center;
  direction: ltr;
  transition: opacity .7s ease .3s, transform .7s ease .3s;
}

/* ---- background music on/off (site.js). Shown only with JavaScript: without it nothing can
   play. Muted: speaker with a cross; playing: speaker with waves that breathe slowly. ---- */
.music-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; /* touch target */
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .2s ease;
}
html.js .music-btn { display: inline-flex; }
html.js .music-btn.is-unavailable { display: none; }
.music-btn svg { display: block; width: 20px; height: 20px; }
.music-btn .music-waves { display: none; }
.music-btn.is-playing { color: var(--ink); }
.music-btn.is-playing .music-waves { display: inline; animation: music-breathe 2.4s ease-in-out infinite; }
.music-btn.is-playing .music-mute { display: none; }
.music-btn:focus-visible, .music-btn:active { color: var(--accent); }
@keyframes music-breathe { 50% { opacity: .35; } }

/* ---- intro: black page, logo flies from the centre to its corner, white curtain falls ---- */
.curtain {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  transform: translateY(-100%);
  z-index: 40;
  pointer-events: none;
}
html.intro body { background: #000; overflow: hidden; }
html.intro .curtain { display: block; }
html.intro .curtain.falling { transition: transform 1.1s var(--ease-curtain); transform: translateY(0); }
html.intro .mark:not(.is-playing) { visibility: hidden; }

/* ---- home background photo: grey, colour revealed in a circle under the pointer ---------- */
.reveal-bg {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  transition: opacity 1s ease .1s;
}
.reveal-bg-gray, .reveal-bg-color {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}
/* Covered by a layer: not rendered, so the photo is only fetched for the home view. */
body.has-view .reveal-bg { display: none; }
/* The home social row is covered by the layer anyway; out of the way of the corner button. */
body.has-view .home-social { display: none; }
.reveal-bg-gray { opacity: .4; filter: grayscale(1) contrast(1.05); }
.reveal-bg-color {
  opacity: .7;
  -webkit-mask-image: radial-gradient(circle var(--spot-r) at var(--mx, -9999px) var(--my, -9999px), #000 0%, #000 55%, transparent 100%);
          mask-image: radial-gradient(circle var(--spot-r) at var(--mx, -9999px) var(--my, -9999px), #000 0%, #000 55%, transparent 100%);
}
/* Touch screens have no pointer to follow: wherever a finger touches, the colour circle appears
   and then fades out slowly (site.js toggles .is-touched; the listeners are passive, so
   scrolling is never held up). */
@media (hover: none) {
  .reveal-bg-color { opacity: 0; transition: opacity 1.6s ease-out; }
  .reveal-bg-color.is-touched { opacity: .7; transition: opacity .15s ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal-bg-color { display: none; }
}

/* ---- home menu ---------------------------------------------------------------------- */
/* The home menu sits above the background photo; layers (#view) stay in the root stacking
   context so they cover the fixed logo and language switch. */
.home { position: relative; z-index: 50; padding-top: calc(var(--header-h) + var(--sat)); }
.hero {
  position: relative; /* holds the social row at its foot */
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h) - var(--sat));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: clamp(32px, 6vw, 64px);
  padding-bottom: calc(clamp(32px, 6vw, 64px) + var(--social-h, 0px) + var(--sab));
}
.hero-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3.4vw, 30px);
}
.hero-menu > a,
.hero-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* touch target */
  min-width: 44px;
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  font: inherit;
  text-decoration: none;
  color: var(--ink);
  font-size: clamp(1.6rem, 4.2vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  padding: 4px 0;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}
.hero-menu > a:focus-visible, .hero-menu-toggle:focus-visible,
.hero-menu > a:active, .hero-menu-toggle:active {
  color: var(--accent);
  border-color: var(--line);
}
.hero-menu-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity .7s ease .4s, transform .7s ease .4s;
}
/* Until the intro ends the menu is hidden. As in the reference, the plain links appear at once
   when the curtain has landed and only the Projects item fades and rises (0.4 s later). */
html.intro .hero-menu > a,
html.intro .hero-menu-item { opacity: 0; transform: translateY(14px); }
html.intro .corner-tools { opacity: 0; transform: translateY(10px); }
html.intro .reveal-bg { opacity: 0; }

/* Social icons: a small, quiet row at the foot of the home page, kept clear of the menu by
   --social-h (added to the hero's bottom padding). Hidden during the intro, it fades in with the
   language switch. Above the photo (inside .home), so the colour circle is untouched. */
.home.has-social { --social-h: 52px; }
.social-links { display: flex; flex-wrap: wrap; gap: 4px; }
.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; /* touch target */
  height: 44px;
  border-radius: 50%;
  color: var(--ink-soft);
  transition: color .2s ease;
}
.social-links svg { display: block; width: 20px; height: 20px; }
.social-links a:focus-visible, .social-links a:active { color: var(--accent); }
.home-social {
  position: absolute;
  inset-inline: 0;
  bottom: calc(8px + var(--sab));
  justify-content: center;
  transition: opacity .7s ease .3s, transform .7s ease .3s;
}
.home-social svg { width: 18px; height: 18px; }
html.intro .home-social { opacity: 0; transform: translateY(10px); }

/* The studio's heading and introduction (Site Settings), below the first screen of the home
   page: the menu screen keeps the reference's look; a scroll shows the text on a plain
   background (it never sits on the photo). */
.home-about {
  position: relative;
  background: var(--bg);
  padding-block: clamp(40px, 7vw, 80px) calc(clamp(40px, 7vw, 80px) + var(--sab));
  padding-inline: var(--pad-l) var(--pad-r);
  text-align: center;
  border-top: 1px solid var(--line);
}
.home-about h1 {
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  font-weight: 700;
  line-height: 1.5;
  max-width: 34ch;
  margin-inline: auto;
}
.home-intro {
  color: var(--ink-soft);
  max-width: 64ch;
  margin: 1.1em auto 0;
  line-height: 1.9;
}
.home-intro p + p { margin-top: .75em; }
html.intro .home-about { opacity: 0; }
html.about-in-view body:not(.has-view) .corner-tools { opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s .3s; }

/* Projects dropdown. Without JavaScript it simply stays open. */
.projects-dropdown {
  display: grid;
  grid-template-rows: 1fr;
  width: 100%;
  max-width: min(560px, 84vw);
}
.projects-dropdown-inner {
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding-top: 18px;
}
html.js .projects-dropdown {
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows .3s ease, opacity .3s ease, visibility 0s linear .3s;
}
html.js .hero-menu-item.open .projects-dropdown {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  transition: grid-template-rows .3s ease, opacity .3s ease, visibility 0s;
}
html:not(.js) .hero-menu-toggle { cursor: default; }
.project-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  min-height: 44px;
  padding: 18px 16px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--bg);
  text-decoration: none;
  color: var(--ink);
  font-size: .85rem;
  font-weight: 500;
  text-align: center;
  transition: border-color .2s ease, color .2s ease;
}
.project-card:focus-visible, .project-card:active { border-color: var(--accent); color: var(--accent); }
.dropdown-empty { color: var(--ink-soft); font-size: .9rem; }

/* ---- full-screen layers (category, gallery, certificates, contact) ----------------------- */
.ov-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  opacity: 1;
  transition: opacity .35s ease;
}
.ov-backdrop.is-hidden { opacity: 0; visibility: hidden; }
.ov-panel {
  max-width: 1120px;
  margin-inline: auto;
  padding: var(--pad) var(--pad-r) calc(var(--pad) + var(--sab)) var(--pad-l);
  padding-top: calc(var(--pad) + var(--sat));
  min-height: 100%;
}
.ov-panel.gal-panel { max-width: none; }
.ov-bar {
  /* Stays at the top while a long layer scrolls, so x and the language switch remain in reach. */
  position: sticky;
  top: var(--sat);
  z-index: 20;
  background: var(--bg);
  box-shadow: 0 calc(var(--sat) * -1) 0 0 var(--bg); /* covers the strip under the notch */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(24px, 5vw, 48px);
}
/* The title may shrink to its longest word; only when even that does not fit next to the tools
   (a 320px screen, or a large text zoom) do the tools move to their own row (WCAG 1.4.10). */
.ov-bar { flex-wrap: wrap; row-gap: 12px; }
.ov-bar h1 { flex: 1 1 0; min-width: min-content; font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 700; line-height: 1.3; }
.ov-tools { display: flex; align-items: center; gap: clamp(12px, 2vw, 24px); flex-shrink: 0; margin-inline-start: auto; }
.ov-close {
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color .2s ease, color .2s ease;
}
.ov-close:focus-visible, .ov-close:active { border-color: var(--accent); color: var(--accent); }

.preview-banner {
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  background: #fff4d6;
  border: 1px solid #e8cf86;
  border-radius: 4px;
}

/* ---- category: project cards ----------------------------------------------------------- */
.cat-intro { color: var(--ink-soft); max-width: 64ch; margin-bottom: clamp(20px, 4vw, 36px); line-height: 1.8; }
.cat-intro p + p { margin-top: .75em; }
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
}
.cat-grid > li { display: flex; }
.cat-project-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg);
  transition: border-color .2s ease;
}
.cat-project-card:focus-visible, .cat-project-card:active { border-color: var(--accent); }
/* Fixed 4:3 frame filled edge to edge: no white bands, every card the same height. */
.cat-project-media {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  overflow: hidden;
}
.cat-project-thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.cat-project-empty { color: var(--ink-soft); font-size: .85rem; }
.cat-project-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2 * 1.5em + 28px);
  padding: 14px 16px;
  font-size: .92rem;
  font-weight: 500;
  line-height: 1.5;
}
.badge {
  align-self: flex-start;
  margin: 0 16px 14px;
  padding: 0 .5rem;
  font-size: .8rem;
  background: #fff4d6;
  border-radius: 2px;
}
.cat-empty { color: var(--ink-soft); font-size: .9rem; padding-block: 24px; }

/* ---- certificates: one row, a click enlarges an item in place ---------------------------- */
.cert-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: clamp(10px, 1.6vw, 20px);
  overflow-x: auto;
  padding-bottom: 4px;
}
.cert-cell {
  flex: 1 1 0%;
  min-width: 64px;
  transition: flex-grow .35s ease, flex-basis .35s ease;
}
.cert-cell.enlarged { flex: 6 1 0%; }
.cert-item {
  display: block;
  border: 1px solid var(--ink);
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg);
  cursor: zoom-in;
  transition: border-color .2s ease;
}
.cert-cell.enlarged .cert-item { cursor: zoom-out; }
.cert-item:focus-visible, .cert-item:active { border-color: var(--accent); }
.cert-thumb { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; }
.cert-cell.enlarged .cert-thumb { object-fit: contain; }

/* ---- contact and project info fields --------------------------------------------------- */
.info-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: clamp(18px, 3vw, 30px);
  margin: 0 0 clamp(22px, 4vw, 36px);
}
.info-fields dt {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.info-fields dd { margin: 0; font-size: .95rem; color: var(--ink); }
.contact-fields address { font-style: normal; }
/* Two numbers side by side, or one under the other when they do not fit (no stray separator). */
.contact-phones { display: flex; flex-wrap: wrap; column-gap: 1.2em; }
.contact-fields dd a {
  display: inline-block;
  padding-block: 10px;
  text-decoration: underline;
  text-underline-offset: .15em;
  white-space: nowrap;
  transition: color .2s ease;
}
.contact-fields dd a:focus-visible, .contact-fields dd a:active { color: var(--accent); }
/* The icons line up with the text above them: the first one's glyph, not its 44px box. */
.contact-social .social-links { margin-inline-start: -12px; }
.contact-fields .social-links a { display: inline-flex; padding: 0; color: var(--ink); text-decoration: none; }

/* ---- project: gallery ---------------------------------------------------------------- */
.gal-panel .ov-bar { flex-wrap: nowrap; }
.project-info-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  min-height: 44px; /* touch target */
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s ease, color .2s ease;
}
.project-info-btn:focus-visible, .project-info-btn:active { border-color: var(--accent); color: var(--accent); }
html:not(.js) .project-info-btn { display: none; }

.gal-body { position: relative; }
.gal { position: relative; }
.gal-stage {
  /* Slot geometry, read by site.js as well (centerBox). Desktop values are the preview's:
     centre slide at most 50% of the stage wide (85% when it must grow past the side slides),
     side slides 30% - 1cm wide and 70% high, centred at 19% / -12% / -43% from the edge. */
  --c-max: .5;
  --c-cap: .85;
  --s-w: .3;
  --s-cut: 37.8px;
  --s-h: .7;
  --x1: 19%;
  --x2: -12%;
  --x3: -43%;
  position: relative;
  /* full-bleed: cancels the panel's side padding exactly (safe areas included) */
  width: calc(100% + var(--pad-l) + var(--pad-r));
  margin-left: calc(var(--pad-l) * -1);
  margin-right: calc(var(--pad-r) * -1);
  aspect-ratio: 2.9;
  max-height: 62vh;
  /* Short windows (laptops at 125-150% display scaling): the arrows and counter stay on screen. */
  max-height: min(62dvh, calc(100dvh - 290px - var(--sat) - var(--sab)));
  min-height: 200px;
  background: #000;
  overflow: hidden;
  /* Horizontal swipes belong to the gallery (site.js); vertical scrolling and pinch-zoom stay
     with the browser. */
  touch-action: pan-y pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* Slot geometry. site.js sizes the centre slide exactly to its photo and moves slides between
   slots; these rules give the same layout before it runs. Slot +1 is the next image: on the
   right in English, on the left in Persian and Arabic. --drag follows a swipe in progress. */
.gal-slide {
  --x: 50%;
  position: absolute;
  top: 50%;
  left: var(--x);
  width: calc(var(--s-w) * 100%);
  height: calc(var(--s-h) * 100%);
  max-width: none;
  transform: translate(calc(-50% + var(--drag, 0px)), -50%);
  object-fit: cover;
  border-radius: 50% / 7%;
  background: #000;
  opacity: .5;
  z-index: 1;
  pointer-events: none;
  transition: left .55s var(--ease-curtain), width .55s var(--ease-curtain),
    height .55s var(--ease-curtain), opacity .55s ease, transform .35s ease-out;
}
.gal-stage.is-dragging .gal-slide { transition: none; }
html[dir="rtl"] .gal-slide { left: calc(100% - var(--x)); }
.gal-slide[data-slot="-3"] { --x: var(--x3); opacity: 1; z-index: 0; }
.gal-slide[data-slot="-2"] { --x: var(--x2); }
.gal-slide[data-slot="-1"] { --x: var(--x1); width: calc(var(--s-w) * 100% - var(--s-cut)); opacity: .55; z-index: 2; }
.gal-slide[data-slot="1"] { --x: calc(100% - var(--x1)); width: calc(var(--s-w) * 100% - var(--s-cut)); opacity: .55; z-index: 2; }
.gal-slide[data-slot="2"] { --x: calc(100% - var(--x2)); }
.gal-slide[data-slot="3"] { --x: calc(100% - var(--x3)); opacity: 1; z-index: 0; }
.gal-slide[data-slot="0"] {
  width: auto;
  height: 94%;
  max-width: calc(var(--c-max) * 100%);
  object-fit: contain;
  border-radius: 2px;
  opacity: 1;
  z-index: 3;
}
.gal-slide:not([src]) { visibility: hidden; }

.gal-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 20px;
}
.gal-nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  appearance: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s ease, color .2s ease;
}
.gal-nav svg { width: 18px; height: 18px; display: block; }
html[dir="rtl"] .gal-nav svg { transform: scaleX(-1); }
.gal-nav:focus-visible, .gal-nav:active { border-color: var(--accent); color: var(--accent); }
.gal-nav:disabled { opacity: .35; cursor: default; border-color: var(--ink); color: var(--ink); }
.gal-counter {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: center;
  padding-top: 16px;
  font-size: .8rem;
  color: var(--ink-soft);
  letter-spacing: .04em;
}
/* Persian digits are right-to-left numbers: isolate each so "۰۱ / ۱۲" keeps its order. */
.gal-counter span { unicode-bidi: isolate; }
.gal-empty {
  display: grid;
  place-items: center;
  min-height: 30vh;
  min-height: 30dvh;
  color: var(--ink-soft);
  background: var(--surface);
}
/* Without JavaScript: a plain list of every image instead of the carousel. */
html:not(.js) .gal-stage,
html:not(.js) .gal-controls,
html:not(.js) .gal-counter { display: none; }
.gal-fallback { display: grid; gap: 1rem; }
.gal-fallback img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 85vh;
  max-height: 85dvh;
  object-fit: contain;
  background: var(--surface);
}

/* ---- project information curtain: unfolds downwards over the gallery -------------------- */
.info-curtain-inner { padding-block: clamp(20px, 4vw, 40px); }
html.js .info-curtain {
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(100% + var(--pad-l) + var(--pad-r));
  margin-left: calc(var(--pad-l) * -1);
  margin-right: calc(var(--pad-r) * -1);
  z-index: 70;
  background: var(--bg);
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  transition: clip-path .7s var(--ease-curtain), visibility 0s linear .7s;
}
html.js .info-curtain.open {
  clip-path: inset(0 0 0% 0);
  visibility: visible;
  transition: clip-path .7s var(--ease-curtain), visibility 0s;
}
html.js .info-curtain-inner {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-left: var(--pad-l);
  padding-right: var(--pad-r);
}
/* The open curtain always reaches the bottom of the screen, even over a short gallery. */
html.js .gal-body:has(.info-curtain.open) {
  min-height: calc(100vh - 170px);
  min-height: calc(100dvh - 170px - var(--sat));
}
.info-curtain-bar {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(22px, 4vw, 36px);
}
.info-eyebrow { font-size: .72rem; font-weight: 400; letter-spacing: .14em; color: var(--ink-soft); text-transform: uppercase; }
.info-title { font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.3; margin-bottom: clamp(22px, 4vw, 36px); }
.info-description { max-width: 64ch; line-height: 1.8; }
.info-description p + p { margin-top: 1em; }

/* ---- 404 ---------------------------------------------------------------------------- */
.error-page .lead { color: var(--ink-soft); margin-bottom: 1.5rem; }
.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 1.25rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .2s ease, color .2s ease;
}
.button:focus-visible, .button:active { border-color: var(--accent); color: var(--accent); }

/* Letter spacing breaks the joining of Persian and Arabic letters. */
html[dir="rtl"] .project-info-btn,
html[dir="rtl"] .info-eyebrow,
html[dir="rtl"] .info-fields dt { letter-spacing: 0; }

/* ---- FAQ page ------------------------------------------------------------------------- */
.faq-lead { color: var(--ink-soft); max-width: 64ch; line-height: 1.8; margin-bottom: clamp(18px, 3vw, 28px); }
.faq-topics ul { display: flex; flex-wrap: wrap; gap: 8px; }
.faq-topics a, .ask-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px; /* touch target */
  padding-inline: 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: .85rem;
  text-decoration: none;
  transition: border-color .2s ease, color .2s ease;
}
.faq-topics a:focus-visible, .faq-topics a:active,
.ask-contact:focus-visible, .ask-contact:active { border-color: var(--accent); color: var(--accent); }
.ask-contact svg { display: block; width: 18px; height: 18px; flex-shrink: 0; }
.faq-section {
  margin-top: clamp(28px, 5vw, 48px);
  scroll-margin-top: 120px; /* clear of the sticky layer bar */
}
.faq-section h2 {
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}
.faq-item { padding-block: 18px; border-bottom: 1px solid var(--line); }
.faq-item h3 { font-size: 1rem; font-weight: 700; line-height: 1.7; }
.faq-answer { max-width: 70ch; margin-top: 6px; line-height: 1.95; }
.faq-answer p + p { margin-top: .75em; }
.faq-more a, .home-faq a, .contact-faq a, .ask-link a, .ask-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* touch target */
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: .3em;
  transition: color .2s ease;
}
.faq-more a { font-size: .88rem; }
.faq-more a:focus-visible, .faq-more a:active, .home-faq a:focus-visible, .home-faq a:active,
.contact-faq a:focus-visible, .contact-faq a:active, .ask-link a:focus-visible, .ask-link a:active,
.ask-foot a:focus-visible, .ask-foot a:active { color: var(--accent); }
.faq-contact {
  margin-top: clamp(32px, 6vw, 56px);
  padding: clamp(20px, 3vw, 28px);
  background: var(--surface);
  border-radius: 2px;
}
.faq-contact h2 { font-size: 1.1rem; font-weight: 700; }
.faq-contact p { color: var(--ink-soft); margin-top: 4px; }
.faq-contact .ask-contacts { margin-top: 16px; }
.ask-contacts { display: flex; flex-wrap: wrap; gap: 8px; }
.home-faq { margin-top: 1.2em; }
.contact-faq { margin-top: -8px; }

/* ---- Journal (CLAUDE.md 13q): article cards, the article itself, the home page's latest ----
   The site's quiet look: thin ink borders, the accent for links and focus. Long text gets a
   column of about 70 characters, a larger size and generous line height: 2 for Persian (its
   letters need the height), 1.75 for English. No letter spacing on Persian text. */
.blog-filter { margin-bottom: clamp(20px, 4vw, 36px); }
.blog-filter a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
}
.post-grid > li { display: flex; }
.post-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid var(--ink);
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .2s ease;
}
.post-card:focus-visible, .post-card:active { border-color: var(--accent); }
.post-card-media { display: block; aspect-ratio: 3 / 2; background: var(--surface); overflow: hidden; }
.post-card-thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.post-card-text { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 16px 18px 18px; }
.post-card-cat { color: var(--accent); font-size: .78rem; font-weight: 500; }
.post-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-summary {
  color: var(--ink-soft);
  font-size: .88rem;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-meta { margin-top: auto; padding-top: 4px; color: var(--ink-soft); font-size: .78rem; }
.post-card .badge { margin: 0; }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  margin-top: clamp(28px, 5vw, 48px);
}
.pager ul { display: flex; flex-wrap: wrap; gap: 4px; }
.pager a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding-inline: 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  font-size: .9rem;
  text-decoration: none;
  transition: border-color .2s ease, color .2s ease;
}
.pager a[aria-current="page"] { border-color: var(--ink); }
.pager .pager-step { border-color: var(--line); }
.pager a:focus-visible, .pager a:active { border-color: var(--accent); color: var(--accent); }

/* The bar of an article names the journal (a link); the title is the article's own <h1>. */
.ov-bar-title {
  flex: 1 1 0;
  min-width: min-content;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  transition: color .2s ease;
}
.ov-bar-title:focus-visible, .ov-bar-title:active { color: var(--accent); }

.post { --measure: 46rem; }
.post-section { max-width: 60rem; margin-inline: auto; }
.post-head, .post-body, .post-author, .post-links, .post-cta { max-width: var(--measure); margin-inline: auto; }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; column-gap: 2px; }
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before { content: "/"; color: var(--line); padding-inline-end: 8px; }
.crumbs a {
  display: inline-flex;
  align-items: center;
  min-width: 44px; /* touch target ("خانه" is short) */
  min-height: 44px;
  color: var(--ink-soft);
  font-size: .82rem;
  text-decoration: none;
  transition: color .2s ease;
}
.crumbs a:focus-visible, .crumbs a:active { color: var(--accent); }
.post-head h1 {
  margin-top: 4px;
  font-size: clamp(1.55rem, 4.2vw, 2.4rem);
  font-weight: 700;
  line-height: 1.45;
}
.post-summary { margin-top: 16px; color: var(--ink-soft); font-size: 1.08rem; line-height: 1.95; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: .85rem;
}
.post-cover { max-width: 860px; margin: clamp(24px, 4vw, 40px) auto 0; }
.post-cover img { display: block; width: 100%; height: auto; border-radius: 2px; background: var(--surface); }
.post-body {
  margin-top: clamp(28px, 5vw, 44px);
  font-size: 1.0625rem;
  line-height: 2;
  overflow-wrap: break-word;
}
html[lang="en"] .post-body { line-height: 1.75; font-size: 1.08rem; hyphens: auto; }
.post-body > * + * { margin-top: 1.15em; }
.post-body h2 {
  margin-top: 2.1em;
  font-size: clamp(1.25rem, 2.6vw, 1.5rem);
  font-weight: 700;
  line-height: 1.6;
}
.post-body h3 { margin-top: 1.7em; font-size: 1.15rem; font-weight: 700; line-height: 1.7; }
.post-body h2 + *, .post-body h3 + * { margin-top: .55em; }
.post-body ul, .post-body ol { padding-inline-start: 1.5em; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
html[lang="fa"] .post-body ol { list-style: persian; }
.post-body li + li { margin-top: .45em; }
.post-body li > ul, .post-body li > ol { margin-top: .45em; }
.post-body li::marker { color: var(--accent); }
.post-body blockquote {
  margin-inline: 0;
  padding-block: .2em;
  padding-inline-start: 1.2em;
  border-inline-start: 2px solid var(--accent);
  color: var(--ink-soft);
  font-size: 1.1rem;
}
.post-body blockquote > * + * { margin-top: .8em; }
.post-body strong { font-weight: 700; }
.post-body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: .3em;
  transition: color .2s ease;
}
.post-body a:focus-visible, .post-body a:active { color: var(--accent); }
/* "About the author" right after the text: the name, a few sentences from Site Settings and a
   link to the contact page. A quiet frame with the accent line on the reading side. */
.post-author {
  margin-top: clamp(32px, 5vw, 48px);
  padding: clamp(18px, 3vw, 26px) clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 2px;
}
.post-author-label { color: var(--accent); font-size: .8rem; font-weight: 500; }
html[lang="en"] .post-author-label { font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; font-size: .72rem; }
.post-author-name { margin-top: 6px; font-size: 1.1rem; font-weight: 700; }
.post-author-bio { margin-top: 8px; color: var(--ink-soft); line-height: 1.95; }
html[lang="en"] .post-author-bio { line-height: 1.7; }
.post-author-more { margin-top: 6px; }
.post-author-more a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: .3em;
  transition: color .2s ease;
}
.post-author-more a:focus-visible, .post-author-more a:active { color: var(--accent); }
.post-links {
  display: flex;
  flex-direction: column;
  margin-top: clamp(28px, 5vw, 44px);
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.post-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: .3em;
  transition: color .2s ease;
}
.post-links a:focus-visible, .post-links a:active { color: var(--accent); }
.post-section { margin-top: clamp(36px, 6vw, 60px); }
.post-section h2 {
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: clamp(16px, 3vw, 24px);
}
.post-cta {
  margin-top: clamp(36px, 6vw, 56px);
  padding: clamp(20px, 3vw, 28px);
  background: var(--surface);
  border-radius: 2px;
}
.post-cta h2 { font-size: 1.15rem; font-weight: 700; }
.post-cta p { color: var(--ink-soft); margin-top: 4px; }
.post-cta .ask-contacts { margin-top: 14px; }
.post-cta .post-channel { margin-top: 20px; }

/* The home page: the three newest articles under the introduction. */
.home-journal { max-width: 960px; margin: clamp(36px, 6vw, 56px) auto 0; text-align: start; }
.home-journal h2 { font-size: 1.1rem; font-weight: 700; text-align: center; margin-bottom: 18px; }
.home-journal-list { --gap: clamp(14px, 2.4vw, 24px); display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); }
.home-journal-list > li { flex: 0 1 calc((100% - 2 * var(--gap)) / 3); min-width: 0; }
.home-journal-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  color: var(--ink);
  text-decoration: none;
}
.home-journal-media {
  display: block;
  aspect-ratio: 3 / 2;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color .2s ease;
}
.home-journal-text { display: flex; flex-direction: column; gap: 4px; }
.home-journal-title { font-size: .95rem; font-weight: 700; line-height: 1.65; transition: color .2s ease; }
.home-journal-item:focus-visible .home-journal-title, .home-journal-item:active .home-journal-title { color: var(--accent); }
.home-journal .home-faq { text-align: center; }

@media (min-width: 641px) and (max-width: 1024px) {
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .post-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .post-card-text { padding: 14px 16px 16px; }
  .post-body { font-size: 1.03rem; }
  html[lang="en"] .post-body { font-size: 1.04rem; }
  .post-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Small photo beside the title, one article per row. */
  .home-journal-list { flex-direction: column; --gap: 14px; }
  .home-journal-list > li { flex-basis: auto; }
  .home-journal-item { flex-direction: row; align-items: flex-start; gap: 14px; }
  .home-journal-media { flex: 0 0 30%; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ov-bar-title { font-size: 1.05rem; }
}
@media (hover: hover) {
  .post-card:hover, .home-journal-item:hover .home-journal-media { border-color: var(--accent); }
  .home-journal-item:hover .home-journal-title { color: var(--accent); }
  .pager a:hover, .crumbs a:hover, .post-links a:hover, .post-body a:hover, .post-author-more a:hover,
  .ov-bar-title:hover { color: var(--accent); }
  .pager a:hover { border-color: var(--accent); }
}

/* ---- "Ask the designer": corner button and panel (site.js setUpAsk) ---------------------
   Bottom right on every page, away from the logo and its tools (top left), the social row
   (bottom centre) and the menu (centre). Without JavaScript the button is a link to the FAQ
   page; with it, a button that opens the panel: a floating card on tablets and desktops, a
   sheet from the bottom on phones. Hidden during the intro; fades in with the language switch. */
.ask-btn {
  position: fixed;
  right: calc(24px + var(--sar));
  bottom: calc(24px + var(--sab));
  z-index: 110; /* over layers (100), under the panel */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px; /* touch target */
  height: 44px;
  padding-inline: 13px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 4px 18px rgba(23, 20, 15, .1);
  font: inherit;
  font-size: .82rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity .7s ease .3s, transform .7s ease .3s, border-color .2s ease, color .2s ease;
}
.ask-btn .ask-icon { display: block; width: 20px; height: 20px; flex-shrink: 0; }
.ask-btn:focus-visible, .ask-btn:active { border-color: var(--accent); color: var(--accent); }
html.js .ask-btn--link, html:not(.js) .ask-btn--open { display: none; }
html.intro .ask-btn { opacity: 0; transform: translateY(10px); pointer-events: none; }
html.ask-open .ask-btn { visibility: hidden; transition: none; }
/* The end of a layer or of the home page can scroll clear of the button. */
body.has-ask .ov-panel { padding-bottom: calc(var(--pad) + var(--sab) + 64px); }
body.has-ask .home-about { padding-bottom: calc(clamp(40px, 7vw, 80px) + var(--sab) + 56px); }

.ask-backdrop {
  position: fixed;
  inset: 0;
  z-index: 125;
  background: rgba(23, 20, 15, .28);
  opacity: 0;
  transition: opacity .3s ease;
  touch-action: none;
}
.ask.is-open .ask-backdrop { opacity: 1; }
.ask-panel {
  position: fixed;
  right: calc(24px + var(--sar));
  bottom: calc(24px + var(--sab));
  z-index: 130;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 48px - var(--sal) - var(--sar)));
  height: min(620px, calc(100vh - 48px));
  height: min(620px, calc(100dvh - 48px - var(--sat) - var(--sab)));
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 18px 48px rgba(23, 20, 15, .2);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .25s ease, transform .3s var(--ease-curtain);
}
.ask.is-open .ask-panel { opacity: 1; transform: none; }
.ask-head {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 56px;
  padding-inline: 16px 6px;
  border-bottom: 1px solid var(--line);
}
.ask-head:has(.ask-back:not([hidden])) { padding-inline-start: 4px; }
.ask-title { flex: 1 1 auto; min-width: 0; font-size: 1rem; font-weight: 700; line-height: 1.4; }
.ask-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; /* touch target */
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease;
}
.ask-icon-btn svg { display: block; width: 20px; height: 20px; }
.ask-icon-btn:focus-visible, .ask-icon-btn:active { color: var(--accent); }
.ask-back[hidden] { display: none; }
html[dir="rtl"] .ask-back svg { transform: scaleX(-1); }
.ask-search { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ask-input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding-inline: 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* 16px or more: iOS Safari does not zoom in on focus */
  -webkit-appearance: none;
  appearance: none;
}
.ask-input::placeholder { color: var(--ink-soft); opacity: 1; }
.ask-input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.ask-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 20px;
}
.ask-heading { font-size: .98rem; font-weight: 700; line-height: 1.7; margin-bottom: 8px; }
.ask-heading:focus { outline: none; }
.ask-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px; /* touch target */
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  line-height: 1.6;
  text-align: start;
  cursor: pointer;
  transition: color .2s ease;
}
.ask-item::after {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-inline-end: 6px;
  border-top: 1.5px solid var(--ink-soft);
  border-right: 1.5px solid var(--ink-soft);
  transform: rotate(45deg);
}
html[dir="rtl"] .ask-item::after { transform: rotate(-135deg); }
.ask-item:focus-visible, .ask-item:active { color: var(--accent); }
.ask-item-body { flex: 1 1 auto; min-width: 0; }
.ask-item-topic { display: block; color: var(--ink-soft); font-size: .74rem; line-height: 1.5; }
.ask-answer { margin-top: 4px; font-size: .92rem; line-height: 1.95; }
.ask-answer p + p { margin-top: .7em; }
.ask-link { margin-top: 6px; font-size: .88rem; }
.ask-subheading { margin: 18px 0 10px; color: var(--ink-soft); font-size: .78rem; font-weight: 500; }
.ask-projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ask-project { display: block; color: var(--ink); text-decoration: none; font-size: .76rem; line-height: 1.5; }
.ask-project-media {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color .2s ease;
}
.ask-project-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ask-project-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
}
.ask-project:focus-visible .ask-project-media, .ask-project:active .ask-project-media { border-color: var(--accent); }
.ask-more { margin-top: 22px; padding-top: 4px; border-top: 1px solid var(--line); }
.ask-loading, .ask-none { color: var(--ink-soft); font-size: .9rem; margin-bottom: 14px; }
.ask-foot {
  padding: 2px 16px calc(2px + var(--sab));
  border-top: 1px solid var(--line);
  font-size: .82rem;
}
.ask-foot a { color: var(--ink-soft); }
html[dir="rtl"] .ask-panel, html[dir="rtl"] .ask-btn { letter-spacing: 0; }

/* ==== Responsive layouts (phase 4) ======================================================
   Desktop (>= 1025px) is the preview's layout above. Each block below only adjusts it; they are
   ordered so that later, narrower cases win: tablet, tablet landscape, mobile, landscape phone. */

/* Tablet, 641-1024px wide (iPad portrait, Android tablets): a taller gallery and three cards
   per row. The Project Info button joins the bar's flow so long names never run under it. */
@media (min-width: 641px) and (max-width: 1024px) {
  .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gal-panel .ov-bar h1 { flex: 1 1 auto; min-width: 0; }
  .project-info-btn { position: static; transform: none; flex-shrink: 0; }
  .gal-stage {
    --c-max: .66;
    --c-cap: .9;
    --s-w: .26;
    --s-cut: 20px;
    --s-h: .62;
    --x1: 11%;
    --x2: -16%;
    --x3: -45%;
    aspect-ratio: 1.45;
    min-height: 260px;
    max-height: calc(100vh - 330px);
    max-height: calc(100dvh - 330px - var(--sat) - var(--sab));
  }
}

/* Tablets held sideways (641-1024px landscape, and touch tablets wider than 1024px such as an
   iPad in landscape): the gallery fills the height that is left under the bar. */
@media (min-width: 641px) and (max-width: 1024px) and (orientation: landscape),
       (min-width: 1025px) and (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .gal-stage {
    --c-max: .56;
    --s-w: .28;
    --s-cut: 30px;
    --s-h: .66;
    --x1: 15%;
    --x2: -14%;
    --x3: -44%;
    aspect-ratio: 2.1;
    max-height: calc(100vh - 280px);
    max-height: calc(100dvh - 280px - var(--sat) - var(--sab));
  }
}

/* Mobile, up to 640px wide. */
@media (max-width: 640px) {
  :root {
    --mark-w: 128px;
    --mark-top: 16px;
    --spot-r: 130px;
    /* the menu starts under the logo and language switch */
    --header-h: calc(var(--mark-top) + var(--mark-h) + 52px);
  }
  .mark { padding: 11px; left: calc(16px + var(--sal)); }
  .corner-tools { left: calc(12px + var(--sal)); }
  .hero { padding-top: 16px; }
  .ov-bar { padding-block: 10px; gap: 10px; margin-bottom: 20px; }
  .ov-tools { gap: 6px; }
  .gal-panel .ov-bar { flex-wrap: wrap; row-gap: 10px; }
  .gal-panel .ov-bar h1 { order: 1; flex: 1 1 0; min-width: 0; }
  .gal-panel .ov-tools { order: 2; }
  .project-info-btn { position: static; transform: none; order: 3; flex: 0 0 100%; }
  .gal-stage {
    --c-max: .8;
    --c-cap: .92;
    --s-w: .3;
    --s-cut: 0px;
    --s-h: .6;
    --x1: 2%;
    --x2: -32%;
    --x3: -62%;
    aspect-ratio: 4 / 5;
    min-height: 220px;
    max-height: calc(100vh - 300px);
    max-height: calc(100dvh - 300px - var(--sat) - var(--sab));
  }
  .gal-controls { padding-top: 16px; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cat-project-name { padding: 10px 12px; font-size: .85rem; min-height: calc(2 * 1.5em + 20px); }
  .badge { margin: 0 12px 10px; }
  /* Certificates: three per row instead of one long row; an enlarged one takes the full width. */
  .cert-grid { flex-wrap: wrap; overflow-x: visible; }
  .cert-cell { flex: 0 0 calc((100% - 2 * clamp(10px, 1.6vw, 20px)) / 3); min-width: 0; }
  .cert-cell.enlarged { flex: 0 0 100%; order: -1; }
  .contact-social { grid-column: 1 / -1; } /* all icons in one line */
  /* "Ask the designer": a round icon button; the panel is a sheet from the bottom. */
  .ask-btn { right: calc(16px + var(--sar)); bottom: calc(16px + var(--sab)); width: 48px; height: 48px; padding: 0; }
  .ask-btn .ask-btn-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .ask-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 85vh;
    height: min(85dvh, calc(100dvh - 24px - var(--sat)));
    border: 0;
    border-radius: 14px 14px 0 0;
    opacity: 1;
    transform: translateY(100%);
    transition: transform .35s var(--ease-curtain);
  }
  .ask-head { min-height: 60px; }
  .ask-projects { gap: 8px; }
}
/* Narrow phones: on the home page the social row (up to six icons) reaches the corner; the
   button sits above it. Measured: the full row meets the button up to 411px. */
@media (max-width: 430px) {
  body:not(.has-view) .ask-btn.has-social { bottom: calc(60px + var(--sab)); }
}

/* Phones held sideways (height <= 500px): everything compact, the gallery takes the whole
   height left under a slim bar, its arrows sit on the photo's edges. */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --pad: 16px;
    --mark-w: 92px;
    --mark-top: 10px;
    --header-h: 56px;
    --spot-r: 120px;
  }
  .mark { padding: 8px; left: calc(14px + var(--sal)); }
  .corner-tools { left: calc(8px + var(--sal)); }
  .hero { padding-top: 8px; padding-bottom: calc(16px + var(--social-h, 0px) + var(--sab)); }
  .home.has-social { --social-h: 44px; }
  .home-social { bottom: var(--sab); }
  .hero-menu { gap: 8px; }
  .hero-menu > a, .hero-menu-toggle { font-size: clamp(1.15rem, 7dvh, 1.6rem); }
  .projects-dropdown-inner { padding-top: 10px; gap: 8px; }
  .project-card { padding: 8px 14px; min-width: 112px; }
  .ov-panel { padding-top: calc(6px + var(--sat)); }
  .ov-bar { padding-block: 6px; margin-bottom: 10px; }
  .ov-bar h1 { font-size: 1.1rem; }
  .gal-panel .ov-bar { flex-wrap: nowrap; }
  .gal-panel .ov-bar h1 { flex: 1 1 auto; min-width: 0; }
  .project-info-btn { position: static; transform: none; order: 0; flex: 0 0 auto; }
  .gal { --stage-h: max(180px, calc(100dvh - 100px - var(--sat) - var(--sab))); }
  .gal-stage {
    --c-max: .58;
    aspect-ratio: auto;
    height: calc(100vh - 100px);
    height: var(--stage-h);
    min-height: 0;
    max-height: none;
  }
  .gal-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    height: var(--stage-h);
    padding: 0;
    justify-content: space-between;
    pointer-events: none;
  }
  .gal-nav { pointer-events: auto; }
  .gal-counter { padding-top: 6px; }
  .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  html.js .gal-body:has(.info-curtain.open) { min-height: calc(100dvh - 76px - var(--sat)); }
  .info-curtain-inner { padding-block: 14px; }
  /* A round icon button, as on phones held upright: a label would sit on the photo. */
  .ask-btn { right: calc(12px + var(--sar)); bottom: calc(10px + var(--sab)); width: 44px; padding: 0; }
  .ask-btn .ask-btn-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .ask-panel {
    right: calc(12px + var(--sar));
    bottom: calc(10px + var(--sab));
    height: calc(100vh - 20px);
    height: calc(100dvh - 20px - var(--sat) - var(--sab));
  }
  .ask-head { min-height: 48px; }
  .ask-search { padding-block: 6px; }
}

/* Hover effects only where a pointer can hover: on touch screens a tap would leave them stuck.
   Every one has a :focus-visible and an :active (press) equivalent above. */
@media (hover: hover) {
  .lang-switch a:hover { color: var(--ink); }
  .hero-menu > a:hover, .hero-menu-toggle:hover { color: var(--accent); border-color: var(--line); }
  .project-card:hover { border-color: var(--accent); color: var(--accent); }
  .ov-close:hover { border-color: var(--accent); color: var(--accent); }
  .cat-project-card:hover { border-color: var(--accent); }
  .cert-item:hover { border-color: var(--accent); }
  .contact-fields dd a:hover { color: var(--accent); }
  .social-links a:hover { color: var(--accent); }
  .music-btn:hover { color: var(--accent); }
  .project-info-btn:hover { border-color: var(--accent); color: var(--accent); }
  .gal-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
  .button:hover { border-color: var(--accent); color: var(--accent); }
  .ask-btn:hover, .faq-topics a:hover, .ask-contact:hover { border-color: var(--accent); color: var(--accent); }
  .ask-icon-btn:hover, .ask-item:hover { color: var(--accent); }
  .faq-more a:hover, .home-faq a:hover, .contact-faq a:hover, .ask-link a:hover, .ask-foot a:hover { color: var(--accent); }
  .ask-project:hover .ask-project-media { border-color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .music-btn.is-playing .music-waves { animation: none; }
}
