﻿/* Didehgaah Optic — public site design system.
   Persian-first, RTL-first, mobile-first. Presentation layer only. */

:root {
  --ink: #12232e;
  --ink-soft: #3c5261;
  --muted: #6b7f8c;
  --brand: #1b3a75;
  --brand-dark: #142c5c;
  --brand-soft: #e8f1fb;
  --accent: #22a6dd;
  --bg: #f6f9f9;
  --surface: #ffffff;
  --border: #dde7e9;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(16, 42, 53, .08), 0 8px 28px rgba(16, 42, 53, .07);
  --shadow-lg: 0 12px 44px rgba(16, 42, 53, .14);
  --maxw: 1140px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font, "Vazirmatn", "Tahoma", system-ui, sans-serif);
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  line-height: 1.7;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--brand); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  top: -100%;
  right: 1rem;
  background: var(--ink);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus { top: .5rem; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.15rem;
}
.brand svg { width: 34px; height: 34px; }
.brand small { display:block; font-size:.68rem; font-weight:400; color:var(--muted); letter-spacing:.04em; }

.site-nav ul {
  display: flex;
  gap: .2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}
.site-nav a {
  display: block;
  padding: .55rem .85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .95rem;
}
.site-nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.site-nav a[aria-current="page"] { color: var(--brand-dark); background: var(--brand-soft); }

.nav-cta { display: inline-flex; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .7rem;
  cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; stroke: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .8rem 1.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  min-height: 48px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--brand-dark); box-shadow: var(--shadow-lg); }
.btn-ghost { border-color: var(--brand); color: var(--brand-dark); background: transparent; }
.btn-ghost:hover { background: var(--brand-soft); }
.btn svg { width: 20px; height: 20px; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(60rem 30rem at 85% -10%, rgba(27,58,117,.12), transparent 60%),
    linear-gradient(180deg, #fdfefe, var(--bg));
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) 1rem clamp(2rem, 6vw, 4rem);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}
.hero h1 {
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  line-height: 1.35;
  margin: 0 0 .8rem;
  color: var(--ink);
}
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p.lead { font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: var(--ink-soft); margin: 0 0 1.6rem; max-width: 34rem; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.hero-figure { display: flex; justify-content: center; }
.hero-figure svg { width: min(100%, 430px); height: auto; }

.hero-badges {
  display: flex; gap: 1.4rem; margin-top: 1.8rem; flex-wrap: wrap;
}
.hero-badges div { display: flex; align-items: center; gap: .45rem; color: var(--ink-soft); font-size: .92rem; }
.hero-badges svg { width: 20px; height: 20px; stroke: var(--brand); }

/* ---------- sections ---------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(2.2rem,6vw,4rem) 1rem; }
.section-head { margin-bottom: 2rem; }
.section-head .kicker { color: var(--accent); font-weight: 700; font-size: .85rem; letter-spacing: .06em; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: .2rem 0 .4rem; }
.section-head p { color: var(--ink-soft); max-width: 40rem; margin: 0; }

/* ---------- cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .9rem;
}
.card .icon svg { width: 26px; height: 26px; }
.card h3 { margin: 0 0 .35rem; font-size: 1.08rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------- steps ---------- */
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(3,1fr); gap: 1.1rem; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; position: relative; }
.step::before {
  counter-increment: step; content: counter(step, persian);
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800; margin-bottom: .6rem;
}
.step h3 { margin: 0 0 .3rem; font-size: 1.02rem; }
.step p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- CTA band ---------- */
.cta-band {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(1.8rem, 4vw, 2.6rem);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.4rem; flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { margin: 0 0 .3rem; font-size: 1.5rem; }
.cta-band p { margin: 0; opacity: .85; }
.cta-band .btn { background: #fff; color: var(--brand-dark); }
.cta-band .btn:hover { background: var(--brand-soft); }

/* ---------- page hero (inner pages) ---------- */
.page-hero { background: linear-gradient(180deg,#fff,var(--bg)); border-bottom: 1px solid var(--border); }
.page-hero-inner { max-width: var(--maxw); margin: 0 auto; padding: clamp(2rem,5vw,3.4rem) 1rem; }
.page-hero h1 { font-size: clamp(1.7rem,3.6vw,2.4rem); margin: 0 0 .5rem; }
.page-hero p { color: var(--ink-soft); margin: 0; max-width: 44rem; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: .8rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }

/* ---------- split layout ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.split .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }
.split .panel h2 { margin-top: 0; }

ul.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
ul.check-list li { display: flex; gap: .6rem; align-items: flex-start; color: var(--ink-soft); }
ul.check-list svg { width: 20px; height: 20px; stroke: var(--brand); flex-shrink: 0; margin-top: .2rem; }

/* ---------- FAQ ---------- */
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .7rem; overflow: hidden; }
.faq-item summary {
  padding: 1rem 1.2rem; font-weight: 700; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; width: 10px; height: 10px; flex-shrink: 0;
  border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand);
  transform: rotate(45deg); transition: transform .15s;
}
.faq-item[open] summary::after { transform: rotate(-135deg); }
.faq-item .faq-body { padding: 0 1.2rem 1rem; color: var(--ink-soft); }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1.1rem; }
.contact-item { display: flex; gap: .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.contact-item svg { width: 26px; height: 26px; stroke: var(--brand); flex-shrink: 0; }
.contact-item strong { display: block; margin-bottom: .15rem; }
.contact-item span { color: var(--muted); font-size: .95rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: #fff; margin-top: 2rem; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1rem; display: flex; justify-content: space-between; gap: 1.4rem; flex-wrap: wrap; color: var(--muted); font-size: .92rem; }
.footer-inner a { color: var(--muted); }
.footer-nav { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- offline / error ---------- */
.offline-hero { min-height: 70vh; display: flex; align-items: center; }
.offline-card { max-width: 34rem; margin: 0 auto; text-align: center; padding: 2rem; }
.offline-card svg { width: 72px; height: 72px; margin: 0 auto 1rem; stroke: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-figure { order: -1; }
  .hero-figure svg { width: min(72%, 300px); }
  .card-grid, .steps { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .site-nav { display: none; position: absolute; inset-inline: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; padding: .6rem; }
  .site-nav a { padding: .8rem 1rem; }
  .nav-cta { display: none; }
  .card-grid, .steps { grid-template-columns: 1fr; }
  .cta-band { flex-direction: column; align-items: flex-start; }
  .header-inner { padding: .6rem .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- dark theme (manual toggle; OS preference respected too) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8eef4; --ink-soft: #b8c8d4; --muted: #8fa3b1;
    --bg: #0e1a24; --surface: #16242f; --border: #2a3d4a;
    --brand-soft: #1d3550;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35);
    --shadow-lg: 0 12px 44px rgba(0,0,0,.5);
  }
}
[data-theme="dark"] {
  --ink: #e8eef4; --ink-soft: #b8c8d4; --muted: #8fa3b1;
  --bg: #0e1a24; --surface: #16242f; --border: #2a3d4a;
  --brand-soft: #1d3550;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 44px rgba(0,0,0,.5);
}
[data-theme="dark"] .site-header { background: rgba(14,26,36,.92); }
[data-theme="dark"] .site-footer { background: #16242f; }
[data-theme="dark"] .cta-band .btn { color: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header { background: rgba(14,26,36,.92); }
  :root:not([data-theme="light"]) .site-footer { background: #16242f; }
}

/* ---------- scroll reveal (JS adds .revealed; no-JS still shows content) ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .45s ease, transform .45s ease; }
.reveal.revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .cta-band, .hero-actions, .nav-toggle, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .panel { box-shadow: none; border: 1px solid #ccc; }
}

/* ---------- theme toggle button ---------- */
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  padding: .45rem .6rem; cursor: pointer; display: inline-flex; align-items: center;
}
.theme-toggle svg { width: 18px; height: 18px; stroke: var(--ink); }
