/*
 * Fi1m — Components
 * =================
 * Reusable UI pieces shared across pages.
 */

/* 1. Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--link-hover);
    color: white;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--search-background);
    border-color: var(--gray);
}

.btn-text-mobile {
    display: none;
}

@media (max-width: 768px) {
    .btn-text-desktop { display: none; }
    .btn-text-mobile { display: inline; }
}

/* 2. Section headings */
.section {
    padding: 3rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 1.75rem;
}

.section-header .section-title {
    margin: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 40px 0 30px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 3px;
    background-color: var(--primary);
    bottom: -8px;
    left: 0;
}

.section-header .section-title::after {
    display: none;
}

.view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary);
    padding: 8px 16px;
    background-color: var(--card-background);
    border-radius: var(--radius);
    white-space: nowrap;
    transition: all 0.3s ease;
}

.view-all svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.view-all:hover {
    background-color: rgba(var(--primary-rgb), 0.12);
}

.view-all:hover svg {
    transform: translateX(3px);
}

.section-footer {
    margin-top: 20px;
}

/* 3. Tags / chips */
.tag {
    display: inline-block;
    background-color: var(--search-background);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: background-color 0.3s ease;
}

.tag-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 4. Score badge (on posters) */
.score-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    line-height: 1.2;
}

/* 5. Poster cards (film / series) */
.media-card {
    display: block;
    color: inherit;
    transition: transform 0.3s ease;
}

.media-card:hover {
    transform: translateY(-5px);
    color: inherit;
}

.media-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: var(--radius);
    background-color: var(--card-background);
    transition: box-shadow 0.3s ease;
}

.media-card:hover .media-card-image {
    box-shadow: var(--card-hover-shadow);
}

.media-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.media-card:hover .media-card-image img {
    transform: scale(1.04);
}

.media-card-content {
    padding: 0.85rem 0.1rem 0;
}

.media-card-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.2rem;
    color: var(--heading-color);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-card-info {
    font-size: 0.85rem;
    color: var(--text-color-muted);
}

/* Empty state for a list or carousel the database has not filled yet */
.empty-note {
    padding: 32px var(--container-pad);
    color: var(--gray);
    font-size: 0.95rem;
}

.empty-note a {
    color: var(--primary);
}

/* Certificate and streaming line under a poster */
.media-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    font-size: 0.75rem;
    color: var(--gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cert {
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 0 4px;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text-color-muted);
}

.poster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

/* 6. People cards */
.card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card-background);
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card-media img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.card-content {
    padding: 12px;
}

.person-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 3px;
}

.person-name a {
    color: var(--heading-color);
}

.person-name a:hover {
    color: var(--primary);
}

.person-role {
    color: var(--gray);
    font-size: 0.9rem;
}

.person-role a {
    color: var(--gray);
}

.person-role a:hover {
    color: var(--primary);
}

/* 7. Content blocks (editorial) */
.content-block {
    background-color: var(--card-background);
    border-radius: var(--radius);
    padding: 24px;
    margin: 30px 0;
    transition: background-color 0.3s ease;
}

.block-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.block-header h3 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.logo-text {
    color: var(--primary);
    font-weight: 700;
}

.text-block {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 30px;
}

.text-content {
    font-size: 1.05rem;
    line-height: 1.7;
}

.text-content p {
    margin-bottom: 1rem;
}

.text-content p:last-child {
    margin-bottom: 0;
}

.content-highlight {
    background-color: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
    border: 1px solid var(--card-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="light"] .content-highlight {
    background-color: rgba(0, 0, 0, 0.03);
}

.byline {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--gray);
    margin-top: 20px;
}

.ai-badge {
    display: inline-block;
    background-color: var(--accent-ai);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.4;
}

/* 8. Links */
.link {
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.link--arrow {
    gap: 6px;
    padding: 10px 20px;
    background-color: var(--card-background);
    border-radius: var(--radius);
}

.link--arrow svg {
    width: 16px;
    height: 16px;
}

.link--arrow:hover {
    background-color: rgba(var(--primary-rgb), 0.12);
}

/* 9. Facts sidebar */
.facts {
    flex: 1;
    background-color: var(--card-background);
    border-radius: var(--radius);
    padding: 25px;
    align-self: flex-start;
    position: sticky;
    top: calc(var(--header-offset, 0px) + 20px);
    transition: background-color 0.3s ease, top 0.3s ease;
}

.facts .section-title {
    margin: 0 0 30px;
}

.facts-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.fact-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.fact-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.fact-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 4px;
}

.fact-value {
    font-size: 1rem;
}

.fact-value a {
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.3);
}

.fact-value a:hover {
    border-bottom-color: var(--primary);
}

/* 10. Article cards */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.article-card {
    display: flex;
    flex-direction: column;
    background-color: var(--card-background);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--card-border);
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
    color: inherit;
}

.article-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: var(--search-background);
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.article-card:hover .article-image img {
    transform: scale(1.05);
}

.article-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-source {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.article-title {
    font-size: 1.15rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

.article-excerpt {
    color: var(--gray);
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.5;
    flex-grow: 1;
}

.article-date {
    color: var(--gray);
    font-size: 0.85rem;
}

/* 11. Two-column content layout */
.content-layout--two-column {
    display: flex;
    gap: 30px;
    margin: 30px 0;
    align-items: flex-start;
}

.content-main {
    flex: 3;
    min-width: 0;
}

/* The facts panel is secondary reading: set smaller than the review, and when a long crew list outruns the viewport
   it scrolls on its own inside the sticky box rather than forcing the reader to the foot of the page. */
.content-layout--two-column .facts {
    flex: 1;
    min-width: 280px;
    padding: 20px 22px;
    max-height: calc(100vh - var(--header-offset, 0px) - 40px);   /* 40px = the sticky top offset, twice */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.content-layout--two-column .facts .section-title {
    font-size: 1.05rem;
    margin: 0 0 16px;
}

.content-layout--two-column .facts-grid {
    gap: 10px;
}

.content-layout--two-column .fact-item {
    padding-bottom: 9px;
}

.content-layout--two-column .fact-label {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
}

.content-layout--two-column .fact-value {
    font-size: 0.86rem;
    line-height: 1.45;
}

/* 12. Forms (sign in, sign up, account) */
.field {
    display: block;
    margin-bottom: 18px;
}

.field-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 6px;
}

.field-label a {
    font-weight: 500;
    font-size: 0.8rem;
}

.input {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: var(--text-color);
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.input::placeholder { color: var(--placeholder-color); }

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.18);
}

textarea.input {
    min-height: 120px;
    resize: vertical;
    line-height: 1.55;
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a919a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

/* Input with a trailing button (show/hide password, clear) */
.input-wrap {
    position: relative;
}

.input-wrap .input { padding-right: 44px; }

.input-wrap .input-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--gray);
    transition: color 0.2s ease, background-color 0.2s ease;
}

.input-wrap .input-btn:hover { color: var(--text-color); background-color: var(--search-background); }
.input-wrap .input-btn svg { width: 18px; height: 18px; }
.input-wrap .icon-hide { display: none; }
.input-wrap.is-shown .icon-show { display: none; }
.input-wrap.is-shown .icon-hide { display: block; }

.help {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 6px;
}

.help.error { color: var(--negative-color); }

/* Checkbox / switch rows */
.check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    cursor: pointer;
    color: var(--text-color);
}

.check input {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.check strong {
    display: block;
    font-weight: 600;
    color: var(--heading-color);
    font-size: 0.95rem;
}

.check span {
    font-size: 0.85rem;
    color: var(--gray);
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 13px 20px;
    font-size: 0.95rem;
}

.btn-social {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    color: var(--heading-color);
    justify-content: center;
}

.btn-social:hover {
    border-color: var(--gray);
    background-color: var(--search-background);
}

.btn-social svg { width: 16px; height: 16px; }

.btn-danger {
    background: transparent;
    border: 2px solid rgba(255, 59, 48, 0.4);
    color: var(--negative-color);
}

.btn-danger:hover { background-color: rgba(255, 59, 48, 0.08); border-color: var(--negative-color); }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }

/* Text divider: ─── or continue with ─── */
.divider-text {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--gray);
    font-size: 0.78rem;
    margin: 22px 0;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

/* 13. Stars: display and input */
.stars {
    display: inline-flex;
    gap: 2px;
    color: var(--mixed-color);
    vertical-align: middle;
}

.stars svg { width: 16px; height: 16px; }
.stars .empty { color: var(--border-color); }
.stars .half { position: relative; }
.stars .half svg:last-child { position: absolute; inset: 0; clip-path: inset(0 50% 0 0); }

/* Input: a fieldset of radios; CSS colours from the hovered/checked star leftwards using row-reverse */
.rate {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 2px;
    border: 0;
}

.rate input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.rate label {
    cursor: pointer;
    color: var(--border-color);
    transition: color 0.15s ease, transform 0.15s ease;
}

.rate label svg { width: 22px; height: 22px; fill: currentColor; }

.rate label:hover,
.rate label:hover ~ label,
.rate input:checked ~ label { color: var(--mixed-color); }

.rate label:hover { transform: scale(1.12); }
.rate input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.rate--lg label svg { width: 30px; height: 30px; }

/* 14. Responsive */
@media (max-width: 900px) {
    .content-layout--two-column {
        flex-direction: column;
    }

    .content-layout--two-column .facts {
        position: static;
        width: 100%;
        max-height: none;        /* stacked under the review: one page scroll, no nested one */
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 2.25rem 0;
    }

    .section-title {
        font-size: 1.35rem;
    }

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

    .poster-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
    }

    .ai-badge {
        font-size: 0.7rem;
    }
}
