@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Source+Sans+3:wght@400;500;600&display=swap');

:root {
    --color-bg-dark: #0d0705;
    --color-bg-mid: #1a0f0a;
    --color-bg-accent: #2c1810;
    --color-cream: #faf6f0;
    --color-cream-mid: #f5efe6;
    --color-cream-warm: #f2ebe0;
    --color-brown: #474026;
    --color-brown-dark: #3a331f;
    --color-text: #3d2e26;
    --color-text-muted: #6b5344;
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Source Sans 3', -apple-system, sans-serif;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--color-bg-accent) 0%, var(--color-bg-mid) 50%, var(--color-bg-dark) 100%);
    margin: 0;
    min-height: 100vh;
    padding: 24px;
    color: var(--color-text);
}

.app-header {
    text-align: center;
    margin-bottom: 24px;
}

.app-header img {
    display: block;
    margin: 0 auto;
    width: 72px;
    height: 72px;
    box-shadow: var(--shadow-card);
}

.app-header .footer,
.app-header .tagline {
    padding: 10px 0 0;
    font-size: 24px;
    color: rgba(250, 246, 240, 0.9);
    margin: 0;
    line-height: 1.4;
    font-family: var(--font-display);
    font-style: italic;
}

.card {
    max-width: 560px;
    margin: 0 auto;
    background: linear-gradient(to right, var(--color-cream) 0%, var(--color-cream-mid) 15%, var(--color-cream-warm) 50%, var(--color-cream-mid) 85%, var(--color-cream) 100%);
    box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(180, 160, 140, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.card-inner {
    position: relative;
    z-index: 1;
    padding: 40px 36px 48px;
}

.card h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 28px;
    color: var(--color-brown);
    margin: 0 0 12px;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.card h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 22px;
    color: var(--color-brown);
    margin: 0 0 8px;
}

.card p {
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0 0 20px;
}

.btn {
    display: inline-block;
    padding: 12px 26px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-cream);
    background: var(--color-brown);
    border: 1px solid var(--color-brown-dark);
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn:hover {
    background: var(--color-brown-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.section {
    text-align: center;
    padding: 24px 0;
}

.section:not(:first-child) {
    border-top: 1px solid rgba(61, 46, 38, 0.12);
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(61, 46, 38, 0.15), transparent);
    margin: 0 24px;
}

.footer {
    text-align: center;
    padding: 20px 0 0;
    font-size: 14px;
    color: var(--color-text-muted);
    font-family: var(--font-display);
    font-style: italic;
}

/* Story-specific */
.story-hero {
    position: relative;
    width: 100%;
    height: 200px;
    margin: 0 0 24px;
    overflow: hidden;
    border-radius: 8px;
}

.story-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.story-image-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent 0%, rgba(250, 246, 240, 0.5) 50%, var(--color-cream-warm) 100%);
    pointer-events: none;
}

.story-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 28px;
    color: var(--color-brown);
    margin: 0 0 16px;
    line-height: 1.3;
}

.story-lines .story-line {
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 1.7;
    color: var(--color-text);
    margin: 0 0 12px;
}

.story-actions {
    margin-top: 24px;
    text-align: right;
}

.story-content {
    display: block;
}

.story-lines {
    position: relative;
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 88%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 88%, transparent 100%);
}

.loading, .error {
    text-align: center;
    color: var(--color-text-muted);
    padding: 48px 0;
    font-size: 17px;
}

/* ========== Landing Page ========== */
.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(to bottom, var(--color-bg-dark) 0%, transparent 100%);
    transition: background 0.3s ease;
}

.landing-nav.scrolled {
    background: rgba(13, 7, 5, 0.95);
    backdrop-filter: blur(8px);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-cream);
    font-weight: 600;
    font-size: 18px;
    font-family: var(--font-display);
}

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

.nav-cta {
    padding: 10px 20px;
    background: var(--color-brown);
    color: var(--color-cream);
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    transition: background 0.2s, transform 0.15s;
}

.nav-cta:hover {
    background: var(--color-brown-dark);
    transform: translateY(-1px);
}

/* Hero */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 24px 80px;
}

.hero-content {
    max-width: 620px;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 600;
    color: var(--color-cream);
    margin: 0 0 16px;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.hero-tagline {
    font-size: 18px;
    line-height: 1.6;
    color: rgba(250, 246, 240, 0.85);
    margin: 0 0 32px;
}

.btn-hero {
    font-size: 17px;
    padding: 14px 32px;
}

.hero-image-wrap {
    margin-top: 48px;
    max-width: 340px;
}

.hero-app-image {
    width: 100%;
    height: auto;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Feature sections */
.feature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    padding: 80px 24px;
}

@media (max-width: 768px) {
    .feature {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 56px 24px;
    }
    .feature-right .feature-image-wrap { order: -1; }
}

.feature-left .feature-image-wrap {
    order: 2;
}

.feature-right .feature-content {
    order: 2;
}

.feature-label {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-cream-mid);
    margin-bottom: 8px;
}

.feature h2 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 600;
    color: var(--color-cream);
    margin: 0 0 16px;
    line-height: 1.3;
}

.feature p {
    font-size: 17px;
    line-height: 1.65;
    color: rgba(250, 246, 240, 0.8);
    margin: 0;
}

.feature-image-wrap {
    position: relative;
}

.feature-image-wrap img {
    width: 100%;
    max-width: 380px;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.feature-image-wrap img {
    display: block;
    margin: 0 auto;
}

/* Download section */
.download-section {
    padding: 80px 24px 100px;
}

.download-inner {
    max-width: 900px;
    margin: 0 auto;
    background: linear-gradient(to right, var(--color-cream) 0%, var(--color-cream-mid) 15%, var(--color-cream-warm) 50%, var(--color-cream-mid) 85%, var(--color-cream) 100%);
    border-radius: 24px;
    padding: 48px 40px 56px;
    box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.download-inner h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-brown);
    text-align: center;
    margin: 0 0 8px;
}

.download-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 16px;
    margin: 0 0 40px;
}

.download-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

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

.download-card {
    text-align: center;
    padding: 28px 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    transition: transform 0.25s, box-shadow 0.25s;
    opacity: 0;
}

.download-inner.animate-visible .download-card {
    animation: fadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.download-inner.animate-visible .download-card:nth-child(1) { animation-delay: 0.1s; }
.download-inner.animate-visible .download-card:nth-child(2) { animation-delay: 0.2s; }
.download-inner.animate-visible .download-card:nth-child(3) { animation-delay: 0.3s; }

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

.download-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.download-card h3 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--color-brown);
    margin: 0 0 8px;
}

.download-card p {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0 0 20px;
    line-height: 1.5;
}

.btn-outline {
    background: transparent;
    color: var(--color-brown);
    border: 2px solid var(--color-brown);
}

.btn-outline:hover {
    background: var(--color-brown);
    color: var(--color-cream);
}

/* Footer */
.landing-footer {
    text-align: center;
    padding: 40px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.landing-footer p {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 15px;
    color: rgba(250, 246, 240, 0.7);
    margin: 0;
}

.footer-credit {
    margin-top: 12px !important;
    font-size: 13px !important;
    font-style: normal !important;
}

.footer-credit a {
    color: rgba(250, 246, 240, 0.6);
    text-decoration: none;
}

.footer-credit a:hover {
    color: rgba(250, 246, 240, 0.9);
    text-decoration: underline;
}

/* Story page: flex layout to push footer to bottom */
.story-page {
    display: flex;
    flex-direction: column;
}

.story-page .card {
    flex: 1;
}

.story-page-footer {
    text-align: center;
    padding: 24px 24px 16px;
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.story-page-footer a {
    font-size: 14px;
    color: rgba(250, 246, 240, 0.6);
    text-decoration: none;
    transition: color 0.2s;
}

.story-page-footer a:hover {
    color: rgba(250, 246, 240, 0.95);
    text-decoration: underline;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-up {
    animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-delay-1 {
    animation-delay: 0.2s;
    opacity: 0;
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-on-scroll.animate-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children for feature sections */
.feature-left .feature-content { transition-delay: 0s; }
.feature-left .feature-image-wrap { transition-delay: 0.15s; }
.feature-right .feature-image-wrap { transition-delay: 0s; }
.feature-right .feature-content { transition-delay: 0.15s; }
