/* =============================================================
   Zain.Systems — single stylesheet
   Editorial minimalism. Restraint is the design.
   ============================================================= */

:root {
  --cream:      #F7F1E8;
  --ink:        #1F1B16;
  --terracotta: #D85A30;
  --stone:      #6B5F52;
  --hairline:   rgba(31, 27, 22, 0.1);
  --muted-dark: rgba(247, 241, 232, 0.55);
  --hairline-dark: rgba(247, 241, 232, 0.18);

  --max-w:      1240px;
  --pad-x:      clamp(24px, 6vw, 96px);
  --section-y:  clamp(96px, 12vw, 200px);

  --ease:       cubic-bezier(0.16, 1, 0.3, 1);
}

/* -------- Reset & base -------- */

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

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

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 400;
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ol, ul, dl, dd, blockquote, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration: none;
  transition: color 200ms ease, border-color 200ms ease;
}

a:hover,
a:focus-visible { color: var(--terracotta); }

a:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 4px;
  border-radius: 2px;
}

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

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--cream);
  padding: 12px 16px;
  z-index: 100;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  color: var(--cream);
}

/* -------- Layout primitives -------- */

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.section-bordered {
  border-top: 1px solid var(--hairline);
}

.section-dark {
  background: var(--ink);
  color: var(--cream);
  border-top: 0;
}

/* -------- Wordmark -------- */

.wordmark {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--ink);
  display: inline-block;
}
.wordmark .dot { color: var(--terracotta); }

.wordmark-sm  { font-size: 22px; }
.wordmark-xs  { font-size: 16px; }

.section-dark .wordmark { color: var(--cream); }

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

.site-header {
  border-bottom: 1px solid var(--hairline);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  padding-bottom: 28px;
  gap: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
}

/* -------- Language switcher -------- */

.lang-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.lang-link {
  color: var(--stone);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 200ms ease, border-color 200ms ease;
}

.lang-link.lang-current {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.lang-link:hover,
.lang-link:focus-visible {
  color: var(--terracotta);
}
.lang-link.lang-current:hover,
.lang-link.lang-current:focus-visible {
  border-bottom-color: var(--terracotta);
}

.nav-link {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.section-dark .nav-link,
.site-footer .nav-link { color: var(--stone); }

@media (max-width: 639px) {
  .nav-hide-sm { display: none; }
}

/* -------- Type scale -------- */

.h-hero {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(48px, 8.5vw, 112px);
  letter-spacing: -0.035em;
  line-height: 0.98;
  color: var(--ink);
  max-width: 16ch;
}

.h-section {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(36px, 5.2vw, 64px);
  letter-spacing: -0.035em;
  line-height: 1.04;
  color: var(--ink);
  max-width: 22ch;
}

.section-dark .h-section { color: var(--cream); }

.h-contact {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(64px, 12vw, 160px);
  letter-spacing: -0.035em;
  line-height: 0.95;
  color: var(--cream);
  margin-bottom: clamp(40px, 5vw, 56px);
}

.h-project {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(26px, 3.4vw, 42px);
  letter-spacing: -0.02em;
  line-height: 1.14;
  color: var(--ink);
  max-width: 24ch;
  margin-bottom: 28px;
}

.h-sub {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(22px, 2.2vw, 26px);
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 16px;
}

.section-dark .h-sub { color: var(--cream); }

.body-lg {
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.5;
}

.body {
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.6;
}

.stone { color: var(--stone); }
.muted-dark { color: var(--muted-dark); }

/* Label / caption — JetBrains Mono */
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 28px;
}

.eyebrow-dark { color: var(--muted-dark); }

.mono-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
}

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

.hero {
  padding-top: clamp(120px, 14vw, 220px);
  padding-bottom: var(--section-y);
}

.hero .eyebrow {
  margin-bottom: clamp(48px, 6vw, 80px);
}

.hero .h-hero {
  margin-bottom: clamp(40px, 5vw, 64px);
}

.hero-subtitle {
  max-width: 54ch;
  margin-bottom: clamp(56px, 8vw, 96px);
}

.tag-row {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.8;
  color: var(--stone);
  max-width: 60ch;
  letter-spacing: 0.01em;
}

/* -------- Section heading spacing -------- */

.section .h-section { margin-bottom: clamp(56px, 7vw, 96px); }

/* -------- Approach: 3-col -------- */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(40px, 5vw, 72px);
}

@media (max-width: 899px) {
  .grid-3 { grid-template-columns: 1fr; }
}

/* -------- What we build: 2x2 -------- */

.grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(40px, 5vw, 72px) clamp(40px, 5vw, 72px);
}

@media (max-width: 768px) {
  .grid-2x2 { grid-template-columns: 1fr; }
}

.block .body { max-width: 52ch; }

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

.process-list {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.process-step {
  display: grid;
  grid-template-columns: clamp(140px, 18vw, 220px) 1fr;
  gap: clamp(24px, 4vw, 48px);
  padding-top: clamp(40px, 5vw, 64px);
  padding-bottom: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--hairline);
}

.process-step:first-child { border-top: 0; }

.process-meta .mono-label { font-size: 13px; }

.process-body { max-width: 680px; }

@media (max-width: 767px) {
  .process-step {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* -------- Studio -------- */

.studio-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(48px, 8vw, 120px);
  align-items: start;
}

@media (max-width: 767px) {
  .studio-grid { grid-template-columns: 1fr; }
}

.studio-copy .body-lg { max-width: 52ch; }
.studio-copy-secondary { margin-top: 24px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: 56px;
  column-gap: 40px;
  margin: 0;
}

.stat { display: flex; flex-direction: column; gap: 10px; }

.stat-num {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(40px, 5vw, 56px);
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--ink);
}

.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
  margin: 0;
}

/* -------- Case study (work) -------- */

.case {
  display: grid;
  grid-template-columns: clamp(140px, 18vw, 220px) 1fr;
  gap: clamp(24px, 4vw, 48px);
  padding-top: clamp(56px, 7vw, 88px);
  padding-bottom: clamp(56px, 7vw, 88px);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  margin-top: clamp(56px, 7vw, 88px);
}

.case-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.case-index {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--stone);
  margin-bottom: 4px;
}

.case-content { max-width: 720px; }

.kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 24px;
}

.case-content .body { margin-bottom: 32px; }

@media (max-width: 767px) {
  .case {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Reserved testimonial styling (kept commented in HTML; styles ready) */
.case-testimonial {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
}
.case-testimonial p {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(20px, 2.2vw, 26px);
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ink);
  max-width: 52ch;
}
.case-testimonial cite {
  display: block;
  margin-top: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
}

/* -------- Notes (placeholder list) -------- */

.notes-intro {
  max-width: 56ch;
  margin-bottom: clamp(56px, 7vw, 88px);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(40px, 5vw, 72px);
}

@media (max-width: 899px) {
  .notes-grid { grid-template-columns: 1fr; }
}

.note-card {
  border-top: 1px solid var(--hairline);
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.note-card .h-sub { margin-bottom: 0; }
.note-card .body { max-width: 38ch; }

/* -------- Contact (dark) -------- */

.section-dark .container { color: var(--cream); }

.contact-sub {
  max-width: 52ch;
  margin-bottom: clamp(64px, 9vw, 96px);
}

.email-link {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(28px, 4.2vw, 56px);
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--cream);
  border-bottom: 1px solid rgba(247, 241, 232, 0.28);
  padding-bottom: 10px;
  transition: color 200ms ease, border-color 200ms ease;
}

.email-link:hover,
.email-link:focus-visible {
  color: var(--terracotta);
  border-bottom-color: var(--terracotta);
}

.form-intro {
  margin-top: clamp(48px, 6vw, 72px);
  margin-bottom: 24px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 640px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-dark);
}

.form-optional {
  color: var(--muted-dark);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

.form-input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline-dark);
  color: var(--cream);
  padding: 10px 0;
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(16px, 1.4vw, 18px);
  font-weight: 400;
  line-height: 1.5;
  width: 100%;
  transition: border-color 200ms ease;
  border-radius: 0;
}

.form-input:focus {
  outline: none;
  border-bottom-color: var(--terracotta);
}

.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--cream);
  -webkit-box-shadow: 0 0 0 1000px var(--ink) inset;
  transition: background-color 5000s ease-in-out 0s;
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  padding-top: 12px;
}

.form-submit {
  align-self: flex-start;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(247, 241, 232, 0.28);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(20px, 2vw, 24px);
  letter-spacing: -0.02em;
  padding: 6px 0;
  margin-top: 8px;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease;
}

.form-submit:hover,
.form-submit:focus-visible {
  color: var(--terracotta);
  border-bottom-color: var(--terracotta);
  outline: none;
}

.form-submit-arrow {
  display: inline-block;
  margin-left: 4px;
  transition: transform 200ms ease;
}

.form-submit:hover .form-submit-arrow,
.form-submit:focus-visible .form-submit-arrow {
  transform: translateX(4px);
}

/* Honeypot — visually hidden, still in tab order out via tabindex=-1 */
.form-hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(32px, 5vw, 64px);
  margin-top: clamp(56px, 8vw, 88px);
}

.meta-item { display: flex; flex-direction: column; gap: 8px; }

.meta-value { color: var(--cream); font-weight: 400; }

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

.site-footer {
  border-top: 1px solid var(--hairline);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding-top: 48px;
  padding-bottom: 48px;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--stone);
}

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

/* Hero stagger */
.hero-anim {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.95s var(--ease), transform 0.95s var(--ease);
}
.hero-anim.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* =============================================================
   RTL + non-Latin script support (Arabic / Urdu)
   ============================================================= */

html[lang="ar"] body,
html[lang="ar"] .h-hero,
html[lang="ar"] .h-section,
html[lang="ar"] .h-contact,
html[lang="ar"] .h-project,
html[lang="ar"] .h-sub,
html[lang="ar"] .stat-num,
html[lang="ar"] .email-link,
html[lang="ar"] .form-input,
html[lang="ar"] .form-submit,
html[lang="ar"] .wordmark {
  font-family: 'Noto Sans Arabic', 'DM Sans', system-ui, sans-serif;
}

html[lang="ur"] body,
html[lang="ur"] .h-hero,
html[lang="ur"] .h-section,
html[lang="ur"] .h-contact,
html[lang="ur"] .h-project,
html[lang="ur"] .h-sub,
html[lang="ur"] .stat-num,
html[lang="ur"] .email-link,
html[lang="ur"] .form-input,
html[lang="ur"] .form-submit {
  font-family: 'Noto Nastaliq Urdu', 'Noto Sans Arabic', 'DM Sans', system-ui, sans-serif;
  line-height: 2;
}

/* Nastaliq needs more vertical breathing room than Latin */
html[lang="ur"] .h-hero { line-height: 1.4; }
html[lang="ur"] .h-section { line-height: 1.4; }
html[lang="ur"] .h-contact { line-height: 1.3; }
html[lang="ur"] .h-project { line-height: 1.4; }
html[lang="ur"] .h-sub { line-height: 1.5; }
html[lang="ur"] .body,
html[lang="ur"] .body-lg,
html[lang="ur"] p { line-height: 2; }

/* Brand wordmark always renders LTR in DM Sans, even on RTL pages */
html[dir="rtl"] .wordmark {
  font-family: 'DM Sans', sans-serif;
  direction: ltr;
  unicode-bidi: isolate;
}

/* JetBrains Mono labels keep Latin look for the 01/02 numerals,
   but the translated words after the slash fall back to the locale font */
html[lang="ar"] .eyebrow,
html[lang="ar"] .mono-label,
html[lang="ar"] .form-label,
html[lang="ar"] .nav-link,
html[lang="ar"] .tag-row {
  font-family: 'JetBrains Mono', 'Noto Sans Arabic', monospace;
}
html[lang="ur"] .eyebrow,
html[lang="ur"] .mono-label,
html[lang="ur"] .form-label,
html[lang="ur"] .nav-link,
html[lang="ur"] .tag-row {
  font-family: 'JetBrains Mono', 'Noto Nastaliq Urdu', monospace;
}

/* RTL: flip layout direction for grids and case meta */
html[dir="rtl"] .footer-row,
html[dir="rtl"] .header-row {
  /* Flex already mirrors with dir=rtl; nothing to override */
}

/* RTL: hero stays "left"-aligned to start (which is now the right) */
html[dir="rtl"] .hero .container,
html[dir="rtl"] .hero-anim {
  text-align: right;
}

html[dir="rtl"] .h-hero,
html[dir="rtl"] .h-section,
html[dir="rtl"] .h-contact,
html[dir="rtl"] .h-project { text-align: right; }

/* RTL: email link underline aligns to start */
html[dir="rtl"] .email-link {
  direction: ltr; /* email addresses are LTR */
  unicode-bidi: isolate;
}

/* RTL: form submit arrow flips */
html[dir="rtl"] .form-submit-arrow {
  display: inline-block;
  transform: scaleX(-1);
}
html[dir="rtl"] .form-submit:hover .form-submit-arrow,
html[dir="rtl"] .form-submit:focus-visible .form-submit-arrow {
  transform: scaleX(-1) translateX(4px);
}

/* RTL: process step's label column is on the right (start side) */
html[dir="rtl"] .process-step {
  /* grid auto-flows in writing-mode order; nothing extra needed */
}

/* RTL: stat-num direction stays LTR (Western Arabic numerals read naturally LTR) */
html[dir="rtl"] .stat-num {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right; /* but visually align right */
}

/* RTL: keep eyebrow / mono-label text aligned to the start (right in RTL) */
html[dir="rtl"] .eyebrow,
html[dir="rtl"] .mono-label,
html[dir="rtl"] .case-index {
  text-align: right;
}

/* RTL: hero-subtitle line keeps right-aligned, normal text flow */
html[dir="rtl"] .hero-subtitle,
html[dir="rtl"] .tag-row,
html[dir="rtl"] .body,
html[dir="rtl"] .body-lg { text-align: right; }

/* Reduced motion: disable all animations + transitions */
@media (prefers-reduced-motion: reduce) {
  .hero-anim,
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
