/* ---------- Tokens ----------
   Teconize keeps its own dark palette. Radius, motion and hit-area tiers
   follow the apple-liquid-glass system so every component speaks the same
   language. Cyan is reserved for actions, links, focus and active states. */
:root {
  --bg: #0d0d0d;
  --bg-soft: #121212;
  --surface-hover: rgba(255, 255, 255, 0.025);
  --border: rgba(255, 255, 255, 0.08); /* hairline */
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f6f7;
  --text-muted: #9a9fa6;
  --accent: #33c3ec;
  --accent-soft: rgba(51, 195, 236, 0.12);
  --accent-glow: rgba(51, 195, 236, 0.35);
  --on-accent: #04222c;
  --danger: #f08a8a;

  --r-pill: 999px;
  --r-thumb: 12px;
  --r-card: 18px;
  --r-panel: 22px;
  --r-hero: 26px;

  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1); /* things arriving */
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1); /* small moves: hover, press */

  --nav-h: 64px;
  --gutter: 32px;
  --section-y: clamp(72px, 10vw, 120px); /* one rhythm between all sections */
  --hit: 44px; /* minimum touch target */
}

@media (max-width: 480px) {
  :root { --gutter: 18px; }
}

* { box-sizing: border-box; }

html {
  /* A jump to a section must land its title below the sticky header. */
  scroll-padding-top: calc(var(--nav-h) + 16px);
  color-scheme: dark;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 55% 40% at 12% 0%, rgba(51, 195, 236, 0.10), transparent 60%),
    radial-gradient(ellipse 50% 45% at 100% 25%, rgba(51, 195, 236, 0.07), transparent 60%),
    radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 26px 26px;
  background-position: center top, center top, center top;
  background-repeat: no-repeat, no-repeat, repeat;
  -webkit-font-smoothing: antialiased;
}

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

/* `hidden` must win over any component's own display value. */
[hidden] { display: none !important; }

/* Arrows that mean "forward" or "back" follow the reading direction. */
html[dir="rtl"] .icon-forward,
html[dir="rtl"] .icon-back { transform: scaleX(-1); }

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

/* One focus ring for everything a keyboard can reach. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Sections receive focus after a jump (so Tab continues from there); they
   are landmarks, not controls, so they get no ring. */
[tabindex="-1"]:focus { outline: none; }

.skip-link {
  position: absolute;
  top: 12px;
  inset-inline-start: 16px;
  z-index: 100;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease-out-quart);
}
.skip-link:focus-visible { transform: none; }

.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;
}

/* ---------- Navbar ---------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(13, 13, 13, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  /* Scroll edge: the hairline appears only once content slides underneath. */
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.navbar.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 1px 16px rgba(0, 0, 0, 0.35);
}

.navbar__inner {
  max-width: 1280px;
  min-height: var(--nav-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--hit);
  font-weight: 700;
  font-size: 1.15rem;
  white-space: nowrap;
}

.brand__mark {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand__logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--hit);
  padding: 0 14px;
  border-radius: var(--r-pill);
  transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a[aria-current] { color: var(--text); }

/* Wayfinding: the section on screen (or the page you are on) is marked in the menu. */
.nav-links a[aria-current]::after {
  content: "";
  position: absolute;
  inset-inline: 14px;
  bottom: 7px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--hit);
  padding: 0 24px;
  border-radius: var(--r-pill);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  transition:
    transform 0.2s var(--ease-out-quart),
    box-shadow 0.2s var(--ease-out-quart),
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.btn--lg {
  min-height: 52px;
  padding: 0 28px;
  font-size: 1rem;
}

.btn--outline {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: transparent;
}
.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--filled {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 1px rgba(51, 195, 236, 0.4), 0 8px 24px -8px var(--accent-glow);
}
.btn--filled:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(51, 195, 236, 0.6), 0 12px 28px -8px var(--accent-glow);
}

/* Press feedback lands on pointer-down, not on release. */
.btn:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

.navbar__cta { padding: 0 20px; font-size: 0.9rem; }

/* ---------- Language switch ---------- */

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  gap: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  flex-shrink: 0;
  direction: ltr; /* FA | EN always reads in that order */
}

.lang-switch__btn {
  position: relative;
  appearance: none;
  border: 0;
  cursor: pointer;
  min-width: 40px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-en);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  transition: color 0.15s ease, background-color 0.15s ease;
}

/* The pill stays compact; its hit area still reaches 44px. */
.lang-switch__btn::after {
  content: "";
  position: absolute;
  inset: -5px 0;
}

.lang-switch__btn:hover { color: var(--text); }

.lang-switch__btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(51, 195, 236, 0.35);
}

/* Set by the inline head script only when a stored language differs from the
   language the HTML is authored in, so English visitors never see a flash of
   Persian. Cleared by lang-toggle.js (and by its own fail-safe timeout), and
   never set at all when JavaScript is off. */
html.i18n-pending body { visibility: hidden; }


/* ---------- Hero layout ---------- */

.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) var(--gutter) var(--section-y);
}

.hero__inner {
  display: grid;
  /* the text column is wide enough for the title's first line at every desktop width */
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 64px;
}

.hero__content {
  animation: rise 0.6s var(--ease-spring) both;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-soft);
  margin-bottom: 28px;
}

.badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 2s ease-in-out infinite;
}

.hero__title {
  font-size: clamp(2.1rem, 3.4vw, 3.1rem);
  line-height: 1.35;
  font-weight: 800;
  margin: 0 0 20px;
}

html[lang="en"] .hero__title {
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.hero__underline {
  display: block;
  width: 72px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 26px;
}

.hero__desc {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 2;
  max-width: 46ch;
  margin: 0 0 36px;
}

.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Hero visual ---------- */

.hero__visual {
  display: flex;
  justify-content: center;
  animation: rise 0.7s var(--ease-spring) 0.1s both;
}

.hero__image {
  position: relative;
  width: 100%;
  max-width: 460px;
  border-radius: var(--r-hero);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  padding: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(51, 195, 236, 0.12), 0 30px 60px -30px rgba(0, 0, 0, 0.7);
}

.hero__image-bg {
  position: absolute;
  inset: 10px;
  border-radius: calc(var(--r-hero) - 10px);
  z-index: 0;
  overflow: hidden;
  background-color: #0e1414;
  background-image:
    linear-gradient(rgba(51, 195, 236, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 195, 236, 0.10) 1px, transparent 1px),
    radial-gradient(circle at 75% 15%, rgba(51, 195, 236, 0.22), transparent 55%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
}

.hero__image-img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Motion ---------- */

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero__content, .hero__visual, .badge__dot { animation: none; }
  .btn:active { transform: none; }
}

/* Glass only where it helps; fall back to solid when asked to. */
@media (prefers-reduced-transparency: reduce) {
  .navbar {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: rgba(255, 255, 255, 0.24);
    --border-strong: rgba(255, 255, 255, 0.42);
    --text-muted: #c6cacf;
  }
}

/* ---------- Responsive ---------- */

.navbar__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: var(--hit);
  height: var(--hit);
  border-radius: var(--r-thumb);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  cursor: pointer;
  flex-shrink: 0;
}

.navbar__toggle span {
  width: 16px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease-out-quart), opacity 0.2s ease;
}

.navbar__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.navbar__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.navbar__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

@media (max-width: 960px) {
  .hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero__underline { margin-inline: auto; }
  .hero__actions { justify-content: center; }
  .hero__desc { margin-inline: auto; }

  .navbar__toggle { display: flex; }

  /* The menu drops down over the page; closed, it is out of sight and out of
     the tab order (visibility), and it slides back the way it came. */
  .nav-links {
    position: absolute;
    top: 100%;
    inset-inline: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px var(--gutter) 14px;
    /* Solid: a blur nested inside the blurred header has nothing to sample,
       and any see-through lets the hero title ghost behind the links. */
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
    transition:
      opacity 0.25s var(--ease-spring),
      transform 0.3s var(--ease-spring),
      visibility 0s linear 0.3s;
  }
  .nav-links.is-open {
    opacity: 1;
    transform: none;
    visibility: visible;
    transition:
      opacity 0.3s var(--ease-spring),
      transform 0.4s var(--ease-spring),
      visibility 0s;
  }
  .nav-links a {
    min-height: 48px;
    padding: 0 4px;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav-links a:last-child { border-bottom: none; }
  .nav-links a[aria-current] { color: var(--accent); }
  .nav-links a[aria-current]::after { display: none; }
}

@media (max-width: 960px) and (prefers-reduced-motion: reduce) {
  .nav-links,
  .nav-links.is-open { transform: none; }
}

@media (max-width: 480px) {
  .navbar__inner { gap: 12px; }
  /* Narrow screens: let the title balance itself instead of a forced break. */
  .hero__title { font-size: 1.85rem; }
  .hero__title br { display: none; }
  .hero__actions .btn { flex: 1 1 100%; }
}

@media (max-width: 400px) {
  .navbar__cta { display: none; }
}

/* ---------- Minimal footer ---------- */

.site-footer-mini {
  border-top: 1px solid var(--border);
  padding: 20px var(--gutter);
  text-align: center;
}

.site-footer-mini span {
  font-size: 0.8rem;
  color: var(--text-muted);
}
