:root {
  --bg: #fbf8f3;
  --bg-alt: #f2ece2;
  --surface: #ffffff;
  --text: #22302c;
  --muted: #5f6f6a;
  --primary: #2f6f62;
  --primary-hover: #245a4f;
  --primary-soft: #dcebe5;
  --accent: #c98a5b;
  --border: #e3dbcf;
  --danger: #b4443a;
  --success: #2f7a4a;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(34, 48, 44, 0.07);
  --on-primary: #ffffff;
  --header-bg: rgba(251, 248, 243, .92);
  --hero-bg: radial-gradient(ellipse at top left, var(--primary-soft), transparent 60%);
  --art-leaf: #7fb59f;
  --notice-bg: #fbefe5;
  --footer-bg: #1f3a34;
  --footer-text: #dfe9e5;
  --footer-strong: #ffffff;
  --input-bg: var(--bg);
  --btn-radius: 999px;
  --font: "Vazirmatn", Tahoma, sans-serif;
  --font-heading: var(--font);
  --heading-weight: 800;
  /* Accent tuned for small text: the theme accent pulled toward the text color (darker on light themes, lighter on dark). */
  --accent-text: color-mix(in srgb, var(--accent) 55%, var(--text));
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.9;
  font-size: 16px;
}

img { max-width: 100%; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.4; margin: 0 0 .5em; font-family: var(--font-heading); }
p { margin: 0 0 1em; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }

.skip-link {
  position: absolute; inset-inline-start: 16px; top: -60px;
  background: var(--primary); color: var(--on-primary); padding: 8px 16px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { top: 12px; }

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

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .7em 1.5em; border-radius: var(--btn-radius); border: 2px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s, box-shadow .2s, filter .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-sm { padding: .35em 1.1em; font-size: .95rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand strong { display: block; font-size: 1.25rem; font-weight: var(--heading-weight); line-height: 1.2; font-family: var(--font-heading); }
.brand small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.2; }

.site-nav { display: flex; align-items: center; gap: 24px; }
.site-nav a:not(.btn) { color: var(--text); text-decoration: none; font-weight: 500; }
.site-nav a:not(.btn):hover { color: var(--primary); }

.nav-toggle {
  display: none; background: none; border: 0; padding: 8px; cursor: pointer;
  flex-direction: column; gap: 5px;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px; display: none;
  }
  .site-nav.open { display: flex; }
  .site-nav a:not(.btn) { padding: 12px 4px; border-bottom: 1px solid var(--border); }
  .site-nav .btn { margin-top: 12px; }
}

/* ---------- Hero ---------- */

.hero { padding: 72px 0 56px; background: var(--hero-bg); }
.hero-inner { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 48px; }
.eyebrow { color: var(--accent-text); font-weight: 700; margin-bottom: .5em; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: var(--heading-weight); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 38em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.hero-art svg { width: 100%; max-width: 360px; display: block; margin-inline: auto; }
.logo { flex: none; }
.logo-bg { fill: var(--primary); }
.logo-heart { fill: var(--bg); }
.logo-leaf { fill: var(--art-leaf); }

.art-bg { fill: var(--primary-soft); }
.art-ring { fill: none; stroke: var(--primary); stroke-width: 2; stroke-dasharray: 4 10; opacity: .5; }
.art-heart { fill: var(--primary); }
.art-leaf { fill: var(--art-leaf); }

@media (max-width: 820px) {
  .hero { padding: 40px 0; }
  .hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .hero-art { order: -1; }
  .hero-art svg { max-width: 180px; }
}

/* ---------- Sections ---------- */

.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: var(--heading-weight); }
.section-head p { color: var(--muted); }

@media (max-width: 600px) { .section { padding: 48px 0; } }

.grid { display: grid; gap: 20px; }
.services { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.therapists { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.service-icon {
  width: 52px; height: 52px; border-radius: 14px; background: var(--primary-soft);
  display: grid; place-items: center; font-size: 1.6rem; margin-bottom: 12px;
}
.service p { color: var(--muted); margin: 0; }

/* ---------- Therapists ---------- */

.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 28px; }
.chip {
  font: inherit; font-size: .9rem; padding: .3em 1em; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.therapist { display: flex; flex-direction: column; }
.therapist-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.avatar {
  flex: none; width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 1.3rem;
  background: var(--primary-soft); color: var(--primary); object-fit: cover;
}
.therapist h3 { margin: 0; font-size: 1.1rem; }
.therapist .role { color: var(--accent-text); font-weight: 500; font-size: .95rem; }
.therapist .bio { color: var(--muted); font-size: .95rem; }
.therapist dl { margin: 0 0 16px; font-size: .88rem; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.therapist dt { color: var(--muted); }
.therapist dd { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; padding: 0; list-style: none; }
.tags li { font-size: .8rem; background: var(--bg-alt); border-radius: 999px; padding: .1em .8em; }
.therapist .btn { margin-top: auto; }

/* ---------- Steps ---------- */

.steps {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px;
}
.steps li { text-align: center; padding: 16px; }
.step-num {
  display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: 1.2rem; margin-bottom: 12px;
}
.steps p { color: var(--muted); }

/* ---------- Request form ---------- */

.request-wrap { display: grid; grid-template-columns: 1fr 1.2fr; gap: 40px; align-items: start; }
.request-intro h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); font-weight: var(--heading-weight); }
.request-intro > p { color: var(--muted); }

.notice {
  border-inline-start: 4px solid var(--accent); background: var(--notice-bg);
  padding: 14px 16px; border-radius: 10px; font-size: .95rem;
}
.notice strong { display: block; }

@media (max-width: 820px) { .request-wrap { grid-template-columns: 1fr; gap: 24px; } }

.field { margin: 0 0 18px; border: 0; padding: 0; }
.field label, .field legend { display: block; font-weight: 500; margin-bottom: 6px; padding: 0; }

input[type="text"], input[type="tel"], select, textarea {
  width: 100%; font: inherit; color: inherit;
  padding: .6em .9em; border: 1px solid var(--border); border-radius: 10px; background: var(--input-bg);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[dir="ltr"] { text-align: right; }
input[dir="ltr"]:placeholder-shown { direction: ltr; }
textarea { resize: vertical; }
/* Styles may make a select's own background transparent; keep its opened list solid and readable. */
select option { background-color: var(--bg); color: var(--text); }

.choices { display: flex; gap: 12px; flex-wrap: wrap; }
.choice { display: inline-flex !important; align-items: center; gap: 8px; font-weight: 400 !important; cursor: pointer; }
.choice input { accent-color: var(--primary); width: 18px; height: 18px; }
.consent { align-items: flex-start !important; }
.consent input { margin-top: 6px; flex: none; }

.field.invalid input, .field.invalid select { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .88rem; margin: 4px 0 0; min-height: 0; }
.field-error:empty { display: none; }

.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.form-status { margin: 14px 0 0; text-align: center; font-weight: 500; }
.form-status.success { color: var(--success); }
.form-status.error { color: var(--danger); }

.form-success { text-align: center; padding: 24px 8px; }
.form-success .check {
  width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 2rem; margin: 0 auto 16px;
}

/* ---------- Footer ---------- */

.site-footer { background: var(--footer-bg); color: var(--footer-text); padding: 48px 0 16px; }
.site-footer a { color: var(--footer-strong); }
.site-footer h3 { font-size: 1rem; color: var(--footer-strong); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 32px; }
.brand-footer { color: var(--footer-strong); margin-bottom: 8px; }
.plain { list-style: none; padding: 0; margin: 0; }
.copyright { border-top: 1px solid color-mix(in srgb, var(--footer-strong) 15%, transparent); margin-top: 32px; padding-top: 16px; font-size: .85rem; opacity: .75; }

/* ---------- Theme preview bar (only on ?theme= links) ---------- */

.theme-bar {
  position: fixed; bottom: 16px; inset-inline-start: 50%; transform: translateX(50%); z-index: 60;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 10px; white-space: nowrap;
  width: max-content; max-width: calc(100vw - 24px);
  background: #1d1d1f; color: #fff; padding: 8px 16px; border-radius: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); font: 500 .9rem/1.5 "Vazirmatn", Tahoma, sans-serif;
}
/* The bar is a fixed UI control: the #id keeps theme and design-style rules (which restyle every select) off it. */
#theme-bar select {
  width: auto; padding: .2em .6em; border-radius: 999px; border: 0;
  font: inherit; background: #fff; color: #1d1d1f; color-scheme: light;
  box-shadow: none; backdrop-filter: none;
}
#theme-bar select:focus { outline: 2px solid #fff; outline-offset: 2px; box-shadow: none; }
#theme-bar option { background: #fff; color: #1d1d1f; }
.theme-bar a { color: #fff; font-size: .85rem; }

/* ---------- Micro-interactions (all themes) ---------- */

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.card { transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease; }
.services .card:hover,
.therapists .card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px color-mix(in srgb, var(--primary) 16%, transparent); }
.service { border-top: 3px solid var(--primary-soft); }
.service:hover { border-top-color: var(--primary); }

/* The heart in the hero gently "breathes". */
.art-heart, .art-leaf { transform-box: fill-box; transform-origin: center; animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.05); } }

/* Sections fade in as they scroll into view (class added by app.js, so no-JS visitors see everything). */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .btn:hover, .card:hover { transform: none !important; }
}

/* Nastaliq has very tall ascenders/descenders; give its headings room to breathe. */
html[data-font="nastaliq"] .brand strong { line-height: 1.9; }
html[data-font="nastaliq"] h1,
html[data-font="nastaliq"] h2,
html[data-font="nastaliq"] h3 { line-height: 1.9; }
.theme-bar-group { display: inline-flex; align-items: center; gap: 6px; }
