/* Code Tutor - Main Stylesheet */

/* Scroll margin for anchored sections */
section[id] { 
    scroll-margin-top: 80px; 
}

/* Skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--blue-700);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    z-index: 1000;
}
.skip-link:focus {
    left: 12px;
    top: 12px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables based on style guide - with font-display optimization */
:root {
    --bg-dark: oklch(20.8% .042 265.755);
    --surface-dark: #1E293B;
    --text-primary: #F9FAFB;
    --text-secondary: #CBD5E1;
    --text-muted: #9CA3AF;
    --primary: #10B981;
    --primary-hover: #60A5FA;
    --border-dark: #374151;
    --error: #EF4444;
    --success: #10B981;
    --blue-600: #3B82F6;
    --blue-700: #2563EB;
}

/* Font display optimization */
@font-face {
    font-family: 'Inter';
    font-display: swap;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navigation */
nav {
    background-color: var(--surface-dark);
    border-bottom: 1px solid var(--border-dark);
    position: sticky;
    top: 0;
    z-index: 50;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.nav-brand img {
    width: 40px;
    height: 40px;
}

.nav-brand h2 {
    font-size: 24px;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 150ms;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    padding: 80px 0;
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
}

.badge .dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 24px;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--blue-600) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: 20px;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 150ms;
    cursor: pointer;
    border: none;
}

.button-primary {
    background-color: var(--blue-600);
    color: white;
}

.button-primary:not(:disabled):hover {
    background-color: var(--blue-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.button-secondary {
    background-color: transparent;
    color: var(--blue-600);
    border: 2px solid var(--blue-600);
}

.button-secondary:not(:disabled):hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Sections */
section {
    padding: 30px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
}

.section-header p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
    margin-bottom: 48px;
}

.feature-card {
    background-color: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 32px;
    transition: transform 150ms, box-shadow 150ms;
}

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

.feature-icon {
    width: 48px;
    height: 48px;
    background-color: rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 24px;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Pricing */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    max-width: 1000px;
    margin: 0 auto;
    margin-top: 48px;
}

.pricing-card {
    background-color: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    position: relative;
    transition: transform 150ms, box-shadow 150ms;
}

.pricing-card.popular {
    border-color: var(--blue-600);
    transform: scale(1.05);
}

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

.pricing-card.popular:hover {
    transform: scale(1.05) translateY(-4px);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--blue-600) 0%, var(--primary) 100%);
    color: white;
    padding: 4px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.pricing-card h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
}

.price {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 8px;
}

.price-period {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.pricing-features {
    list-style: none;
    margin-bottom: 32px;
}

.pricing-features li {
    padding: 8px 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pricing-features li::before {
    content: "✓";
    color: var(--primary);
    font-weight: 600;
}

/* Contact Form */
.contact-section {
    background-color: var(--surface-dark);
    border-radius: 12px;
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

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

label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

input, textarea, select {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    transition: border-color 150ms;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--blue-600);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* Newsletter Form */
.newsletter-form {
    background-color: var(--surface-dark);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    max-width: 650px;
    margin: 0 auto;
}

.newsletter-form h3 {
    font-size: 28px;
    margin-bottom: 16px;
}

.newsletter-form p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Footer */
footer {
    background-color: var(--surface-dark);
    border-top: 1px solid var(--border-dark);
    padding: 48px 0 24px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
    margin-bottom: 48px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

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

.footer-section h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 12px;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 150ms;
}

.footer-section a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    border-top: 1px solid var(--border-dark);
    padding-top: 24px;
    text-align: center;
    color: var(--text-muted);
}

/* Message styles */
.message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: slideIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.message.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* How It Works Grid - 3 columns on desktop */
.how-it-works-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

/* FAQ Accordion Styles */
.faq-accordion {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background-color: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 300ms ease;
}

.faq-item:hover {
    border-color: var(--blue-600);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.faq-question {
    padding: 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-family: inherit;
    transition: background-color 150ms;
}

.faq-question:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.faq-question h3 {
    color: var(--primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    padding-right: 16px;
}

.faq-icon {
    font-size: 24px;
    color: var(--blue-600);
    transition: transform 300ms ease;
    flex-shrink: 0;
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease, padding 300ms ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
    padding: 0 24px 24px 24px;
}

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .how-it-works-grid {
        grid-template-columns: 1fr;
    }
    .nav-links {
        display: none;
    }

    h1 {
        font-size: 32px;
        line-height: 1.3;
    }

    .hero-description {
        font-size: 16px;
        padding: 0 10px;
    }

    .features-grid, .pricing-grid {
        grid-template-columns: 1fr;
    }

    .pricing-card.popular {
        transform: none;
    }

    .contact-section, .newsletter-form {
        padding: 24px 20px;
    }
    
    /* Beta-specific mobile optimizations */
    .hero .container > div:first-child {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    /* Sticky CTA on mobile */
    @supports (position: sticky) {
        #join-beta {
            position: relative;
        }
        
        #join-beta .button-primary {
            position: sticky;
            bottom: 20px;
            z-index: 10;
            box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
        }
    }
    
    /* Founder section mobile */
    section > div > div > div > div > div:first-child {
        width: 100px !important;
        height: 100px !important;
    }
    
    /* Simplified form on mobile */
    .newsletter-form {
        padding: 20px 16px;
    }
    
    .newsletter-form h3 {
        font-size: 24px;
    }
    
    .newsletter-form p {
        font-size: 14px;
    }
    
    /* Touch-friendly button sizes */
    .button {
        min-height: 48px;
        font-size: 16px;
    }
    
    /* Better spacing for form fields */
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group label {
        font-size: 16px;
    }
    
    input, textarea, select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 12px;
    }
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-left: 8px;
}

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

.spinner.hidden {
    display: none;
}

/* Turnstile widget styling */
.cf-turnstile {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

/* Ensure Turnstile widget is centered on mobile */
@media (max-width: 768px) {
    .cf-turnstile iframe {
        max-width: 100%;
    }
}

/* Enhanced form styling - Compact Design */
.form-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.form-legend {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding: 0;
}

/* Multi-column form layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row.single {
    grid-template-columns: 1fr;
}

.conditional-field {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
    grid-column: 1 / -1;
}

.conditional-field.show {
    max-height: 80px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 8px;
    margin-bottom: -8px;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

/* Compact input styling */
input, textarea, select {
    padding: 10px 12px;
    font-size: 15px;
}

/* Remove verbose helper text, keep essential info in placeholders */
.form-help {
    display: none;
}

/* Number input styling */
input[type="number"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Select dropdown arrow styling */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' fill='%23CBD5E1' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

/* Form accessibility improvements */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Compact textarea */
textarea {
    min-height: 80px;
    resize: vertical;
}

/* Enhanced responsive form layout */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }

    .conditional-field.show {
        max-height: 100px;
        margin-top: 12px;
        margin-bottom: -8px;
    }

    .form-fieldset {
        margin-bottom: 12px;
    }
}