/* ==========================================
   Ankh AI Protocol — Site HTML Pur
   Design: Midnight Egyptian / Deep Blue
   ========================================== */

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  background: #0A1628;
  color: #F8F6F0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ---- Typography ---- */
.font-display { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }
.font-body { font-family: 'DM Sans', sans-serif; font-weight: 400; }
.font-mono { font-family: 'IBM Plex Mono', monospace; font-weight: 400; }

h1, h2, h3, h4, h5, h6 { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }

/* ---- Colors ---- */
.bg-midnight { background: #0A1628; }
.bg-deep-nile { background: #1E293B; }
.bg-nile-dark { background: #0D1E35; }
.text-gold { color: #F5C542; }
.text-blue { color: #3B82F6; }
.text-cyan { color: #22D3EE; }
.text-parchment { color: #F8F6F0; }
.text-sand { color: #D4C5A9; }
.text-white { color: #FFFFFF; }
.text-lapis { color: #1A3A5C; }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 900px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 24px; }

.section-padding { padding: 100px 0; }
@media (min-width: 768px) { .section-padding { padding: 140px 0; } }

/* ---- Header ---- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(248, 246, 240, 0.06);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
@media (min-width: 1024px) { .site-header { padding: 0 48px; } }

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon { width: 22px; height: 22px; }
.logo-text { font-family: 'Instrument Serif', serif; font-size: 20px; color: #FFFFFF; }

.nav-desktop { display: none; gap: 28px; }
@media (min-width: 1024px) { .nav-desktop { display: flex; } }

.nav-desktop a {
  font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 13px;
  color: #D4C5A9; text-decoration: none; letter-spacing: 0.02em;
  transition: color 0.3s ease;
}
.nav-desktop a:hover { color: #F5C542; }

/* Mobile menu */
.menu-toggle { display: flex; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 4px; }
.menu-toggle span { display: block; width: 22px; height: 2px; background: #F8F6F0; transition: all 0.3s ease; }
@media (min-width: 1024px) { .menu-toggle { display: none; } }

.nav-mobile {
  display: none; position: fixed; top: 56px; left: 0; right: 0;
  background: rgba(10, 22, 40, 0.97); backdrop-filter: blur(12px);
  padding: 20px 24px; flex-direction: column; gap: 16px; z-index: 99;
}
.nav-mobile.active { display: flex; }
.nav-mobile a { font-size: 14px; color: #D4C5A9; text-decoration: none; font-weight: 500; }
.nav-mobile a:hover { color: #F5C542; }

/* ---- Buttons ---- */
.btn {
  display: inline-block; padding: 14px 32px;
  font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 13px;
  letter-spacing: 0.05em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; border: none;
  transition: all 0.3s ease;
}
.btn-primary { background: #F5C542; color: #0A1628; }
.btn-primary:hover { background: #FFFFFF; }
.btn-secondary { background: transparent; color: #F5C542; border: 1px solid #F5C542; }
.btn-secondary:hover { background: rgba(245, 197, 66, 0.1); }
.btn-small { padding: 10px 24px; font-size: 12px; }

/* ---- Section Label ---- */
.section-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  letter-spacing: 0.15em; text-transform: uppercase; color: #F5C542;
  display: block; margin-bottom: 16px;
}

/* ---- Cards ---- */
.glass-card {
  background: rgba(10, 22, 40, 0.7);
  border: 1px solid rgba(248, 246, 240, 0.08);
  border-radius: 4px; padding: 32px;
  backdrop-filter: blur(12px);
}
.cyan-card {
  background: rgba(10, 22, 40, 0.85);
  border: 1px solid #22D3EE;
  border-radius: 4px; padding: 24px;
}
.metric-pill {
  display: inline-block;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 100px; padding: 8px 20px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #F8F6F0;
}

/* ---- Hero ---- */
.hero {
  position: relative; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 120px 24px 80px;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, #0D1E35 0%, #0A1628 50%, #060F1C 100%);
}
.hero-stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, rgba(245,197,66,0.4), transparent),
    radial-gradient(1px 1px at 50px 80px, rgba(59,130,246,0.3), transparent),
    radial-gradient(1.5px 1.5px at 130px 50px, rgba(34,211,238,0.3), transparent),
    radial-gradient(1px 1px at 200px 120px, rgba(248,246,240,0.3), transparent),
    radial-gradient(1.5px 1.5px at 300px 40px, rgba(245,197,66,0.3), transparent),
    radial-gradient(1px 1px at 400px 90px, rgba(59,130,246,0.2), transparent),
    radial-gradient(1.5px 1.5px at 500px 60px, rgba(34,211,238,0.3), transparent),
    radial-gradient(1px 1px at 600px 130px, rgba(248,246,240,0.2), transparent),
    radial-gradient(1.5px 1.5px at 700px 30px, rgba(245,197,66,0.3), transparent),
    radial-gradient(1px 1px at 80px 180px, rgba(59,130,246,0.3), transparent),
    radial-gradient(1.5px 1.5px at 250px 200px, rgba(34,211,238,0.3), transparent),
    radial-gradient(1px 1px at 450px 170px, rgba(248,246,240,0.2), transparent),
    radial-gradient(1.5px 1.5px at 650px 190px, rgba(245,197,66,0.3), transparent);
  background-size: 750px 220px;
  animation: twinkle 8s ease-in-out infinite alternate;
}
@keyframes twinkle {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}
.hero-mandala {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -55%);
  width: 500px; height: 500px; opacity: 0.12; pointer-events: none;
}
.hero-mandala svg { width: 100%; height: 100%; animation: rotateMandala 120s linear infinite; }
@keyframes rotateMandala { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.hero-content { position: relative; z-index: 2; max-width: 800px; }
.hero h1 { font-size: clamp(56px, 10vw, 140px); letter-spacing: -0.02em; line-height: 0.92; color: #FFFFFF; }
.hero-subtitle { font-size: clamp(16px, 2vw, 24px); color: #F8F6F0; max-width: 560px; margin: 20px auto 0; line-height: 1.5; }
.hero-buttons { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 40px; }
@media (min-width: 640px) { .hero-buttons { flex-direction: row; justify-content: center; } }

/* ---- Grid layouts ---- */
.grid-2 { display: grid; gap: 32px; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; gap: 48px; } }
.grid-3 { display: grid; gap: 24px; }
@media (min-width: 768px) { .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }
.grid-4 { display: grid; gap: 24px; }
@media (min-width: 768px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; } }

/* ---- Animations on scroll ---- */
.reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ---- Timeline ---- */
.timeline { position: relative; padding-left: 32px; }
@media (min-width: 768px) { .timeline { padding-left: 0; } }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: rgba(248, 246, 240, 0.12);
}
@media (min-width: 768px) {
  .timeline::before { left: 50%; transform: translateX(-50%); }
}
.timeline-item { position: relative; margin-bottom: 32px; }
.timeline-dot {
  position: absolute; left: -28px; top: 24px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid; background: #0D1E35;
}
@media (min-width: 768px) {
  .timeline-dot { left: 50%; transform: translateX(-50%); }
}
.timeline-item-left .timeline-content { margin-right: auto; }
.timeline-item-right .timeline-content { margin-left: auto; }
@media (min-width: 768px) {
  .timeline-content { width: 45%; }
}

/* ---- Donut chart ---- */
.donut-container { position: relative; width: 260px; height: 260px; margin: 0 auto; }
.donut { width: 100%; height: 100%; border-radius: 50%; position: relative; }
.donut-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 150px; height: 150px; border-radius: 50%;
  background: #0D1E35; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.donut-label { font-family: 'Instrument Serif', serif; font-size: 42px; color: #FFFFFF; line-height: 1; }
.donut-sublabel { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #D4C5A9; margin-top: 4px; }

/* ---- Footer ---- */
.site-footer { background: #0A1628; border-top: 1px solid rgba(248, 246, 240, 0.08); padding: 48px 0 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a { font-size: 13px; color: #D4C5A9; text-decoration: none; font-weight: 500; transition: color 0.3s; }
.footer-links a:hover { color: #F5C542; }
.footer-bottom { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: rgba(212, 197, 169, 0.5); margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(248, 246, 240, 0.05); }

/* ---- Separator ---- */
.separator { width: 80px; height: 1px; background: rgba(248, 246, 240, 0.15); margin: 48px auto; }

/* ---- Page content (docs) ---- */
.doc-page { padding-top: 80px; min-height: 100vh; }
.doc-header { padding: 60px 0 40px; }
.doc-body { padding-bottom: 80px; }
.doc-body h2 { font-size: clamp(26px, 3vw, 40px); color: #FFFFFF; margin: 48px 0 20px; line-height: 1.1; }
.doc-body h3 { font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 20px; color: #F5C542; margin: 32px 0 12px; }
.doc-body h4 { font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 17px; color: #F8F6F0; margin: 24px 0 10px; }
.doc-body p { color: #D4C5A9; margin-bottom: 16px; font-size: 15px; line-height: 1.7; }
.doc-body ul, .doc-body ol { margin: 16px 0 16px 24px; color: #D4C5A9; font-size: 15px; line-height: 1.7; }
.doc-body li { margin-bottom: 8px; }
.doc-body table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 14px; }
.doc-body th { background: rgba(30, 41, 59, 0.6); color: #F5C542; text-align: left; padding: 12px 16px; font-weight: 500; }
.doc-body td { padding: 10px 16px; border-bottom: 1px solid rgba(248, 246, 240, 0.06); color: #D4C5A9; }
.doc-body tr:hover td { background: rgba(30, 41, 59, 0.3); }
.doc-body blockquote { border-left: 3px solid #F5C542; padding-left: 20px; margin: 24px 0; font-style: italic; color: #F8F6F0; }
.doc-body .highlight-box { background: rgba(30, 41, 59, 0.5); border: 1px solid rgba(59, 130, 246, 0.2); border-radius: 4px; padding: 24px; margin: 24px 0; }
.doc-body .metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 24px 0; }
.doc-body .metric-box { background: rgba(10, 22, 40, 0.7); border: 1px solid rgba(248, 246, 240, 0.08); border-radius: 4px; padding: 24px; text-align: center; }
.doc-body .metric-box .value { font-family: 'Instrument Serif', serif; font-size: 28px; color: #F5C542; }
.doc-body .metric-box .label { font-size: 12px; color: #D4C5A9; margin-top: 4px; }

/* ---- Article styling ---- */
.article-meta { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #D4C5A9; margin-bottom: 8px; }
.article-quote { border-left: 3px solid #F5C542; padding: 16px 20px; margin: 24px 0; background: rgba(30, 41, 59, 0.4); }
.article-quote p { color: #F8F6F0; font-style: italic; margin: 0; }
.article-quote cite { display: block; margin-top: 8px; font-size: 12px; color: #D4C5A9; font-style: normal; }

/* ---- Press kit ---- */
.press-info-table { width: 100%; margin: 16px 0; }
.press-info-table td { padding: 8px 16px 8px 0; border: none; font-size: 14px; }
.press-info-table td:first-child { color: #D4C5A9; width: 40%; }
.press-info-table td:last-child { color: #F8F6F0; }

/* ---- Print styles ---- */
@media print {
  .site-header, .hero-buttons { display: none; }
  .doc-page { padding-top: 20px; }
  body { background: white; color: black; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0A1628; }
::-webkit-scrollbar-thumb { background: #1E293B; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2E3A4B; }

/* ---- Canvas effects ---- */
canvas { display: block; }

/* ==========================================
   MULTI-LANGUAGE SUPPORT
   ========================================== */

/* ---- Language Selector ---- */
.lang-selector {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(248, 246, 240, 0.08);
  border-radius: 4px;
  padding: 3px;
}
.lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.lang-btn:hover {
  background: rgba(245, 197, 66, 0.15);
}
.lang-btn.active {
  background: rgba(245, 197, 66, 0.25);
  box-shadow: 0 0 0 1px rgba(245, 197, 66, 0.4);
}
.lang-flag {
  font-size: 14px;
  line-height: 1;
  filter: grayscale(0.3);
  transition: filter 0.2s;
}
.lang-btn.active .lang-flag,
.lang-btn:hover .lang-flag {
  filter: grayscale(0);
}

/* ---- RTL Support ---- */
[dir="rtl"] .site-header {
  flex-direction: row-reverse;
}
[dir="rtl"] .logo {
  flex-direction: row-reverse;
}
[dir="rtl"] .nav-desktop {
  flex-direction: row-reverse;
}
[dir="rtl"] .hero-content {
  direction: rtl;
}
[dir="rtl"] .hero-buttons {
  flex-direction: row-reverse;
}
[dir="rtl"] .grid-2 {
  direction: rtl;
}
[dir="rtl"] .grid-3 {
  direction: rtl;
}
[dir="rtl"] .grid-4 {
  direction: rtl;
}
[dir="rtl"] .timeline {
  padding-left: 0;
  padding-right: 32px;
}
[dir="rtl"] .timeline::before {
  left: auto;
  right: 8px;
}
@media (min-width: 768px) {
  [dir="rtl"] .timeline {
    padding-right: 0;
  }
  [dir="rtl"] .timeline::before {
    right: 50%;
    transform: translateX(50%);
  }
}
[dir="rtl"] .timeline-dot {
  left: auto;
  right: -28px;
}
@media (min-width: 768px) {
  [dir="rtl"] .timeline-dot {
    right: 50%;
    transform: translateX(50%);
  }
}
[dir="rtl"] .doc-layout {
  direction: rtl;
}
[dir="rtl"] .doc-toc a.l2 {
  padding-left: 0;
  padding-right: 12px;
}
[dir="rtl"] .doc-toc {
  direction: rtl;
}
[dir="rtl"] .metric-grid,
[dir="rtl"] .footer-links,
[dir="rtl"] .footer-bottom {
  direction: rtl;
}
[dir="rtl"] .container,
[dir="rtl"] .container-narrow,
[dir="rtl"] .container-wide {
  direction: rtl;
}
[dir="rtl"] .hero-content {
  direction: rtl;
}
[dir="rtl"] .hero-buttons {
  direction: rtl;
}

/* Fix nested LTR content inside RTL */
[dir="rtl"] .metric-box .font-mono,
[dir="rtl"] .donut-label,
[dir="rtl"] code,
[dir="rtl"] .font-mono {
  direction: ltr;
  unicode-bidi: embed;
}

/* ---- Chinese Typography Adjustments ---- */
.lang-zh body {
  line-height: 1.75;
}
.lang-zh h1, .lang-zh h2 {
  line-height: 1.2;
}
.lang-zh .section-label {
  letter-spacing: 0.05em;
}
.lang-zh .doc-body p {
  line-height: 1.85;
}

/* ---- Arabic Typography ---- */
[dir="rtl"] body {
  font-family: 'DM Sans', 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
}
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6 {
  line-height: 1.4;
}
[dir="rtl"] .article-quote {
  border-left: none;
  border-right: 3px solid #F5C542;
  padding-left: 20px;
  padding-right: 20px;
}
[dir="rtl"] .highlight-box {
  direction: rtl;
}
[dir="rtl"] table {
  direction: rtl;
}
[dir="rtl"] .hero-subtitle {
  direction: rtl;
}
[dir="rtl"] .hero {
  direction: rtl;
}

/* Add Noto Sans Arabic for Arabic script */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500&display=swap');
