@import '../common.css';

/* ================================
   CSS Custom Properties
   ================================ */
:root {
    /* Page-specific colors */
    --color-gold: rgb(244, 167, 1);
    --color-gold-transparent: rgba(244, 167, 1, 0.4);
    --color-gold-hover: rgba(244, 167, 1, 0.9);
    --color-orange: rgb(220, 78, 1);
    --color-purple: rgb(33, 1, 122);
    --color-text-muted: rgba(255, 255, 255, 0.8);
    --card-bg: linear-gradient(131deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.40) 35%, rgba(0,0,0,0.40) 70%, rgba(0,0,0,0.30) 100%);
    --gradient-bg: linear-gradient(131deg, rgb(5, 160, 244) 15%, rgb(33, 1, 122) 45%, rgb(126, 30, 200) 60%, rgb(220, 78, 1) 80%, rgb(244, 188, 33) 100%);
    --gradient-btn: linear-gradient(135deg, rgba(5, 160, 244, 0.8) 0%, rgba(33, 1, 122, 0.8) 100%);
    --gradient-btn-hover: linear-gradient(135deg, var(--color-gold-hover) 0%, var(--color-orange) 100%);
    --gradient-rainbow: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #54a0ff, #5f27cd, #ff6b6b);
    /* Tab colors for this page */
    --tab-active-bg: rgba(244, 167, 1, 0.3);
    --tab-hover-bg: rgba(244, 167, 1, 0.2);
}

/* ================================
   Base Styles
   ================================ */
body, html {
    background: rgb(5, 160, 244);
    background: var(--gradient-bg);
    background-size: 200% 200%;
    animation: gradient 70s ease infinite;
    font-weight: lighter;
}

@keyframes rainbow-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ================================
   Typography
   ================================ */
h2 {
    font-family: var(--font-display);
    color: var(--color-gold);
}

a {
    color: var(--color-gold);
}

.bookTitle {
    font-weight: bold;
    font-style: italic;
}

/* ================================
   Hero Section
   ================================ */
.hero {
    text-align: center;
    width: 300px;
    max-width: 90vw;
    margin: 0 auto 20px auto;
    padding: 0 20px;
}

.hero h1 {
    font-family: var(--font-display);
    color: var(--color-gold);
    font-size: 24px;
    margin-bottom: 10px;
}

.hero p {
    color: var(--color-white);
    font-size: 16px;
    margin: 5px 0;
}

.hero-instructions {
    font-size: 14px;
    color: var(--color-text-muted);
}

/* ================================
   FAQ Section
   ================================ */
.faq {
    width: 300px;
    max-width: 90vw;
    margin: 30px auto 20px auto;
    padding: 0 10px;
}

.faq h2 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 24px;
}

.faq details {
    margin-bottom: 8px;
}

.faq summary {
    cursor: pointer;
    color: var(--color-gold);
    font-weight: bold;
    padding: 8px 0;
    list-style: none;
}

.faq summary::-webkit-details-marker {
    display: none;
}

.faq summary::before {
    content: "+ ";
    font-family: monospace;
}

.faq details[open] summary::before {
    content: "- ";
}

.faq details p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0 0 10px 18px;
    line-height: 1.5;
}

/* ================================
   Form / Genre Selection
   ================================ */
.formSection,
.flashStyle,
.storyStyle {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flashStyle,
.storyStyle {
    opacity: 0;
    max-height: 0;
    pointer-events: none;
}

.flashStyle.visible,
.storyStyle.visible {
    opacity: 1;
    max-height: 100%;
    transition: opacity var(--transition-medium);
    pointer-events: auto;
}

.formContent {
    border: 4px double var(--color-gold);
    border-radius: var(--radius-lg);
    width: 300px;
    max-width: 90vw;
    padding: 0 20px 20px 20px;
    justify-content: center;
}

.selection {
    border: 1px;
    padding: var(--gap-sm);
    margin: 20px;
}

.genreList {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.genre-btn {
    min-width: 280px;
    padding: 12px 20px;
    font-size: 16px;
    font-family: var(--font-body);
    font-weight: bold;
    color: var(--color-white);
    background: var(--gradient-btn);
    border: 2px solid var(--color-gold);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.genre-btn:hover {
    background: var(--gradient-btn-hover);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--color-gold-transparent);
}

.genre-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(244, 167, 1, 0.3);
}

.genre-btn.active {
    background: var(--gradient-btn-hover);
    border-color: var(--color-white);
    box-shadow: 0 0 12px rgba(244, 167, 1, 0.6);
}

/* Random Genre Button */
.genre-btn-random {
    background: var(--gradient-rainbow);
    background-size: 300% 100%;
    animation: rainbow-shift 30s ease infinite;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.genre-btn-random:hover,
.genre-btn-random.active {
    animation-duration: 6s;
}

.genre-btn-random:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.4);
}

.genre-btn-random.active {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* ================================
   Cards (Flash & Story)
   ================================ */
.flash {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.flash h2 {
    margin: 10px 0 8px 0;
}

.flash-author {
    font-size: 1em;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.flash-author a {
    color: var(--color-gold);
}

.flash-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.flash-pill {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    font-size: 0.85em;
}

.flash-cws:not(:empty)::before {
    content: "CWs: ";
    opacity: 0.7;
}

.story h2 {
    width: 100%;
    text-align: center;
}

.storyDetail {
    padding: 15px;
    margin: 0 15px;
}

.hint {
    width: 100%;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    margin-top: -10px;
    margin-bottom: 20px;
    text-align: center;
}

/* ================================
   Story Tags (Interactive)
   ================================ */
.story-tag {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 2px;
    font-size: 0.9em;
    font-weight: 600;
    color: #1a1a1a;
    border-radius: var(--radius-sm);
    position: relative;
    background: var(--color-white);
}

.story-tag:not(.filled) {
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.story-tag:not(.filled):hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px var(--color-gold-transparent);
}

.story-tag.filled {
    color: transparent;
    background: var(--gradient-bg);
    background-size: 200% 200%;
    animation: gradient 70s ease infinite;
    will-change: background-position;
    -webkit-background-clip: text;
    background-clip: text;
}

.story-tag.filled::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--color-white);
    border-radius: var(--radius-sm);
    z-index: -1;
}

.story-tag-input {
    font-family: inherit;
    font-size: 0.9em;
    font-weight: 600;
    padding: 2px 8px;
    margin: 0 2px;
    border: 2px solid var(--color-gold);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    color: #1a1a1a;
    outline: none;
    min-width: 60px;
    max-width: 200px;
}

.story-tag-input:focus {
    box-shadow: 0 0 8px rgba(244, 167, 1, 0.6);
}

/* ================================
   Button Row (Share/Print)
   ================================ */
.button-row {
    margin-bottom: 20px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
}

.button-row.visible {
    opacity: 1;
    max-height: 150px;
    transition: opacity var(--transition-medium);
}

.button-row button {
    background-color: var(--color-gold);
    border: 2px solid var(--color-gold);
    color: var(--color-white);
    transition: all var(--transition-fast);
}

.button-row button:hover {
    background: var(--gradient-btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--color-gold-transparent);
}

.button-row button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(244, 167, 1, 0.3);
}

.button-row button.secondary {
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
}

.button-row button.secondary:hover {
    background: rgba(244, 167, 1, 0.2);
}

/* CTA Button Colors */
.cta-btn-primary {
    background: var(--gradient-btn-hover);
    color: var(--color-white);
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.4);
    box-shadow: 4px 4px var(--color-shadow);
}

.cta-btn-primary:hover {
    background-color: var(--color-white-muted);
    color: var(--color-purple);
    text-decoration: none;
}

.cta-btn-secondary {
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
}

.cta-btn-secondary:hover {
    background-color: var(--color-gold-transparent);
    text-decoration: none;
}

/* ================================
   Media Queries - Tablet & Desktop (600px+)
   ================================ */
@media (min-width: 600px) {
    .hero {
        width: 600px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero p {
        font-size: 18px;
    }

    .hero-instructions {
        font-size: 16px;
    }

    .faq {
        width: 600px;
    }

    .faq h2 {
        font-size: 28px;
    }

    .formContent {
        width: 600px;
    }

    .genreList {
        grid-template-columns: 1fr 1fr;
    }

}

/* ================================
   Media Queries - Print
   ================================ */
@media print {
    body, html {
        font-size: 12px;
        height: auto;
    }

    .selection,
    .hint,
    .hero,
    .faq,
    #printButtonRow,
    .button-row {
        display: none;
    }

    .logo {
        padding-bottom: 20px;
    }

    h2 {
        color: black;
    }

    .card {
        background: white;
        color: black;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: 1px solid #333;
    }

    .flash-author {
        color: #333;
    }

    .flashStyle,
    .storyStyle {
        opacity: 1;
        max-height: 100%;
    }

    .story-tag {
        padding: 0 4px;
        margin: 0 1px;
    }

    .story-tag.filled {
        color: var(--color-purple);
        background: var(--color-white);
        background-clip: border-box;
        -webkit-background-clip: border-box;
        animation: none;
    }

    .story-tag.filled::before {
        display: none;
    }
}
