/**
 * ClawCaptcha Landing Page Styles
 * Custom styles that extend Pico CSS
 */

/* CSS Variables for theming */
:root {
  --gradient-start: #ff6b6b;
  --gradient-end: #4ecdc4;
  --claw-orange: #ff6b35;
  --claw-teal: #00c9a7;
  --flow-arrow-color: var(--pico-muted-color);
}

[data-theme="dark"] {
  --gradient-start: #ff8787;
  --gradient-end: #63e6be;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 4rem);
  margin-bottom: 0.5rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1.25rem;
  max-width: 600px;
  margin: 2rem auto;
  line-height: 1.8;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* Section styling */
section {
  padding: 3rem 0;
}

section h2 {
  text-align: center;
  margin-bottom: 2rem;
}

.section-subtitle {
  text-align: center;
  margin-bottom: 2rem;
  opacity: 0.8;
}

/* Theme toggle button */
#theme-toggle,
#theme-toggle-mobile {
  padding: 0.5rem 0.75rem;
  font-size: 1.25rem;
  border-radius: 50%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="light"] .dark-icon,
[data-theme="dark"] .light-icon {
  display: none;
}

[data-theme="light"] .light-icon,
[data-theme="dark"] .dark-icon {
  display: inline;
}

/* Bot Test Section */
.bot-test-container {
  display: grid;
  gap: 1.5rem;
}

.bot-test {
  border-left: 4px solid var(--claw-teal);
}

.bot-test header h3 {
  margin-bottom: 0.25rem;
}

.bot-test header small {
  opacity: 0.7;
}

.test-content {
  padding: 1rem 0;
}

.math-problem {
  font-size: 2rem;
  font-family: monospace;
  text-align: center;
  padding: 1rem;
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
  margin-bottom: 1rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.input-group input {
  flex: 1;
  margin-bottom: 0;
}

.input-group button {
  margin-bottom: 0;
  white-space: nowrap;
}

.input-group textarea {
  flex: 1;
  min-height: 100px;
  font-family: monospace;
  font-size: 0.9rem;
}

.full-width {
  width: 100%;
}

.result {
  padding: 0.75rem;
  border-radius: var(--pico-border-radius);
  text-align: center;
  min-height: 2.5rem;
}

.result.success {
  background: rgba(46, 204, 113, 0.2);
  color: #27ae60;
}

.result.failure {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.result.info {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
}

[data-theme="dark"] .result.success {
  color: #2ecc71;
}

[data-theme="dark"] .result.failure {
  color: #e74c3c;
}

[data-theme="dark"] .result.info {
  color: #5dade2;
}

/* Score Card */
.score-card {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
}

.score-card header h3 {
  color: white;
}

.score-display {
  text-align: center;
  padding: 1rem 0;
}

.score-circle {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.score-circle .percent {
  font-size: 1.25rem;
}

#score-verdict {
  font-size: 1.1rem;
  margin: 0;
}

.score-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.score-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--pico-border-radius);
}

/* Demo Section */
.demo-container {
  max-width: 800px;
  margin: 0 auto;
}

.demo-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.demo-note {
  opacity: 0.7;
}

.demo-controls label {
  margin-bottom: 0;
}

.demo-controls input {
  margin-bottom: 0;
}

.demo-controls button {
  margin-bottom: 0;
}

.demo-output {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.demo-step {
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
  overflow: hidden;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--pico-card-sectioning-background-color);
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--pico-primary);
  color: white;
  border-radius: 50%;
  font-weight: bold;
  font-size: 0.9rem;
}

.step-title {
  flex: 1;
  font-weight: 600;
}

.step-status {
  font-size: 1.25rem;
}

.step-output {
  margin: 0;
  padding: 1rem;
  font-size: 0.85rem;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.step-output:empty {
  display: none;
}

.demo-result {
  text-align: center;
  padding: 1.5rem;
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
}

.demo-result.success {
  background: rgba(46, 204, 113, 0.15);
  border: 2px solid #27ae60;
}

.demo-result.failure {
  background: rgba(231, 76, 60, 0.15);
  border: 2px solid #e74c3c;
}

/* Flow Diagram */
.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2rem 0;
}

.flow-step {
  flex: 1;
  min-width: 150px;
  max-width: 200px;
  text-align: center;
  padding: 1rem;
}

.flow-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.flow-step h4 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.flow-step p {
  font-size: 0.9rem;
  margin: 0;
  opacity: 0.8;
}

.flow-arrow {
  font-size: 2rem;
  color: var(--flow-arrow-color);
  font-weight: bold;
}

/* Technical Details */
.tech-details {
  padding: 1rem 0;
}

.tech-details h4 {
  color: var(--pico-primary);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.tech-details h4:first-child {
  margin-top: 0;
}

/* Fun Facts */
.fact-card {
  text-align: center;
}

.fact-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.fact-card p {
  margin: 0;
}

/* CTA Section */
.cta-card {
  text-align: center;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  padding: 3rem;
}

.cta-card h2 {
  color: white;
  margin-bottom: 1rem;
}

.cta-card p {
  margin-bottom: 2rem;
  opacity: 0.95;
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-buttons a {
  background: white;
  color: var(--gradient-start);
  border: none;
}

.cta-buttons a.outline {
  background: transparent;
  color: white;
  border: 2px solid white;
}

.cta-buttons a:hover {
  opacity: 0.9;
}

/* Integration Code */
#integration article {
  overflow: hidden;
}

#integration pre {
  margin: 0;
  border-radius: 0;
}

#integration code {
  font-size: 0.85rem;
}

/* Footer */
footer.container {
  padding-bottom: 2rem;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-tagline {
  margin: 0;
  opacity: 0.8;
}

/* Animations */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.score-circle {
  animation: pulse 2s ease-in-out infinite;
}

/* Schema display */
#schema-display {
  font-size: 0.8rem;
  margin-bottom: 1rem;
  max-height: 200px;
  overflow: auto;
}

/* ==================== Overflow containment ==================== */

/* Prevent anything from blowing out the viewport */
html, body {
  overflow-x: hidden;
}

/* All cards contain their children */
article {
  overflow: hidden;
}

/* Code blocks scroll horizontally instead of overflowing */
pre {
  overflow-x: auto;
  max-width: 100%;
}

/* Inline code wraps on small screens */
code {
  word-break: break-word;
}

#integration pre {
  font-size: clamp(0.7rem, 2vw, 0.85rem);
}

/* ==================== Mobile menu ==================== */

.nav-mobile {
  display: none;
}

#menu-toggle {
  font-size: 1.4rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--pico-border-radius);
  line-height: 1;
}

.mobile-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.mobile-menu-backdrop.open {
  display: block;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(280px, 80vw);
  background: var(--pico-background-color);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  padding: 1rem 1.5rem;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.mobile-menu-header button {
  font-size: 1.5rem;
  padding: 0.25rem 0.6rem;
  line-height: 1;
  border-radius: var(--pico-border-radius);
}

.mobile-menu nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobile-menu nav li {
  padding: 0;
}

.mobile-menu nav a {
  display: block;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
  text-decoration: none;
  font-size: 1.05rem;
}

/* ==================== Responsive ==================== */

/* Tablets and below */
@media (max-width: 768px) {
  .nav-desktop {
    display: none;
  }

  .nav-mobile {
    display: flex;
  }

  .hero {
    padding: 2rem 0 1.5rem;
  }

  .tagline {
    font-size: 1.1rem;
  }

  section {
    padding: 2rem 0;
  }

  /* Stack Pico grids into single column */
  .grid {
    grid-template-columns: 1fr !important;
  }

  .cta-card {
    padding: 2rem 1.5rem;
  }

  .score-circle {
    width: 100px;
    height: 100px;
    font-size: 2rem;
  }

  .score-circle .percent {
    font-size: 1rem;
  }

  .flow-diagram {
    flex-direction: column;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }
}

/* Phones */
@media (max-width: 576px) {
  .hero {
    padding: 1.5rem 0 1rem;
  }

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

  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-cta a {
    text-align: center;
  }

  .input-group {
    flex-direction: column;
  }

  .input-group button {
    width: 100%;
  }

  .math-problem {
    font-size: 1.4rem;
    padding: 0.75rem;
  }

  .cta-card {
    padding: 1.5rem 1rem;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-buttons a {
    text-align: center;
  }

  .footer-links {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .step-output {
    font-size: 0.75rem;
    padding: 0.75rem;
  }

  #schema-display {
    font-size: 0.7rem;
  }
}
