/* ==========================================================
   Global
   ========================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {

    --background: #240029;
    --background-2: #3d143f;
    --surface: #2f1035;
    --card: #f4f2f5;
    --accent: #f4a27a;
    --accent-strong: #fb9dbd;
    --accent-rose: #c44174;
    --accent-lavender: #803b61;
    --text: #f4f2f5;
    --text-muted: #dccdd9;
    --shadow: rgba(0, 0, 0, 0.35);

    --card-width: 340px;
    --card-height: 520px;

    font-family:
        "Iowan Old Style",
        "Palatino Linotype",
        "Book Antiqua",
        Georgia,
        serif;
}

body {

    margin: 0;
    min-height: 100vh;

    background:
        radial-gradient(circle at top left, rgba(251, 157, 189, 0.22), transparent 28%),
        radial-gradient(circle at bottom right, rgba(244, 162, 122, 0.18), transparent 24%),
        linear-gradient(135deg, var(--background) 0%, var(--background-2) 100%);

    color: var(--text);

    display: flex;
    justify-content: center;
    align-items: flex-start;

    padding: 32px 20px 40px;
}

/* ==========================================================
   Layout
   ========================================================== */

.app {

    width: min(1100px, 100%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero {

    width: min(100%, 680px);
    padding: 1.5rem 1.25rem 1.25rem;
    margin-bottom: 24px;
    border-radius: 24px;
    border: 1px solid rgba(244, 242, 245, 0.16);
    background: rgba(36, 0, 41, 0.72);
    box-shadow: 0 20px 55px var(--shadow);
    backdrop-filter: blur(10px);
}

.hero h1 {

    margin: 0;
    font-size: clamp(2.2rem, 4.2vw, 3.2rem);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

.hero p {

    margin-top: 12px;
    color: var(--text-muted);
    font-size: 1.04rem;
    line-height: 1.7;
}

/* ==========================================================
   Deck
   ========================================================== */

.deck-container {

    display: flex;
    justify-content: center;

    margin: 32px 0 28px;
}

.deck {

    width: var(--card-width);
    height: var(--card-height);

    position: relative;
    perspective: 1500px;
}

/* ==========================================================
   Card
   ========================================================== */

.card {

    position: absolute;

    width: 100%;
    height: 100%;

    transform-style: preserve-3d;

    transition:
        transform .9s cubic-bezier(.2,.8,.2,1),
        box-shadow .35s;

    cursor: default;
}

.card.revealed {

    transform: rotateY(180deg);
}

.card-face {

    position: absolute;
    inset: 0;

    border-radius: 18px;

    overflow: hidden;

    backface-visibility: hidden;

    box-shadow:
        0 24px 60px var(--shadow);

    border: 1px solid rgba(36, 0, 41, 0.22);
}

/* ==========================================================
   Card Back
   ========================================================== */

.card-back {

    display: flex;
    justify-content: center;
    align-items: center;

    background:
        linear-gradient(145deg, rgba(244, 242, 245, 0.24), rgba(244, 242, 245, 0.08)),
        radial-gradient(circle at 20% 20%, rgba(244, 162, 122, 0.32), transparent 32%),
        linear-gradient(135deg, var(--accent-lavender) 0%, var(--background) 80%);
}

.back-design {

    width: 88%;
    height: 88%;

    border-radius: 16px;

    border: 1px solid rgba(244, 242, 245, 0.24);

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: center;

    background:
        repeating-radial-gradient(
            circle,
            rgba(244, 242, 245, 0.06) 0px,
            rgba(244, 242, 245, 0.06) 6px,
            transparent 6px,
            transparent 18px
        );
}

.flower-icon {

    font-size: 5rem;
    margin-bottom: 18px;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.24);
}

.title {

    letter-spacing: .25rem;
    font-weight: bold;
    color: var(--card);
    font-size: 1.05rem;
    text-transform: uppercase;
}

/* ==========================================================
   Card Front
   ========================================================== */

.card-front {

    transform: rotateY(180deg);

    background: linear-gradient(180deg, rgba(244, 242, 245, 0.96), rgba(244, 242, 245, 0.9));

    display: flex;
    flex-direction: column;
}

.card-image {

    width: 100%;
    height: 220px;

    object-fit: cover;

    background: linear-gradient(135deg, #d9c7d8, #b48ea7);
}

.card-content {

    display: flex;
    flex-direction: column;

    flex: 1;

    padding: 22px;
}

.card-title {

    margin: 0;

    font-size: 1.8rem;
    color: var(--accent-lavender);
}

.card-description {

    flex: 1;

    margin: 18px 0;

    line-height: 1.55;

    color: #5c445b;

    text-align: left;
}

.wiki-link {

    text-decoration: none;

    color: var(--accent-rose);

    font-weight: 600;

    transition: color .2s;
}

.wiki-link:hover {

    color: var(--accent);
}

/* ==========================================================
   Controls
   ========================================================== */

.controls {

    margin-top: 22px;
    width: 100%;
    display: flex;
    justify-content: center;
}

button {

    appearance: none;

    border: none;

    border-radius: 999px;

    padding: 14px 28px;

    font-size: 1rem;

    font-weight: 600;

    color: var(--card);

    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 60%, var(--accent-rose) 100%);

    cursor: pointer;

    box-shadow: 0 16px 30px rgba(196, 65, 116, 0.24);

    transition: transform .2s ease, filter .2s ease;
    width: min(100%, 280px);
}

button:hover {

    transform: translateY(-2px);
    filter: brightness(1.04);
}

button:disabled {

    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.flower-info {

    margin-top: 1.5rem;
    padding: 1.2rem;
    border-radius: 20px;
    border: 1px solid rgba(244, 242, 245, 0.14);
    background: rgba(36, 0, 41, 0.7);
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.22);
}

.flower-info.hidden {

    display: none;
}

.flower-details {

    color: var(--text-muted);
    line-height: 1.6;
}

.flower-details h2 {

    margin-top: 0;
    color: var(--card);
}

.flower-details a {

    color: var(--accent);
}

@media (max-width: 900px) {

    body {

        padding: 24px 16px 32px;
    }

    .hero {

        padding: 1.25rem 1rem 1rem;
    }
}

@media (max-width: 700px) {

    :root {

        --card-width: min(88vw, 320px);
        --card-height: min(88vw * 1.35, 460px);
    }

    .deck-container {

        margin: 22px 0 20px;
    }

    .hero h1 {

        font-size: clamp(1.7rem, 5vw, 2.4rem);
    }

    .hero p {

        font-size: .95rem;
    }

    .flower-info {

        grid-template-columns: 1fr;
    }

    .card-description {

        font-size: .95rem;
    }

    button {

        width: 100%;
        max-width: 320px;
    }
}

@media (max-width: 480px) {

    :root {

        --card-width: min(92vw, 280px);
        --card-height: min(92vw * 1.25, 420px);
    }

    body {

        padding: 16px 12px 24px;
    }

    .hero {

        border-radius: 18px;
    }

    .deck-container {

        margin: 18px 0 16px;
    }

    .controls {

        margin-top: 18px;
    }

    .card-image {

        height: 170px;
    }

    .card-title {

        font-size: 1.4rem;
    }

    .card-description {

        font-size: .9rem;
    }
}