:root {
  --bg: #06070f;
  --ink: #d8eeff;
  --ink-soft: #9cb6d4;
  --cyan: #00e5ff;
  --magenta: #cc00ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  --card-crop-scale: 1.136;
  background:
    radial-gradient(ellipse 900px 500px at -5% -8%, rgba(0, 229, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 700px 600px at 108% 95%, rgba(204, 0, 255, 0.08) 0%, transparent 60%),
    var(--bg);
}

.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  background: rgba(0, 229, 255, 0.06);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.hero-link:hover {
  transform: translateY(-1px);
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.45);
}

.hero-link.primary {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.22), rgba(204, 0, 255, 0.16));
  box-shadow: 0 10px 30px rgba(0, 229, 255, 0.12);
}

.hero-link.secondary {
  background: rgba(255, 255, 255, 0.04);
}

.hero-link.active {
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.5);
}

/* ── Navigation ── */

.site-nav {
  width: 100%;
  border-bottom: 1px solid rgba(0, 229, 255, 0.12);
  background: rgba(6, 7, 15, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-nav-inner {
  margin: 0 auto;
  width: min(100%, 1100px);
  padding: 0 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.site-nav-brand {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav-toggle {
  display: none;
}

.site-nav ul {
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 56px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav li {
  display: flex;
}

.site-nav a,
.toc-sidebar a {
  display: block;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover,
.site-nav a.active,
.toc-sidebar a:hover,
.toc-sidebar a.active {
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.06);
}

/* ── Content pages (FAQ, Strategies, VPR Rules) ── */

.content-page {
  max-width: 100%;
  padding: 48px 24px 80px;
  line-height: 1.7;
}

/* Pages with TOC (FAQ, Strategies) */
.content-page.with-toc {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0 auto;
  max-width: 1200px;
}

/* Mobile: TOC hidden by default */
.toc-sidebar {
  display: none;
}

/* Desktop layout: TOC on left, content on right */
@media (min-width: 1000px) {
  .toc-sidebar-toggle {
    display: none;
  }

  .content-page.with-toc {
    grid-template-columns: minmax(200px, 200px) 1fr;
    grid-template-areas: "toc content";
    gap: 48px;
    padding: 48px 32px 80px;
  }

  .toc-sidebar {
    display: block;
    grid-area: toc;
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    height: fit-content;
    padding: 24px 0;
    font-size: 0.9rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 229, 255, 0.15) transparent;
  }

  .toc-sidebar-title {
    font-weight: 700;
    color: var(--cyan);
    margin: 0 0 16px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .toc-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .toc-sidebar li {
    margin: 0 0 8px;
  }

  .toc-sidebar a {
    text-decoration: none;
    display: block;
    margin: 0;
    border-left: 2px solid transparent;
    padding-left: 12px;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
  }

  .page-content {
    grid-area: content;
    max-width: 800px;
  }

  /* Nested TOC styling */
  .toc-sidebar ul ul {
    margin: 4px 0 0;
    padding: 0 0 0 12px;
    list-style: none;
  }

  .toc-sidebar ul ul a {
    font-size: 0.875rem;
    opacity: 0.75;
  }

  .toc-sidebar ul ul ul {
    margin: 0;
    padding: 0 0 0 8px;
  }

  .toc-sidebar ul ul ul a {
    font-size: 0.8rem;
    opacity: 0.65;
  }

  .toc-sidebar .toc-h3 > a {
    font-weight: 500;
    opacity: 0.85;
  }

  .toc-sidebar a.active {
    color: var(--cyan);
    border-left-color: var(--cyan);
  }
}

.page-content {
  max-width: 800px;
  margin: 0 auto;
}

.content-page h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.content-page .page-subtitle {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0 0 48px;
}

.content-page h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cyan);
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.15);
  letter-spacing: 0.01em;
}

.content-page h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 32px 0 10px;
}

.content-page p {
  margin: 0 0 16px;
  color: var(--ink);
}

.content-page ul,
.content-page ol {
  margin: 0 0 16px;
  padding-left: 24px;
  color: var(--ink);
}

.content-page li {
  margin-bottom: 6px;
}

.content-page strong {
  color: var(--ink);
  font-weight: 600;
}

.content-page code {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.875em;
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  color: var(--cyan);
}

.content-page hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin: 40px 0;
}

/* FAQ / Strategies Q&A blocks */

.qa-block {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(0, 229, 255, 0.08);
  border-left: 3px solid rgba(0, 229, 255, 0.3);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 20px 0;
}

.qa-block .question {
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px;
}

.qa-block .answer {
  margin: 0;
  color: var(--ink-soft);
}

.qa-block .answer p:last-child {
  margin-bottom: 0;
}

/* Feedback form */

.feedback-form {
  max-width: 600px;
  margin: 32px auto;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.optional {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.85em;
}

.required {
  color: var(--magenta);
  font-weight: 400;
  font-size: 0.85em;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 6px;
  background: rgba(0, 229, 255, 0.03);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.06);
}

.form-group textarea {
  resize: vertical;
  min-height: 140px;
}

.submit-button {
  display: inline-block;
  padding: 12px 28px;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  background: rgba(0, 229, 255, 0.08);
  color: var(--cyan);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.15s;
}

.submit-button:hover {
  background: rgba(0, 229, 255, 0.15);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.submit-button:active {
  transform: scale(0.98);
}

.form-message {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.form-message.success {
  background: rgba(76, 175, 80, 0.12);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: #a5d6a7;
}

.form-message.error {
  background: rgba(244, 67, 54, 0.12);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: #ef9a9a;
}

/* ── QA Block Flash Animation ── */

@keyframes qa-flash {
  0%, 100% {
    background: rgba(255, 255, 255, 0.025);
    border-left-color: rgba(0, 229, 255, 0.3);
  }
  50% {
    background: rgba(0, 229, 255, 0.1);
    border-left-color: var(--cyan);
  }
}

.qa-block.flash {
  animation: qa-flash 0.45s ease-in-out 3;
}

/* ── Footer ── */

.site-footer {
  margin-top: 2px;
  padding: 2px 2px 10px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-soft);
  opacity: 0.6;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 900px) {
  .content-page.with-toc {
    gap: 18px;
  }

  .site-nav-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
  }

  .site-nav-inner > * {
    min-width: 0;
  }

  .site-nav-toc-slot {
    display: flex;
    align-items: center;
    order: 1;
    flex: 0 0 auto;
    min-width: 0;
    white-space: nowrap;
  }

  .site-nav-brand-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    order: 2;
    margin-left: auto;
    gap: 6px;
    min-width: 0;
  }

  .site-nav-brand {
    width: auto;
    white-space: nowrap;
    margin-right: 0;
    font-size: 1rem;
    text-align: center;
  }

  .site-nav-toggle {
    display: inline-grid;
    align-content: center;
    justify-items: center;
    gap: 4px;
    height: 40px;
    border: 1px solid rgba(0, 229, 255, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    color: var(--ink);
  }

  .site-nav-toggle {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    flex: 0 0 40px;
    flex-shrink: 0;
    padding: 8px;
  }

  .toc-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 auto;
    flex-shrink: 0;
    width: auto;
    min-height: 40px;
    padding: 10px 12px;
    box-sizing: border-box;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--ink-soft);
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
  }

  .site-nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .site-nav ul {
    display: none;
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    min-height: 0;
    margin: 0 0 14px;
    padding: 8px 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .site-nav.is-open ul {
    display: flex;
  }

  .site-nav li {
    width: 100%;
  }

  .site-nav a {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
  }

  .toc-sidebar {
    display: block;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 99;
    max-height: 0;
    border: 0;
    border-radius: 0 0 16px 16px;
    background: rgba(6, 7, 15, 0.96);
    box-shadow: 0 18px 28px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height 0.22s ease, opacity 0.22s ease, transform 0.22s ease;
  }

  .toc-sidebar.is-open {
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
  }

  .toc-sidebar-toggle-label {
    display: inline-block;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    line-height: 1.1;
  }

  .toc-sidebar-toggle-icon {
    display: inline-grid;
    gap: 4px;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    color: currentColor;
  }

  .toc-sidebar-toggle-icon span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }
}

@media (max-width: 640px) {
  .content-page {
    padding: 32px 16px 60px;
  }

  .content-page .page-subtitle {
    margin: 0 0 32px;
  }

  .content-page h2 {
    margin: 36px 0 14px;
  }

  .qa-block {
    padding: 16px;
  }

  .content-page ul,
  .content-page ol {
    padding-left: 20px;
  }

  .feedback-form {
    margin: 24px auto;
  }

  .form-group {
    margin-bottom: 18px;
  }

  .form-group input,
  .form-group textarea {
    padding: 12px;
    font-size: 16px;
  }

  .submit-button {
    width: 100%;
    min-height: 46px;
  }

}

@media (max-width: 344px) {
  .site-nav-inner {
    padding: 0 10px;
    gap: 6px 8px;
    min-height: 52px;
  }

  .site-nav-brand-group {
    gap: 4px;
  }

  .site-nav-brand {
    font-size: 0.86rem;
    letter-spacing: 0.03em;
  }

  .site-nav-toggle {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    height: 38px;
    flex-basis: 40px;
    padding: 7px;
  }

  .toc-sidebar-toggle {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.8rem;
    gap: 6px;
  }

  .toc-sidebar-toggle-label {
    line-height: 1;
  }

  .toc-sidebar-toggle-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    gap: 3px;
  }

  .toc-sidebar-toggle-icon span {
    height: 2px;
  }

  .toc-sidebar {
    top: 52px;
  }

  .toc-sidebar.is-open {
    max-height: calc(100vh - 52px);
  }
}
