/* ==========================================================================
   DahuaNet — base.css
   توکن‌های طراحی، فونت، ریست، تایپوگرافی، چیدمان پایه و حرکت.
   همه‌ی رنگ‌ها از لوگو آمده‌اند: سرمه‌ای لنز، آبی بدنه و آبی درخشان بازتاب.
   ========================================================================== */

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

/* زاویه و درصد قابل انیمیشن، برای حلقه‌ی دسته‌ها و حلقه‌ی مشخصات */
@property --dn-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --dn-p { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  /* --- رنگ‌های لوگو --- */
  --night: #090f28;       /* تاریکی داخل لنز */
  --night-2: #0f1a3d;
  --navy: #1a2a58;        /* واژه‌ی dahua */
  --blue-700: #194394;
  --blue: #1d46a2;        /* net و بدنه */
  --azure: #267ada;       /* درخشش لنز */
  --sky: #79a6eb;
  --sky-200: #c5d7ee;
  --ice: #e6f3fc;
  --slate: #4a597f;
  --slate-300: #7180aa;
  --amber: #f5a524;       /* فقط تخفیف و نقطه‌ی تأکید */

  /* --- نقش‌ها --- */
  --fg: var(--navy);
  --fg-muted: var(--slate);
  --fg-subtle: #5c6a93; /* slate-300 روی سفید ۳٫۹ است؛ متن ریز دست‌کم ۴٫۵ می‌خواهد */
  --bg: #ffffff;
  --bg-soft: #f5f9fe;
  --bg-tint: var(--ice);
  --line: #e2e9f4;
  --line-strong: var(--sky-200);
  --primary: var(--blue);
  --primary-strong: var(--blue-700);
  --primary-glow: var(--azure);
  --on-primary: #ffffff;
  --accent: var(--amber);
  --on-accent: var(--navy);

  --success: #087a51;
  --success-bg: #e5f6ee;
  --danger: #c8281c;
  --danger-bg: #fdecea;
  --warning: #9a4a05;
  --warning-bg: #fff3df;

  /* روی سطح تیره */
  --on-dark: #ffffff;
  --on-dark-muted: #a9bfe6;
  --dark-line: rgba(121, 166, 235, .18);
  --glass: rgba(255, 255, 255, .06);
  --glass-line: rgba(255, 255, 255, .14);

  --grad-brand: linear-gradient(135deg, var(--blue-700) 0%, var(--azure) 100%);
  --grad-night:
    radial-gradient(110% 90% at 88% 0%, rgba(29, 70, 162, .95) 0%, rgba(29, 70, 162, 0) 55%),
    radial-gradient(70% 70% at 0% 100%, rgba(38, 122, 218, .35) 0%, rgba(38, 122, 218, 0) 60%),
    var(--night);
  --grad-media: radial-gradient(circle at 50% 38%, #ffffff 0%, #f1f7fd 45%, var(--ice) 100%);

  /* --- تایپوگرافی --- */
  --font: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  --font-code: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-2xs: .6875rem;
  --fs-xs: .75rem;
  --fs-sm: .875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: clamp(1.2rem, 1.1rem + .5vw, 1.4rem);
  --fs-2xl: clamp(1.4rem, 1.2rem + 1vw, 1.85rem);
  --fs-3xl: clamp(1.7rem, 1.35rem + 1.8vw, 2.5rem);
  --fs-4xl: clamp(2.1rem, 1.5rem + 3vw, 3.6rem);

  /* --- شکل --- */
  --r-xs: 8px;
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 32px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(26, 42, 88, .06), 0 1px 1px rgba(26, 42, 88, .04);
  --sh-2: 0 14px 34px -14px rgba(26, 42, 88, .22), 0 2px 6px -2px rgba(26, 42, 88, .08);
  --sh-3: 0 28px 60px -24px rgba(25, 67, 148, .45);
  --sh-glow: 0 12px 28px -10px rgba(38, 122, 218, .65);

  /* --- حرکت --- */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur-1: .15s;
  --dur-2: .3s;
  --dur-3: .6s;

  /* --- چیدمان --- */
  --container: 1280px;
  --gutter: clamp(16px, 4vw, 32px);
  --section-y: clamp(48px, 7vw, 104px);

  color-scheme: light;
}

/* ---------- ریست ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.85;
  color: var(--fg);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--fg);
  font-weight: 800;
  line-height: 1.4;
  text-wrap: balance;
}
h1 { font-size: var(--fs-4xl); letter-spacing: -.01em; }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-xl); font-weight: 700; }
h4 { font-size: var(--fs-lg); font-weight: 700; }

p, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--azure);
  outline-offset: 3px;
  border-radius: 6px;
}
::selection { background: var(--sky-200); color: var(--navy); }

/* ---------- متن ---------- */
.prose { max-width: 70ch; color: var(--fg); line-height: 2; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: var(--fs-2xl); margin-top: 1.8em; }
.prose h3 { font-size: var(--fs-xl); margin-top: 1.5em; }
.prose a { color: var(--primary); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--sky-200); }
.prose a:hover { text-decoration-color: currentColor; }
.prose img { border-radius: var(--r); }
.prose ul, .prose ol { padding-inline-start: 1.4em; }

.text-muted { color: var(--fg-muted); }
.text-subtle { color: var(--fg-subtle); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.code { font-family: var(--font-code); font-size: .92em; letter-spacing: .01em; }
.num { font-variant-numeric: tabular-nums; }
.hl {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- چیدمان ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.container--narrow { max-width: 880px; }

.section { padding-block: var(--section-y); }
.section--soft { background: var(--bg-soft); }
.section--tight { padding-block: clamp(32px, 4vw, 56px); }

.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 12px); }
.grid {
  display: grid;
  gap: var(--gap, 24px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 240px)), 1fr));
}
.grid > *, .stack > *, .cluster > * { min-width: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  inset-inline-start: 16px;
  top: calc(12px + env(safe-area-inset-top, 0px));
  z-index: 200;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform var(--dur-2) var(--ease);
}
.skip-link:focus { transform: none; }

/* ---------- آیکن ---------- */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm { width: 1em; height: 1em; }
.icon--lg { width: 1.6em; height: 1.6em; }
.icon--flip { transform: scaleX(-1); }

/* ---------- ظهور هنگام اسکرول ----------
   بدون جاوااسکریپت همه‌چیز دیده می‌شود؛ کلاس js روی html فقط حالت شروع را پنهان می‌کند. */
.js [data-reveal]:not(.is-in) {
  opacity: 0;
  transform: translateY(28px);
}
.js [data-reveal="fade"]:not(.is-in) { transform: none; }
.js [data-reveal="zoom"]:not(.is-in) { transform: scale(.94); }
.js [data-reveal="start"]:not(.is-in) { transform: translateX(32px); }
[data-reveal] {
  transition:
    opacity var(--dur-3) var(--ease) calc(var(--i, 0) * 80ms),
    transform .8s var(--ease) calc(var(--i, 0) * 80ms);
}

@keyframes dn-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes dn-spin { to { transform: rotate(360deg); } }
@keyframes dn-spin-angle { to { --dn-angle: 360deg; } }
@keyframes dn-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes dn-shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
  .js [data-reveal]:not(.is-in) { opacity: 1; transform: none; }
}
