/* ==========================================================================
   FirstDelivery Talk — App Permissions Reference Design System
   Stack: HTML5 / Vanilla CSS (Tailwind-grade design system)
   Main App Color: #4fba57 (FirstDelivery Brand Green) & Harmonious Palette Variants
   ========================================================================== */

:root {
  /* Brand & Primary Color Palette (#4fba57) */
  --primary: #4fba57;
  --primary-hover: #3da545;
  --primary-dark: #2e8234;
  --primary-light: rgba(79, 186, 87, 0.08);
  --primary-glow: rgba(79, 186, 87, 0.25);
  --primary-surface: rgba(79, 186, 87, 0.12);
  
  /* Complementary & Semantic Accents */
  --accent-orange: #f97316;
  --accent-cyan: #06b6d4;
  --accent-emerald: #4fba57;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  /* Neutral Surface Palette */
  --bg-main: #f8fafc;
  --surface-card: #ffffff;
  --surface-dark: #0f172a;
  --surface-dark-secondary: #1e293b;
  
  /* Typography & Border Colors */
  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --border-hover: #cbd5e1;

  /* Shadows & Elevation */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 24px rgba(79, 186, 87, 0.2);

  /* Radius & Transitions */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Multilingual Display Toggle Rules
   One element per language sits in the markup; <body class="lang-xx"> picks
   which survives. Every language must hide BOTH others — with three of them a
   pair of rules is no longer enough. */
body.lang-en .lang-fr,
body.lang-en .lang-ar,
body.lang-fr .lang-en,
body.lang-fr .lang-ar,
body.lang-ar .lang-en,
body.lang-ar .lang-fr {
  display: none !important;
}

/* Accessibility: Skip to Content */
.skip {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--surface-dark);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  z-index: 1000;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.2s ease;
}
.skip:focus {
  top: 1rem;
  outline: 3px solid var(--primary);
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-app {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.brand-org {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(79, 186, 87, 0.1);
  border: 1px solid rgba(79, 186, 87, 0.25);
  color: var(--primary-dark);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.35rem 0.875rem;
  border-radius: var(--radius-full);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--primary);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.25); }
  100% { opacity: 1; transform: scale(1); }
}

/* Language selector
   A native <select> rather than a button group: three languages already
   crowded the navbar on a phone, and a fourth would not fit at all. The
   element keeps its native behaviour — the OS picker on mobile, keyboard
   support, screen-reader semantics — and only its chrome is replaced, which
   is why `appearance: none` is paired with a drawn chevron rather than a
   div pretending to be a listbox. */
.lang-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0 0.5rem;
  transition: var(--transition-fast);
}

.lang-select-wrap:hover {
  border-color: var(--primary);
  background: #ffffff;
}

.lang-select-wrap:focus-within {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(34, 139, 63, 0.15);
}

.lang-select-icon,
.lang-select-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  pointer-events: none;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--text-heading);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  /* Room for the globe and the chevron, which sit outside the select itself
     so the native picker's own hit area stays the whole control. */
  padding: 0.45rem 0.35rem 0.45rem 0.4rem;
  /* Wide enough for the longest option (Français) so switching language
     does not resize the navbar. */
  min-width: 5.5rem;
}

/* The dropdown list is drawn by the OS and does not inherit the page font,
   so the options are styled explicitly for the few browsers that allow it. */
.lang-select option {
  background: #ffffff;
  color: var(--text-heading);
  font-weight: 600;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  position: relative;
  background: linear-gradient(135deg, var(--surface-dark) 0%, #172418 100%);
  color: #ffffff;
  padding: 4.5rem 1.5rem 5rem 1.5rem;
  overflow: hidden;
}

.hero-bg-glow {
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 850px;
  height: 550px;
  background: radial-gradient(circle, rgba(79, 186, 87, 0.22) 0%, rgba(15, 23, 42, 0) 70%);
  pointer-events: none;
}

.hero-container {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 10;
}

.badge-group {
  margin-bottom: 1.25rem;
}

.hero-badge {
  display: inline-block;
  background: rgba(79, 186, 87, 0.15);
  border: 1px solid rgba(79, 186, 87, 0.35);
  color: #72d67a;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.35rem 1.125rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.text-gradient {
  background: linear-gradient(135deg, #a3ebb5 0%, #4fba57 50%, #3da545 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  font-size: 1.125rem;
  color: #94a3b8;
  max-width: 760px;
  margin: 0 auto 2.25rem auto;
  line-height: 1.7;
}

.platform-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.875rem;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   Main Content Container
   ========================================================================== */
.main-content {
  max-width: 1280px;
  margin: -2rem auto 4rem auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 20;
}

/* Overview Card */
.overview-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2.5rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.5rem;
  align-items: center;
}

.overview-heading {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.overview-text p {
  color: var(--text-body);
  font-size: 1rem;
  margin-bottom: 0.875rem;
  line-height: 1.65;
}

.overview-metrics {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.metric-box {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.75rem;
}
.metric-box:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.metric-num {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--primary-dark);
  line-height: 1.1;
}

.metric-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ==========================================================================
   Controls Section (Filter Tabs & Search)
   ========================================================================== */
.controls-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  color: var(--text-body);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.filter-btn.active {
  background: var(--primary-dark);
  color: #ffffff;
  border-color: var(--primary-dark);
}

.filter-btn:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.search-box {
  position: relative;
  min-width: 320px;
  flex-grow: 1;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#permission-search {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  background: var(--surface-card);
  color: var(--text-heading);
  outline: none;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

#permission-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 186, 87, 0.2);
}

/* ==========================================================================
   Permissions Cards Grid
   ========================================================================== */
.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(560px, 1fr));
  gap: 2rem;
  margin-bottom: 3.5rem;
}

.perm-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.perm-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.perm-card-header {
  padding: 1.75rem 1.75rem 1.25rem 1.75rem;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.perm-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.perm-icon-wrapper.core {
  background: var(--primary-surface);
  color: var(--primary-dark);
}

.perm-icon-wrapper.optional {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
}

.perm-icon-wrapper.restricted {
  background: rgba(249, 115, 22, 0.1);
  color: var(--accent-orange);
}

.perm-title-area {
  flex-grow: 1;
}

.perm-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
}

.badge-core {
  background: var(--primary-surface);
  color: var(--primary-dark);
}

.badge-optional {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
}

.badge-recommended {
  background: var(--primary-surface);
  color: var(--primary-dark);
}

.badge-restricted {
  background: rgba(249, 115, 22, 0.1);
  color: #c2410c;
}

.badge-warning {
  background: rgba(244, 63, 94, 0.1);
  color: #be123c;
}

.perm-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.perm-tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.perm-card-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex-grow: 1;
}

.block-label {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.perm-block p {
  font-size: 0.9375rem;
  color: var(--text-body);
  line-height: 1.6;
}

/* Tech Spec Box */
.tech-spec-box {
  background: #0f172a;
  color: #f8fafc;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
}

.tech-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tech-key {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #94a3b8;
  min-width: 110px;
}

.code-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #1e293b;
  color: #72d67a;
  font-size: 0.8125rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.copy-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  margin-left: auto;
}

.copy-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

.copy-btn.copied {
  background: var(--primary-dark);
  color: #ffffff;
}

.tech-row.full-width {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.75rem;
}

.usage-quote {
  font-size: 0.8125rem;
  color: #cbd5e1;
  font-style: italic;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  width: 100%;
}

/* ==========================================================================
   Restricted Scope Section ("What We Never Ask For")
   ========================================================================== */
.restricted-scope-section,
.privacy-principles-section {
  margin-bottom: 4rem;
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 900;
  color: var(--text-heading);
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.text-danger {
  color: var(--accent-rose);
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

.never-grid {
  display grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
}

.never-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.never-card:hover {
  border-color: rgba(244, 63, 94, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.never-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.never-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.35rem;
}

.never-content p {
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.5;
}

/* ==========================================================================
   Data Principles Section
   ========================================================================== */
.principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.5rem;
}

.principle-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.principle-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.principle-number {
  font-size: 2rem;
  font-weight: 900;
  color: rgba(79, 186, 87, 0.25);
  line-height: 1;
  margin-bottom: 0.75rem;
}

.principle-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 0.5rem;
  letter-spacing: -0.015em;
}

.principle-card p {
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.6;
}

/* ==========================================================================
   Footer Component
   ========================================================================== */
.footer {
  background: var(--surface-dark);
  color: #94a3b8;
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem 2rem 2.5rem;
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-app {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  display: block;
  margin-bottom: 0.5rem;
}

.footer-brand p {
  font-size: 0.875rem;
  max-width: 480px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-link {
  color: #72d67a;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.footer-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  font-size: 0.8125rem;
  color: #64748b;
}

/* Toast Component */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface-dark);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(79, 186, 87, 0.3);
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition-normal);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .permissions-grid {
    grid-template-columns: 1fr;
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 3.5rem 1rem 4rem 1rem;
  }
  .nav-container {
    padding: 0.75rem 1rem;
  }
  .main-content {
    padding: 0 1rem;
  }
  .controls-section {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: 100%;
    min-width: 100%;
  }
  .status-pill {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.85rem;
  }
  .perm-card-header {
    flex-direction: column;
  }
  .never-grid {
    grid-template-columns: 1fr;
  }
  .footer-container {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ==========================================================================
   Arabic / Right-to-Left
   ==========================================================================
   `dir="rtl"` on <html> (set by setLanguage) already mirrors the layout:
   flex and grid order, text alignment, and scroll direction all follow the
   document direction for free. What it does NOT mirror is anything pinned
   with a physical `left`/`right` or offset with a physical margin — those
   name a side of the screen, not a side of the reading order, so they stay
   put and end up on the wrong edge. Each one below is a rule the stylesheet
   states physically; they are restated here for RTL rather than rewritten as
   logical properties, which would change LTR rendering too.
   ========================================================================== */

/* Arabic needs its own face — Inter ships no Arabic glyphs, so without this
   the text falls back to whatever the OS picks and stops matching the page. */
html[dir="rtl"] body {
  font-family: 'IBM Plex Sans Arabic', 'Inter', system-ui, -apple-system, sans-serif;
}

/* Arabic script sits taller than Latin at the same size; a little extra
   leading keeps the dense paragraphs readable. */
html[dir="rtl"] p,
html[dir="rtl"] .perm-tagline,
html[dir="rtl"] .hero-description {
  line-height: 1.85;
}

/* Skip link: pinned to the physical left. */
html[dir="rtl"] .skip {
  left: auto;
  right: 1rem;
}

/* Search glyph: absolutely positioned inside the field. */
html[dir="rtl"] .search-icon {
  left: auto;
  right: 1rem;
}
html[dir="rtl"] .search-box input {
  padding-left: 1rem;
  padding-right: 3rem;
}

/* Copy button is pushed to the end of its row with `margin-left: auto`. */
html[dir="rtl"] .copy-btn {
  margin-left: 0;
  margin-right: auto;
}

/* The usage quote's accent bar and its matching corner radii. */
html[dir="rtl"] .usage-quote {
  border-left: none;
  border-right: 3px solid var(--primary);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* Toast is pinned to the physical bottom-right. */
html[dir="rtl"] .toast {
  right: auto;
  left: 2rem;
}

/* Code identifiers, file names and Info.plist keys stay left-to-right even
   inside Arabic prose — an RTL run would otherwise reorder the dots and
   underscores and render `SYSTEM_ALERT_WINDOW` unreadable. */
html[dir="rtl"] code,
html[dir="rtl"] .code-pill,
html[dir="rtl"] .tech-key {
  direction: ltr;
  unicode-bidi: embed;
  text-align: left;
}



/* ==========================================================================
   Search empty state
   ========================================================================== */
.search-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
  text-align: center;
}

.search-empty p {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* The globe/chevron flank the select; `dir="rtl"` reverses the flex row for
   free, but the select's own text needs to follow the language, not the
   document — Arabic reads right-aligned, Latin option names do not. */
html[dir="rtl"] .lang-select {
  text-align: right;
  padding: 0.45rem 0.4rem 0.45rem 0.35rem;
}

/* The switcher was pinned LTR while it was a fixed EN/FR button sequence.
   A <select> shows one value at a time and has nothing to mirror wrongly, so
   it follows the document direction like everything else. */
html[dir="rtl"] .lang-select-wrap {
  direction: rtl;
}
