/* =============================================================
   پورتال شهری — Design System
   Palette: warm cream paper, coral-rose brand, sun amber CTAs,
   mint teal for stats. Shared with the admin theme (admin-theme.css).
   Type: Vazirmatn + JetBrains Mono for numbers.
   Icons: Tabler Icons webfont (ti ti-*).
   ============================================================= */

:root {
  /* --- Brand (keep in sync with static/css/admin-theme.css) --- */
  --brand: #FF4D6D;
  --brand-deep: #E12D55;
  --brand-soft: #FFE4EA;
  --accent: #FFB020;
  --accent-deep: #E09200;
  --teal: #12B5A0;
  --teal-deep: #0D9488;
  --teal-soft: #E6FAF6;

  /* Legacy token names — mapped onto the new palette so block CSS stays valid */
  --ink: #8E1F38;
  --ink-soft: #6B4450;
  --ink-elevated: #C4455A;
  --turquoise: #FF4D6D;
  --turquoise-deep: #E12D55;
  --turquoise-tint: #FFE4EA;
  --amber: #FFB020;
  --amber-deep: #E09200;
  --mist: #FFF6EE;
  --surface: #FFFFFF;
  --border: #F3D9CE;
  --text: #2A1A16;
  --text-muted: #7A5C55;
  --text-on-ink: #FFF8F4;
  --text-on-ink-muted: rgba(255, 248, 244, 0.86);
  --danger: #E12D55;

  --sunset: linear-gradient(135deg, #FF4D6D 0%, #FF8A4C 52%, #FFC14A 100%);

  /* --- Type --- */
  --font-base: 'Vazirmatn', Tahoma, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  /* --- Spacing scale --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* --- Radii & shadow --- */
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shadow-sm: 0 2px 8px rgba(255, 77, 109, 0.08);
  --shadow-md: 0 10px 28px rgba(255, 77, 109, 0.14);
  --shadow-lg: 0 22px 48px rgba(225, 45, 85, 0.18);

  --container-max: 1180px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-base);
  color: var(--text);
  background: var(--mist);
  background-image:
    radial-gradient(circle at 8% 0%, rgba(255, 177, 32, 0.22), transparent 34%),
    radial-gradient(circle at 96% 4%, rgba(255, 77, 109, 0.14), transparent 30%);
  line-height: 1.75;
  font-size: 16px;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

.ti { font-size: 1.15em; line-height: 1; vertical-align: -0.12em; }

/* --- Accessibility floor --- */
.skip-link {
  position: absolute; inset-inline-start: -9999px; top: 0; z-index: 200;
  background: var(--amber); color: var(--text); padding: 12px 20px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 700;
}
.skip-link:focus { inset-inline-start: 12px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.font-mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* --- Layout helpers --- */
.container { max-width: var(--container-max); margin-inline: auto; padding-inline: var(--space-4); }
.block { padding-block: var(--space-8); }
.block__narrow { max-width: var(--container-max); }
.block--bg-mist { background: var(--mist); }
.block--bg-white { background: var(--surface); }
.block--bg-ink {
  background: var(--sunset);
  color: var(--text-on-ink);
}
.block--bg-ink .section-title, .block--bg-ink .hero__title, .block--bg-ink h1, .block--bg-ink h2 { color: var(--text-on-ink); }
.block--bg-ink .section-subtitle, .block--bg-ink p { color: var(--text-on-ink-muted); }

.section-title { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: var(--space-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-title .ti { color: var(--brand); font-size: 0.9em; }
.block--bg-ink .section-title .ti, .block__cta-copy .section-title .ti { color: var(--amber); }
.section-subtitle { color: var(--text-muted); font-size: 17px; margin-bottom: var(--space-6); }
.section-title:last-child, .section-subtitle:last-child { margin-bottom: 0; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 15px;
  border: 2px solid transparent; transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
}
.btn .ti { font-size: 18px; }
.btn--lg { padding: 15px 28px; font-size: 16px; }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(255, 77, 109, 0.28); }
.btn--primary:hover { background: var(--brand-deep); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn--accent { background: var(--amber); color: var(--text); box-shadow: 0 8px 18px rgba(255, 176, 32, 0.32); }
.btn--accent:hover { background: var(--accent-deep); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn--outline { background: transparent; border-color: var(--brand); color: var(--brand-deep); }
.btn--outline:hover { background: var(--brand-soft); }
.btn--outline-light { background: rgba(255,255,255,0.16); border-color: rgba(255,248,244,0.45); color: var(--text-on-ink); }
.btn--outline-light:hover { background: rgba(255,255,255,0.28); }

/* --- Tags / "district plate" system --- */
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;
  padding: 5px 12px; border-radius: 999px; background: var(--ink-soft); color: #fff;
}
.tag .ti { font-size: 15px; }
.tag--plate {
  background: var(--brand); color: #fff; border-radius: 999px; letter-spacing: 0.01em;
}
a.tag--plate:hover { background: var(--brand-deep); }
.badge-verified {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700;
  color: var(--teal-deep); background: var(--teal-soft); padding: 3px 10px; border-radius: 999px;
  vertical-align: middle;
}
.badge-verified .ti { font-size: 15px; color: var(--teal); }

/* =============================================================
   Cards + grids (blog posts, businesses) — used on list pages too
   ============================================================= */
.card-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-5); }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--surface); border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-6px) rotate(-0.2deg); box-shadow: var(--shadow-lg); }
.card__media-link { display: block; }
.card__media { position: relative; aspect-ratio: 16/10; background: var(--brand-soft); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.card:hover .card__media img { transform: scale(1.05); }
.card__media .tag-stack {
  position: absolute; top: var(--space-3); inset-inline-start: var(--space-3);
  display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 24px); z-index: 1;
}
.card__media .tag--plate { position: static; }
.tag-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-stack--header { margin-bottom: var(--space-3); justify-content: center; }
.card__body { padding: var(--space-5); flex: 1; display: flex; flex-direction: column; }
.card__title { font-size: 18px; font-weight: 800; line-height: 1.5; margin-bottom: var(--space-2); }
.card__title a:hover { color: var(--brand-deep); }
.card__excerpt { color: var(--text-muted); font-size: 14.5px; line-height: 1.7; flex: 1; margin-bottom: var(--space-3); }
.card__meta { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; color: var(--text-muted); }
.card__meta .ti { color: var(--brand); font-size: 16px; }
.card__meta-dot { opacity: 0.5; }

/* Gallery + map also used on business detail outside page-builder blocks */
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
@media (min-width: 640px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
.gallery-grid__item { border-radius: var(--radius-md); overflow: hidden; background: var(--mist); }
.gallery-grid__item img { aspect-ratio: 4/3; object-fit: cover; }
.gallery-grid__item figcaption { padding: var(--space-2) var(--space-3); font-size: 13px; color: var(--text-muted); background: var(--surface); }
.block__contact-map { border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4/3; }
.block__contact-map iframe { width: 100%; height: 100%; border: 0; }

/* =============================================================
   Page header (list pages)
   ============================================================= */
.page-header { padding-block: var(--space-8) var(--space-7); }
.page-header__title { font-size: clamp(28px, 4vw, 40px); font-weight: 900; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-header__title .ti { font-size: 0.85em; }
.page-header__subtitle { margin-top: var(--space-2); color: var(--text-on-ink-muted); font-size: 16px; }
.block--bg-white .page-header__subtitle { color: var(--text-muted); }

.search-form { display: flex; gap: var(--space-2); margin-top: var(--space-5); max-width: 520px; }
.search-form input {
  flex: 1; padding: 12px 16px; border-radius: 999px; border: none; font-size: 15px;
  background: #fff; color: var(--text); box-shadow: var(--shadow-sm);
}
.filter-bar { display: grid; grid-template-columns: 1fr; gap: var(--space-3); margin-bottom: var(--space-6); }
@media (min-width: 700px) { .filter-bar { grid-template-columns: 1.4fr 1fr 1fr auto; } }
.filter-bar input, .filter-bar select {
  padding: 11px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 14.5px;
}

/* =============================================================
   Blog list layout (sidebar)
   ============================================================= */
.blog-layout { display: grid; grid-template-columns: 1fr; gap: var(--space-7); align-items: start; padding-block: var(--space-7); }
@media (min-width: 900px) { .blog-layout { grid-template-columns: 2.4fr 1fr; } }
.sidebar-widget { background: var(--mist); border-radius: var(--radius-md); padding: var(--space-5); border: 1px solid var(--border); }
.sidebar-widget__title { font-size: 15px; font-weight: 800; margin-bottom: var(--space-3); display: flex; align-items: center; gap: 8px; }
.sidebar-widget__title .ti { color: var(--brand); }
.sidebar-widget__list li a { display: block; padding-block: 8px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 14.5px; }
.sidebar-widget__list li:last-child a { border-bottom: none; }
.sidebar-widget__list li a:hover, .sidebar-widget__list li a.is-active { color: var(--brand-deep); font-weight: 700; }
.empty-state { color: var(--text-muted); padding-block: var(--space-6); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state .ti { font-size: 36px; color: var(--brand); }

/* =============================================================
   Breadcrumbs & pagination
   ============================================================= */
.breadcrumbs { margin-bottom: var(--space-4); font-size: 13.5px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs li { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.breadcrumbs li:not(:last-child)::after { content: "/"; opacity: 0.5; margin-inline-start: 6px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--brand); }
.block--bg-ink .breadcrumbs li, .block--bg-ink .breadcrumbs a { color: var(--text-on-ink-muted); }

.pagination { display: flex; align-items: center; justify-content: center; gap: var(--space-4); margin-top: var(--space-7); }
.pagination__link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 999px; background: var(--mist); font-weight: 700; font-size: 14px;
}
.pagination__link:hover { background: var(--brand-soft); color: var(--brand-deep); }
.pagination__current { font-family: var(--font-mono); font-size: 13.5px; color: var(--text-muted); }

/* =============================================================
   Blog post detail
   ============================================================= */
.post-header { padding-block: var(--space-7); text-align: center; }
.post-header .tag--plate { margin-bottom: var(--space-3); }
.post-header__title { font-size: clamp(26px, 4.5vw, 42px); font-weight: 900; line-height: 1.35; margin-block: var(--space-3); }
.post-header__meta { display: flex; align-items: center; justify-content: center; gap: var(--space-2); color: var(--text-muted); font-size: 14px; flex-wrap: wrap; }
.post-header__meta .ti { color: var(--brand); }
.post-featured-image { margin-block: var(--space-7); }
.post-featured-image img { border-radius: var(--radius-lg); width: 100%; }
.post-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.lede { font-size: 19px; color: var(--text-muted); line-height: 1.8; }

/* =============================================================
   Business detail
   ============================================================= */
.business-header { padding-block: var(--space-7); background-size: cover; background-position: center; position: relative; }
.business-header--with-cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,77,109,0.45), rgba(142,31,56,0.88)); }
.business-header__inner { position: relative; z-index: 1; }
.business-header__row { display: flex; align-items: center; gap: var(--space-4); margin-block: var(--space-3) var(--space-5); flex-wrap: wrap; }
.business-header__logo { width: 76px; height: 76px; border-radius: var(--radius-md); object-fit: cover; background: #fff; border: 3px solid rgba(255,255,255,0.35); }
.business-header__title { font-size: clamp(24px, 4vw, 34px); font-weight: 900; margin-top: var(--space-2); display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.business-header__district { color: var(--text-on-ink-muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.business-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.business-info-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-5); }
@media (min-width: 700px) { .business-info-grid { grid-template-columns: 1fr 1fr; } }
.business-info-card { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-5); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.business-info-card__title { font-size: 15px; font-weight: 800; margin-bottom: var(--space-2); display: flex; align-items: center; gap: 8px; }
.business-info-card__title .ti { color: var(--brand); }

.content-section .prose { margin-top: var(--space-4); }
.content-section__media { margin-top: var(--space-5); border-radius: var(--radius-lg); overflow: hidden; }
.content-section__media img { width: 100%; max-height: 520px; object-fit: cover; }
.content-section__media figcaption,
.content-section__caption { padding-top: var(--space-3); font-size: 14px; color: var(--text-muted); }
.video-embed { position: relative; padding-top: 56.25%; border-radius: var(--radius-lg); overflow: hidden; background: #000; margin-top: var(--space-5); }
.video-embed iframe,
.video-embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-embed video { object-fit: contain; background: #000; }

/* =============================================================
   Error pages
   ============================================================= */
.error-page { text-align: center; padding-block: var(--space-9); }
.error-page__icon { font-size: 56px !important; color: var(--brand); display: block; margin-bottom: var(--space-3); }
.error-page__code { font-family: var(--font-mono); font-size: 72px; font-weight: 700; color: var(--brand); margin-bottom: var(--space-2); }
.error-page__title { font-size: 26px; font-weight: 800; margin-bottom: var(--space-3); }
.error-page__text { color: var(--text-muted); margin-bottom: var(--space-6); }
