/* ==========================================================================
   Beharsoft — shared site theme
   Every page loads this file. Per-page colour comes from --accent, set with a
   class on <body> (see "Project accents" below).
   Uses logical properties (inline-start/end) so Arabic (dir="rtl") just works.
   ========================================================================== */

:root {
  --bg: #0d151b;
  --bg-2: #101b22;
  --surface: #142129;
  --surface-2: #1a2a33;
  --ink: #f4f4eb;
  --muted: #b6c5c5;
  --faint: #7f9393;
  --mint: #a8e6cf;
  --lime: #d7f171;
  --orange: #ff9b71;
  --line: rgba(244, 244, 235, .13);
  --line-strong: rgba(244, 244, 235, .24);

  --accent: var(--lime);        /* overridden per project */
  --accent-ink: #172126;        /* text colour on top of --accent */
  --accent-soft: rgba(215, 241, 113, .12);

  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 26px;
  --max: 1180px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);

  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-ar: "Readex Pro", Tahoma, "Segoe UI", sans-serif;
}

/* Project accents ---------------------------------------------------------- */
.theme-nawyah        { --accent: #e0b34a; --accent-soft: rgba(224, 179, 74, .13); }
.theme-biogear       { --accent: #ff5a5f; --accent-ink: #fff; --accent-soft: rgba(255, 90, 95, .13); }
.theme-galaxy-prince { --accent: #c99bff; --accent-soft: rgba(201, 155, 255, .13); }
.theme-my-lost-parts { --accent: #7cc4ff; --accent-soft: rgba(124, 196, 255, .13); }
.theme-asmsam        { --accent: var(--orange); --accent-soft: rgba(255, 155, 113, .13); }

/* Base --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); line-height: 1.65; font-size: 1rem;
  overflow-x: hidden;
}
html[lang="ar"] body, .arabic { font-family: var(--font-ar); }
html[lang="ar"] body { line-height: 1.9; }
body::before {
  content: ""; position: absolute; z-index: -1; inset: 0 0 auto; height: 820px; pointer-events: none;
  background:
    radial-gradient(ellipse at 82% 8%, var(--accent-soft), transparent 50%),
    radial-gradient(ellipse at 6% 36%, rgba(255, 155, 113, .08), transparent 40%);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -.045em; margin: 0; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { letter-spacing: 0; line-height: 1.3; }
p { margin: 0 0 1em; }
.wrap { width: min(var(--max), calc(100% - 44px)); margin-inline: auto; }
.muted { color: var(--muted); }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 50; font-weight: 700; }
.skip-link:focus { top: 12px; }

/* Header ------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13, 21, 27, .88); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.nav { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.08rem; font-weight: 800; letter-spacing: .08em; font-family: var(--font); }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--lime); color: #172126; display: grid; place-items: center; font-weight: 900; font-size: 1.15rem; transform: rotate(-7deg); }
.brand b { color: var(--mint); }
.navlinks { display: flex; align-items: center; gap: 6px; }
.navlinks a { text-decoration: none; color: var(--muted); font-size: .92rem; padding: 8px 12px; border-radius: 8px; }
.navlinks a:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.navlinks a[aria-current="page"] { color: var(--accent); }
.lang-btn, .menu-btn {
  border: 1px solid var(--line-strong); border-radius: 99px; background: transparent; color: var(--ink);
  padding: 7px 14px; font: inherit; font-size: .88rem; cursor: pointer;
}
.lang-btn { margin-inline-start: 8px; font-family: var(--font-ar); }
html[lang="ar"] .lang-btn { font-family: var(--font); }
.lang-btn:hover, .menu-btn:hover { border-color: var(--accent); }
.menu-btn { display: none; }

/* Dropdown for projects in the nav */
.nav-projects { position: relative; }
.nav-projects > button {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .92rem; padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
.nav-projects > button:hover, .nav-projects.open > button { color: var(--ink); background: rgba(255, 255, 255, .05); }
.nav-projects > button::after { content: " ▾"; font-size: .75em; }
.nav-menu {
  position: absolute; inset-inline-start: 0; top: calc(100% + 8px); min-width: 250px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow);
  display: none;
}
.nav-projects.open .nav-menu { display: grid; }
.nav-menu a { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); }
.nav-menu a span { color: var(--faint); font-size: .78rem; }

/* Buttons, tags, kicker ---------------------------------------------------- */
.kicker { display: flex; align-items: center; gap: 10px; text-transform: uppercase; letter-spacing: .16em; color: var(--accent); font-size: .76rem; font-weight: 800; }
html[lang="ar"] .kicker { letter-spacing: 0; font-size: .9rem; }
.kicker::before { content: ""; width: 28px; height: 2px; background: var(--orange); flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; text-decoration: none;
  padding: 12px 18px; border-radius: var(--radius-sm); font-weight: 800; border: 1px solid var(--line-strong);
  transition: transform .18s, background .18s, border-color .18s; background: transparent; color: var(--ink); font-size: .95rem;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--accent); letter-spacing: .14em; text-transform: uppercase; font-weight: 800; }
html[lang="ar"] .tag { letter-spacing: 0; font-size: .82rem; }
.status { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
html[lang="ar"] .status { letter-spacing: 0; text-transform: none; font-size: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.chips li { border: 1px solid var(--line); border-radius: 99px; padding: 6px 11px; font-size: .8rem; color: var(--muted); }

/* Sections ----------------------------------------------------------------- */
.section { padding: 80px 0; }
.section.tight { padding: 48px 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 32px; }
.section-head > p { max-width: 470px; color: var(--muted); margin: 0; }
.section h2 { font-size: clamp(2.1rem, 4.4vw, 3.6rem); margin-top: 12px; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 580px; }
.band { background: var(--bg-2); border-block: 1px solid var(--line); }

/* Home hero ---------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 52px; align-items: center; padding: 76px 0 84px; min-height: 580px; }
.hero h1 { font-size: clamp(3.2rem, 6.6vw, 6.2rem); letter-spacing: -.075em; line-height: .98; margin: 20px 0 24px; max-width: 650px; }
html[lang="ar"] .hero h1 { letter-spacing: 0; line-height: 1.2; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-art { position: relative; aspect-ratio: 1 / 1; max-height: 520px; justify-self: center; width: 100%; }
.hero-art .disc { position: absolute; inset: 6%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #1f3540, #142129 65%); border: 1px solid var(--line); }
.hero-art .gear { position: absolute; width: 30%; inset-inline-end: 0; top: 4%; opacity: .5; animation: spin 40s linear infinite; }
.hero-art .mascot { position: absolute; inset: 10% 8% 0; width: 84%; height: 90%; object-fit: contain; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .5)); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hero-art .gear { animation: none; } html { scroll-behavior: auto; } }

/* Pillars ("what we make") */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.pillar { padding: 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.pillar .num { font-size: .8rem; color: var(--faint); font-weight: 800; }
.pillar h3 { font-size: 1.4rem; margin: 10px 0 8px; }
.pillar p { color: var(--muted); margin: 0; font-size: .95rem; }

/* Project cards ------------------------------------------------------------ */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.project-card {
  --card-accent: var(--accent);
  position: relative; display: flex; flex-direction: column; min-width: 0; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.project-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--card-accent) 55%, transparent); }
.project-card.featured { grid-column: span 2; flex-direction: row; }
.project-card .media { height: 240px; background: var(--surface-2); overflow: hidden; position: relative; }
.project-card.featured .media { height: auto; min-height: 340px; flex: 1.1; }
.project-card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.project-card .media img.contain { object-fit: contain; padding: 20px; }
.project-card:hover .media img { transform: scale(1.04); }
.project-card .body { padding: 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.project-card .tag { color: var(--card-accent); }
.project-card h3 { font-size: 1.5rem; letter-spacing: -.03em; }
.project-card.featured h3 { font-size: clamp(2rem, 3.4vw, 2.8rem); }
.project-card p { font-size: .94rem; color: var(--muted); margin: 0; }
.project-card .more { margin-top: auto; padding-top: 10px; color: var(--card-accent); font-weight: 800; }
.project-card .status { position: absolute; top: 14px; inset-inline-start: 14px; background: rgba(13, 21, 27, .8); color: var(--card-accent); border-color: color-mix(in srgb, var(--card-accent) 40%, transparent); }
.card-nawyah { --card-accent: #e0b34a; }
.card-biogear { --card-accent: #ff5a5f; }
.card-galaxy-prince { --card-accent: #c99bff; }
.card-my-lost-parts { --card-accent: #7cc4ff; }
.card-asmsam { --card-accent: var(--orange); }

/* Project page hero -------------------------------------------------------- */
.page-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.page-hero .backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.page-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(13, 21, 27, .2), var(--bg) 96%); }
.page-hero .inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; padding: 64px 0 72px; min-height: 520px; }
.page-hero h1 { font-size: clamp(3rem, 6.4vw, 5.8rem); letter-spacing: -.07em; margin: 18px 0 8px; }
html[lang="ar"] .page-hero h1 { letter-spacing: 0; }
.page-hero .alt-name { font-family: var(--font-ar); color: var(--accent); font-size: 1.5rem; font-weight: 600; margin-bottom: 18px; }
.page-hero .visual { position: relative; display: grid; place-items: center; }
.page-hero .visual img { max-height: 440px; width: auto; object-fit: contain; filter: drop-shadow(0 22px 40px rgba(0, 0, 0, .5)); }
.page-hero .visual img.framed { border-radius: var(--radius); border: 1px solid var(--line-strong); filter: none; box-shadow: var(--shadow); }
.breadcrumb { font-size: .85rem; color: var(--faint); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

/* Facts strip */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0; }
.facts div { background: var(--surface); padding: 18px 20px; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); font-weight: 800; }
html[lang="ar"] .facts dt { letter-spacing: 0; font-size: .8rem; }
.facts dd { margin: 4px 0 0; font-weight: 700; }

/* Two-column text + image */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split.reverse > :first-child { order: 2; }
.split .art { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: grid; place-items: center; min-height: 320px; }
.split .art img { width: 100%; height: 100%; object-fit: contain; }
.split .art.pad img { padding: 24px; max-height: 460px; }
.split .art.cover img { object-fit: cover; }
.prose p { color: var(--muted); font-size: 1.05rem; }
.prose h2 { margin-bottom: 18px; }

/* Feature cards */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-card { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.feature-card .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.2rem; margin-bottom: 14px; }
.feature-card h3 { font-size: 1.2rem; letter-spacing: -.02em; margin-bottom: 8px; }
.feature-card p { color: var(--muted); font-size: .94rem; margin: 0; }

/* Roadmap / list */
.roadmap { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.roadmap li { display: flex; gap: 14px; padding: 16px 18px; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--muted); }
.roadmap li strong { color: var(--ink); display: block; }
.roadmap li::before { content: "◆"; color: var(--accent); flex: none; }

/* Character cards */
.cast { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cast figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cast img { width: 100%; height: 380px; object-fit: contain; padding: 18px; background: radial-gradient(circle at 50% 30%, var(--surface-2), var(--surface)); }
.cast figcaption { padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.cast figcaption strong { display: block; font-size: 1.1rem; }
.cast figcaption span { color: var(--muted); font-size: .9rem; }

/* Gallery + lightbox */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.gallery.wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.gallery.pages { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.gallery.panels { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.shot { margin: 0; border: 1px solid var(--line); background: var(--surface); padding: 8px; border-radius: 14px; overflow: hidden; }
.shot a { display: block; border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.shot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .3s; }
.gallery.wide .shot img { aspect-ratio: 2796 / 1290; }
.gallery.panels .shot img { aspect-ratio: 1000 / 462; }
.shot img.light { background: #e9ece6; }
.gallery.pages .shot img { aspect-ratio: 632 / 882; object-fit: cover; }
.shot img.contain { object-fit: contain; padding: 10px; }
.shot a:hover img { transform: scale(1.03); }
.shot figcaption { font-size: .82rem; color: var(--muted); padding: 10px 4px 2px; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5, 9, 12, .92); display: none; place-items: center; padding: 4vh 4vw; }
.lightbox.open { display: grid; }
.lightbox img { max-width: 100%; max-height: 84vh; border-radius: 10px; object-fit: contain; }
.lightbox .cap { color: var(--muted); text-align: center; margin-top: 12px; font-size: .9rem; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, .08); border: 1px solid var(--line-strong); color: var(--ink); width: 46px; height: 46px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; }
.lightbox .close { top: 18px; inset-inline-end: 18px; }
.lightbox .prev { inset-inline-start: 18px; top: 50%; }
.lightbox .next { inset-inline-end: 18px; top: 50%; }
html[dir="rtl"] .lightbox .prev, html[dir="rtl"] .lightbox .next { transform: scaleX(-1); }

/* Synopsis block (manga, stories) */
.synopsis { padding: clamp(26px, 4vw, 46px); border-radius: var(--radius-lg); border: 1px solid var(--line); background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface); }
.synopsis p { font-size: 1.1rem; color: var(--muted); max-width: 760px; }
.synopsis p:last-child { margin-bottom: 0; }

/* Contact / CTA */
.cta { padding: clamp(28px, 5vw, 54px); border-radius: var(--radius-lg); border: 1px solid var(--line); background: linear-gradient(120deg, var(--accent-soft), rgba(168, 230, 207, .06)), var(--surface); display: flex; justify-content: space-between; align-items: center; gap: 28px; }
.cta h2 { margin: 12px 0; font-size: clamp(2rem, 4vw, 3.2rem); }
.cta p { color: var(--muted); margin-bottom: 0; max-width: 600px; }

/* "More projects" strip at the bottom of project pages */
.more-projects { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.more-projects a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; transition: border-color .2s; }
.more-projects a:hover { border-color: var(--line-strong); }
.more-projects img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex: none; }
.more-projects strong { display: block; font-size: .98rem; }
.more-projects span { font-size: .8rem; color: var(--faint); }

/* Footer ------------------------------------------------------------------- */
.footer { margin-top: 40px; padding: 44px 0 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.footer h4 { margin: 0 0 10px; color: var(--ink); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }
html[lang="ar"] .footer h4 { letter-spacing: 0; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer-bottom { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: .84rem; }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 960px) {
  .project-grid { grid-template-columns: 1fr 1fr; }
  .project-card.featured { grid-column: span 2; }
  .features, .cast { grid-template-columns: 1fr 1fr; }
  .more-projects { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .menu-btn { display: inline-block; }
  .navlinks { display: none; position: absolute; top: 100%; inset-inline: 0; flex-direction: column; align-items: stretch; padding: 12px 22px 18px; background: rgba(13, 21, 27, .98); border-bottom: 1px solid var(--line); }
  .topbar.menu-open .navlinks { display: flex; }
  .nav-projects > button { width: 100%; text-align: start; }
  .nav-menu { position: static; box-shadow: none; margin-top: 4px; }
  .lang-btn { margin: 8px 0 0; align-self: flex-start; }
  .hero, .page-hero .inner, .split { grid-template-columns: 1fr; }
  .hero { padding-top: 48px; gap: 26px; min-height: 0; }
  .hero-art { max-width: 420px; }
  .page-hero .inner { min-height: 0; padding: 44px 0 52px; gap: 28px; }
  .page-hero .visual img { max-height: 320px; }
  .split.reverse > :first-child { order: 0; }
  .pillars { grid-template-columns: 1fr; }
  .section-head { align-items: start; flex-direction: column; }
  .roadmap { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: span 2; }
}
@media (max-width: 600px) {
  .wrap { width: calc(100% - 30px); }
  .section { padding: 56px 0; }
  .project-grid, .features, .cast, .more-projects { grid-template-columns: 1fr; }
  .project-card.featured { grid-column: auto; flex-direction: column; }
  .project-card.featured .media { min-height: 260px; }
  .hero h1 { font-size: 3.3rem; }
  .cta { flex-direction: column; align-items: flex-start; }
  .gallery, .gallery.wide { grid-template-columns: 1fr 1fr; gap: 8px; }
  .gallery.wide, .gallery.panels { grid-template-columns: 1fr; }
  .cast img { height: 280px; }
}
