/* ==========================================================================
   Pahlevan - GitHub Pages site
   Dark, security-tooling aesthetic. Accessible contrast, mobile responsive.
   ========================================================================== */

:root {
  /* Palette */
  --bg: #0b1020;
  --bg-elev: #111a30;
  --bg-elev-2: #0f1830;
  --bg-code: #0c1326;
  --panel-border: #243049;
  --border: #334155;

  --text: #e6ecf5;
  --text-muted: #9aa8c0;
  --text-dim: #64748b;

  --accent: #38bdf8;      /* sky */
  --accent-2: #818cf8;    /* indigo */
  --accent-3: #f0abfc;    /* fuchsia - "deny" */
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;

  --radius: 0.6rem;
  --radius-lg: 1rem;
  --maxw: 1160px;
  --transition: all 0.2s ease;

  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 50px -15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 40px -8px rgba(56, 189, 248, 0.25);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

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

a { color: var(--accent); }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(129, 140, 248, 0.12);
  color: #c7d2fe;
  padding: 0.12em 0.4em;
  border-radius: 0.3rem;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #06121f;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 2000;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* Typography */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
p { color: var(--text-muted); }
em { color: var(--text); font-style: normal; font-weight: 600; }

.text-gradient {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-sm { padding: 0.55rem 1rem; font-size: 0.875rem; }

.btn-primary {
  background: var(--grad);
  color: #06121f;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 46px -6px rgba(56, 189, 248, 0.45); }

.btn-outline {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(56, 189, 248, 0.06); }

.btn:focus-visible, a:focus-visible, .nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(11, 16, 32, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  z-index: 1000;
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.nav-logo { width: 30px; height: 30px; }
.nav-links { display: flex; align-items: center; gap: 1.75rem; }
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
}
.nav-link:hover { color: var(--text); }
.nav-github {
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
}
.nav-github:hover { border-color: var(--accent); color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  width: 24px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* Hero */
.hero {
  position: relative;
  padding: 9rem 0 5rem;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  top: -20%; left: 50%;
  width: 900px; height: 700px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(56, 189, 248, 0.14), rgba(129, 140, 248, 0.08), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.hero .container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 3.5rem;
  align-items: center;
}
.hero-badge { margin-bottom: 1.5rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #bae6fd;
  border-radius: 2rem;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--mono);
}
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  margin-bottom: 1.25rem;
}
.hero-description {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 40ch;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}
.hero-meta li {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--panel-border);
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.02);
}

.demo-figure { margin: 0; }
.demo-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-lg);
  background: #000;
}
.demo-figure figcaption {
  margin-top: 0.9rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  text-align: center;
}

/* Sections */
.section { padding: 5rem 0; }
.section-header { text-align: center; max-width: 720px; margin: 0 auto 3rem; }
.section-header h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin-bottom: 1rem; }
.section-header p { font-size: 1.1rem; }

/* Why */
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.why-card {
  background: var(--bg-elev);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: var(--transition);
}
.why-card:hover { border-color: rgba(56, 189, 248, 0.4); transform: translateY(-4px); box-shadow: var(--shadow-md); }
.why-icon {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: #06121f;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad);
  border-radius: 0.6rem;
  margin-bottom: 1.25rem;
}
.why-card h3 { font-size: 1.2rem; margin-bottom: 0.6rem; }
.why-card p { font-size: 0.96rem; }

/* Compare */
.compare { background: #0a0f1e; border-block: 1px solid var(--panel-border); }
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--panel-border); }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: var(--bg-elev);
  font-size: 0.95rem;
}
.compare-table th, .compare-table td {
  text-align: left;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-muted);
}
.compare-table thead th {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--bg-elev-2);
}
.compare-table tbody th[scope="row"] {
  color: var(--text);
  font-weight: 600;
}
.compare-table td strong { color: var(--text); }
.compare-table .muted { color: var(--text-dim); font-size: 0.85em; }
.compare-table .col-highlight {
  background: rgba(56, 189, 248, 0.07);
  color: var(--text);
  border-left: 1px solid rgba(56, 189, 248, 0.25);
  border-right: 1px solid rgba(56, 189, 248, 0.25);
}
.compare-table thead th.col-highlight { color: var(--accent); }
.compare-table tbody tr:last-child td, .compare-table tbody tr:last-child th { border-bottom: none; }

/* Architecture */
.arch-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.5rem;
  align-items: center;
}
.arch-diagram {
  background: var(--bg-elev);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
}
.arch-notes { display: flex; flex-direction: column; gap: 1.25rem; }
.arch-note {
  border-left: 3px solid transparent;
  border-image: var(--grad) 1;
  padding-left: 1.1rem;
}
.arch-note h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.arch-note p { font-size: 0.96rem; }

/* Features */
.features { background: #0a0f1e; border-block: 1px solid var(--panel-border); }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}
.feature-card {
  background: var(--bg-elev);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
}
.feature-card:hover { border-color: rgba(129, 140, 248, 0.45); transform: translateY(-3px); }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.92rem; margin: 0; }

/* How it works */
.steps { list-style: none; display: grid; gap: 1.25rem; max-width: 820px; margin: 0 auto; }
.step {
  display: flex;
  gap: 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.step-num {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-weight: 600;
  background: var(--grad);
  color: #06121f;
  border-radius: 50%;
}
.step h3 { font-size: 1.1rem; margin-bottom: 0.3rem; }
.step p { font-size: 0.96rem; margin: 0; }

/* Quick start */
.quickstart { background: #0a0f1e; border-block: 1px solid var(--panel-border); }
.qs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.qs-col h3 { font-size: 1.05rem; margin: 1.25rem 0 0.6rem; }
.qs-col h3:first-child { margin-top: 0; }
.qs-note { font-size: 0.9rem; color: var(--text-dim); margin-top: 1rem; }

.code-block {
  position: relative;
  background: var(--bg-code);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-block pre {
  margin: 0;
  padding: 1.25rem;
  /* Wrap long lines (incl. unbreakable URLs) instead of overflowing the page.
     pre-wrap preserves indentation; overflow-wrap/anywhere breaks only when a
     token can't fit. This guarantees the block never widens its column. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: auto;
  max-width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
}
.code-block code {
  background: none;
  color: #d7e0f2;
  padding: 0;
  font-size: inherit;
  white-space: inherit;
  overflow-wrap: inherit;
  word-break: inherit;
}

/* Requirements + benchmarks */
.req-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.req-card {
  background: var(--bg-elev);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.req-card h3 { font-size: 1.25rem; margin-bottom: 1rem; }
.req-card ul { list-style: none; display: grid; gap: 0.75rem; }
.req-card li { color: var(--text-muted); padding-left: 1.4rem; position: relative; font-size: 0.96rem; }
.req-card li::before {
  content: "";
  position: absolute; left: 0; top: 0.6em;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}
.req-card li strong { color: var(--text); }
.req-card .btn { margin-top: 1.25rem; }

/* CTA */
.cta-box {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(129, 140, 248, 0.08));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
}
.cta-box h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin-bottom: 0.75rem; }
.cta-box p { font-size: 1.1rem; margin-bottom: 1.75rem; }
.cta-box .hero-actions { justify-content: center; }

/* Footer */
.footer {
  background: #080c18;
  border-top: 1px solid var(--panel-border);
  padding: 3.5rem 0 1.5rem;
}
.footer-content {
  display: grid;
  grid-template-columns: 1.3fr 2fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}
.footer-brand .nav-brand { margin-bottom: 1rem; }
.footer-brand p { color: var(--text-dim); font-size: 0.95rem; max-width: 42ch; }
.footer-logo { width: 30px; height: 30px; }
.footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.footer-section h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.9rem; }
.footer-section a {
  display: block;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
  transition: var(--transition);
}
.footer-section a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.75rem;
  border-top: 1px solid var(--panel-border);
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-bottom p { color: var(--text-dim); font-size: 0.88rem; margin: 0; }
.footer-tagline { font-family: var(--mono); color: var(--text-muted) !important; }

/* Responsive */
@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero-description { max-width: none; }
  .hero-visual { order: -1; }
  .arch-layout { grid-template-columns: 1fr; gap: 1.75rem; }
  .qs-grid { grid-template-columns: 1fr; }
  .req-grid { grid-template-columns: 1fr; }
  .footer-content { grid-template-columns: 1fr; gap: 2rem; }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 1rem 1.5rem 1.5rem;
    background: rgba(11, 16, 32, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border);
  }
  .nav-links.active { display: flex; }
  .nav-link { padding: 0.5rem 0; width: 100%; }
  .nav-github { width: 100%; text-align: center; }
  .nav-toggle { display: flex; }
  .nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
  .nav-toggle.active span:nth-child(2) { opacity: 0; }
  .nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }
}

@media (max-width: 520px) {
  .container { padding: 0 1.1rem; }
  .section { padding: 3.5rem 0; }
  .hero { padding: 7rem 0 3.5rem; }
  .hero-actions { flex-direction: column; }
  .btn { justify-content: center; }
  .footer-links { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* --- Overflow hardening -----------------------------------------------------
   Grid/flex children default to min-width:auto (their content size), so a wide
   <pre> widens its column and pushes the page sideways. Letting these items
   shrink to zero makes the code block's own overflow-x:auto take over, and
   images/SVGs never exceed their container. */
img, svg { max-width: 100%; }
img { height: auto; }
.hero .container,
.qs-grid, .req-grid, .arch-layout,
.features-grid, .steps, .compare > *, .section .container { min-width: 0; }
.hero .container > *,
.qs-grid > *, .qs-col,
.req-grid > *, .arch-layout > *,
.feature-card, .step, .step > * { min-width: 0; }
.code-block, .code-block pre { min-width: 0; max-width: 100%; }
/* Wrap long tokens in prose (not code) so nothing forces horizontal scroll. */
p, li, h1, h2, h3, .hero-description, .section-header p { overflow-wrap: anywhere; }

/* ==========================================================================
   Releases / changelog page
   ========================================================================== */
.page-head {
  padding: 9rem 0 3rem;
  border-bottom: 1px solid var(--panel-border);
  background: radial-gradient(70% 120% at 50% -10%, rgba(56, 189, 248, 0.10), transparent 70%);
}
.page-head h1 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); margin-bottom: 1rem; }
.page-head p { font-size: 1.08rem; max-width: 72ch; }
.page-head .hero-actions { margin-top: 1.75rem; }

.packages-table { margin-top: 2rem; }

.release-list { display: grid; gap: 1.5rem; max-width: 900px; margin: 0 auto; }
.release {
  background: var(--bg-elev);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.release-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
}
.release-version { font-family: var(--mono); font-size: 1.3rem; color: var(--text); margin: 0; }
.release-date { font-family: var(--mono); font-size: 0.85rem; color: var(--text-dim); }
.release-pill {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.08);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}
.release-summary { color: var(--text-muted); font-size: 0.98rem; margin-top: 1.1rem; }
.change-group { margin-top: 1.5rem; }
.change-group h4 {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.change-group h4.added { color: var(--success); }
.change-group h4.changed { color: var(--accent); }
.change-group h4.fixed { color: var(--warning); }
.change-group h4.removed { color: var(--danger); }
.change-group ul { list-style: none; display: grid; gap: 0.6rem; }
.change-group li {
  position: relative;
  padding-left: 1.3rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.change-group li::before {
  content: "";
  position: absolute; left: 0; top: 0.62em;
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}
.change-group li strong { color: var(--text); }

@media (max-width: 520px) {
  .page-head { padding: 7rem 0 2.5rem; }
  .release { padding: 1.5rem; }
}
