@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-var.woff2') format('woff2-variations'),
       url('../fonts/Vazirmatn-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #07090f;
  --panel: rgba(10, 15, 26, 0.72);
  --panel-strong: rgba(14, 21, 36, 0.92);
  --ink: #f6faff;
  --muted: #9fb0c6;
  --line: rgba(186, 220, 255, 0.16);
  --cyan: #45f2ff;
  --blue: #3a7bff;
  --pink: #ff4fd8;
  --lime: #cff86b;
  --amber: #ffb347;
  --red: #ff5c6a;
  --teal: #37d9a0;
  --radius: 14px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --maxw: 1240px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: Vazirmatn, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.7;
  background:
    radial-gradient(circle at 82% 8%, rgba(69, 242, 255, 0.16), transparent 34%),
    radial-gradient(circle at 12% 22%, rgba(255, 79, 216, 0.12), transparent 32%),
    radial-gradient(circle at 50% 92%, rgba(58, 123, 255, 0.14), transparent 40%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
img, canvas { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

#bg-field {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

main, .topbar, .site-footer { position: relative; z-index: 2; }

/* ===== Layout helpers ===== */
main { width: min(var(--maxw), calc(100vw - 40px)); margin: 0 auto; }
section { scroll-margin-top: 88px; }

.eyebrow {
  color: var(--cyan);
  font-size: 13px; font-weight: 800;
  letter-spacing: 0.12em;
  margin-bottom: 14px;
}
.section-head { max-width: 760px; margin: 0 auto 34px; text-align: center; }
.section-head .eyebrow { text-align: center; }
h2 { font-size: clamp(28px, 4.2vw, 46px); line-height: 1.15; letter-spacing: -0.01em; }
.section-lede { color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); margin-top: 14px; }

.glass {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

/* ===== Topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  width: min(var(--maxw), calc(100vw - 40px));
  margin: 14px auto;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.66);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; }
.brand img { filter: drop-shadow(0 0 14px rgba(69, 242, 255, 0.5)); }
.brand-text { font-size: 20px; font-weight: 700; }
.brand-text b { color: var(--cyan); font-weight: 900; }
.nav-actions { display: flex; align-items: center; gap: 4px; }
.nav-actions a {
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px;
  color: #cfe0f6; border: 1px solid transparent; transition: .18s;
}
.nav-actions a:hover { border-color: var(--line); background: rgba(255,255,255,0.05); color: #fff; }
.nav-actions a.ext { color: var(--cyan); }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: 8px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: .2s; }

/* ===== Hero ===== */
.hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 40px; align-items: center;
  padding: 40px 0 60px;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 72px); line-height: 1.08; letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.hero h1 em { font-style: normal; color: var(--cyan); }
.lede { color: var(--muted); font-size: clamp(16px, 1.8vw, 20px); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 26px; border-radius: 999px; font-weight: 800; font-size: 15px; border: 1px solid transparent;
  transition: transform .16s, box-shadow .16s;
}
.btn-primary {
  color: #04121a;
  background: linear-gradient(135deg, var(--cyan), #ffffff 52%, var(--pink));
  box-shadow: 0 16px 40px rgba(69, 242, 255, 0.26);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 52px rgba(69, 242, 255, 0.34); }
.btn-ghost { border-color: var(--line); background: rgba(255,255,255,0.04); color: #dceafc; }
.btn-ghost:hover { border-color: var(--cyan); }
.hero-stats { list-style: none; display: flex; gap: 28px; margin: 34px 0 0; padding: 0; }
.hero-stats strong { display: block; font-size: 30px; color: #fff; line-height: 1; }
.hero-stats span { color: var(--muted); font-size: 13px; }
.hero-visual { position: relative; }
.hero-card {
  position: relative; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-strong);
  box-shadow: var(--shadow); aspect-ratio: 1 / 1;
}
#hero-canvas { width: 100%; height: 100%; }
.hero-tag {
  position: absolute; bottom: 14px; inset-inline-start: 14px;
  padding: 7px 14px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(8, 12, 22, 0.7); border: 1px solid var(--line); backdrop-filter: blur(8px);
}

/* ===== Explorer ===== */
.explorer { padding: 40px 0 60px; }
.explorer-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 22px;
}
.sys-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 14px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: #cfe0f6;
  transition: .18s;
}
.sys-tab .dot { width: 10px; height: 10px; border-radius: 50%; }
.sys-tab:hover { border-color: rgba(255,255,255,0.28); }
.sys-tab.active { color: #04121a; background: linear-gradient(135deg, var(--cyan), var(--pink)); border-color: transparent; }
.sys-tab.active .dot { box-shadow: 0 0 0 3px rgba(0,0,0,0.25); }

.explorer-stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch;
}
.stage-canvas { position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: linear-gradient(180deg, #0a1120, #060910);
  min-height: 520px; box-shadow: var(--shadow); }
.viewer { position: absolute; inset: 0; }
.viewer canvas { width: 100%; height: 100%; touch-action: none; }
.viewer-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 15px;
}
.viewer-toolbar {
  position: absolute; top: 12px; inset-inline-start: 12px; display: flex; gap: 6px; flex-wrap: wrap;
}
.tool {
  padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  border: 1px solid var(--line); background: rgba(8, 12, 22, 0.72); color: #cfe0f6; backdrop-filter: blur(8px);
  transition: .16s;
}
.tool:hover { border-color: rgba(255,255,255,0.3); }
.tool.active { color: #04121a; background: var(--cyan); border-color: transparent; }
.viewer-hint {
  position: absolute; bottom: 12px; inset-inline-start: 12px; inset-inline-end: 12px;
  text-align: center; font-size: 12px; color: var(--muted);
  background: rgba(8, 12, 22, 0.5); padding: 6px 10px; border-radius: 999px; backdrop-filter: blur(6px);
}
/* Focus (isolated part) view */
.focus-back {
  position: absolute; top: 12px; inset-inline-end: 12px; z-index: 7;
  display: none; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px; border: 0; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 13px; color: #04121a;
  background: linear-gradient(135deg, var(--cyan), var(--pink));
  box-shadow: 0 12px 32px rgba(69, 242, 255, 0.32);
  transition: transform .15s;
}
.focus-back:hover { transform: translateY(-2px); }
.focus-open {
  width: 100%; margin-top: 12px;
  padding: 9px 14px; border-radius: 10px; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 13px;
  color: var(--cyan); background: rgba(69, 242, 255, 0.08);
  border: 1px solid rgba(69, 242, 255, 0.35);
  transition: .15s;
}
.focus-open:hover { background: rgba(69, 242, 255, 0.16); }

/* HTML labels over the 3D canvas */
.part-label {
  position: absolute; transform: translate(50%, -50%);
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: rgba(8, 12, 22, 0.82); border: 1px solid var(--line); color: #eaf3ff;
  pointer-events: none; backdrop-filter: blur(6px); transition: opacity .2s;
}
.part-label .num {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  font-size: 10px; color: #04121a; margin-inline-start: 5px;
}

.stage-panel { display: flex; flex-direction: column; gap: 14px; }
.panel-system, .panel-parts, .panel-detail {
  border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius);
  padding: 18px; backdrop-filter: blur(20px);
}
.panel-system h3 { font-size: 22px; margin-bottom: 8px; }
.panel-system p { color: var(--muted); font-size: 14px; }
.panel-parts { flex: 1; overflow: auto; max-height: 320px; }
.panel-parts h4, .panel-detail h4 { font-size: 14px; color: var(--cyan); margin-bottom: 12px; }
.part-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.part-list li {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px;
  border: 1px solid transparent; background: rgba(255,255,255,0.03); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .14s;
}
.part-list li:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.06); }
.part-list li.active { border-color: var(--cyan); background: rgba(69,242,255,0.1); }
.part-list .pdot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.part-list .pnum { margin-inline-start: auto; color: var(--muted); font-size: 12px; }
.panel-detail .detail-swatch { width: 34px; height: 34px; border-radius: 9px; margin-bottom: 10px; }
.panel-detail p { color: var(--muted); font-size: 14px; }
#variantWrap { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.variant-label { font-size: 12px; color: var(--cyan); font-weight: 700; margin-bottom: 8px; }
.variant-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.vchip {
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: #cfe0f6; transition: .15s;
}
.vchip:hover { border-color: rgba(255,255,255,0.3); }
.vchip.active { color: #04121a; background: var(--cyan); border-color: transparent; }
.variant-desc { color: var(--muted); font-size: 13px; margin: 0; }
.detail-specs { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.detail-specs dt { color: var(--cyan); font-weight: 700; }
.detail-specs dd { margin: 0; color: #dceafc; }

/* ===== Systems grid ===== */
.systems { padding: 40px 0 60px; }
.system-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.system-card {
  text-align: start; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 10px; color: inherit;
  transition: transform .18s, border-color .18s; backdrop-filter: blur(18px);
}
.system-card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,0.3); }
.system-card .sc-icon { width: 52px; height: 52px; }
.system-card h3 { font-size: 18px; }
.system-card p { color: var(--muted); font-size: 13px; flex: 1; }
.system-card .sc-go { color: var(--cyan); font-size: 13px; font-weight: 800; }

/* ===== Cycles ===== */
.cycles { padding: 40px 0 60px; }
.cycle-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.cycle-card { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 22px; backdrop-filter: blur(18px); }
.cycle-card h3 { font-size: 20px; margin-bottom: 6px; }
.cycle-card .csub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.cycle-card svg { width: 100%; height: auto; }

/* ===== Glossary ===== */
.glossary { padding: 40px 0 60px; }
.glossary-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.gloss-item { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 16px; backdrop-filter: blur(14px); }
.gloss-item dt { font-weight: 800; margin-bottom: 6px; }
.gloss-item dd { margin: 0; color: var(--muted); font-size: 14px; }

/* ===== Footer ===== */
.site-footer {
  width: min(var(--maxw), calc(100vw - 40px)); margin: 20px auto 40px;
  border-top: 1px solid var(--line); padding-top: 24px;
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: center;
}
.site-footer p { color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--cyan); }
.disclaimer { max-width: 420px; }

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .explorer-stage { grid-template-columns: 1fr; }
  .stage-canvas { min-height: 420px; }
  .system-grid { grid-template-columns: repeat(2, 1fr); }
  .glossary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-visual { order: -1; max-width: 420px; }
  .cycle-grid { grid-template-columns: 1fr; }
  .nav-actions {
    position: absolute; top: 64px; inset-inline-end: 8px; flex-direction: column; align-items: stretch;
    padding: 10px; border-radius: 16px; background: rgba(8,12,22,0.95); border: 1px solid var(--line);
    display: none; min-width: 200px; box-shadow: var(--shadow);
  }
  .nav-actions.open { display: flex; }
  .nav-toggle { display: flex; }
}
@media (max-width: 560px) {
  main { width: calc(100vw - 24px); }
  .system-grid, .glossary-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
