/* ========================================
   AgeGuard Demo RP — Styles
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Design Tokens --- */
:root {
  --bg-primary: #0a0a0f;
  --bg-surface: #13131a;
  --bg-overlay: rgba(10,10,15,0.97);
  --accent: #4f6ef7;
  --accent-hover: #6b85ff;
  --success: #22c55e;
  --success-bg: rgba(13,79,47,0.9);
  --text-primary: #f1f1f5;
  --text-muted: #8b8ba0;
  --border: #2a2a3a;
  --code-bg: #0d0d17;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', monospace;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ========================================
   NAV BAR (content behind age gate)
   ======================================== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 2rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.site-nav__logo {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--accent);
}

.site-nav__links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.site-nav__links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.site-nav__links a:hover {
  color: var(--text-primary);
}

/* ========================================
   CONTENT GRID
   ======================================== */
.content-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.content-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.content-card {
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.content-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.content-card__image {
  width: 100%;
  height: 200px;
  position: relative;
  overflow: hidden;
}

/* Gradient placeholders */
.content-card:nth-child(1) .content-card__image {
  background: linear-gradient(135deg, #1a1a3e, #3d2066, #1a1a3e);
}
.content-card:nth-child(2) .content-card__image {
  background: linear-gradient(135deg, #0d2b3e, #164a6b, #0d2b3e);
}
.content-card:nth-child(3) .content-card__image {
  background: linear-gradient(135deg, #1a3320, #2d5a3a, #1a3320);
}
.content-card:nth-child(4) .content-card__image {
  background: linear-gradient(135deg, #3e1a1a, #6b2020, #3e1a1a);
}
.content-card:nth-child(5) .content-card__image {
  background: linear-gradient(135deg, #2e2a0d, #5a4f1a, #2e2a0d);
}
.content-card:nth-child(6) .content-card__image {
  background: linear-gradient(135deg, #1a2e3e, #204a6b, #1a2e3e);
}

/* Abstract shapes inside placeholders */
.content-card__image::before,
.content-card__image::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
}

.content-card__image::before {
  width: 120px;
  height: 120px;
  background: var(--accent);
  top: -20px;
  right: -20px;
}

.content-card__image::after {
  width: 80px;
  height: 80px;
  background: var(--text-primary);
  bottom: -10px;
  left: 20px;
}

.content-card__body {
  padding: 1rem 1.25rem;
}

.content-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.content-card__desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ========================================
   SITE FOOTER
   ======================================== */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ========================================
   AGE GATE OVERLAY
   ======================================== */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

body.state-unlocked .age-gate {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.age-gate__inner {
  width: 100%;
  max-width: 580px;
  text-align: center;
}

/* Logo */
.age-gate__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  margin-bottom: 2rem;
}

.age-gate__logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  color: #fff;
}

.age-gate__logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Text */
.age-gate__headline {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.age-gate__description {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.7;
  margin-bottom: 2rem;
}

/* CTA */
.age-gate__cta {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  position: relative;
  overflow: hidden;
}

.age-gate__cta:hover:not(:disabled) {
  background: var(--accent-hover);
}

.age-gate__cta:active:not(:disabled) {
  transform: scale(0.985);
}

.age-gate__cta:disabled {
  cursor: default;
  opacity: 0.85;
}

/* CTA spinner */
.age-gate__cta .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 0.5rem;
}

body.state-verifying .age-gate__cta .spinner {
  display: inline-block;
}

body.state-verifying .age-gate__cta .cta-label {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Privacy trust line */
.age-gate__privacy {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ========================================
   VERIFYING STATE — progress area
   ======================================== */
.age-gate__progress {
  display: none;
  margin-top: 1.5rem;
  text-align: center;
}

body.state-verifying .age-gate__progress {
  display: block;
}

body.state-verifying .age-gate__description,
body.state-verifying .age-gate__privacy,
body.state-verifying .age-gate__how-it-works,
body.state-verifying .age-gate__code-panel {
  display: none;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-bar__fill {
  height: 100%;
  width: 30%;
  background: var(--accent);
  border-radius: 2px;
  animation: progress-sweep 2.5s ease-in-out infinite;
}

@keyframes progress-sweep {
  0%   { width: 10%; margin-left: 0; }
  50%  { width: 40%; margin-left: 30%; }
  100% { width: 10%; margin-left: 90%; }
}

.progress-status {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 1.5em;
}

.progress-hint {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ========================================
   "HOW IT WORKS" EXPANDABLE
   ======================================== */
.age-gate__how-it-works {
  margin-top: 1.5rem;
  text-align: left;
}

.how-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0;
  width: 100%;
}

.how-toggle__arrow {
  transition: transform 0.2s;
  font-size: 0.75rem;
}

.how-toggle[aria-expanded="true"] .how-toggle__arrow {
  transform: rotate(90deg);
}

.how-content {
  display: none;
  padding: 1rem 0 0.5rem;
}

.how-content.open {
  display: block;
}

.how-step {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.how-step__num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-top: 2px;
}

/* ========================================
   CODE SNIPPET PANEL
   ======================================== */
.age-gate__code-panel {
  margin-top: 2rem;
  text-align: left;
}

.code-panel__headline {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.code-block {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
}

.code-block pre {
  margin: 0;
  font-family: var(--font-code);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre;
}

/* Syntax highlight tokens */
.code-block .kw { color: #c792ea; }
.code-block .fn { color: #82aaff; }
.code-block .str { color: #c3e88d; }
.code-block .cm { color: #546e7a; }
.code-block .pr { color: #f78c6c; }

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--border);
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.code-copy-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ========================================
   SUCCESS BANNER
   ======================================== */
.success-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--success-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  transform: translateY(-100%);
  transition: transform 0.4s ease;
}

.success-banner.visible {
  transform: translateY(0);
}

.success-banner__icon {
  font-size: 1.25rem;
}

.success-banner__text {
  font-size: 0.875rem;
  font-weight: 500;
}

.success-banner__sub {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.75);
  margin-left: 0.5rem;
}

.success-banner__dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.success-banner__dismiss:hover {
  color: #fff;
}

/* ========================================
   DEBUG PANEL
   ======================================== */
.debug-panel {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 1001;
  font-size: 0.8125rem;
}

.debug-tab {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 0.375rem 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.debug-panel.open .debug-tab {
  display: none;
}

.debug-body {
  display: none;
  width: 360px;
  max-height: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px 0 0 0;
  padding: 1rem;
  overflow-y: auto;
}

.debug-panel.open .debug-body {
  display: block;
}

.debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.debug-header__title {
  font-weight: 600;
  font-size: 0.875rem;
}

.debug-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.125rem;
  cursor: pointer;
  padding: 0.125rem;
  line-height: 1;
}

.debug-close:hover {
  color: var(--text-primary);
}

.debug-section {
  margin-bottom: 0.875rem;
}

.debug-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.debug-value {
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--text-primary);
  word-break: break-all;
}

.debug-jwt {
  font-family: var(--font-code);
  font-size: 0.6875rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.625rem;
  max-height: 100px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-primary);
  line-height: 1.5;
}

.debug-reset {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.debug-reset:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========================================
   SETTINGS MODAL
   ======================================== */
.settings-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1002;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}

.settings-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.settings-modal.open {
  opacity: 1;
  visibility: visible;
}

.settings-modal__inner {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
}

.settings-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.settings-modal__title {
  font-size: 1.125rem;
  font-weight: 600;
}

.settings-modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.125rem;
  line-height: 1;
}

.settings-modal__close:hover {
  color: var(--text-primary);
}

.settings-field {
  margin-bottom: 1rem;
}

.settings-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.settings-field input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-family: var(--font-code);
  font-size: 0.8125rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.settings-field input:focus {
  border-color: var(--accent);
}

.settings-presets {
  margin-bottom: 1.25rem;
}

.settings-presets__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.settings-presets__btns {
  display: flex;
  gap: 0.5rem;
}

.preset-btn {
  padding: 0.375rem 1rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.settings-apply {
  width: 100%;
  padding: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.settings-apply:hover {
  background: var(--accent-hover);
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 639px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .age-gate__code-panel {
    display: none;
  }

  .how-content {
    display: block;
  }

  .how-toggle {
    display: none;
  }

  .site-nav {
    padding: 0.75rem 1rem;
    gap: 1rem;
  }

  .site-nav__links {
    gap: 1rem;
  }

  .content-section {
    padding: 2rem 1rem;
  }

  .debug-body {
    width: 100vw;
    max-height: 50vh;
    border-radius: 12px 12px 0 0;
  }

  .settings-modal {
    padding: 0;
    align-items: flex-end;
  }

  .settings-modal__inner {
    max-width: none;
    border-radius: 14px 14px 0 0;
  }
}
