@font-face {
    font-family: Vazirmatn;
    src: url('/Vazirmatn-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --bg: #fff7fa;
    --surface: #fff;
    --raised: #fcf1f6;
    --tint: #f7e2ed;
    --border: #ecdae5;
    --text: #2c1927;
    --muted: #705464;
    --accent: #862650;
    --primary: #8e305a;
    --primary-hover: #702143;
    --focus: #a83872;
    --shadow: 0 12px 32px #6828470c;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #20151e;
    --surface: #2a1d28;
    --raised: #33232f;
    --tint: #3e2938;
    --border: #51364a;
    --text: #fceaf3;
    --muted: #d3b6c8;
    --accent: #ff9ac5;
    --primary: #a63a67;
    --primary-hover: #8f2e57;
    --focus: #ffaaD1;
    --shadow: 0 12px 32px #0003;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] {
        --bg: #20151e;
        --surface: #2a1d28;
        --raised: #33232f;
        --tint: #3e2938;
        --border: #51364a;
        --text: #fceaf3;
        --muted: #d3b6c8;
        --accent: #ff9ac5;
        --primary: #a63a67;
        --primary-hover: #8f2e57;
        --focus: #ffaaD1;
        --shadow: 0 12px 32px #0003;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 96px; scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.85 Vazirmatn, Tahoma, sans-serif;
    overflow-wrap: anywhere;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 3rem); line-height: 1.27; margin-bottom: 12px; }
h2 { font-size: 1.2rem; line-height: 1.5; margin-bottom: 10px; }
h3 { font-size: 1rem; margin-bottom: 4px; }
p { margin-bottom: 12px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: fixed; inset: 12px auto auto 12px; z-index: 30; padding: 10px; background: var(--surface); }

button, .button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 8px 17px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    cursor: pointer;
}
button:hover, .button:hover { background: var(--primary-hover); }
.secondary { background: var(--surface); color: var(--accent); border-color: var(--border); }
.secondary:hover { background: var(--tint); }
.text-link { color: var(--accent); font-weight: 700; }
a.text-link:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .88rem; }
.eyebrow { color: var(--accent); font-size: .86rem; font-weight: 750; }

.topbar {
    position: sticky;
    inset-block-start: 0;
    z-index: 10;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 69px;
    max-width: 1240px;
    margin-inline: auto;
    padding: 8px 24px;
}
.brand { color: var(--accent); font-size: 1.55rem; font-weight: 850; }
.header-brand { display: inline-flex; align-items: center; gap: 10px; }
.header-brand img { width: 45px; height: auto; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.customer-login { flex: none; white-space: nowrap; }
.theme-control { display: block; }
.theme-control select { min-height: 42px; }
.install-button { font-size: .82rem; white-space: nowrap; }

.app-frame {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 30px;
    align-items: start;
    max-width: 1240px;
    margin-inline: auto;
    padding: 26px 24px 20px;
}
.app-rail {
    position: sticky;
    top: 95px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    padding: 12px;
}
.main-nav { display: grid; gap: 4px; }
.main-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 13px;
    padding: 9px 10px;
    font-weight: 680;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--accent); background: var(--tint); }
.nav-icon { font-size: 1.4rem; line-height: 1; width: 26px; text-align: center; }
.rail-action { display: flex; margin-top: 12px; font-size: .85rem; }
main { min-width: 0; }
.page-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 40px;
    padding: 18px 4px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .85rem;
}

.discover-intro {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    overflow: hidden;
    border-radius: 28px;
    background: var(--tint);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.intro-copy { align-self: center; padding: clamp(20px, 3vw, 38px); }
.intro-copy h1 { max-width: 15ch; font-size: clamp(1.65rem, 3.5vw, 3.1rem); font-weight: 850; }
.intro-copy > p { color: var(--muted); }
.intro-photo { width: 100%; height: 100%; min-height: 320px; object-fit: cover; object-position: 56% center; }
.discover-login .intro-copy h1 { max-width: none; }
.salon-strip {
    display: flex;
    align-items: start;
    gap: 16px;
    margin-block-start: 20px;
    padding: 14px;
    overflow-x: auto;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.salon-strip a { display: grid; flex: 0 0 70px; gap: 6px; justify-items: center; text-align: center; }
.salon-strip .avatar-ring { width: 62px; height: 62px; font-size: 1.35rem; }
.strip-name { width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .76rem; }

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 27px 0 12px;
}
.section-heading h2 { margin-bottom: 0; }
.booking-filters {
    display: grid;
    align-items: end;
    gap: 12px;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.search { display: grid; gap: 12px; margin-top: 20px; }
.search-scope {
    display: flex;
    flex-wrap: wrap;
    width: fit-content;
    min-width: 0;
    gap: 4px;
    margin: 0;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}
.search-scope label { cursor: pointer; }
.search-scope span { display: block; padding: 6px 11px; border-radius: 9px; color: var(--muted); font-weight: 650; }
.search-scope input:checked + span { background: var(--tint); color: var(--accent); }
.search-scope input:focus-visible + span { outline: 2px solid var(--focus); }
.search-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface);
}
.search-bar:focus-within { border-color: var(--focus); }
.search-bar input { border-color: transparent; background: transparent; }
.search-tools { display: flex; flex-wrap: wrap; align-items: start; gap: 8px 14px; }
.search-tools > a { padding: 6px 0; }
.search-location summary { padding: 6px 10px; border-radius: 10px; background: var(--surface); color: var(--accent); cursor: pointer; font-weight: 650; }
.search-location[open] { flex-basis: 100%; }
.search-location[open] summary { width: fit-content; margin-bottom: 8px; }
.location-fields, .booking-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.location-fields label, .booking-filters label { display: block; color: var(--muted); font-size: .8rem; }
input, select, textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--raised);
    color: var(--text);
}
input::placeholder { color: var(--muted); }
.salon-grid, .grid, .slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.salon-card, .card, .profile, .post, .team-member {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 22px;
}
.salon-card, .profile, .post { overflow: hidden; }
.salon-identity { display: flex; align-items: center; gap: 12px; padding: 14px; }
.salon-identity h3, .salon-identity p { margin: 0; }
.salon-cover { display: block; overflow: hidden; aspect-ratio: 1.45; }
.salon-cover img, .profile-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder, .profile-cover-pattern {
    display: grid;
    height: 100%;
    place-items: center;
    background: linear-gradient(135deg, var(--tint), var(--raised));
    color: var(--accent);
    font-weight: 850;
}
.cover-placeholder { font-size: 3rem; }
.salon-card-body { display: grid; gap: 7px; padding: 12px 15px 16px; }
.salon-card-body p { margin: 0; }
.service-matches { display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 3px 0; list-style: none; }
.service-match { display: inline-block; padding: 5px 10px; border-radius: 10px; background: var(--tint); color: var(--accent); font-weight: 650; }
a.service-match:hover { text-decoration: underline; }
.directory-pagination { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.handle { width: fit-content; color: var(--muted); font-size: .82rem; }
.bio-excerpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.avatar-ring {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--accent);
    overflow: hidden;
    background: var(--tint);
    color: var(--accent);
    font-size: 2rem;
    font-weight: 800;
}
.avatar-ring img { width: 100%; height: 100%; object-fit: cover; }
.avatar-ring.small { width: 42px; height: 42px; font-size: 1.08rem; }
.empty { grid-column: 1 / -1; text-align: center; padding: 31px 16px; border: 1px dashed var(--border); background: var(--surface); border-radius: 22px; color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--accent); font-weight: 680; }

.profile-cover { height: clamp(150px, 27vw, 280px); background: var(--tint); }
.profile-main { display: flex; align-items: end; flex-wrap: wrap; gap: 17px; position: relative; margin-top: -33px; padding: 0 22px; }
.profile-info { padding-top: 40px; flex: 1; min-width: 130px; }
.profile-info h1 { margin: 0; font-size: 1.72rem; }
.profile-info p { margin: 4px 0; }
.profile-stats { display: flex; flex-wrap: wrap; column-gap: 14px; font-size: .78rem; color: var(--muted); }
.profile-stats strong { font-size: .92rem; color: var(--text); }
.profile-bio { padding: 14px 22px 9px; white-space: pre-line; }
.profile-tabs { display: flex; gap: 6px; overflow-x: auto; margin-top: 16px; padding: 6px; border-radius: 15px; border: 1px solid var(--border); background: var(--surface); }
.profile-tabs a { padding: 7px 13px; border-radius: 10px; color: var(--accent); white-space: nowrap; }
.profile-tabs a:hover { background: var(--tint); }
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.post { position: relative; margin: 0; align-self: start; }
.post img, .post video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--raised); }
.post figcaption { padding: 10px; font-size: .86rem; }
.media-label { position: absolute; inset: 8px 8px auto auto; padding: 3px 7px; border-radius: 10px; background: var(--surface); font-size: .71rem; pointer-events: none; }
.card { padding: 18px; min-width: 0; }
.card form { margin-top: 12px; }
.service-symbol { color: var(--accent); font-size: 1.35rem; }
.team-list { display: flex; flex-wrap: wrap; gap: 12px; }
.team-member { padding: 18px; min-width: 135px; text-align: center; }
.team-member .avatar-ring { margin: 0 auto 8px; }

.booking-layout { display: grid; grid-template-columns: minmax(245px, .82fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.calendar-heading { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.calendar-heading h2 { margin: 0; font-size: 1rem; }
.calendar-heading select { width: auto; font-size: .8rem; }
.calendar-days, .calendar-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; text-align: center; }
.calendar-week { font-size: .75rem; color: var(--muted); margin: 14px 0 8px; }
.calendar-days button { min-height: 36px; padding: 0; border-radius: 10px; color: var(--accent); background: var(--tint); }
.calendar-days button:disabled { color: var(--muted); background: transparent; opacity: .57; cursor: default; }
.calendar-days button[aria-pressed="true"] { color: white; background: var(--primary); }
.calendar-help { margin: 12px 0 0; }
.booking-filters { margin-bottom: 14px; padding: 12px; }
.slot-card time { color: var(--accent); font-weight: 730; }
.slot-card .button, .slot-card button { width: 100%; font-size: .85rem; }
.login { max-width: 460px; margin: 30px auto; box-shadow: var(--shadow); }
.login label { display: block; margin: 10px 0; }
.notice { padding: 12px 15px; border: 1px solid var(--border); border-radius: 14px; background: var(--tint); color: var(--text); }
.notice.error { color: var(--accent); }
.install-dialog {
    width: min(calc(100% - 32px), 430px);
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}
.install-dialog::backdrop { background: #26101fb0; }

@media (max-width: 860px) {
    .app-frame { display: block; padding-bottom: calc(78px + var(--safe-bottom)); }
    .app-rail {
        position: fixed;
        inset: auto 0 0;
        padding: 5px max(8px, env(safe-area-inset-right)) calc(6px + var(--safe-bottom)) max(8px, env(safe-area-inset-left));
        z-index: 12;
        border-radius: 17px 17px 0 0;
        border-bottom: 0;
    }
    .main-nav { display: flex; gap: 3px; }
    .main-nav a { flex: 1; flex-direction: column; gap: 3px; font-size: .74rem; line-height: 1.4; text-align: center; padding: 6px; }
    .rail-action { display: none; }
}
@media (max-width: 590px) {
    .topbar-inner { padding: 7px 12px; min-height: 61px; }
    .header-brand { gap: 5px; flex-shrink: 0; }
    .header-brand img { width: 29px; }
    .brand { font-size: 1.23rem; }
    .header-actions { justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
    .customer-login { font-size: .84rem; padding-inline: 10px; }
    .header-actions select, .install-button { font-size: .74rem; padding: 6px; }
    .install-button { min-height: 42px; }
    .app-frame { padding-inline: 12px; padding-top: 14px; }
    .discover-intro { border-radius: 22px; grid-template-columns: minmax(0, 1fr); }
    .intro-copy h1 { max-width: none; font-size: clamp(1.45rem, 6vw, 2.35rem); }
    .intro-photo { display: none; }
    .search-bar button { padding-inline: 11px; }
    .salon-grid, .grid, .booking-layout { grid-template-columns: 1fr; }
    .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile-main { padding-inline: 13px; gap: 12px; }
    .profile-main .avatar-ring { width: 70px; height: 70px; }
    .profile-main .button { width: 100%; }
    .profile-bio { padding-inline: 13px; }
    .slot-grid { gap: 8px; }
    .slot-grid .card { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
@media (pointer: coarse) {
    /* Keep field text legible to avoid Safari zooming on focus. */
    :is(
        input:not([type='button'], [type='submit'], [type='reset'], [type='image'], [type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file']),
        select,
        textarea,
        [contenteditable=''],
        [contenteditable='true'],
        [contenteditable='plaintext-only']
    ) {
        font-size: max(16px, 1em) !important;
    }
}
