/* ==========================================================================
   Turjuman — turjuman.io
   Single stylesheet. Design tokens mirror the app's DarkSmokeTheme
   (tarjuman2/src/constants/theme.js). RTL is handled exclusively with
   CSS logical properties — no physical left/right properties anywhere.
   ========================================================================== */

/* ---- Self-hosted IBM Plex Sans Arabic (SIL OFL 1.1 — see ../fonts/OFL.txt).
   Subsets + unicode-range values from Fontsource. Loaded lazily: English
   pages never match this family, so they download zero font bytes. ---- */

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("../fonts/ibm-plex-sans-arabic-arabic-400.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("../fonts/ibm-plex-sans-arabic-arabic-600.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("../fonts/ibm-plex-sans-arabic-arabic-700.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* Latin glyphs inside Arabic pages (e.g. "OBD-II", the support email) */
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("../fonts/ibm-plex-sans-arabic-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("../fonts/ibm-plex-sans-arabic-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Design tokens (DarkSmokeTheme parity) ---- */

:root {
  --bg-start: #1E1E21;
  --bg-end: #040405;
  --bg-elevated: #1C1C1F;
  --bg-card: #2A2A2F;
  --hairline: rgba(255, 255, 255, 0.07);
  --primary: #6366F1;
  --primary-bright: #818CF8;   /* app's increased-contrast primary — body links */
  --accent: #06B6D4;
  --success: #10B981;
  --error: #EF4444;
  --amber: #F59E0B;
  --text: #F4F4F5;
  --text-secondary: #A1A1AA;
  --text-muted: #6B7280;       /* decorative / >=24px only (4.2:1 on bg) */
  --primary-alpha: rgba(99, 102, 241, 0.14);
  --accent-alpha: rgba(6, 182, 212, 0.14);
  --success-alpha: rgba(16, 185, 129, 0.08);
  --amber-alpha: rgba(245, 158, 11, 0.12);

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-card: 20px;
  --radius-modal: 26px;
  --radius-hero: 28px;
  --radius-full: 999px;

  --font-latin: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-arabic: "IBM Plex Sans Arabic", "Segoe UI", "Geeza Pro", Tahoma, sans-serif;

  --fs-hero: clamp(2.25rem, 5vw + 1rem, 3.5rem);
  --fs-h2: clamp(1.375rem, 2vw + 0.75rem, 1.75rem);
  --fs-h3: 1.1875rem;
  --fs-body: 1.0625rem;   /* 17px — app body size */
  --fs-small: 0.8125rem;  /* 13px — app footnote size */

  --content-max: 720px;
  --landing-max: 1080px;

  color-scheme: dark;
}

/* ---- Base ---- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-end);
  background-image: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-latin);
  font-size: var(--fs-body);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

html[lang="ar"] body {
  font-family: var(--font-arabic);
  line-height: 1.9;
}

h1, h2, h3 {
  line-height: 1.25;
  text-wrap: balance;
}

/* Arabic diacritics (e.g. the damma/sukun in تُرْجُمَان) clip at tight line-heights */
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3 {
  line-height: 1.75;
}

p {
  margin-block: 0 var(--space-lg);
}

a {
  color: var(--primary-bright);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

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

img {
  max-inline-size: 100%;
  block-size: auto;
}

/* Keep identifiers like the support email readable inside RTL text */
.ltr-inline {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

/* Visually-hidden but available to assistive tech (section headings) */
.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- Skip link ---- */

.skip-link {
  position: absolute;
  inset-block-start: var(--space-sm);
  inset-inline-start: var(--space-sm);
  z-index: 10;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--text);
  transform: translateY(-300%);
}

.skip-link:focus-visible {
  transform: none;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  max-inline-size: var(--landing-max);
  inline-size: 100%;
  margin-inline: auto;
  padding-block: var(--space-xl);
  padding-inline: var(--space-lg);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  min-block-size: 44px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
  text-decoration: none;
}

html[lang="ar"] .wordmark {
  letter-spacing: 0; /* letter-spacing breaks Arabic shaping */
}

.wordmark img {
  inline-size: 28px;
  block-size: 28px;
  border-radius: 7px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  min-inline-size: 44px;
  padding-block: var(--space-sm);
  padding-inline: var(--space-xl);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

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

/* ---- Main layout ---- */

main {
  flex: 1;
  inline-size: 100%;
  max-inline-size: var(--landing-max);
  margin-inline: auto;
  padding-inline: var(--space-lg);
  padding-block-end: var(--space-3xl);
}

/* ---- Hero (landing) ---- */

.hero {
  text-align: center;
  padding-block: clamp(2.5rem, 8vw, 5.5rem) clamp(2rem, 6vw, 4rem);
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  margin-inline: auto;
  inline-size: min(600px, 100%);
  block-size: 420px;
  background: radial-gradient(closest-side, var(--primary-alpha), transparent 70%);
  pointer-events: none;
}

.hero > * {
  position: relative;
}

@media (prefers-reduced-motion: no-preference) {
  .hero > * {
    animation: hero-fade 0.7s ease-out both;
  }
}

@keyframes hero-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  padding-inline: var(--space-lg);
  border: 1px solid var(--amber);
  border-radius: var(--radius-full);
  background: var(--amber-alpha);
  color: var(--amber);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[lang="ar"] .eyebrow {
  letter-spacing: 0;
  text-transform: none; /* keep "App Store" correctly cased inside caseless Arabic */
}

.hero-icon {
  display: block;
  margin-inline: auto;
  margin-block: var(--space-3xl) var(--space-2xl);
  inline-size: clamp(96px, 14vw, 128px);
  block-size: auto;
  border-radius: 22.5%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.hero h1 {
  margin-block: 0 var(--space-md);
  font-size: var(--fs-hero);
  font-weight: 700;
  letter-spacing: 0.1em;
}

html[lang="ar"] .hero h1 {
  letter-spacing: 0;
}

.tagline {
  margin-block: 0 var(--space-2xl);
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

html[lang="ar"] .tagline {
  letter-spacing: 0;
}

.lede {
  max-inline-size: 620px;
  margin-inline: auto;
  margin-block: 0;
  color: var(--text-secondary);
  font-size: 1.125rem;
}

/* ---- Feature teasers ---- */

.features {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  padding: 0;
  margin-block: var(--space-3xl);
  list-style: none;
}

.card {
  padding: var(--space-2xl);
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
}

.card h3 {
  margin-block: 0 var(--space-sm);
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--text);
}

.card p {
  margin-block: 0;
  color: var(--text-secondary);
  font-size: 1rem;
}

.card .glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 40px;
  block-size: 40px;
  margin-block-end: var(--space-lg);
  border-radius: var(--radius-sm);
  background: var(--primary-alpha);
  color: var(--primary-bright);
}

.card .glyph svg {
  inline-size: 22px;
  block-size: 22px;
}

/* ---- Privacy band ---- */

.privacy-band {
  margin-block: var(--space-3xl);
  padding: var(--space-3xl);
  background: var(--success-alpha);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-hero);
}

.privacy-band h2 {
  margin-block: 0 var(--space-lg);
  font-size: var(--fs-h2);
  color: var(--success);
}

.privacy-band p {
  max-inline-size: var(--content-max);
  color: var(--text);
}

.privacy-band p:last-of-type {
  margin-block-end: var(--space-lg);
}

/* ---- Contact strip ---- */

.contact-strip {
  margin-block: var(--space-3xl);
  text-align: center;
  color: var(--text-secondary);
}

.contact-strip p {
  margin-block: 0;
}

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

.site-footer {
  border-block-start: 1px solid var(--hairline);
  margin-block-start: var(--space-3xl);
}

.site-footer .inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  max-inline-size: var(--landing-max);
  margin-inline: auto;
  padding-block: var(--space-2xl);
  padding-inline: var(--space-lg);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding-inline: var(--space-md);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  text-decoration: none;
}

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

.copyright {
  margin-block: 0;
  color: var(--text-secondary);
  font-size: var(--fs-small);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-block-size: 52px;
  padding-block: var(--space-md);
  padding-inline: var(--space-3xl);
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #FFFFFF;                 /* 4.5:1 not met at small sizes — text is large+bold (AA large-text) */
  font-size: 1.1875rem;
  font-weight: 700;
  text-decoration: none;
}

.btn:hover {
  background: var(--primary-bright);
  color: #0B0B10;
}

/* ---- Content pages (privacy / terms / support) ---- */

.content {
  max-inline-size: var(--content-max);
  margin-inline: auto;
  padding-block-start: var(--space-2xl);
}

.content h1 {
  font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem);
  margin-block: var(--space-2xl) var(--space-sm);
}

.content .updated {
  color: var(--text-secondary);
  font-size: var(--fs-small);
  margin-block-end: var(--space-3xl);
}

.content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-block: var(--space-3xl) var(--space-md);
}

.content p {
  color: var(--text);
  line-height: 1.7;
}

html[lang="ar"] .content p {
  line-height: 1.9;
}

.content ul {
  margin-block: 0 var(--space-lg);
  padding-inline-start: var(--space-2xl);
  line-height: 1.7;
}

html[lang="ar"] .content ul {
  line-height: 1.9;
}

.content li {
  margin-block-end: var(--space-sm);
}

.note {
  color: var(--text-secondary);
}

.support-card {
  margin-block: var(--space-2xl);
  padding: var(--space-2xl);
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  text-align: center;
}

.support-card .btn {
  margin-block-end: var(--space-lg);
}

.support-card .email-plain {
  margin-block: 0;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ---- 404 ---- */

.notfound {
  text-align: center;
  padding-block: clamp(3rem, 10vw, 6rem);
}

.notfound .code {
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 700;
  color: var(--text-muted); /* decorative, large */
  margin-block: 0;
}

.notfound h1 {
  font-size: var(--fs-h2);
  margin-block: var(--space-lg);
}

.notfound .links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-lg);
  margin-block-start: var(--space-2xl);
}

/* ---- Breakpoints ---- */

@media (min-width: 641px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
  }
}

@media (min-width: 1000px) {
  .features {
    grid-template-columns: repeat(4, 1fr);
  }
}
