/* =========================================================
   TRION — Developer-grade design system
   Light-first, dark-mode-capable, RTL-first theme
   ========================================================= */

:root {
  /* Light theme (default) */
  --bg: #f8fafc;
  --bg-soft: #eef2f7;
  --bg-rgb: 248, 250, 252;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-muted: #52607a;
  --text-dim: #8592a8;

  --primary: #0ea5e9;    /* sky */
  --primary-2: #0284c7;
  --primary-rgb: 14, 165, 233;
  --accent: #3b82f6;     /* blue */
  --accent-rgb: 59, 130, 246;
  --accent-2: #6366f1;   /* indigo */
  --accent-2-rgb: 99, 102, 241;
  --on-accent: #ffffff;
  --warn: #d97706;
  --danger: #dc2626;
  --danger-rgb: 220, 38, 38;

  --font-ar: 'Cairo', 'Tahoma', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-glow: 0 0 0 1px var(--border), 0 20px 60px -20px rgba(var(--primary-rgb), 0.18);
  --container-max: 1200px;

  /* Terminal / code surfaces: always dark, like a real editor, in both themes */
  --term-bg: #0d121d;
  --term-bg-2: #111827;
  --term-border: rgba(148, 163, 184, 0.18);
  --term-text: #e7edf5;
  --term-text-dim: #7b8698;
}

:root[data-theme="dark"] {
  --bg: #05070a;
  --bg-soft: #0a0e16;
  --bg-rgb: 5, 7, 10;
  --surface: #0d121d;
  --surface-2: #111827;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e7edf5;
  --text-muted: #8b96a8;
  --text-dim: #5b6576;

  --primary: #38bdf8;
  --primary-2: #0ea5e9;
  --primary-rgb: 56, 189, 248;
  --accent: #3b82f6;
  --accent-rgb: 59, 130, 246;
  --accent-2: #6366f1;
  --accent-2-rgb: 99, 102, 241;
  --on-accent: #ffffff;
  --warn: #fbbf24;
  --danger: #f85149;
  --danger-rgb: 248, 81, 73;

  --shadow-glow: 0 0 0 1px var(--border), 0 20px 60px -20px rgba(var(--primary-rgb), 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  line-height: 1.75;
  position: relative;
  transition: background-color .25s ease, color .25s ease;
}

body::after {
  content: "";
  position: fixed;
  top: -10%;
  inset-inline-start: -10%;
  width: 60vw;
  height: 60vw;
  z-index: -1;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.13), transparent 60%);
  filter: blur(20px);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--on-accent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.container-trion {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.mono { font-family: var(--font-mono); }

.text-muted-trion { color: var(--text-muted); }

.text-gradient {
  background: linear-gradient(90deg, var(--accent), var(--primary) 60%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.14);
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  padding: .35rem .85rem;
  border-radius: 999px;
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  width: 46px; height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all .2s ease;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Buttons ---------- */
.btn-trion {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-ar);
  font-weight: 700;
  padding: .8rem 1.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn-trion-primary {
  background: linear-gradient(135deg, var(--accent), var(--primary) 55%, var(--accent-2));
  color: var(--on-accent);
  box-shadow: 0 10px 30px -10px rgba(var(--accent-rgb), 0.45);
}
.btn-trion-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -12px rgba(var(--accent-rgb), 0.6); color: var(--on-accent); }
.btn-trion-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-trion-outline:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.btn-trion-sm { padding: .5rem 1rem; font-size: .875rem; border-radius: 8px; }

/* ---------- Navbar ---------- */
.trion-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(14px) saturate(140%);
  background: rgba(var(--bg-rgb), 0.78);
  border-bottom: 1px solid var(--border);
}
.trion-nav .container-trion { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.trion-logo { display: flex; align-items: center; gap: .6rem; font-family: var(--font-mono); font-weight: 700; font-size: 1.25rem; color: var(--text); }
.trion-logo .bracket { color: var(--accent); }
.trion-logo .dot { color: var(--primary); }
.brand-mark { height: 38px; width: auto; display: block; }
.brand-mark-dark { display: none; }
:root[data-theme="dark"] .brand-mark-light { display: none; }
:root[data-theme="dark"] .brand-mark-dark { display: block; }
.trion-footer .brand-mark { height: 46px; }
.admin-sidebar .brand-mark { height: 32px; }
/* Admin sidebar background stays dark always (see --term-* convention) — force the white logo variant regardless of site theme */
.admin-sidebar .brand-mark-light { display: none; }
.admin-sidebar .brand-mark-dark { display: block; }
.trion-nav-links { display: flex; align-items: center; gap: 2rem; list-style: none; margin: 0; padding: 0; }
.trion-nav-links a {
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
  padding-block: .3rem;
  transition: color .2s ease;
}
.trion-nav-links a:hover, .trion-nav-links a.active { color: var(--text); }
.trion-nav-links a.active::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -6px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 2px;
}
.trion-nav-actions { display: flex; align-items: center; gap: .75rem; }
.trion-burger {
  display: none;
  width: 46px; height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  align-items: center; justify-content: center;
}

/* ---------- Hero ---------- */
.hero { padding: 5.5rem 0 4.5rem; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 3rem; align-items: center; }
.hero-title { font-size: clamp(2.3rem, 4.5vw, 3.75rem); font-weight: 800; line-height: 1.18; margin: 1.1rem 0 1.25rem; }
.hero-title .cursor { display: inline-block; width: .55ch; background: var(--accent); animation: blink 1s steps(1) infinite; }
.hero-sub { color: var(--text-muted); font-size: 1.1rem; max-width: 46ch; margin-bottom: 2rem; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.hero-stats { display: flex; gap: 2.2rem; flex-wrap: wrap; }
.hero-stat b { display: block; font-family: var(--font-mono); font-size: 1.6rem; color: var(--text); }
.hero-stat span { color: var(--text-dim); font-size: .85rem; }

@keyframes blink { 50% { opacity: 0; } }

/* Terminal card — stays dark like a real code editor in both themes */
.terminal {
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glow);
  overflow: hidden;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .8rem 1rem;
  background: var(--term-bg-2);
  border-bottom: 1px solid var(--term-border);
}
.terminal-dot { width: 11px; height: 11px; border-radius: 50%; }
.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27c93f; }
.terminal-title { margin-inline-start: .5rem; font-family: var(--font-mono); font-size: .78rem; color: var(--term-text-dim); }
.terminal-body { padding: 1.4rem 1.5rem; font-family: var(--font-mono); font-size: .88rem; color: #c9d1d9; direction: ltr; text-align: left; min-height: 240px; }
.terminal-body .line { margin-bottom: .55rem; white-space: pre-wrap; }
.tk-key { color: #ff7b72; }
.tk-fn { color: #d2a8ff; }
.tk-str { color: #a5d6ff; }
.tk-com { color: #6b7280; }
.tk-var { color: #79c0ff; }
.tk-num { color: #79c0ff; }
.tk-prop { color: #79c0ff; }
.tk-punc { color: #c9d1d9; }
.type-cursor { display: inline-block; width: 8px; height: 1.05em; background: var(--accent); vertical-align: text-bottom; animation: blink .9s steps(1) infinite; }

/* Forms nested inside a terminal card keep the dark editor look too */
.terminal .form-trion label { color: var(--term-text); }
.terminal .form-trion .form-control,
.terminal .form-trion .form-select {
  background: var(--term-bg-2);
  border-color: var(--term-border);
  color: var(--term-text);
}
.terminal .form-trion .form-control::placeholder { color: var(--term-text-dim); }
.terminal .form-trion .form-control:focus,
.terminal .form-trion .form-select:focus {
  background: var(--term-bg-2);
  border-color: var(--primary);
  color: var(--term-text);
}
.terminal .form-check-label { color: var(--term-text); }

/* ---------- Section shell ---------- */
.section { padding: 5rem 0; }
.section-head { max-width: 700px; margin-bottom: 3rem; }
.section-head h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 800; margin: .9rem 0 .75rem; }
.section-head p { color: var(--text-muted); font-size: 1.05rem; }
.section-alt { background: var(--bg-soft); }

/* ---------- Cards ---------- */
.card-trion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.9rem;
  height: 100%;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  position: relative;
}
.card-trion:hover { transform: translateY(-6px); border-color: rgba(var(--primary-rgb), 0.35); box-shadow: 0 20px 50px -24px rgba(var(--primary-rgb), 0.35); }
.card-tag { font-family: var(--font-mono); color: var(--text-dim); font-size: .8rem; position: absolute; top: 1.5rem; inset-inline-end: 1.7rem; }
.card-icon {
  width: 66px; height: 66px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--primary) 60%, var(--accent-2));
  color: var(--on-accent);
  font-size: 1.75rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 10px 24px -10px rgba(var(--accent-rgb), 0.55);
}
.card-trion h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: .6rem; }
.card-trion p { color: var(--text-muted); font-size: .95rem; margin: 0; }

/* Project cards */
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; height: 100%; transition: transform .25s ease, border-color .25s ease; }
.project-card:hover { transform: translateY(-6px); border-color: rgba(var(--accent-2-rgb), .4); }
.project-thumb { aspect-ratio: 16/10; background: linear-gradient(135deg, var(--surface-2), var(--bg-soft)); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; border-bottom: 1px solid var(--border); }
.project-thumb .bracket-deco { font-family: var(--font-mono); font-size: 3.5rem; color: var(--border-strong); font-weight: 800; }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-body { padding: 1.5rem 1.6rem 1.7rem; }
.project-cat { font-family: var(--font-mono); font-size: .74rem; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.project-body h3 { margin: .5rem 0 .6rem; font-size: 1.2rem; font-weight: 800; }
.project-body p { color: var(--text-muted); font-size: .93rem; }
.tech-pill { display: inline-block; font-family: var(--font-mono); font-size: .74rem; color: var(--primary-2); background: rgba(var(--primary-rgb), .1); border: 1px solid rgba(var(--primary-rgb), .25); padding: .18rem .6rem; border-radius: 999px; margin: .2rem; margin-inline-start: 0; }

.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.filter-chip { font-family: var(--font-mono); font-size: .82rem; padding: .5rem 1.1rem; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-muted); background: transparent; cursor: pointer; transition: all .2s ease; }
.filter-chip:hover { color: var(--text); border-color: var(--primary); }
.filter-chip.active { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--primary)); border-color: transparent; }

/* Team */
.team-card { text-align: center; padding: 2rem 1.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: transform .25s ease, border-color .25s ease; height: 100%; }
.team-card:hover { transform: translateY(-6px); border-color: rgba(var(--accent-rgb), .35); }
.team-avatar { width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 1.1rem; background: linear-gradient(135deg, var(--surface-2), var(--bg-soft)); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-weight: 800; font-size: 1.4rem; color: var(--accent); border: 1px solid var(--border); }
.team-card h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: .2rem; }
.team-card .role { font-family: var(--font-mono); font-size: .78rem; color: var(--primary-2); margin-bottom: .8rem; display: block; }
.team-card p { color: var(--text-muted); font-size: .88rem; }
.team-socials { display: flex; justify-content: center; gap: .6rem; margin-top: 1rem; }
.team-socials a { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1.05rem; transition: all .2s ease; }
.team-socials a:hover { color: var(--on-accent); border-color: var(--accent); background: linear-gradient(135deg, var(--accent), var(--primary)); }

/* Partners */
.partners-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1.2rem; }
.partner-logo { display: flex; align-items: center; justify-content: center; width: 130px; height: 90px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; transition: transform .25s ease, border-color .25s ease; }
.partner-logo:hover { transform: translateY(-4px); border-color: rgba(var(--accent-rgb), .35); }
.partner-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.partner-logo .partner-name { font-family: var(--font-mono); font-size: .82rem; color: var(--text-muted); text-align: center; }

/* Testimonials */
.quote-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; height: 100%; position: relative; }
.quote-card .stars { color: var(--warn); font-size: .85rem; margin-bottom: .9rem; }
.quote-card p.msg { color: var(--text); font-size: 1rem; margin-bottom: 1.3rem; }
.quote-author { display: flex; align-items: center; gap: .8rem; }
.quote-author .initial { width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); color: var(--accent); font-weight: 700; }
.quote-author b { display: block; font-size: .92rem; }
.quote-author span { color: var(--text-dim); font-size: .8rem; }

/* Stats strip */
.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 3rem 0; }
.stats-strip .stat { text-align: center; }
.stats-strip .stat b { font-family: var(--font-mono); font-size: 2.4rem; color: var(--text); display: block; }
.stats-strip .stat span { color: var(--text-muted); font-size: .9rem; }

/* Tech marquee */
.marquee { overflow: hidden; position: relative; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 1.6rem 0; }
.marquee-track { display: flex; gap: 3.5rem; width: max-content; animation: scroll-x 28s linear infinite; }
.marquee-track span { font-family: var(--font-mono); color: var(--text-dim); font-size: 1rem; white-space: nowrap; }
@keyframes scroll-x { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* CTA band */
.cta-band { background: linear-gradient(135deg, rgba(var(--accent-rgb), .09), rgba(var(--primary-rgb), .09)); border: 1px solid var(--border); border-radius: 24px; padding: 3.2rem; text-align: center; position: relative; overflow: hidden; }
.cta-band h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; margin-bottom: .8rem; }
.cta-band p { color: var(--text-muted); margin-bottom: 1.8rem; }

/* Forms */
.form-trion label { font-weight: 700; font-size: .9rem; margin-bottom: .4rem; display: block; }
.form-trion .form-control, .form-trion .form-select {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
}
.form-trion .form-control:focus, .form-trion .form-select:focus {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18);
}
.form-trion .form-control::placeholder { color: var(--text-dim); }
.form-trion textarea.form-control { min-height: 140px; }

/* Footer */
.trion-footer { border-top: 1px solid var(--border); padding: 3.5rem 0 1.5rem; margin-top: 4rem; }
.trion-footer h4 { font-weight: 800; margin-bottom: 1rem; font-size: 1rem; }
.trion-footer ul { list-style: none; padding: 0; margin: 0; }
.trion-footer li { margin-bottom: .6rem; }
.trion-footer a { color: var(--text-muted); transition: color .2s ease; }
.trion-footer a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 2.5rem; padding-top: 1.5rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; color: var(--text-dim); font-size: .85rem; }
.footer-socials { display: flex; gap: .6rem; }
.footer-socials a { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1.2rem; transition: all .2s ease; }
.footer-socials a:hover { color: var(--on-accent); border-color: var(--accent); background: linear-gradient(135deg, var(--accent), var(--primary)); }

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Badges for admin/status */
.badge-trion { font-family: var(--font-mono); font-size: .74rem; padding: .3rem .65rem; border-radius: 6px; }
.badge-featured { background: rgba(var(--accent-rgb), .12); color: var(--accent); border: 1px solid rgba(var(--accent-rgb), .3); }
.badge-unread { background: rgba(var(--danger-rgb), .12); color: var(--danger); border: 1px solid rgba(var(--danger-rgb), .3); }

/* Page header (inner pages) */
.page-hero { padding: 3.5rem 0 3rem; border-bottom: 1px solid var(--border); }
.page-hero .eyebrow { margin-bottom: 1rem; }
.page-hero h1 { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 800; }
.page-hero p { color: var(--text-muted); max-width: 60ch; margin-top: .8rem; }

.breadcrumb-trion { font-family: var(--font-mono); font-size: .82rem; color: var(--text-dim); }
.breadcrumb-trion a:hover { color: var(--accent); }

/* Responsive */
@media (max-width: 991px) {
  .trion-nav-links { display: none; }
  .trion-burger { display: flex; }
  .hero-grid { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 991px) {
  .trion-nav-links.mobile-open {
    display: flex;
    position: absolute;
    top: 76px;
    inset-inline: 0;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1.5rem 1.25rem;
    gap: 1.1rem;
  }
}
