/* ============================================================
   HomeX — Design System (Awwwards-grade)
   RTL, fluid type, full responsive, glassmorphism, motion.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Brand */
  --hx-primary: #10b981;
  --hx-primary-600: #059669;
  --hx-primary-400: #34d399;
  --hx-accent: #38bdf8;
  --hx-amber: #f59e0b;
  --hx-rose: #fb7185;
  --hx-violet: #a78bfa;

  /* Surfaces (dark = default) */
  --hx-bg: #0a0a0f;
  --hx-bg-1: #0d0d14;
  --hx-bg-2: #13131c;
  --hx-surface: rgba(255, 255, 255, 0.04);
  --hx-surface-2: rgba(255, 255, 255, 0.07);
  --hx-border: rgba(255, 255, 255, 0.08);
  --hx-border-strong: rgba(255, 255, 255, 0.16);

  /* Text */
  --hx-text: #f3f4f6;
  --hx-text-muted: #9ca3af;
  --hx-text-dim: #6b7280;

  /* States */
  --hx-success: #22c55e;
  --hx-danger: #ef4444;
  --hx-warning: #f59e0b;
  --hx-info: #38bdf8;

  /* Effects */
  --hx-radius-sm: 10px;
  --hx-radius: 16px;
  --hx-radius-lg: 22px;
  --hx-radius-xl: 28px;
  --hx-radius-pill: 999px;

  --hx-shadow-sm: 0 2px 8px rgba(0, 0, 0, .25);
  --hx-shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --hx-shadow-lg: 0 20px 60px rgba(0, 0, 0, .45);
  --hx-glow: 0 0 30px rgba(16, 185, 129, .35);

  /* Motion */
  --hx-ease: cubic-bezier(.22, .61, .36, 1);
  --hx-dur: 220ms;

  /* Layout */
  --hx-header-h: 64px;
  --hx-tabs-h: 52px;
  --hx-safe-top: env(safe-area-inset-top, 0px);
  --hx-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light theme tokens — toggled via [data-theme="light"] on <html> */
html[data-theme="light"] {
  --hx-bg: #f6f7f9;
  --hx-bg-1: #ffffff;
  --hx-bg-2: #f1f5f9;
  --hx-surface: rgba(15, 23, 42, 0.04);
  --hx-surface-2: rgba(15, 23, 42, 0.07);
  --hx-border: rgba(15, 23, 42, 0.08);
  --hx-border-strong: rgba(15, 23, 42, 0.16);
  --hx-text: #0f172a;
  --hx-text-muted: #475569;
  --hx-text-dim: #94a3b8;
  --hx-shadow: 0 8px 30px rgba(15, 23, 42, .08);
  --hx-shadow-lg: 0 20px 60px rgba(15, 23, 42, .12);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Vazirmatn', 'IRANSans', 'Tahoma', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--hx-bg);
  color: var(--hx-text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  transition: background-color var(--hx-dur) var(--hx-ease), color var(--hx-dur) var(--hx-ease);
}

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

button {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

input,
button,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

/* RTL/LTR helpers */
[dir="rtl"] .flip-x {
  transform: scaleX(-1);
}

/* ---------- Ambient background ---------- */
.hx-aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.hx-aurora::before,
.hx-aurora::after {
  content: "";
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .35;
  mix-blend-mode: screen;
  animation: hx-float 22s ease-in-out infinite;
}

.hx-aurora::before {
  background: radial-gradient(circle, var(--hx-primary) 0%, transparent 60%);
  top: -20vmax;
  right: -15vmax;
}

.hx-aurora::after {
  background: radial-gradient(circle, var(--hx-accent) 0%, transparent 60%);
  bottom: -25vmax;
  left: -20vmax;
  animation-delay: -8s;
}

@keyframes hx-float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(8vmax, -6vmax) scale(1.1);
  }
}

.hx-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .25;
  background-image:
    linear-gradient(var(--hx-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--hx-border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* ---------- Container ---------- */
.hx-container {
  width: min(1200px, 100% - 2.5rem);
  margin-inline: auto;
}

.hx-container-wide {
  width: min(1400px, 100% - 2.5rem);
  margin-inline: auto;
}

/* ---------- Glass ---------- */
.hx-glass {
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-radius);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.hx-glass-strong {
  background: var(--hx-surface-2);
  border: 1px solid var(--hx-border-strong);
  border-radius: var(--hx-radius);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
}

/* ---------- Buttons ---------- */
.hx-btn {
  --b-bg: var(--hx-surface);
  --b-fg: var(--hx-text);
  --b-bd: var(--hx-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: .75rem 1.25rem;
  min-height: 44px;
  border-radius: var(--hx-radius-pill);
  background: var(--b-bg);
  color: var(--b-fg);
  border: 1px solid var(--b-bd);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: transform var(--hx-dur) var(--hx-ease), background var(--hx-dur) var(--hx-ease), box-shadow var(--hx-dur) var(--hx-ease), border-color var(--hx-dur) var(--hx-ease);
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.hx-btn:hover {
  transform: translateY(-1px);
  border-color: var(--hx-border-strong);
}

.hx-btn:active {
  transform: translateY(0) scale(.98);
}

.hx-btn:focus-visible {
  outline: 2px solid var(--hx-primary);
  outline-offset: 3px;
}

.hx-btn[disabled] {
  opacity: .55;
  pointer-events: none;
}

.hx-btn-primary {
  --b-bg: linear-gradient(135deg, var(--hx-primary), var(--hx-primary-600));
  --b-fg: #062017;
  --b-bd: transparent;
  box-shadow: var(--hx-glow);
}

.hx-btn-primary:hover {
  box-shadow: 0 0 40px rgba(16, 185, 129, .55);
}

.hx-btn-ghost {
  --b-bg: transparent;
  --b-bd: transparent;
}

.hx-btn-ghost:hover {
  --b-bg: var(--hx-surface);
}

.hx-btn-danger {
  --b-bg: linear-gradient(135deg, #ef4444, #b91c1c);
  --b-fg: #fff;
  --b-bd: transparent;
}

.hx-btn-sm {
  padding: .5rem .9rem;
  min-height: 36px;
  font-size: .85rem;
}

.hx-btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  min-height: 0;
}

.hx-btn-icon.hx-btn-sm {
  width: 36px;
  height: 36px;
}

/* ---------- Inputs ---------- */
.hx-field {
  position: relative;
}

.hx-input {
  width: 100%;
  padding: 1rem 1.1rem .9rem;
  border-radius: var(--hx-radius);
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  color: var(--hx-text);
  outline: none;
  transition: border-color var(--hx-dur) var(--hx-ease), background var(--hx-dur) var(--hx-ease), box-shadow var(--hx-dur) var(--hx-ease);
  min-height: 48px;
}

.hx-input::placeholder {
  color: var(--hx-text-dim);
}

.hx-input:focus {
  border-color: var(--hx-primary);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .18);
}

.hx-input[dir="ltr"],
.hx-input.ltr {
  direction: ltr;
  text-align: left;
}

.hx-label {
  display: block;
  font-size: .85rem;
  color: var(--hx-text-muted);
  margin-bottom: .4rem;
  font-weight: 500;
}

/* ---------- Cards ---------- */
.hx-card {
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-radius);
  padding: 1.25rem;
  transition: transform var(--hx-dur) var(--hx-ease), background var(--hx-dur) var(--hx-ease), border-color var(--hx-dur) var(--hx-ease);
}

.hx-card:hover {
  background: var(--hx-surface-2);
  border-color: var(--hx-border-strong);
}

/* ---------- Pills / chips ---------- */
.hx-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .75rem;
  border-radius: var(--hx-radius-pill);
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  font-size: .8rem;
  color: var(--hx-text-muted);
  font-weight: 500;
}

.hx-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hx-text-dim);
}

.hx-pill.is-on .dot {
  background: var(--hx-success);
  box-shadow: 0 0 12px var(--hx-success);
}

.hx-pill.is-warn .dot {
  background: var(--hx-warning);
}

.hx-pill.is-off .dot {
  background: var(--hx-danger);
}

/* ---------- Section / type ---------- */
.hx-section {
  padding: clamp(3rem, 8vw, 6rem) 0;
}

.hx-h1 {
  font-size: clamp(2rem, 5.5vw, 4rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 1rem;
}

.hx-h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0 0 .75rem;
}

.hx-h3 {
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 .5rem;
}

.hx-lead {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--hx-text-muted);
  line-height: 1.8;
}

.hx-muted {
  color: var(--hx-text-muted);
}

.hx-dim {
  color: var(--hx-text-dim);
}

.hx-grad {
  background: linear-gradient(135deg, var(--hx-primary) 0%, var(--hx-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hx-mono {
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* ---------- Reveal on scroll ---------- */
.hx-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .8s var(--hx-ease), transform .8s var(--hx-ease);
}

.hx-reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- Toast ---------- */
.hx-toast-root {
  position: fixed;
  bottom: calc(20px + var(--hx-safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.hx-toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: min(92vw, 420px);
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--hx-surface-2);
  border: 1px solid var(--hx-border-strong);
  color: var(--hx-text);
  backdrop-filter: blur(20px);
  box-shadow: var(--hx-shadow);
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: hx-toast-in .3s var(--hx-ease);
}

.hx-toast.success {
  border-color: rgba(34, 197, 94, .4);
}

.hx-toast.error {
  border-color: rgba(239, 68, 68, .4);
}

.hx-toast.info {
  border-color: rgba(56, 189, 248, .4);
}

@keyframes hx-toast-in {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

.hx-toast .icon {
  font-size: 1.1rem;
}

/* ---------- Utility ---------- */
.hx-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hx-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hx-between {
  justify-content: space-between;
}

.hx-grow {
  flex: 1;
}

.hx-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hx-text-center {
  text-align: center;
}

.hx-gap-1 {
  gap: .5rem;
}

.hx-gap-2 {
  gap: 1rem;
}

.hx-gap-3 {
  gap: 1.5rem;
}

.hx-hidden {
  display: none !important;
}

/* ---------- Skeleton ---------- */
@keyframes hx-shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.hx-skel {
  background: linear-gradient(90deg, var(--hx-surface) 0%, var(--hx-surface-2) 50%, var(--hx-surface) 100%);
  background-size: 200% 100%;
  animation: hx-shimmer 1.6s linear infinite;
  border-radius: var(--hx-radius-sm);
}

/* ---------- Spinner ---------- */
@keyframes hx-spin {
  to {
    transform: rotate(360deg);
  }
}

.hx-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: hx-spin .8s linear infinite;
  display: inline-block;
}

/* ---------- Focus ring shared ---------- */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--hx-primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }

  .hx-reveal {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 980px) {
  .hx-toast-root {
    bottom: calc(96px + var(--hx-safe-bottom));
  }
}

@media (max-width: 720px) {

  .hx-container,
  .hx-container-wide {
    width: min(100% - 1.25rem, 1200px);
  }
}

@media (display-mode: standalone) {
  body {
    min-height: 100dvh;
  }
}