/* Design tokens — mirror of CrossedPaths/DesignSystem/Tokens/{Color+Path,Theme}.swift.
   When a token changes in Swift, update the corresponding line here by hand. */
:root {
    /* Color */
    --color-primary:#FF5F5F;
    --color-secondary:#4A90E2;
    --color-accent:#FFD93D;
    --color-accent-dark:#B8860B;
    --color-purple:#A78BFA;
    --color-dark:#1A1A1A;
    --color-surface:#FFFFFF;
    --color-bg:#F8F9FF;
    --color-text-secondary:#6B7280;
    --color-text-muted:#9CA3AF;
    --color-divider:#F3F4F6;
    --color-online:#4ADE80;

    /* Spacing */
    --space-xs:4px;  --space-sm:8px;  --space-md:12px;
    --space-lg:16px; --space-xl:24px; --space-xxl:32px; --space-xxxl:48px;

    /* Radius */
    --radius-sm:12px; --radius-md:16px; --radius-lg:24px;
    --radius-xl:32px; --radius-xxl:40px;

    /* Border */
    --border-thin:2px; --border-medium:3px; --border-thick:4px;

    /* Shadow (offset-x offset-y blur-radius color, blur=0 = neo-brutalist) */
    --shadow-cardPop: 8px 8px 0 var(--color-dark);
    --shadow-sticker: 6px 6px 0 rgba(0,0,0,0.1);
    --shadow-polaroid: 4px 4px 0 rgba(0,0,0,0.1);

    /* Type */
    --font-sans: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
    --weight-display: 900;
    --weight-title: 900;
    --weight-body: 700;
    --weight-label: 800;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--color-bg);
    color: var(--color-dark);
    font-family: var(--font-sans);
    font-weight: var(--weight-body);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
    max-width: 960px;
    margin: 0 auto;
    padding: var(--space-xl);
}

.wordmark {
    font-weight: var(--weight-display);
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

.card {
    background: var(--color-surface);
    border: var(--border-medium) solid var(--color-dark);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-cardPop);
    padding: var(--space-xl);
}

.btn-primary {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    border: var(--border-medium) solid var(--color-dark);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-cardPop);
    padding: var(--space-md) var(--space-xl);
    font-weight: var(--weight-title);
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn-primary:hover {
    transform: translate(-2px, -2px);
    box-shadow: 10px 10px 0 var(--color-dark);
    text-decoration: none;
}

.btn-primary:active {
    transform: translate(2px, 2px);
    box-shadow: 4px 4px 0 var(--color-dark);
}

.btn-secondary {
    display: inline-block;
    background: var(--color-surface);
    color: var(--color-dark);
    border: var(--border-medium) solid var(--color-dark);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-xl);
    font-weight: var(--weight-title);
    font-size: 1.05rem;
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
    .btn-primary:hover { transform: none; box-shadow: var(--shadow-cardPop); }
    .animate-in { opacity: 1 !important; transform: none !important; }
}

/* ===== Cascade-in entrance animation (matches WelcomeStepView.CascadeIn) ===== */
@keyframes cascadeIn {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes cascadeInTilt {
    from { opacity: 0; transform: translateY(28px) rotate(-3deg); }
    to   { opacity: 1; transform: translateY(0) rotate(0); }
}

/* Continuous gentle wiggle on stickers (matches AnimatedSticker.wigglePeriod). */
@keyframes wiggle {
    0%, 100% { transform: rotate(-2deg); }
    50%      { transform: rotate(3deg); }
}

.animate-in {
    opacity: 0;
    animation: cascadeIn 0.7s cubic-bezier(0.32, 1.2, 0.42, 1) both;
}
.animate-in.tilt {
    animation-name: cascadeInTilt;
}

.animate-delay-0 { animation-delay: 0.05s; }
.animate-delay-1 { animation-delay: 0.18s; }
.animate-delay-2 { animation-delay: 0.28s; }
.animate-delay-3 { animation-delay: 0.40s; }
.animate-delay-4 { animation-delay: 0.55s; }
.animate-delay-5 { animation-delay: 0.78s; }
.animate-delay-6 { animation-delay: 0.95s; }
.animate-delay-7 { animation-delay: 1.05s; }
.animate-delay-8 { animation-delay: 1.15s; }
.animate-delay-9 { animation-delay: 1.25s; }
.animate-delay-10 { animation-delay: 1.45s; }

.wiggle {
    animation: wiggle 3.4s ease-in-out 1.2s infinite;
}

/* Page-specific layout helpers go below this line in their own pages or
   here as small additions. Keep this file under ~400 lines. */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) 0 var(--space-xxl);
}

.page-header .wordmark {
    font-size: 1.5rem;
}

.hero {
    padding: var(--space-xxxl) 0;
    text-align: center;
}

.hero .app-icon {
    display: block;
    width: clamp(96px, 18vw, 144px);
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 auto var(--space-lg);
    /* iOS-style squircle (continuous corner curvature) via SVG mask. */
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M50,0 C71,0 86,0 93,7 C100,14 100,29 100,50 C100,71 100,86 93,93 C86,100 71,100 50,100 C29,100 14,100 7,93 C0,86 0,71 0,50 C0,29 0,14 7,7 C14,0 29,0 50,0 Z'/></svg>");
            mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M50,0 C71,0 86,0 93,7 C100,14 100,29 100,50 C100,71 100,86 93,93 C86,100 71,100 50,100 C29,100 14,100 7,93 C0,86 0,71 0,50 C0,29 0,14 7,7 C14,0 29,0 50,0 Z'/></svg>");
    -webkit-mask-size: 100% 100%;
            mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    filter: drop-shadow(8px 8px 0 var(--color-dark));
}

.hero .wordmark {
    font-size: clamp(3rem, 10vw, 6rem);
    display: block;
    margin-bottom: var(--space-lg);
    text-shadow: 4px 4px 0 var(--color-dark);
}

.hero .tagline {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: var(--weight-title);
    margin-bottom: var(--space-sm);
}

.hero .subline {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    margin-bottom: var(--space-xxl);
}

/* Example preview card — mirrors PaywallOfferStepView.examplePreview in the iOS app. */
.example-preview {
    background: var(--color-surface);
    border: var(--border-thick) solid var(--color-dark);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-cardPop);
    overflow: hidden;
    margin: var(--space-xxl) 0;
}

.map-hero {
    position: relative;
    height: 220px;
    background: linear-gradient(135deg, var(--color-bg) 0%, #E8ECFF 100%);
    border-bottom: var(--border-thick) solid var(--color-dark);
    overflow: hidden;
}

.map-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(26, 26, 26, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 26, 26, 0.08) 1px, transparent 1px);
    background-size: 36px 36px;
    background-position: -1px -1px;
}

.map-pin {
    position: absolute;
    transform: translate(-50%, -50%);
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: var(--border-medium) solid var(--color-surface);
    box-shadow: 0 0 0 2px var(--color-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--weight-display);
    font-size: 0.95rem;
    color: white;
    user-select: none;
}
.avatar-md   { width: 46px; height: 46px; font-size: 1.1rem; }
.avatar-you  { background: var(--color-primary); }
.avatar-them { background: var(--color-secondary); }

.example-detail {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: var(--border-medium) solid var(--color-dark);
    margin: calc(-1 * var(--space-xxl)) var(--space-lg) var(--space-lg);
    padding: var(--space-xl);
    position: relative;
    z-index: 1;
}

.example-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    gap: var(--space-md);
}

.sticker-badge {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    font-weight: var(--weight-label);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    padding: 6px 12px;
    border: var(--border-thin) solid var(--color-dark);
    border-radius: var(--radius-sm);
    box-shadow: 4px 4px 0 var(--color-dark);
    transform: rotate(-2deg);
    text-transform: uppercase;
    transform-origin: center;
}

.example-date {
    font-size: 0.72rem;
    font-weight: var(--weight-label);
    letter-spacing: 0.18em;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.example-title {
    font-weight: var(--weight-display);
    font-size: clamp(1.4rem, 4vw, 2rem);
    margin-bottom: var(--space-xs);
    letter-spacing: -0.01em;
}

.example-subtitle {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
}

.dashed-divider {
    height: 0;
    border-top: 2px dashed var(--color-dark);
    margin: var(--space-md) 0 var(--space-lg);
    opacity: 0.35;
}

.example-tier {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}
.example-tier-avatars {
    display: inline-flex;
    align-items: center;
}
.example-tier-avatars .avatar:nth-child(2) {
    margin-left: -14px;
}

.example-tier-text {
    display: flex;
    flex-direction: column;
}
.example-tier-label {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    color: var(--color-text-muted);
    font-weight: var(--weight-label);
    text-transform: uppercase;
}
.example-tier-value {
    font-weight: var(--weight-display);
    color: var(--color-secondary);
    font-size: 1.15rem;
}

/* Stats section — mirrors PaywallOfferStepView's section label, top common
   ground card, and 2×2 stats grid. */
.stats-section {
    margin: var(--space-xxl) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.section-label {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: var(--weight-label);
    padding-left: var(--space-xs);
}

.feature-stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    background: var(--color-surface);
    border: var(--border-medium) solid var(--color-dark);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-cardPop);
    padding: var(--space-xl);
}

.feature-stat-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.feature-stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: var(--weight-label);
}

.feature-stat-value {
    font-weight: var(--weight-display);
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
    color: var(--color-dark);
    line-height: 1.2;
}

.feature-stat-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

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

.stat-card {
    background: var(--color-surface);
    border: var(--border-medium) solid var(--color-dark);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-cardPop);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
}

.stat-label {
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: var(--weight-label);
    line-height: 1.2;
}

.stat-value {
    font-weight: var(--weight-display);
    font-size: clamp(1.4rem, 4.5vw, 1.8rem);
    line-height: 1.05;
    word-break: break-word;
}
.stat-value-primary     { color: var(--color-primary); }
.stat-value-purple      { color: var(--color-purple); }
.stat-value-accent-dark { color: var(--color-accent-dark); }

/* Tinted icon tile — matches the iOS list-row icon tile pattern. */
.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; display: block; }

.stat-icon-secondary { background: rgba(74, 144, 226, 0.15); color: var(--color-secondary); }
.stat-icon-accent    { background: rgba(255, 217, 61, 0.30); color: var(--color-accent-dark); }
.stat-icon-purple    { background: rgba(167, 139, 250, 0.18); color: var(--color-purple); }
.stat-icon-primary   { background: rgba(255, 95, 95, 0.15);  color: var(--color-primary); }

.privacy-promise {
    margin: var(--space-xxxl) 0;
    padding: var(--space-xxl);
    background: var(--color-accent);
    border: var(--border-medium) solid var(--color-dark);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-cardPop);
    text-align: center;
}

.privacy-promise h2 {
    font-weight: var(--weight-display);
    font-size: 1.75rem;
    margin-bottom: var(--space-md);
}

.privacy-promise p {
    font-size: 1.1rem;
    max-width: 32em;
    margin: 0 auto;
}

.page-footer {
    margin-top: var(--space-xxxl);
    padding: var(--space-xl) 0;
    border-top: var(--border-thin) solid var(--color-divider);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md) var(--space-xl);
    align-items: center;
    justify-content: space-between;
}

.page-footer a { color: var(--color-text-secondary); }
.page-footer a:hover { color: var(--color-dark); }

.app-store-badge img {
    height: 48px;
    width: auto;
}

.legal-card iframe {
    width: 100%;
    border: 0;
    min-height: 80vh;
}
