@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

:root {
    --bg:         #F4F3EE;
    --bubble:     #FFFFFF;
    --ink:        #0D0D0D;
    --muted:      #888888;
    --amazon:     #FF9900;
    --tweet:      #1D9BF0;
    --shadow:     4px 4px 0 var(--ink);
    --radius:     22px;
}

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

html { font-size: 16px; overflow-x: hidden; width: 100%; }

body {
    background: var(--bg);
    font-family: 'DM Sans', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 56px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* ── Grain overlay ─────────────────────────────────── */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    opacity: 0.4;
    pointer-events: none;
    z-index: 100;
}

/* ── Alien link ────────────────────────────────────── */
.alien-link {
    display: block;
    font-size: 1.8rem;
    line-height: 1;
    text-decoration: none;
    margin-bottom: 6px;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.alien-link:hover { transform: scale(1.25) rotate(-8deg); }

.book-cta {
    flex: 1;
    padding-bottom: 2px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* ── Layout ────────────────────────────────────────── */
.site-wrap {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Speech bubble ─────────────────────────────────── */
.speech-bubble {
    background: var(--bubble);
    border: 3px solid var(--ink);
    border-radius: var(--radius);
    padding: 48px 52px 44px;
    box-shadow: var(--shadow);
    position: relative;
    animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Tail — points bottom-left toward the book cover */
.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -38px;
    left: 72px;
    border: 20px solid transparent;
    border-top: 20px solid var(--ink);
}
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -31px;
    left: 75px;
    border: 17px solid transparent;
    border-top: 17px solid var(--bubble);
    z-index: 1;
}

/* ── Era badge ─────────────────────────────────────── */
.saying-era-badge {
    position: absolute;
    top: 16px;
    right: 18px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--ink);
    color: #fff;
    padding: 4px 9px;
    border-radius: 4px;
    line-height: 1;
}

/* ── Saying text ───────────────────────────────────── */
.saying-text {
    font-family: 'Bebas Neue', impact, sans-serif;
    font-size: clamp(3rem, 8.5vw, 6rem);
    line-height: 1.0;
    letter-spacing: 0.025em;
    color: var(--ink);
    text-transform: uppercase;
    overflow-wrap: break-word;
    animation: text-in 0.4s 0.15s ease both;
}

/* ── Book + CTA row ────────────────────────────────── */
.book-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 0 4px;
    margin-top: 4px;  /* connects to bubble tail */
}

.book-cover-link {
    display: block;
    flex-shrink: 0;
    width: 80px;
    margin-top: -8px; /* slight overlap with tail area */
}

.book-cover-link img {
    width: 100%;
    display: block;
    border: 2px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.book-cover-link:hover img {
    transform: rotate(-3deg) scale(1.06);
    box-shadow: 5px 5px 0 var(--ink);
}

.btn-amazon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--amazon);
    color: var(--ink);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    padding: 11px 20px;
    border: 2px solid var(--ink);
    border-radius: 10px;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    white-space: nowrap;
}
.btn-amazon:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}
.btn-amazon:active {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 var(--ink);
}

/* ── Social row ────────────────────────────────────── */
.social-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

#tweet-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--tweet);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    padding: 9px 18px;
    border: 2px solid var(--ink);
    border-radius: 8px;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
#tweet-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

.fb-share-button { display: inline-flex; align-items: center; }

/* ── Navigation ────────────────────────────────────── */
.nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 20px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    padding: 10px 18px;
    border: 2px solid #CECCC4;
    border-radius: 8px;
    background: transparent;
    transition: color 0.14s, border-color 0.14s, background 0.14s, transform 0.12s;
    white-space: nowrap;
}
.nav-btn:hover {
    color: var(--ink);
    border-color: var(--ink);
    background: #fff;
    transform: translateY(-1px);
}
.nav-btn.is-random {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
    font-weight: 600;
    padding: 10px 22px;
    box-shadow: 3px 3px 0 #555;
}
.nav-btn.is-random:hover {
    background: #2a2a2a;
    border-color: #2a2a2a;
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 #555;
}

.nav-spacer { flex: 1; }

/* ── Animations ────────────────────────────────────── */
@keyframes pop-in {
    0%   { opacity: 0; transform: scale(0.88) translateY(20px); }
    60%  { transform: scale(1.02) translateY(-4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes text-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .speech-bubble, .saying-text { animation: none; }
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 520px) {
    body {
        padding: 12px 16px 90px; /* top tight; bottom clears sticky nav */
        align-items: flex-start;
    }
    .speech-bubble { padding: 32px 28px 30px; }
    .saying-text        { font-size: clamp(4.9rem, 14vw, 5.5rem); }
    .saying-text--sm    { font-size: clamp(4.1rem, 12vw, 5rem); }
    .social-row { margin-top: 18px; }
    .fb-share-button { display: none; }
    .btn-amazon { font-size: 0.84rem; padding: 10px 14px; }

    /* ── Alien: back to fixed corner on mobile ───────── */
    .alien-link {
        position: fixed;
        top: 14px;
        right: 14px;
        margin-bottom: 0;
        font-size: 1.5rem;
        z-index: 300;
    }
    .book-cta { flex-direction: row; align-items: center; gap: 0; }

    /* ── Sticky nav bar ──────────────────────────────── */
    .nav-row {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-wrap: nowrap;
        justify-content: stretch;
        gap: 8px;
        margin-top: 0;
        background: var(--bg);
        border-top: 2px solid #CECCC4;
        padding: 10px 16px 14px;
        z-index: 200; /* above grain overlay at z-index 100 */
    }
    .nav-btn {
        flex: 1;
        justify-content: center;
        font-size: 0.82rem;
        padding: 10px 6px;
    }
    .nav-spacer { display: none; }
}
