/* ===================================
   calctxt - Modern Text Calculator
   =================================== */

/* CSS Custom Properties */
:root {
    /* Light mode (default) */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-subtle: rgba(124, 58, 237, 0.1);
    --border: rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 60px rgba(124, 58, 237, 0.15);

    /* Code colors */
    --code-bg: #1e1e2e;
    --code-text: #cdd6f4;
    --code-comment: #6c7086;
    --code-number: #a6e3a1;
    --code-operator: #89b4fa;
    --code-string: #f9e2af;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0a0a0b;
        --bg-secondary: #111113;
        --bg-tertiary: #18181b;
        --text-primary: #fafafa;
        --text-secondary: #a1a1aa;
        --text-muted: #71717a;
        --border: rgba(255, 255, 255, 0.08);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
        --shadow-glow: 0 0 80px rgba(124, 58, 237, 0.25);
        --accent-subtle: rgba(124, 58, 237, 0.15);
    }
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Grain overlay for texture */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    z-index: 1000;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

/* ===================================
   Hero Section
   =================================== */
.hero {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4xl) var(--space-xl);
    position: relative;
}

.hero-content {
    max-width: 800px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.hero-title {
    font-size: clamp(3.5rem, 12vw, 7rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: var(--space-md);
    font-family: var(--font-mono);
}

.title-line {
    color: var(--text-primary);
}

.title-accent {
    color: var(--accent);
}

.hero-tagline {
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
    font-weight: 400;
}

/* Demo box */
.hero-demo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
}

.demo-input,
.demo-output {
    background: var(--code-bg);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-align: left;
    min-width: 200px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.demo-input {
    color: var(--code-text);
}

.demo-output {
    color: var(--code-text);
}

.demo-line {
    display: block;
    line-height: 1.8;
}

.demo-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
}

.comment {
    color: var(--code-comment);
}

.num {
    color: var(--code-number);
}

.op {
    color: var(--code-operator);
}

/* CTA Buttons */
.hero-cta {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(124, 58, 237, 0.4);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* ===================================
   Screenshot Section
   =================================== */
.screenshot {
    padding: var(--space-2xl) var(--space-xl);
    display: flex;
    justify-content: center;
}

.screenshot-container {
    position: relative;
    max-width: 1000px;
    width: 100%;
}

.screenshot-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 60%;
    background: radial-gradient(ellipse, var(--accent) 0%, transparent 70%);
    opacity: 0.15;
    filter: blur(60px);
    pointer-events: none;
}

.screenshot-frame {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.screenshot-frame img {
    display: block;
    width: 100%;
    height: auto;
}

/* ===================================
   Features Section
   =================================== */
.features {
    padding: var(--space-4xl) var(--space-xl);
    max-width: 1200px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
}

.feature {
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.feature:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.icon-text {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
}

.feature h3 {
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.feature p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===================================
   Download Section
   =================================== */
.download {
    padding: var(--space-4xl) var(--space-xl);
    max-width: 900px;
    margin: 0 auto;
}

.section-title {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 4vw, 2rem);
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-title .comment {
    color: var(--text-muted);
}

.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
}

.download-card {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    color: var(--text-primary);
}

.download-card:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.download-icon {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.download-card:hover .download-icon {
    color: var(--accent);
}

.download-info {
    flex: 1;
}

.download-platform {
    display: block;
    font-weight: 600;
    font-size: 1rem;
}

.download-format {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.download-arrow {
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.download-card:hover .download-arrow {
    color: var(--accent);
    transform: translate(3px, -3px);
}

/* ===================================
   Philosophy Section
   =================================== */
.philosophy {
    padding: var(--space-4xl) var(--space-xl);
    display: flex;
    justify-content: center;
}

.philosophy-content {
    max-width: 600px;
    text-align: center;
}

blockquote {
    position: relative;
}

.quote-mark {
    font-size: 4rem;
    font-family: Georgia, serif;
    color: var(--accent);
    opacity: 0.3;
    line-height: 1;
    display: block;
    margin-bottom: -1rem;
}

blockquote p {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    font-weight: 500;
    color: var(--text-secondary);
    font-style: italic;
    letter-spacing: -0.01em;
}

/* ===================================
   Footer
   =================================== */
.footer {
    padding: var(--space-2xl) var(--space-xl);
    border-top: 1px solid var(--border);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-text .comment {
    color: var(--text-muted);
}

.footer-license {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .hero {
        padding: var(--space-2xl) var(--space-lg);
        min-height: 60vh;
    }

    .hero-demo {
        flex-direction: column;
    }

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

    .demo-input,
    .demo-output {
        width: 100%;
        min-width: auto;
    }

    .features {
        padding: var(--space-2xl) var(--space-lg);
    }

    .download {
        padding: var(--space-2xl) var(--space-lg);
    }

    .download-card {
        padding: var(--space-lg);
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero-cta {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===================================
   Animations
   =================================== */
@media (prefers-reduced-motion: no-preference) {
    .hero-content {
        animation: fadeInUp 0.8s ease-out;
    }

    .screenshot-frame {
        animation: fadeInUp 0.8s ease-out 0.2s backwards;
    }

    .feature {
        animation: fadeInUp 0.6s ease-out backwards;
    }

    .feature:nth-child(1) { animation-delay: 0.1s; }
    .feature:nth-child(2) { animation-delay: 0.2s; }
    .feature:nth-child(3) { animation-delay: 0.3s; }
    .feature:nth-child(4) { animation-delay: 0.4s; }
    .feature:nth-child(5) { animation-delay: 0.5s; }
    .feature:nth-child(6) { animation-delay: 0.6s; }

    .download-card {
        animation: fadeInUp 0.6s ease-out backwards;
    }

    .download-card:nth-child(1) { animation-delay: 0.1s; }
    .download-card:nth-child(2) { animation-delay: 0.2s; }
    .download-card:nth-child(3) { animation-delay: 0.3s; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus states for accessibility */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--accent);
    color: white;
}
