:root {
    --colors-accent: #1EC6F9;
    --colors-accent-hover: #199AC4;
    --colors-labels-primary: #000000;
    --colors-labels-secondary: rgba(60, 60, 67, 0.6);
    --colors-labels-tertiary: rgba(60, 60, 67, 0.3);
    --colors-fill-secondary: rgba(120, 120, 128, 0.16);
    --colors-fill-quaternary: rgba(116, 116, 128, 0.08);
    --colors-background: #F2F2F7;

    --colors-green: #34C759;
    --colors-yellow: #FFCC00;
    --colors-orange: #FF9500;
    --colors-red: #FF3B30;

    /* Typography Scale (Design Tokens) */
    --font-large-title: clamp(2.4rem, 5vw, 3.2rem);
    --font-title: clamp(2rem, 4.2vw, 2.6rem);
    --font-title2: clamp(1.75rem, 3.4vw, 2.15rem);
    --font-title3: clamp(1.5rem, 2.8vw, 1.75rem);
    --font-headline: 1.375rem; /* ~22px */
    --font-body: 1rem; /* 16px base */
    --font-callout: .95rem; /* slightly smaller body */
    --font-subheadline: .9rem; /* supporting text */
    --font-footnote: .8rem; /* meta info */
    --font-caption: .75rem; /* small label */
    --font-caption2: .7rem; /* smallest */
}

@media(prefers-color-scheme: dark) {
    :root {
        --colors-accent: #1EC6F9;
        --colors-accent-hover: #199AC4;
        --colors-labels-primary: #FFFFFF;
        --colors-labels-secondary: rgba(235, 235, 245, 0.6);
        --colors-labels-tertiary: rgba(235, 235, 245, 0.3);
        --colors-fill-secondary: rgba(120, 120, 128, 0.32);
        --colors-fill-quaternary: rgba(116, 116, 128, 0.18);
        --colors-background: #000000;

        --colors-green: #30D158;
        --colors-yellow: #FFD60A;
        --colors-orange: #FF9F0A;
        --colors-red: #FF453A;
    }

    .download-on-the-app-store {
        content: url('/images/download-on-the-app-store-badge-dark.svg');
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;

    max-width: 960px;
    margin: 0 auto;
    padding: 1em 2em 2em 2em;

    -webkit-font-smoothing: antialiased;

    background-color: var(--colors-background);
}

/* Unified placeholder styles */
.poster-fallback {
    background: transparent !important; /* poster wrapper paints background */
    color: var(--colors-labels-secondary) !important;
    opacity: 1 !important;
    padding: 0; /* avoid layout issues; pad text only */
    text-align: center; /* center inner label text */
}

.media-picture.media-fallback {
    background: var(--colors-fill-quaternary) !important; /* ensure visible fallback for recommended/collection */
    color: var(--colors-labels-secondary) !important;
    opacity: 1 !important;
    padding: 0; /* pad text only */
    text-align: center; /* center inner label text */
}

.poster-fallback .poster-fallback-label,
.media-picture.media-fallback .media-fallback-label,
.video-fallback span {
    color: var(--colors-labels-secondary) !important;
    opacity: 1 !important;
    padding: .5rem; /* apply padding to text content */
    font-weight: 600 !important; /* semibold */
    font-size: var(--font-callout); /* allow page-specific overrides to adjust size */
    display: block; /* ensure text-align applies to multiline */
    text-align: center;
}

/* Use subheadline size specifically for recommendation/collection fallback labels */
.media-picture.media-fallback .media-fallback-label {
    font-size: var(--font-subheadline);
}

/* For videos, apply background to the thumbnail container when missing image */
.movie-detail .video-thumb.no-thumb { background: var(--colors-fill-quaternary) !important; }
/* Ensure the inner video-fallback itself stays transparent so only container paints */
.video-fallback { background: transparent !important; padding: 0; }

/* Typography utility classes */
.large-title { font-size: var(--font-large-title); line-height:1.1; letter-spacing:-.02em; }
.title { font-size: var(--font-title); line-height:1.15; letter-spacing:-.015em; }
.title2 { font-size: var(--font-title2); line-height:1.18; letter-spacing:-.01em; }
.title3 { font-size: var(--font-title3); line-height:1.2; }
.headline { font-size: var(--font-headline); line-height:1.22; }
.body { font-size: var(--font-body); line-height:1.5; }
.callout { font-size: var(--font-callout); line-height:1.45; }
.subheadline { font-size: var(--font-subheadline); line-height:1.4; }
.footnote { font-size: var(--font-footnote); line-height:1.3; }
.caption { font-size: var(--font-caption); line-height:1.25; }
.caption2 { font-size: var(--font-caption2); line-height:1.2; }

/* Global image subtle placeholder background (no shimmer) */
img { background: var(--colors-fill-quaternary); }

/* Avoid double placeholder layers: if a wrapper already paints a background,
   keep the inner image transparent so backgrounds don't stack */
.poster img,
.media-picture img,
.people-avatar img {
    background: transparent !important;
}

/* typography */

h1 {
    font-size: 2.5em;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0.75em 0;
}

.without-margin {
    margin: 0;
}

.without-margin-bottom {
    margin-bottom: 0;
}

h2 {
    font-size: 2em;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0.75em 0;
}

h3 {
    font-size: 1.75em;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.005em;
    margin: 0.75em 0;
}

h4 {
    font-size: 1.5em;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0;
    margin: 0.5em 0;
}

h5 {
    font-size: 1.25em;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.01em;
    margin: 0.5em 0;
}

h6 {
    font-size: 1em;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.02em;
    margin: 0.5em 0;
}

p {
    font-size: 1em;
    line-height: 1.5;
    letter-spacing: 0;
    margin: 1em 0;
}

.title {
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    margin: 0.75em 0;
}


.footnote {
    font-size: 0.75em;
    line-height: 1.3;
    margin: 0.5em 0;
}

.label-primary {
    color: var(--colors-labels-primary);
}

.label-secondary {
    color: var(--colors-labels-secondary);
}

.padding {
    padding: 1em;
}

.padding-vertical {
    padding-top: 1em;
    padding-bottom: 1em;
}

.padding-horizontal {
    padding-left: 1em;
    padding-right: 1em;
}

.center {
    text-align: center;
}

.svg-icon {
    fill: var(--colors-labels-primary);
}

/* a */

a {
    color: var(--colors-accent);
    text-decoration: none;
    letter-spacing: 0;
}

a:hover {
    text-decoration: underline;
}

/* pill button */

.pill-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 1em;
    font-weight: 600;
    color: white;
    background-color: var(--colors-accent);
    border: none;
    border-radius: 50px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    gap: 2px;
}

.pill-button:hover {
    background-color: var(--colors-accent-hover);
    text-decoration: none;
}

.pill-button svg {
    flex-shrink: 0;
}

.pill-button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 1em;
    font-weight: 600;
    color: var(--colors-labels-primary);
    background-color: var(--colors-fill-quaternary);
    border: none;
    border-radius: 50px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    gap: 4px;
}

.pill-button-secondary:hover {
    background-color: var(--colors-fill-secondary);
    text-decoration: none;
}

.pill-button-secondary svg {
    flex-shrink: 0;
}

/* image */

.download-on-the-app-store-container {
    display: flex;
    justify-content: center;
}

.download-on-the-app-store {
    height: 60px;
}

/* navigation */

.navigation-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5em;
}

.navigation-container a:hover {
    text-decoration: none;
}

.navigation-left {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* icon button utility (header search trigger might rely on layout inline styles, keep here as baseline) */
.icon-button svg { display:block; }

/* Rating Ring */
.rating-tier-excellent { --rating-color: var(--colors-accent); }
.rating-tier-good { --rating-color: var(--colors-green); }
.rating-tier-average { --rating-color: var(--colors-yellow); }
.rating-tier-poor { --rating-color: var(--colors-orange); }
.rating-tier-bad { --rating-color: var(--colors-red); }
.rating-tier-unknown { --rating-color: var(--colors-fill-secondary); }

/* footer */

.footer {
    display: flex;
    justify-content: space-between;
}

.footer-left {
    margin-right: 20px;
}

.footer-right {
    text-align: right;
}

/* layout */

@media (max-width: 768px) {
    body {
        padding: 1em;
    }

    h1 {
        font-size: 2.0em;
        font-weight: 700;
        line-height: 1.2;
        margin: 1em 0;
    }

    .links-container {
        grid-template-columns: 1fr;
    }

    .download-on-the-app-store {
        height: 50px;
    }
}