/* ═══════════════════════════════════════════
   PixDice — Design System & Landing Page
   Warm, tactile aesthetic for a physical craft tool.
   Palette: stone neutrals + terracotta accent.
   ═══════════════════════════════════════════ */

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

:root {
    --color-bg: #faf9f7;
    --color-surface: #ffffff;
    --color-text: #1c1917;
    --color-text-secondary: #78716c;
    --color-border: #e7e5e4;
    --color-primary: #1c1917;
    --color-primary-hover: #44403c;
    --color-accent: #c2410c;
    --color-accent-hover: #9a3412;
    --color-accent-light: #fff7ed;
    --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(28,25,23,0.04);
    --shadow-md: 0 4px 16px rgba(28,25,23,0.06);
    --shadow-lg: 0 12px 40px rgba(28,25,23,0.08);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --max-w: 1120px;
    --transition: 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #1c1917;
        --color-surface: #292524;
        --color-text: #fafaf9;
        --color-text-secondary: #a8a29e;
        --color-border: #44403c;
        --color-primary: #fafaf9;
        --color-primary-hover: #e7e5e4;
        --color-accent: #fb923c;
        --color-accent-hover: #f97316;
        --color-accent-light: #292524;
        --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
        --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
        --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
    }
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

/* ── Typography ── */
h1 {
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.025em;
}
h2 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.015em;
}
h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

/* ── Layout helpers ── */
.section-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
}

.section-header {
    margin-bottom: 48px;
}

.section-header h2 {
    margin-bottom: 12px;
}

.section-header p {
    color: var(--color-text-secondary);
    font-size: 1.05rem;
    max-width: 520px;
    line-height: 1.6;
}

/* ── Scroll reveal animation ── */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: var(--font-sans);
}

.btn:active {
    transform: scale(0.97);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-bg);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: var(--color-accent);
    color: white;
}

.btn-accent:hover {
    background: var(--color-accent-hover);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text);
    border: 1.5px solid var(--color-border);
}

.btn-ghost:hover {
    border-color: var(--color-text);
    background: var(--color-surface);
}

/* ── Nav ── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250,249,247,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}

@media (prefers-color-scheme: dark) {
    .nav {
        background: rgba(28,25,23,0.85);
    }
}

.nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.15rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: white;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
}

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

.nav-link {
    padding: 8px 14px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    border-radius: var(--radius);
    transition: color var(--transition), background var(--transition);
}

.nav-link:hover {
    color: var(--color-text);
    background: rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
    .nav-link:hover {
        background: rgba(255,255,255,0.06);
    }
}

.nav-cta {
    margin-left: 4px;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--color-primary);
    color: var(--color-bg);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.nav-cta:hover {
    background: var(--color-primary-hover);
}

/* ── Hero: Asymmetric Split ── */
.hero {
    padding: 0;
    min-height: calc(100dvh - 64px);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
    width: 100%;
}

.hero-content {
    padding: 48px 0;
}

.hero-badge {
    display: inline-block;
    padding: 5px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-accent);
    background: var(--color-accent-light);
    border-radius: 6px;
    margin-bottom: 20px;
    letter-spacing: 0.01em;
}

.hero h1 {
    margin-bottom: 18px;
}

.hero-sub {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    max-width: 440px;
    line-height: 1.7;
    margin-bottom: 32px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Hero visual: image compare */
.hero-visual {
    position: relative;
}

.hero-visual .image-compare {
    width: 100%;
    max-width: 480px;
    margin-left: auto;
}

/* ── Image Compare (shared) ── */
.image-compare {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
}

.image-compare img {
    width: 100%;
    display: block;
    pointer-events: none;
}

.image-compare .img-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    clip-path: inset(0 100% 0 0);
}

.compare-slider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background: white;
    box-shadow: 0 0 8px rgba(0,0,0,0.3);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-compare:hover .compare-slider {
    opacity: 1;
}

.compare-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: white;
    transform: translateX(-50%);
}

.compare-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.5);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

/* ── Features: Bento Grid ── */
.features {
    padding: 100px 0 80px;
}

.features-bento {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.bento-card {
    padding: 32px 28px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    transition: all var(--transition);
}

.bento-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.bento-card.card-highlight {
    grid-column: 1 / -1;
    background: var(--color-accent);
    color: white;
    border-color: transparent;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
    padding: 40px 36px;
}

.bento-card.card-highlight .feature-icon {
    background: rgba(255,255,255,0.2);
    color: white;
}

.bento-card.card-highlight h3 {
    color: white;
    font-size: 1.3rem;
}

.bento-card.card-highlight p {
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
}

.bento-card.card-highlight .highlight-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.highlight-dice {
    display: flex;
    gap: 12px;
}

.highlight-dice .dice-sample {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    border: 1px solid rgba(255,255,255,0.2);
}

.bento-card.card-dark {
    background: var(--color-primary);
    color: var(--color-bg);
    border-color: transparent;
}

.bento-card.card-dark .feature-icon {
    background: rgba(250,249,247,0.15);
    color: var(--color-bg);
}

.bento-card.card-dark h3 {
    color: var(--color-bg);
}

.bento-card.card-dark p {
    color: rgba(250,249,247,0.7);
}

.feature-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent-light);
    color: var(--color-accent);
    border-radius: 8px;
    margin-bottom: 14px;
}

.bento-card h3 {
    margin-bottom: 6px;
}

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

/* ── How it works ── */
.how-it-works {
    padding: 80px 0 100px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 220px;
    max-width: 280px;
    text-align: center;
    padding: 24px;
}

.step-num {
    width: 44px;
    height: 44px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 50%;
}

.step h3 {
    margin-bottom: 6px;
}

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

.step-arrow {
    display: flex;
    align-items: center;
    padding-top: 20px;
    color: var(--color-border);
}

/* ── Examples ── */
.examples {
    padding: 100px 0;
}

.example-grid {
    display: flex;
    gap: 32px;
    justify-content: center;
    flex-wrap: wrap;
}

.example-card {
    text-align: center;
}

.example-card .image-compare {
    width: 400px;
}

.example-meta {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.example-tag {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--color-accent-light);
    color: var(--color-accent);
    border-radius: 6px;
}

.example-detail {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* ── CTA Bottom ── */
.cta-bottom {
    padding: 80px 0;
    background: var(--color-primary);
    color: var(--color-bg);
    text-align: center;
}

.cta-bottom h2 {
    margin-bottom: 10px;
}

.cta-bottom p {
    color: rgba(250,249,247,0.65);
    margin-bottom: 28px;
    font-size: 1.05rem;
}

.cta-bottom .btn {
    background: var(--color-accent);
    color: white;
}

.cta-bottom .btn:hover {
    background: var(--color-accent-hover);
}

/* ── Footer ── */
.footer {
    padding: 28px 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
}

.footer-logo {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.footer p {
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */

@media (max-width: 1024px) {
    .hero-inner {
        gap: 48px;
    }

    .example-card .image-compare {
        width: 340px;
    }
}

@media (max-width: 768px) {
    .nav-links .nav-link {
        display: none;
    }

    .hero {
        min-height: auto;
    }

    .hero-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .hero-content {
        padding: 48px 0 0;
        text-align: center;
    }

    .hero-sub {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-visual {
        order: -1;
    }

    .hero-visual .image-compare {
        max-width: 400px;
        margin: 0 auto;
    }

    .image-compare {
        width: 100%;
        max-width: 400px;
    }

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

    .bento-card.card-highlight {
        grid-template-columns: 1fr;
    }

    .highlight-visual {
        display: none;
    }

    .steps {
        flex-direction: column;
        align-items: center;
    }

    .step-arrow {
        transform: rotate(90deg);
        padding: 0;
    }

    .example-grid {
        flex-direction: column;
        align-items: center;
    }

    .example-card .image-compare {
        width: 100%;
        max-width: 400px;
    }

    .features,
    .how-it-works,
    .examples {
        padding: 60px 0;
    }

    .section-header {
        margin-bottom: 32px;
    }
}

@media (max-width: 480px) {
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .hero-actions .btn {
        width: 100%;
        max-width: 280px;
    }
}
