@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-primary: #6514ff;
  --c-accent: #bf00ff;
  --c-dark: #1c1726;
  --c-dark2: #110f1b;
  --c-mid: #2d2540;
  --c-mid2: #3d3358;
  --c-light: #e8e0ff;
  --c-lighter: #f5f2ff;
  --c-text: #e8e0ff;
  --c-text-dim: #a090c8;
  --c-border: #3d3358;
  --nav-h: 64px;
  --header-h: 56px;
  --sidebar-w: 220px;
  --font: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --radius: 0;
  --gap-xl: 64px;
  --gap-lg: 48px;
  --gap-md: 32px;
  --gap-sm: 20px;
  --gap-xs: 12px;
  --transition: 200ms ease;
}

html {
  scroll-behavior: smooth;
  font-size: 17px;
  line-height: 1.6;
  background: var(--c-dark2);
  color: var(--c-text);
  font-family: var(--font);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--c-dark2);
}

/* Animated background pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 60px,
      rgba(101,20,255,0.04) 60px,
      rgba(101,20,255,0.04) 61px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 60px,
      rgba(191,0,255,0.03) 60px,
      rgba(191,0,255,0.03) 61px
    );
  pointer-events: none;
  z-index: 0;
  animation: patternDrift 20s linear infinite;
}

@keyframes patternDrift {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 120px 120px, -120px 120px; }
}

/* ===== PAGE WRAP ===== */
.page-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding-bottom: var(--nav-h);
}

/* ===== SITE HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--c-dark);
  border-bottom: 2px solid var(--c-primary);
  display: flex;
  align-items: center;
  padding: 0 var(--gap-md);
  gap: var(--gap-sm);
  overflow: hidden;
}

.brand-mark {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  z-index: 2;
}

.brand-icon {
  height: 36px;
  width: auto;
  display: block;
}

.brand-icon-text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-bg-text {
  position: absolute;
  right: var(--gap-md);
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.2rem;
  font-weight: 700;
  color: rgba(101,20,255,0.12);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

/* ===== LAYOUT BODY ===== */
.layout-body {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
}

/* ===== ASIDE / SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--c-dark);
  border-right: 2px solid var(--c-primary);
  padding: var(--gap-md) var(--gap-sm);
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.sidebar-eyebrow {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-accent);
  padding-bottom: var(--gap-xs);
  border-bottom: 1px solid var(--c-mid2);
}

.sidebar-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav-list li {
  opacity: 0;
  transform: translateX(-12px);
  animation: staggerIn 0.4s ease forwards;
}

.sidebar-nav-list li:nth-child(1) { animation-delay: 0.05s; }
.sidebar-nav-list li:nth-child(2) { animation-delay: 0.1s; }
.sidebar-nav-list li:nth-child(3) { animation-delay: 0.15s; }
.sidebar-nav-list li:nth-child(4) { animation-delay: 0.2s; }
.sidebar-nav-list li:nth-child(5) { animation-delay: 0.25s; }
.sidebar-nav-list li:nth-child(6) { animation-delay: 0.3s; }
.sidebar-nav-list li:nth-child(7) { animation-delay: 0.35s; }

@keyframes staggerIn {
  to { opacity: 1; transform: translateX(0); }
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--gap-xs);
  padding: 10px var(--gap-xs);
  text-decoration: none;
  color: var(--c-text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
  border-left: 2px solid transparent;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  color: var(--c-text);
  background: rgba(101,20,255,0.12);
  border-left-color: var(--c-accent);
  outline: none;
}

.sidebar-idx {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--c-primary);
  font-style: normal;
  letter-spacing: 0.05em;
  min-width: 20px;
}

.sidebar-deco-block {
  margin-top: auto;
  height: 80px;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-accent) 100%);
  opacity: 0.15;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 0;
}

.page-article {
  display: flex;
  flex-direction: column;
}

/* ===== HERO SECTION ===== */
.hero-section {
  position: relative;
  min-height: 70vh;
  background: linear-gradient(135deg, var(--c-dark) 0%, var(--c-mid) 60%, rgba(101,20,255,0.2) 100%);
  display: flex;
  align-items: center;
  padding: var(--gap-xl) var(--gap-xl);
  overflow: hidden;
  border-bottom: 3px solid var(--c-primary);
  scroll-margin-top: calc(var(--header-h) + 8px);
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 60% at 80% 40%, rgba(191,0,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--gap-xl);
  width: 100%;
  max-width: 900px;
}

.hero-text-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-accent);
  padding: 4px 10px;
  border: 1px solid var(--c-accent);
}

.hero-h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
  background: linear-gradient(90deg, #fff 0%, var(--c-light) 60%, var(--c-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1rem;
  color: var(--c-text-dim);
  font-weight: 300;
  max-width: 480px;
  line-height: 1.7;
}

.hero-illo-col {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-illo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Geometric shapes fallback */
.hero-geo {
  position: relative;
}

.geo-shape {
  position: absolute;
}

.geo-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  opacity: 0.7;
  top: 20px;
  left: 20px;
  animation: geoFloat 4s ease-in-out infinite;
}

.geo-rect {
  width: 70px;
  height: 70px;
  background: var(--c-accent);
  opacity: 0.4;
  bottom: 10px;
  right: 10px;
  animation: geoFloat 4s ease-in-out infinite reverse;
}

@keyframes geoFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

.hero-bg-num {
  position: absolute;
  bottom: -0.1em;
  right: var(--gap-xl);
  font-size: clamp(6rem, 18vw, 14rem);
  font-weight: 700;
  color: rgba(101,20,255,0.08);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.05em;
}

/* ===== CONTENT SECTION ===== */
.content-section {
  padding: var(--gap-xl) var(--gap-xl);
  scroll-margin-top: calc(var(--header-h) + 8px);
}

.content-body {
  max-width: 860px;
}

/* Rich content styles */
.content-body h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  color: #fff;
  margin-top: var(--gap-xl);
  margin-bottom: var(--gap-sm);
  letter-spacing: -0.01em;
  border-left: 4px solid var(--c-primary);
  padding-left: var(--gap-sm);
  line-height: 1.2;
}

.content-body h2:first-child {
  margin-top: 0;
}

.content-body h3 {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 600;
  color: var(--c-light);
  margin-top: var(--gap-md);
  margin-bottom: var(--gap-xs);
}

.content-body p {
  color: var(--c-text-dim);
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: var(--gap-sm);
}

.content-body ul,
.content-body ol {
  color: var(--c-text-dim);
  padding-left: 1.5rem;
  margin-bottom: var(--gap-sm);
}

.content-body li {
  margin-bottom: 6px;
  line-height: 1.7;
}

.content-body a {
  color: var(--c-accent);
  text-decoration: underline;
  text-decoration-color: rgba(191,0,255,0.4);
  transition: color var(--transition), text-decoration-color var(--transition);
}

.content-body a:hover {
  color: #fff;
  text-decoration-color: var(--c-accent);
}

.content-body strong {
  color: var(--c-light);
  font-weight: 600;
}

.content-body blockquote {
  border-left: 3px solid var(--c-accent);
  padding: var(--gap-sm) var(--gap-md);
  background: rgba(101,20,255,0.08);
  margin: var(--gap-md) 0;
  color: var(--c-text-dim);
  font-style: normal;
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--gap-md) 0;
  font-size: 0.9rem;
}

.content-body th {
  background: var(--c-primary);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}

.content-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-dim);
}

.content-body tr:hover td {
  background: rgba(101,20,255,0.06);
}

/* Section dividers inside content */
.content-body section {
  padding-top: var(--gap-lg);
  margin-top: var(--gap-lg);
  border-top: 1px solid var(--c-border);
  scroll-margin-top: calc(var(--header-h) + var(--nav-h) + 12px);
}

.content-body section:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* Scroll reveal */
.content-body section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.content-body section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--c-dark);
  border-top: 2px solid var(--c-primary);
  padding: var(--gap-xl) var(--gap-xl) var(--gap-lg);
  text-align: center;
  overflow: hidden;
  position: relative;
}

.footer-brand-big {
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(101,20,255,0.3);
  user-select: none;
  line-height: 1;
  margin-bottom: var(--gap-md);
}

.footer-copy {
  display: block;
  font-size: 0.78rem;
  color: var(--c-text-dim);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--c-dark);
  border-top: 2px solid var(--c-primary);
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar { display: none; }

.bottom-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 56px;
  padding: 0 var(--gap-xs);
  text-decoration: none;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  position: relative;
}

.bottom-logo {
  height: 28px;
  width: auto;
}

.bottom-logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.bottom-nav-dl {
  display: flex;
  align-items: stretch;
  flex: 1;
  gap: 0;
}

.nav-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.nav-item dd {
  width: 100%;
  display: flex;
}

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 40px;
  padding: 6px 4px;
  text-decoration: none;
  color: var(--c-text-dim);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-right: 1px solid var(--c-border);
  transition: color var(--transition), background var(--transition);
  text-align: center;
  line-height: 1.3;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #fff;
  background: rgba(101,20,255,0.2);
  outline: none;
}

.nav-num {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--c-primary);
  letter-spacing: 0.04em;
}

.nav-name {
  font-size: 0.62rem;
}

/* ===== UTILITY ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ===== SCROLL MARGIN FOR SECTIONS ===== */
section[id] {
  scroll-margin-top: calc(var(--header-h) + var(--nav-h) + 8px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --gap-xl: 40px;
    --gap-lg: 32px;
    --gap-md: 24px;
  }

  .sidebar {
    display: none;
  }

  .layout-body {
    flex-direction: column;
  }

  .main-content {
    width: 100%;
  }

  .hero-section {
    padding: var(--gap-lg) var(--gap-md);
    min-height: 60vh;
  }

  .hero-inner {
    flex-direction: column-reverse;
    gap: var(--gap-md);
  }

  .hero-illo-col {
    width: 120px;
    height: 120px;
  }

  .hero-bg-num {
    right: var(--gap-md);
    font-size: 5rem;
  }

  .content-section {
    padding: var(--gap-lg) var(--gap-md);
  }

  .site-footer {
    padding: var(--gap-lg) var(--gap-md);
  }

  .nav-link {
    font-size: 0.58rem;
    padding: 4px 2px;
  }

  .nav-name {
    font-size: 0.55rem;
  }

  .bottom-brand {
    width: 44px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  .hero-h1 {
    font-size: 1.9rem;
  }

  .bottom-nav {
    height: 58px;
  }

  :root {
    --nav-h: 58px;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
  .geo-circle,
  .geo-rect {
    animation: none;
  }
  .sidebar-nav-list li {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .content-body section {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

button[aria-expanded]{min-width:44px;min-height:44px}
