/* CheckOn Base — چک‌آن · Masterpiece */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  direction: rtl;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  font-weight: var(--font-weight-regular);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Subtle film grain — premium dark feel */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}
[data-theme="light"] body::before { opacity: 0.02; }

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary-hover);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--color-teal); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
}
ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-bold);
  color: var(--text);
  letter-spacing: var(--letter-tight);
}
h1 {
  font-size: var(--font-size-hero);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: var(--letter-display);
  line-height: var(--line-height-tight);
}
h2 { font-size: clamp(1.55rem, 3.2vw, var(--font-size-3xl)); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
p { color: var(--text-secondary); }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
::selection {
  background: rgba(90, 103, 216, 0.4);
  color: var(--text);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.container--wide { max-width: var(--container-wide); }

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

.skip-link {
  position: absolute;
  top: -100px;
  right: var(--space-4);
  z-index: 9999;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-semibold);
}
.skip-link:focus { top: var(--space-4); }

/* Utilities */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--color-primary-hover); }
.text-teal { color: var(--color-teal); }
.fw-medium { font-weight: var(--font-weight-medium); }
.fw-semibold { font-weight: var(--font-weight-semibold); }
.fw-bold { font-weight: var(--font-weight-bold); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-7 { margin-top: var(--space-7); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-7 { margin-bottom: var(--space-7); }

.section { padding-block: var(--space-8); }
.section--sm { padding-block: var(--space-7); }
.section--tight { padding-block: var(--space-6); }

.section-header {
  max-width: 680px;
  margin-inline: auto;
  margin-bottom: var(--space-7);
  text-align: center;
}
.section-header .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-teal);
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid rgba(45, 212, 191, 0.22);
  border-radius: var(--radius-full);
}
.section-header p {
  margin-top: var(--space-3);
  font-size: var(--font-size-lg);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section { padding-block: var(--space-7); }
}

.page-main {
  padding-top: var(--nav-height);
  min-height: 60vh;
}

.page-hero {
  padding-block: var(--space-8) var(--space-7);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: -30% 10% auto;
  height: 380px;
  background:
    radial-gradient(ellipse at 50% 0%, var(--aurora-1), transparent 60%),
    radial-gradient(ellipse at 80% 40%, var(--aurora-2), transparent 55%);
  pointer-events: none;
  z-index: 0;
  filter: blur(2px);
}
.page-hero .container { position: relative; z-index: 1; }
.page-hero h1 { margin-bottom: var(--space-4); }
.page-hero .lead {
  max-width: 640px;
  margin-inline: auto;
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
}

.prose { max-width: 720px; margin-inline: auto; }
.prose h2 { margin-top: var(--space-6); margin-bottom: var(--space-3); }
.prose h3 { margin-top: var(--space-5); margin-bottom: var(--space-2); }
.prose p, .prose li {
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}
.prose ul, .prose ol {
  padding-right: var(--space-5);
  margin-bottom: var(--space-4);
}
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Accent text gradient */
.accent,
.text-gradient {
  background: linear-gradient(125deg, var(--color-primary-hover) 10%, var(--color-teal) 55%, var(--color-violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Safe areas */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --bottom-nav-height: 68px;
  --tap-min: 44px;
}

@media (max-width: 900px) {
  .container {
    padding-inline: max(var(--space-4), var(--safe-left), var(--safe-right));
  }
  .page-main {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + var(--space-5));
  }
  .site-footer {
    margin-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding-bottom: var(--space-7);
  }
  h1 { font-size: clamp(1.85rem, 7.5vw, 2.5rem); }
  h2 { font-size: clamp(1.4rem, 5.5vw, 1.8rem); }
  .section { padding-block: var(--space-6); }
  .section-header { margin-bottom: var(--space-5); }
  .section-header p { font-size: var(--font-size-base); }
  .btn { min-height: var(--tap-min); padding-inline: 1.1rem; }
  .btn--lg { min-height: 52px; }
  .btn--sm { min-height: 40px; }
  .icon-btn { width: var(--tap-min); height: var(--tap-min); }
  .input, .select, .textarea {
    min-height: var(--tap-min);
    font-size: 16px;
  }
  .textarea { min-height: 120px; }
  .card { border-radius: var(--radius-lg); padding: var(--space-4); }
  .page-hero {
    padding-block: var(--space-6) var(--space-5);
    text-align: right;
  }
  .page-hero .lead { margin-inline: 0; text-align: right; }
  .cta-band {
    padding: var(--space-5);
    border-radius: var(--radius-lg);
  }
  .btn-group { gap: var(--space-2); }
  .btn-group .btn { flex: 1 1 auto; }
}

/* Reveal on scroll (optional via JS) */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
