/* App Overview — shares the visual language of /terms (charter layout). */
:root {
  --bg-primary: #000000;
  --bg-surface: #0a0a0a;
  --bg-card: #121212;
  --border-color: #262626;
  --border-focus: #3f3f46;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #ffffff;
  --positive: #22c55e;
  --font-en: 'Inter', system-ui, -apple-system, sans-serif;
  --font-ar: 'Cairo', system-ui, -apple-system, sans-serif;
  --header-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-en);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
html[dir="rtl"] body { font-family: var(--font-ar); }

/* ---------- Header ---------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 16px;
}
.brand svg { width: 28px; height: 28px; }

.header-actions { display: flex; align-items: center; gap: 16px; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}
.lang-switch button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}
.lang-switch button[aria-pressed="true"] { background: #ffffff; color: #000000; }

/* ---------- Layout ---------- */
.layout {
  max-width: 1200px;
  margin: var(--header-h) auto 0;
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: calc(100vh - var(--header-h));
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  padding: 40px 24px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
html[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border-color); }
@media (max-width: 900px) {
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  html[dir="rtl"] .sidebar { border-left: none; }
  .sidebar-eye-container { display: none; }
}

.sidebar-top h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.sidebar-top p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 32px;
}

.nav-chapters { display: flex; flex-direction: column; gap: 6px; list-style: none; }
.nav-chapters a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.nav-chapters a:hover { color: var(--text-primary); background: var(--bg-surface); }
.nav-chapters a.active { color: #ffffff; background: var(--bg-card); border-color: var(--border-color); }
.nav-num { font-family: monospace; font-size: 11px; color: var(--text-muted); }

.sidebar-eye-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0 10px;
}
.sidebar-eye-container svg { width: 140px; height: auto; }

.main-content { padding: 48px 48px 96px; max-width: 760px; }
@media (max-width: 768px) { .main-content { padding: 24px 16px 64px; } }

/* ---------- Manifesto ---------- */
.manifesto-box {
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border-color);
}
.manifesto-box h2 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.5px;
}
.manifesto-word {
  display: inline;
  color: var(--text-muted);
  transition: color 0.3s ease;
  margin-right: 0.3em;
}
html[dir="rtl"] .manifesto-word { margin-right: 0; margin-left: 0.3em; }
.manifesto-word.revealed { color: var(--text-primary); }

/* ---------- Chapters ---------- */
.chapter-section { margin-bottom: 64px; scroll-margin-top: 96px; }

.chapter-header { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.chapter-tag {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 1px;
}
.chapter-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }

.clause-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 28px;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.clause-card:hover { border-color: var(--border-focus); background: var(--bg-card); }

.clause-card.has-media {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 28px;
  align-items: center;
}
@media (max-width: 640px) {
  .clause-card.has-media { grid-template-columns: 1fr; }
  .clause-card.has-media .device { justify-self: center; }
}

.clause-body {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 24px;
}

.feature-col {
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}
.feature-col h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--positive);
}
.feature-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.feature-col li {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}
.feature-col li::before { content: "\2713"; color: var(--positive); font-weight: bold; }

/* ---------- Device frame + video ---------- */
.device {
  position: relative;
  width: 100%;
  max-width: 240px;
  padding: 6px;
  border-radius: 30px;
  border: 1px solid var(--border-focus);
  background: #000000;
  overflow: hidden;
}
.device video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 24px;
  background: #000000;
}

.device-toggle {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}
.device-toggle:focus-visible { outline: 2px solid #ffffff; outline-offset: -4px; border-radius: 30px; }
.device-toggle .icon {
  width: 52px;
  height: 52px;
  padding: 14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--border-focus);
  backdrop-filter: blur(6px);
  display: none;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
/* Only the replay button is shown, and only once the video has finished. */
.device.is-ended .icon-replay { display: block; opacity: 1; transform: none; }

/* Reduced motion disables autoplay, so a play button is needed to start. */
@media (prefers-reduced-motion: reduce) {
  .device:not(.is-playing):not(.is-ended) .icon-play { display: block; opacity: 1; transform: none; }
}

/* ---------- Call to action ---------- */
.cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 28px;
}
.cta-card h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 6px; }
.cta-card p { color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 999px;
  background: #ffffff;
  color: #000000;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.cta-button:hover { opacity: 0.88; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border-color);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-primary);
}
.footer-links { display: flex; justify-content: center; gap: 20px; margin-bottom: 12px; }
.footer-links a { color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--text-primary); }

/* ---------- Scroll reveal (only when JS is available) ---------- */
html.js .chapter-section,
html.js .cta-section {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.js .chapter-section .device {
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.7s ease 0.2s, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s;
}
html.js .chapter-section.in-view,
html.js .cta-section.in-view { opacity: 1; transform: none; }
html.js .chapter-section.in-view .device { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .chapter-section,
  html.js .cta-section,
  html.js .chapter-section .device {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
