/*
 * Kaizen Dev Team — shared styles for /en/ and /fa/.
 * Direction-aware: uses logical properties (inline-start/end) so the same
 * rules produce a correct LTR (en) and RTL (fa) layout.
 */

:root {
  --bg: #1f1f1f;
  --bg-deep: #151515;
  --surface: #252525;
  --surface-2: #2b2b2b;
  --border: #383838;
  --border-strong: #4a4a4a;
  --text: #f2f2f2;
  --text-muted: #a8a8a8;
  --text-faint: #8e8e8e;
  --accent: #00b4cc;
  --accent-hover: #19c6dc;
  --accent-bright: #5ef2f2;
  --accent-soft: rgba(0, 180, 204, 0.14);
  --on-accent: #04181c;
  --chip-violet: #7b4fd6;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 28px;
  --container: 1120px;
  --gutter: 24px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-wordmark: "Space Grotesk", sans-serif;
}

:root:lang(fa) {
  --font-display: "Vazirmatn", sans-serif;
  --font-body: "Vazirmatn", sans-serif;
}

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

html {
  background: var(--bg-deep);
  -webkit-text-size-adjust: 100%;
}

/* Smooth only for in-page link clicks (a link has focus), never when a page
   loads with a #section, e.g. after switching language. */
html:focus-within {
  scroll-behavior: smooth;
}

/* Subtle cross-fade between /en/ and /fa/ where supported. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

:lang(fa) body,
body:lang(fa) {
  line-height: 1.9;
}

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

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Sections focused by the in-page scroll script don't need a ring. */
[tabindex="-1"]:focus {
  outline: none;
}

.visually-hidden {
  position: absolute !important;
  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;
  inset-inline-start: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

.container {
  width: min(100%, var(--container));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Arrows and chevrons point "forward", so they mirror in RTL. */
[dir="rtl"] .flip-rtl {
  transform: scaleX(-1);
}

/* Latin fragments (emails, handles, API) inside Persian text. */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------- Logo ---------- */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.logo-mark {
  width: 36px;
  height: 36px;
}

.logo-name {
  color: var(--accent);
  font-family: var(--font-wordmark);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ---------- Header / navigation ---------- */

.site-header {
  position: relative;
  z-index: 50;
  background: var(--bg-deep);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 88px;
}

.header-inner > .logo {
  grid-column: 2;
  grid-row: 1;
}

.main-nav {
  grid-column: 1;
  grid-row: 1;
}

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.main-nav .nav-contact {
  display: none;
}

.main-nav a:hover {
  background: var(--surface);
  color: var(--text);
}

.header-actions {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.lang-switch:hover {
  border-color: var(--accent);
}

.lang-switch[lang="fa"] {
  font-family: "Vazirmatn", sans-serif;
}

.lang-switch[lang="en"] {
  font-family: "Inter", sans-serif;
}

.lang-switch i {
  color: var(--accent);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.hero {
  position: relative;
  overflow: hidden;
  padding: 56px 0 170px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--bg-deep);
  text-align: center;
}

/*
 * Ambient grid shared by the Hero and the dark Panel: one rule, one
 * animation. Both layers span the full page width with the grid centred, so
 * their vertical lines sit on the same columns, and both drift down one
 * 96px tile per loop, in lockstep from page load: one continuous moving grid.
 */
.hero::before,
.panel::before {
  content: "";
  position: absolute;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-position: center center;
  background-size: 96px 96px;
  animation: grid-lines-drift 3s linear infinite;
  -webkit-mask-image: radial-gradient(
    ellipse 60% 70% at 50% 45%,
    #000 20%,
    transparent 75%
  );
  mask-image: radial-gradient(
    ellipse 60% 70% at 50% 45%,
    #000 20%,
    transparent 75%
  );
  pointer-events: none;
}

.hero::before,
.panel::before {
  inset: 0;
}

/* Ambient drift: the grid moves down exactly one 96px tile per loop, so the
   restart is seamless. The mask stays fixed because only the background moves. */
@keyframes grid-lines-drift {
  to {
    background-position: center calc(50% + 96px);
  }
}

.hero::after {
  content: "";
  position: absolute;
  top: 10%;
  left: 50%;
  width: 640px;
  height: 320px;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse at center,
    rgba(0, 180, 204, 0.12),
    transparent 70%
  );
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1 {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  margin: 0 auto;
}

.wordmark {
  color: var(--accent-bright);
  font-family: var(--font-wordmark);
  font-size: clamp(3.6rem, 12vw, 7.5rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  direction: ltr;
}

.wordmark-caption {
  margin-top: 8px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.6vw, 0.95rem);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.hero-lead {
  max-width: 44rem;
  margin: 36px auto 0;
  color: var(--text);
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  line-height: 1.9;
}

/* ---------- Highlights (overlapping the hero) ---------- */

.highlights {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: -120px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.highlight {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 200px;
  padding: 28px 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  text-align: center;
}

.highlight-value {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
}

.highlight-label {
  max-width: 22ch;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.highlight-cta {
  flex-direction: row;
  justify-content: space-between;
  gap: 20px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  text-align: start;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.highlight-cta:hover {
  background: var(--accent-hover);
}

.highlight-cta:focus-visible {
  outline-color: var(--text);
}

.highlight-cta-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.highlight-cta .highlight-label {
  color: var(--on-accent);
  font-weight: 600;
}

.highlight-cta .highlight-value {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
}

.cta-circle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
  color: var(--accent);
  font-size: 1.5rem;
  transition: transform 0.2s ease;
}

.highlight-cta:hover .cta-circle {
  transform: scale(1.05);
}

/* ---------- Generic section ---------- */

.section {
  padding: 88px 0;
}

.section[id],
.panel [id] {
  scroll-margin-top: 24px;
}

.section-head {
  max-width: 40rem;
  margin: 0 auto 40px;
  text-align: center;
}

.section-head p,
.hero-lead,
.contact-text {
  text-wrap: pretty;
}

.section-head h2 {
  font-size: clamp(1.45rem, 3vw, 1.85rem);
}

.section-head p {
  margin-top: 10px;
  color: var(--text-muted);
}

/* ---------- Services ---------- */

.services {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 22px 28px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  text-align: center;
}

.service-icon {
  margin-bottom: 16px;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
}

.service h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.service p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.services-note {
  margin-top: 28px;
  color: var(--text-muted);
  text-align: center;
}

.services-note a {
  color: var(--accent-bright);
  text-underline-offset: 4px;
}

/* ---------- Process ---------- */

.section-process {
  padding-top: 0;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  padding-top: 20px;
  border-top: 1px solid var(--border-strong);
}

.step-num {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.step h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.step p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ---------- Dark panel (core team + Kaizen projects) ---------- */

/* The grid sits behind the whole panel; content stays above it inside the
   panel's own stacking context. */
.panel {
  position: relative;
  isolation: isolate;
  padding: 80px 0;
  border-radius: var(--radius-lg);
  background: var(--bg-deep);
}

.panel-block + .panel-block {
  margin-top: 80px;
}

.panel::before {
  z-index: -1;
  border-radius: inherit;
}

/* Founder on the first row by himself, the rest of the team below. The
   first card keeps the width of one grid column. */
.team-grid > li:first-child {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc((100% - 22px) / 2);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.avatar {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface-2);
  object-fit: cover;
}

.card h3 {
  font-size: 1.15rem;
}

.card-title-alt {
  margin-inline-start: 6px;
  color: var(--text-faint);
  font-size: 0.9rem;
  font-weight: 500;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.7;
}

.chip-violet {
  background: rgba(123, 79, 214, 0.2);
  color: #c7b1ff;
}

.card-body {
  flex: 1 1 auto;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.card-link i {
  color: var(--accent);
}

.card-link:hover {
  color: var(--accent-bright);
}

.card-meta {
  color: var(--text-faint);
  font-size: 0.85rem;
}

.project-stack {
  margin-top: 14px;
  color: var(--text-faint);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

[dir="rtl"] .project-stack {
  text-align: right;
}

/* A single project sits centred; more projects fill the two-column grid. */
.project-list > li:only-child {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(100%, 760px);
}

/* ---------- Contact CTA ---------- */

.section-contact {
  padding-top: 96px;
  text-align: center;
}

.contact-title {
  max-width: 24ch;
  text-wrap: balance;
  margin: 0 auto;
  font-size: clamp(1.75rem, 4.6vw, 3.1rem);
  font-weight: 700;
  line-height: 1.35;
}

:lang(fa) .contact-title {
  line-height: 1.6;
}

.contact-text {
  max-width: 40rem;
  margin: 18px auto 0;
  color: var(--text-muted);
}

/* Phone first (primary for the Iranian audience), email second. */
.contact-methods {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}

.contact-methods > li {
  width: min(100%, 420px);
}

.contact-pill {
  display: flex;
  align-items: center;
  width: min(100%, 420px);
  min-height: 56px;
  margin: 0 auto;
  padding: 6px;
  padding-inline-start: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-deep);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.contact-pill:hover {
  border-color: var(--accent);
}

.contact-pill-primary {
  min-height: 64px;
  border-color: var(--border-strong);
}

.contact-pill-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  text-align: start;
}

.contact-pill-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.contact-pill-value {
  overflow: hidden;
  font-size: 0.95rem;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-pill-primary .contact-pill-value {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.contact-pill-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--accent-bright);
  font-size: 1.1rem;
}

.contact-pill-primary .contact-pill-btn {
  width: 50px;
  height: 50px;
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 72px 0 32px;
  text-align: center;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--text);
}

.footer-meta {
  margin-top: 28px;
  color: var(--text-faint);
  font-size: 0.8rem;
}

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

@media (max-width: 1024px) {
  .services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 24px;
  }

  .main-nav a {
    padding-inline: 9px;
  }
}

@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    min-height: 76px;
  }

  .header-inner > .logo {
    grid-column: 1;
    justify-self: start;
  }

  .header-actions {
    grid-column: 2;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  /* Collapsed only when JS is available to open it again. */
  .js .main-nav {
    position: absolute;
    top: 100%;
    inset-inline: var(--gutter);
    display: none;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  }

  .js .main-nav.is-open {
    display: block;
  }

  .js .main-nav ul {
    flex-direction: column;
    gap: 2px;
  }

  .js .main-nav a {
    display: flex;
    min-height: 48px;
    padding-inline: 14px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
  }

  .main-nav .nav-contact {
    display: list-item;
  }

  .no-js .menu-toggle {
    display: none;
  }

  .hero {
    padding-top: 40px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .team-grid > li:first-child {
    width: 100%;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
    --radius-lg: 24px;
  }

  .header-actions .btn {
    display: none;
  }

  .hero {
    padding-bottom: 130px;
  }

  .hero-lead {
    margin-top: 28px;
  }

  .highlights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: -96px;
    padding: 10px;
  }

  .highlight {
    min-height: 150px;
    padding: 22px 14px;
  }

  .highlight-cta {
    grid-column: 1 / -1;
    min-height: 0;
    padding: 20px 22px;
  }

  .cta-circle {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }

  .highlight-value {
    font-size: 1.5rem;
  }

  .highlight-label {
    font-size: 0.75rem;
  }

  .section {
    padding: 64px 0;
  }

  .section-process {
    padding-top: 0;
  }

  .services {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .service {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 16px;
    align-items: start;
    padding: 20px;
    border-radius: 18px;
    text-align: start;
  }

  .service-icon {
    grid-row: span 2;
    margin: 2px 0 0;
    font-size: 1.6rem;
  }

  .service h3 {
    margin-bottom: 4px;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .panel {
    padding: 56px 0;
  }

  .panel-block + .panel-block {
    margin-top: 56px;
  }

  .card {
    padding: 20px;
  }

  .card-foot {
    flex-wrap: wrap;
  }

  .section-contact {
    padding-top: 72px;
  }

  .contact-title {
    font-size: clamp(1.5rem, 7vw, 1.9rem);
  }
}

@media (max-width: 380px) {
  .lang-switch {
    padding-inline: 11px;
  }

  .highlights {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .hero::before,
  .panel::before {
    animation: none;
  }
}

/* The logo lockup is always read left-to-right, as in the design. */
.logo {
  direction: ltr;
}

[dir="rtl"] .contact-pill-text {
  text-align: right;
}
