/* ==========================================================================
   Open4D Website — Shared Stylesheet
   ========================================================================== */

:root {
  --bg: #070b14;
  --bg-elevated: #0d1322;
  --bg-card: #101830;
  --bg-card-hover: #16203d;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e6ecf5;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-3: #a78bfa;
  --gradient: linear-gradient(120deg, #6366f1 0%, #8b5cf6 45%, #22d3ee 100%);
  --gradient-soft: linear-gradient(120deg, rgba(99, 102, 241, 0.16), rgba(34, 211, 238, 0.10));
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --nav-height: 68px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 20px); }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(99, 102, 241, 0.45); }

img { max-width: 100%; display: block; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-height);
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(7, 11, 20, 0.78);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.nav-logo:hover { text-decoration: none; }
.nav-logo .logo-mark { width: 30px; height: 30px; flex-shrink: 0; }
.nav-logo .logo-4d {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}
.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--text); background: rgba(148, 163, 184, 0.08); text-decoration: none; }
.nav-links a.active { color: var(--text); background: rgba(99, 102, 241, 0.16); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff !important;
  font-weight: 600;
  font-size: 0.9rem;
  transition: opacity 0.15s, transform 0.15s;
}
.nav-cta:hover { opacity: 0.9; transform: translateY(-1px); text-decoration: none; }
.nav-cta svg { width: 16px; height: 16px; fill: currentColor; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: calc(var(--nav-height) + 96px) 0 96px;
  overflow: hidden;
  text-align: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 50% at 20% 0%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(ellipse 50% 45% at 80% 10%, rgba(34, 211, 238, 0.14), transparent 60%),
    radial-gradient(ellipse 45% 40% at 50% 100%, rgba(139, 92, 246, 0.10), transparent 60%);
}

.hero-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 30%, transparent 75%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid var(--border-strong);
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 28px;
}
.hero-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
}

.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin-bottom: 24px;
}
.hero h1 .gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 760px;
  margin: 0 auto 40px;
  font-size: 1.18rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 28px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.15s, opacity 0.15s, background 0.15s;
  cursor: pointer;
  border: none;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35); }
.btn-primary:hover { opacity: 0.92; }
.btn-secondary {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: rgba(148, 163, 184, 0.14); }

.hero-terminal {
  max-width: 620px;
  margin: 0 auto;
  text-align: left;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: rgba(10, 15, 28, 0.85);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-terminal .term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.term-bar .term-dot { width: 12px; height: 12px; border-radius: 50%; }
.term-bar .term-dot:nth-child(1) { background: #ff5f57; }
.term-bar .term-dot:nth-child(2) { background: #febc2e; }
.term-bar .term-dot:nth-child(3) { background: #28c840; }
.term-bar .term-title { margin-left: auto; margin-right: auto; font-size: 0.8rem; color: var(--text-faint); font-family: var(--mono); }
.hero-terminal pre {
  padding: 20px 22px;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.9;
  overflow-x: auto;
}
.hero-terminal .prompt { color: var(--accent-2); }
.hero-terminal .comment { color: var(--text-faint); }

/* Stats strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-block: 1px solid var(--border);
}
.stat {
  background: var(--bg-elevated);
  padding: 32px 20px;
  text-align: center;
}
.stat .stat-num {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat .stat-label { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { padding: 96px 0; }
.section-alt { background: var(--bg-elevated); border-block: 1px solid var(--border); }

.section-head { max-width: 720px; margin: 0 auto 56px; text-align: center; }
.section-head.left { text-align: left; margin-left: 0; }
.section-eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}
.section-head p { color: var(--text-muted); font-size: 1.08rem; }

/* Cards */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); background: var(--bg-card-hover); }

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  margin-bottom: 18px;
}
.card-icon svg { width: 24px; height: 24px; stroke: var(--accent-2); fill: none; stroke-width: 1.8; }

.card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.01em; }
.card p { color: var(--text-muted); font-size: 0.95rem; }
.card .card-link { display: inline-block; margin-top: 14px; font-weight: 600; font-size: 0.9rem; }

.card-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.tag-core { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; }
.tag-module { background: rgba(34, 211, 238, 0.14); color: #67e8f9; }
.tag-app { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; }
.tag-soon { background: rgba(251, 191, 36, 0.14); color: #fcd34d; }

/* Figure blocks */
.figure-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.figure-block .figure-media {
  background: #fff;
  padding: 24px;
  display: flex;
  justify-content: center;
}
.figure-block .figure-media.dark { background: var(--bg-elevated); }
.figure-block figcaption {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.92rem;
}
.figure-block figcaption strong { color: var(--text); }

/* Split layout */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

/* Checklist */
.checklist { list-style: none; display: grid; gap: 14px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-muted); }
.checklist li strong { color: var(--text); }
.checklist .check {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  margin-top: 3px;
}
.checklist .check svg { width: 12px; height: 12px; stroke: var(--accent-2); stroke-width: 3; fill: none; }

/* News list */
.news-list { display: grid; gap: 14px; }
.news-item {
  display: flex;
  gap: 22px;
  align-items: baseline;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}
.news-item:hover { border-color: var(--border-strong); }
.news-date {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-faint);
  min-width: 100px;
}
.news-item h4 { font-size: 1rem; font-weight: 600; margin-bottom: 2px; }
.news-item p { color: var(--text-muted); font-size: 0.9rem; }

/* --------------------------------------------------------------------------
   Code blocks
   -------------------------------------------------------------------------- */

.code-block {
  position: relative;
  background: #0a0f1c;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin: 18px 0;
  overflow: hidden;
}
.code-block .code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}
.code-block pre {
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.75;
}
.code-block code .kw { color: #c4b5fd; }
.code-block code .str { color: #86efac; }
.code-block code .fn { color: #7dd3fc; }
.code-block code .cm { color: #64748b; font-style: italic; }
.code-block code .num { color: #fca5a5; }

.copy-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font);
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.copy-btn:hover { background: rgba(148, 163, 184, 0.2); color: var(--text); }
.copy-btn.copied { color: #86efac; border-color: rgba(134, 239, 172, 0.4); }

/* --------------------------------------------------------------------------
   Documentation layout
   -------------------------------------------------------------------------- */

.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 56px;
  padding-top: calc(var(--nav-height) + 48px);
  padding-bottom: 96px;
}

.docs-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 48px);
  align-self: start;
  max-height: calc(100vh - var(--nav-height) - 80px);
  overflow-y: auto;
}
.docs-sidebar h5 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin: 22px 0 8px;
  font-weight: 700;
}
.docs-sidebar h5:first-child { margin-top: 0; }
.docs-sidebar ul { list-style: none; }
.docs-sidebar a {
  display: block;
  padding: 6px 12px;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.15s, border-color 0.15s;
}
.docs-sidebar a:hover, .docs-sidebar a.active {
  color: var(--text);
  border-left-color: var(--accent);
  text-decoration: none;
}

.docs-content { min-width: 0; }
.docs-content h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 16px; }
.docs-content .lead { font-size: 1.12rem; color: var(--text-muted); margin-bottom: 40px; }
.docs-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 56px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.docs-content h3 { font-size: 1.18rem; font-weight: 700; margin: 32px 0 12px; }
.docs-content p { color: var(--text-muted); margin-bottom: 16px; }
.docs-content ul, .docs-content ol { color: var(--text-muted); margin: 0 0 16px 22px; }
.docs-content li { margin-bottom: 8px; }
.docs-content li strong, .docs-content p strong { color: var(--text); }
.docs-content code:not(pre code) {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 6px;
  color: #a5b4fc;
}

.callout {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.07);
  margin: 20px 0;
}
.callout.warn { border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.07); }
.callout p { margin: 0; font-size: 0.93rem; }
.callout .callout-icon { flex-shrink: 0; font-size: 1.1rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th {
  text-align: left;
  padding: 12px 18px;
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
td { padding: 12px 18px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
tr:last-child td { border-bottom: none; }
td code { font-family: var(--mono); font-size: 0.85em; color: #a5b4fc; }

/* --------------------------------------------------------------------------
   Page hero (interior pages)
   -------------------------------------------------------------------------- */

.page-hero {
  position: relative;
  padding: calc(var(--nav-height) + 72px) 0 64px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 14px; }
.page-hero p { max-width: 700px; color: var(--text-muted); font-size: 1.12rem; }

/* Gallery */
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px; }
.gallery-grid .wide { grid-column: 1 / -1; }

/* Module detail rows */
.module-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  margin-bottom: 26px;
}
.module-row .module-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.module-row h3 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
.module-row p { color: var(--text-muted); margin-bottom: 12px; }
.module-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; font-size: 0.85rem; color: var(--text-faint); font-family: var(--mono); }
.module-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* Timeline / roadmap */
.timeline { position: relative; margin-left: 10px; padding-left: 32px; border-left: 2px solid var(--border-strong); display: grid; gap: 32px; }
.timeline-item { position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -41px;
  top: 6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}
.timeline-item.done::before { background: var(--accent); box-shadow: 0 0 14px rgba(99, 102, 241, 0.7); }
.timeline-item h4 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.timeline-item p { color: var(--text-muted); font-size: 0.94rem; }
.timeline-item .when { font-family: var(--mono); font-size: 0.78rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }

/* --------------------------------------------------------------------------
   CTA band + Footer
   -------------------------------------------------------------------------- */

.cta-band {
  position: relative;
  text-align: center;
  padding: 88px 24px;
  border-block: 1px solid var(--border);
  background:
    radial-gradient(ellipse 55% 90% at 50% 110%, rgba(99, 102, 241, 0.25), transparent 70%),
    var(--bg-elevated);
}
.cta-band h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 14px; }
.cta-band p { color: var(--text-muted); max-width: 560px; margin: 0 auto 32px; font-size: 1.05rem; }

.footer { padding: 64px 0 40px; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border);
}
.footer-brand p { color: var(--text-muted); font-size: 0.92rem; margin-top: 14px; max-width: 320px; }
.footer h5 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); margin-bottom: 16px; }
.footer ul { list-style: none; display: grid; gap: 10px; }
.footer ul a { color: var(--text-muted); font-size: 0.92rem; }
.footer ul a:hover { color: var(--text); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 28px;
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 960px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; gap: 40px; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: static; max-height: none; display: none; }
  .gallery-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: rgba(7, 11, 20, 0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .section { padding: 64px 0; }
  .hero { padding-bottom: 64px; }
}
