/* ==========================================================================
   POETRY PLATFORM - STYLES RAFFINÉS & TYPOGRAPHIE POÉTIQUE
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --font-heading: 'Cinzel', serif;
    --font-verse: 'Playfair Display', 'EB Garamond', Georgia, serif;
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    
    --color-gold-400: #E1A878;
    --color-gold-500: #CF8655;
    --color-gold-600: #A9653D;
    
    --bg-parchment: #fdfbf7;
    --bg-dark: #1a1f2b;       /* dark gray page (not black) */
    --bg-panel: #232a38;
    --bg-elevated: #2d3548;
    --text-primary: #f1f5f9;  /* slate-100 */
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-subtle: #334155;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.font-heading {
    font-family: var(--font-heading);
}

.font-verse {
    font-family: var(--font-verse);
}

/* Scrollbar élégante */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: #2d3748;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #4a5568;
}

/* Flat ambient background — no gradients */
.bg-ambient {
    background-color: var(--bg-dark);
}

/* Full-bleed breakout from constrained containers */
.full-bleed {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Hero banner */
.hero-banner {
    position: relative;
    max-height: 70vh;
    min-height: 320px;
    border: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(26, 31, 43, 0.55);
    z-index: 0;
}

.hero-banner > * {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    line-height: 1.2;
}

/* Horizontal scroll row for categories */
.categories-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.categories-scroll > * {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.category-chip-card {
    width: 180px;
    height: 140px;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    background-color: #232a38;
    border: 1px solid #2d3548;
}

.category-chip-card .cat-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-color: #2d3548;
}

.category-chip-card .cat-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.category-chip-card .cat-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.85rem;
}

.category-illustration {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background-color: #2d3548;
}

.category-illustration-placeholder {
    width: 100%;
    height: 140px;
    background-color: #2d3548;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gold-500);
    font-size: 1.75rem;
}

/* Cartes verre dépoli — flat fills on dark gray */
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-panel-hover {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.glass-panel-hover:hover {
    transform: translateY(-3px);
    border-color: rgba(207, 134, 85, 0.3);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Flat gold text (no gradient clip) */
.text-gold-gradient {
    color: var(--color-gold-500);
    background: none;
    -webkit-text-fill-color: unset;
}

/* Typographie poétique pour les vers — flat reading */
.poem-body {
    white-space: pre-wrap;
    line-height: 1.85;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    font-style: normal;
    font-family: Georgia, 'Times New Roman', serif;
    text-align: left;
    color: var(--text-primary);
    margin: 1.5rem 0 0;
    max-height: 60vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.25rem 1rem 0.25rem 1.25rem;
    border-left: 2px solid var(--color-gold-500);
    scrollbar-gutter: stable;
}

.poem-body:focus-visible {
    outline: 2px solid var(--color-gold-400);
    outline-offset: 4px;
}

@media (min-width: 768px) {
    .poem-body {
        font-size: 1.15rem;
        line-height: 1.9;
    }
}

.poem-page {
    padding-bottom: 3rem;
    width: 100%;
}

.poem-reading-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    width: 100%;
}

@media (min-width: 1024px) {
    .poem-reading-layout {
        grid-template-columns: minmax(0, 1fr) 260px;
        align-items: start;
        gap: 3rem;
    }
}

.poem-reading-main {
    max-width: 640px;
    width: 100%;
    margin: 0;
}

/* Flat reading — no card, no double border */
.poem-flat-read {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.poem-title-display {
    font-family: var(--font-sans);
    font-size: clamp(1.25rem, 3.5vw, 1.65rem);
    font-weight: 700;
    text-transform: capitalize;
    line-height: 1.35;
    text-align: left;
    color: #f1f5f9;
    margin: 0 0 1.25rem;
    letter-spacing: -0.01em;
}

.poem-title-text {
    font-family: var(--font-sans);
    font-weight: 700;
    text-transform: capitalize;
}

.poem-meta-footer {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid #2d3548;
}

.poem-author-row {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    margin-bottom: 0.85rem;
    transition: opacity 0.15s ease;
}

.poem-author-row:hover {
    opacity: 0.85;
}

.poem-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.75rem;
    color: #64748b;
}

.poem-meta-row span + span::before {
    content: none;
}

.poem-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    margin: 1.75rem 0 2.5rem;
    padding: 0.85rem 0;
    border-top: 1px solid #2d3548;
    border-bottom: 1px solid #2d3548;
}

.poem-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.875rem;
    padding: 0.4rem 0.55rem;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: color 0.15s ease, background 0.15s ease;
}

.poem-action-btn:hover:not(.is-static) {
    color: #f1f5f9;
    background: #232a38;
}

.poem-action-btn.is-static {
    cursor: default;
}

.poem-comments-heading {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.poem-comments-heading span {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    background: #232a38;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.poem-comment-form-wrap {
    margin-bottom: 1.5rem;
}

.poem-comment-input {
    width: 100%;
    background: transparent;
    border: 1px solid #2d3548;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 0.875rem;
    color: #f1f5f9;
    resize: vertical;
    outline: none;
}

.poem-comment-input:focus {
    border-color: var(--color-gold-500);
}

.poem-comments-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.poem-comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid #2d3548;
    background: transparent;
}

.poem-comment-replies {
    margin-top: 0.75rem;
    padding-left: 1rem;
    border-left: 2px solid #2d3548;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.poem-comment-reply {
    padding: 0;
}

.poem-aside {
    display: none;
}

@media (min-width: 1024px) {
    .poem-aside {
        display: block;
        position: sticky;
        top: 6rem;
        space-y: 2rem;
    }

    .poem-aside > * + * {
        margin-top: 2rem;
    }
}

.poem-aside-title {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 0.75rem;
}

.suggestion-card {
    display: block;
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    background: #232a38;
    border: 1px solid #2d3548;
    transition: border-color 0.2s ease;
}

.suggestion-card:hover {
    border-color: rgba(207, 134, 85, 0.4);
}

/* Legacy parchment — no double border */
.parchment-sheet {
    background: transparent;
    box-shadow: none;
    border: none;
    position: relative;
}

.parchment-sheet::before {
    display: none;
}

/* Badges de statut */
.badge-draft {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}
.badge-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-published {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.badge-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-archived {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.badge-comp-draft {
    background: #334155;
    color: #cbd5e1;
}
.badge-comp-active {
    background: #166534;
    color: #86efac;
}
.badge-comp-closed {
    background: #9a3412;
    color: #fdba74;
}
.competition-announcement {
    position: sticky;
    top: 4rem;
    z-index: 39;
    background: #713f12;
    border-bottom: 1px solid var(--color-gold-500);
    color: #fef3c7;
    text-decoration: none;
}

.competition-announcement:not(.hidden) {
    display: block;
}

.competition-announcement:hover {
    background: #854d0e;
}

.competition-announcement-inner {
    min-height: 2.5rem;
    max-width: 80rem;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.winner-home-card {
    border-radius: 0.75rem;
}

.winner-cup-icon {
    display: grid;
    place-items: center;
    flex: 0 0 3.25rem;
    width: 3.25rem;
    aspect-ratio: 1;
    border: 1px solid var(--color-gold-500);
    border-radius: 50%;
    color: var(--color-gold-400);
    font-size: 1.35rem;
}

.winner-confetti,
.results-celebration {
    position: absolute;
    pointer-events: none;
    animation: celebration-float 2.8s ease-in-out infinite;
}

.winner-confetti-one {
    top: 0.75rem;
    right: 16%;
}

.winner-confetti-two {
    bottom: 0.75rem;
    right: 5%;
    animation-delay: 0.7s;
}

.winner-confetti-three {
    top: 1rem;
    right: 3%;
    animation-delay: 1.3s;
}

.results-winner-banner {
    border-block: 1px solid #a16207;
    background: linear-gradient(115deg, #1c1917, #292014 55%, #1c1917);
}

.results-celebration-left {
    top: 12%;
    left: 5%;
}

.results-celebration-right {
    right: 5%;
    bottom: 12%;
    animation-delay: 1s;
}

@keyframes celebration-float {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-0.65rem) rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
    .winner-confetti,
    .results-celebration {
        animation: none;
    }
}

/* Animations légères */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Boutons dorés — flat */
.btn-gold {
    background: var(--color-gold-500);
    color: #1a1f2b;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: none;
}
.btn-gold:hover {
    background: var(--color-gold-400);
    transform: translateY(-1px);
}
.btn-gold:active {
    transform: translateY(0);
}

/* Like button on cards */
.poem-card-like-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    font-size: inherit;
}
.poem-card-like-btn:hover,
.poem-card-like-btn.is-liked {
    color: #f43f5e;
}
.poem-card-like-btn:disabled {
    cursor: default;
    opacity: 0.9;
}

.poem-card-open-link {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(207, 134, 85, 0.28);
    border-radius: 9999px;
    color: var(--color-gold-400);
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.poem-card-open-link i {
    transition: transform 0.18s ease;
}

.poem-card-open-link:hover,
.poem-card-open-link:focus-visible {
    color: #1a1f2b;
    background-color: var(--color-gold-500);
    border-color: var(--color-gold-500);
}

.poem-card-open-link:hover i,
.poem-card-open-link:focus-visible i {
    transform: translateX(3px);
}

/* Copyright bar */
.copyright-bar {
    background: var(--bg-dark);
    color: #64748b;
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    border-top: 1px solid var(--border-subtle);
}

/* Loader spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--color-gold-500);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Google button container */
#google-signin-btn,
#google-signin-btn-register {
    display: flex;
    justify-content: center;
    min-height: 44px;
}

/* ==========================================================================
   RESPONSIVE — site-wide
   ========================================================================== */

img, video, svg {
    max-width: 100%;
    height: auto;
}

#app-content {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

@media (max-width: 640px) {
    .hero-banner {
        min-height: 280px;
        max-height: 60vh;
        background-attachment: scroll; /* fixed is janky on mobile */
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .category-chip-card {
        width: 150px;
        height: 120px;
    }

    .category-illustration,
    .category-illustration-placeholder {
        height: 110px;
    }

    header .font-heading {
        font-size: 1.1rem;
    }

    #nav-guest-section a:first-child {
        display: none; /* keep Inscription CTA visible on narrow screens */
    }
}

@media (max-width: 767px) {
    .poem-actions {
        gap: 0.25rem;
    }

    .poem-action-btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.4rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .hero-banner {
        background-attachment: scroll;
    }
}

/* Prevent horizontal overflow from full-bleed */
.full-bleed {
    overflow-x: hidden;
}

/* Give content and type more room on modern displays. */
html {
    font-size: 18px;
}

#app-content .max-w-3xl,
#app-content .max-w-4xl,
#app-content .max-w-5xl,
#app-content .max-w-6xl {
    width: 100%;
}

#app-content .max-w-3xl {
    max-width: 72rem;
}

#app-content .max-w-4xl {
    max-width: 80rem;
}

#app-content .max-w-5xl {
    max-width: 88rem;
}

#app-content .max-w-6xl {
    max-width: 92rem;
}

header .max-w-7xl {
    max-width: 96rem;
}

#app-content {
    max-width: 96rem;
}

.poem-reading-main {
    max-width: 48rem;
}
