/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    /* Core colors */
    --primary: mediumpurple;
    --alt-primary: #8960df;
    --success: #15803D;
    --alt-success: #156c34;
    --info: #2563EB;
    --error: #DC2626;
    --alt-error: #b91c1c;
    --gold: gold;
    --border: rgba(255, 255, 255, 0.1);
    --alt-border: rgba(255, 255, 255, 0.15);
    --white: white;
    --alt-white: #f5f5f5;
    --black: black;
    /* Background colors */
    --bg: black;
    --surface: #1E1E1E;
    --surface-hover: #404040;
    --card: #141414;
    --card-hover: #1A1A1A;
    /* Text colors */
    --text: #ededed;
    --text-dim: #bdbdbd;
    /* Gaps */
    --gap-sm: 0.5rem;
    --gap-md: 1rem;
    --gap-lg: 2rem;
    /* Consistent Spacing Scale */
    --space-xs: 0.25rem;    /* 4px */
    --space-sm: 0.5rem;     /* 8px */
    --space-md: 1rem;       /* 16px */
    --space-lg: 1.5rem;     /* 24px */
    --space-xl: 2rem;       /* 32px */
    --space-2xl: 3rem;      /* 48px */
    --space-3xl: 4rem;      /* 64px */
    /* Specific spacing tokens */
    --nav-offset: 12rem;
    --input-padding: 2rem;
    /* Layout */
    --container-width: 800px;
    --scrollbar-width: 10px;
    --touch-target: 64px;
    /* Typography Scale */
    --text-xs: 15px;
    --text-sm: 17px;
    --text-base: 20px;
    --text-lg: 25px;
    --text-xl: 35px;
    --text-2xl: 50px;
}

/* ========================================
   BASE STYLES
   ======================================== */
html {
    font-family: system-ui, -apple-system, sans-serif;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-size: var(--text-base);
    line-height: 1.6;
    =
}

body.menu-open {
    overflow: hidden;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1, h2, h3, h4 {
    font-weight: 700;
    color: var(--white);
}

h1 {
    font-size: var(--text-2xl);
}

h2 {
    font-size: var(--text-xl);
}

h3 {
    font-size: var(--text-lg);
}

h4 {
    font-size: var(--text-base);
}

p {
    margin: var(--space-md) 0;
}

a {
    color: inherit;
    transition: opacity 250ms;
}

a:hover {
    text-decoration: underline;
}

ul {
    list-style: none;
}


/* ========================================
   COMMON STYLES
   ======================================== */

.visually-hidden {
    display: none;
}


/* ========================================
   LAYOUT
   ======================================== */
.container {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
                "header"
                "subheader"
                "main"
                "footer";
    min-height: 90vh;
    margin: 0 auto;
    padding: var(--space-md);
}

/* ========================================
   HEADER
   ======================================== */
header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    margin-bottom: var(--space-2xl);
}

/* ========================================
   LOGO
   ======================================== */
.logo-image {
    width: 64px;
    height: 64px;
}

g {
    fill: mediumpurple;
}

svg:hover g {
    fill: #8960df;
}

/* ========================================
   NAVIGATION
   ======================================== */
.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 50px;
    height: 50px;
    background: transparent;
    border: none;
    position: relative;
    z-index: 10;
    cursor: pointer;
    padding: 0;
}

.hamburger-menu span {
    display: block; /* Force block display */

    height: 10px;
    width: 100%;
    background: var(--alt-white);
    transition: transform 250ms, background 250ms;
    position: relative;
}

.hamburger-menu:hover span {
    background: var(--text-dim);
}

.hamburger-menu.active span {
    background: var(--error);
}

.hamburger-menu.active span:nth-child(1) {
    transform: translateY(20px);
}

.hamburger-menu.active span:nth-child(3) {
    transform: translateY(-20px);
}

.nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    opacity: 0;
    z-index: -10;
    transition: opacity 250ms;
}


.nav.open {
    opacity: 1;
    z-index: 5;
    overflow-y: scroll;
}

.nav ul {
    margin-top: var(--nav-offset);
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 0;
}

.nav a {
    color: var(--white);
    display: block;
    padding: var(--space-md) 0;
    font-size: var(--text-lg);
    font-weight: 500;
    text-decoration: none;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
}

nav a:hover {
    text-decoration: underline;
}

/* ========================================
   SUBHEADER & BREADCRUMBS
   ======================================== */
.subheader {
    display: flex;
    justify-content: center;
    align-items: center;
    grid-area: subheader;
    font-size: .9rem;
    z-index: 10;
    margin: var(--space-md) 0;
}

.subheader-breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text);

}

.breadcrumb-item a {
    transition: color 250ms;
    font-weight: 400;
}

.breadcrumb-item a:hover {
    color: var(--text-dim);
}

.breadcrumb-item.current {
}

/* ========================================
   MAIN CONTENT
   ======================================== */
main {
    grid-area: main;
}

.page-title {
    font-size: var(--text-xl);
    text-align: center;
    text-transform: uppercase;
}

.content-title {
    font-size: var(--text-2xl);
}

.page-intro {
    text-align: center;
}

/* ========================================
   SEARCH INTERFACE
   ======================================== */

.search-wrapper {
    display: flex;
    width: 100%;
    margin: var(--space-2xl) auto;
    max-width: 600px;
}

.search-bar-container {
    height: 64px;
    flex-grow: 1;
    background: white;
    border-radius: 32px 0 0 32px;
}

.search-input {
    height: 100%;
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 0 var(--input-padding);
    font-size: var(--text-sm);
}

.search-input:focus {
    color: black;
}

.gear-button {
    width: 64px;
    background: white;
    border: 2px solid white;
    border-left: none;
    border-right: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gear-button svg {
    width: 32px;
    height: 32px;
    fill: var(--bg);
    transition: transform 250ms;
}

.gear-button:hover svg {
    transform: scale(1.1);
}

.search-button {
    height: var(--touch-target);
    width: 124px;
    background: linear-gradient(135deg, mediumpurple 0%, rebeccapurple 80%);
    color: var(--white);
    font-weight: bold;
    font-size: var(--text-sm);
    border: 2px solid white;
    border-radius: 0 32px 32px 0;
    cursor: pointer;
    transition: background 250ms;
}

.search-button:hover {
    background: linear-gradient(135deg, mediumpurple 0%, rebeccapurple 50%);
}

/* ========================================
   RESULTS SECTION
   ======================================== */

.clear-active-filters {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--white);
    background: transparent;
    outline: none;
    border: none;
}
.clear-active-filters:hover {

    text-decoration: underline;
}

.results-metadata {
    position: absolute;
    bottom: 100%; /* Places it above the search bar */
    left: 0;
    right: 0;
    display: flex;
    justify-items: center;
    text-align: center;
    gap: var(--space-sm);
    margin: var(--space-xl) auto;
    font-size: var(--text-sm);
    color: var(--text-dim);
    flex-wrap: wrap;
    max-width: 400px;
    z-index: 1;
    margin-bottom: 8px;
}
.search-section {
    position: relative;
    margin-top: 20vh;

}
.query-term {
    color: var(--text);
    font-weight: 500;
}

.results-query {
    margin: 0 auto;

}

.results-filters {
    display: flex;
    gap: var(--space-sm);
    margin: var(--space-md) auto;
}

.filter-pill {
    color: var(--text);
    padding: 0.375rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-pill:hover {
    background: var(--surface-hover);
    border-color: var(--alt-border);
    transform: scale(1.1);
}

.results-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    margin: 0 auto;
}

.content-card {
    border-radius: 12px;
    overflow: hidden;
    transition: transform 250ms;
    scroll-snap-type: y proximity;
    scroll-snap-align: center;
}

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

/* ========================================
   RESULT ITEMS
   ======================================== */
.result-item-group {
    color: var(--white);
    border: 1px solid var(--surface-hover);
    position: relative;
    margin: 0 auto;
}

.result-content-header {
    background: rgba(0, 0, 0, 0.75);
    border-bottom: 1px solid var(--surface-hover);
    min-height: 64px;
    padding: 0 var(--space-md);
    display: flex;
    align-items: center;
}

.result-title {
    margin: 0;
    font-size: var(--text-xs);
    text-transform: uppercase;
    padding-right: 64px;

}

.result-title a {
    color: var(--white);
    text-decoration: underline;
}

.result-image-container {
    position: relative;
    line-height: 0;

}

.result-image {
    width: 100%;
    min-height: 256px;
}

.result-description {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    font-size: var(--text-xs);
    background: rgba(0, 0, 0, 0.7);
    border-top: 1px solid var(--surface-hover);
}

.result-description p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.result-actions-trigger {
    position: absolute;
    top: 0;
    right: 0;
}

.result-actions-trigger button {
    height: var(--touch-target);
    width: var(--touch-target);
    background: var(--card);
    border: none;
    border-left: 1px solid var(--surface-hover);
    font-size: 32px;
    cursor: pointer;
    color: var(--white);
    transition: background 250ms;
}

.result-actions-trigger button:hover {
    background: var(--card-hover);
}

/* Image Grid Layout for Scanning */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md, 1rem);
    margin: var(--space-lg, 2rem) 0;
}

@media (min-width: 541px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 750px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

/* ========================================
   RESULT ACTIONS MENU
   ======================================== */
.result-actions-menu {
    display: none;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 2;
    background: var(--card);
}

.result-actions-menu.active {
}

.result-actions-menu-buttons, .page-actions-menu-buttons {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%
}

.page-actions-menu-buttons button {
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: var(--space-md);
    margin: var(--space-xs) 0;
    font-size: var(--text-sm);
    color: var(--text);
    cursor: pointer;
    transition: background 250ms;
    border: 1px solid var(--border);
}

.thumbs-down-button, .thumbs-up-button, .favorite-button, .watchlist-button {
    background: var(--card);
}

.thumbs-down-button:hover, .thumbs-up-button:hover, .favorite-button:hover, .watchlist-button:hover {
    background: var(--card-hover);
}

.thumbs-down-button.active:hover,
.thumbs-up-button.active:hover,
.favorite-button.active:hover,
.watchlist-button.active:hover  {
    background: var(--alt-success);
}
.thumbs-down-button.active,
.thumbs-up-button.active,
.favorite-button.active,
.watchlist-button.active{
    background: var(--success);
}


.result-actions-menu-buttons button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border: 1px solid var(--border);
    font-size: var(--text-sm);
    color: var(--text);
    cursor: pointer;
    transition: background 250ms;
}

/* ========================================
   MENU OVERLAY (GEAR BUTTON MENU)
   ======================================== */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 30, 30, 0.75);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-panel {
    background: var(--bg);
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 100%;
    color: white;
    z-index: 1001;
    overflow-y: auto;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--container-width);
    margin: 2rem auto;
}

.menu-title {
    font-size: var(--text-xl);
    font-weight: bold;
    margin: 0 var(--space-xl);
}

.apply-filter-button{
    background: none;
    border: none;
    font-size: var(--text-2xl);
    cursor: pointer;
    color: var(--success);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 250ms;
    margin: 0 var(--space-xl);

}

.apply-filter-button:hover {
    color: var(--success);
    opacity: 0.8;
}

/* ========================================
   FILTER MENU CONTENT
   ======================================== */
.menu-content {
    display: grid;
    gap: var(--space-xl);
    max-width: var(--container-width);
    margin: var(--space-xl) auto;
}

.menu-content > div {
    margin: 0 var(--space-xl);
    display: flex;
}
.menu-content h3 {
    font-size: var(--text-base);
    color: var(--white);
    margin: 0;
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.menu-content button {
}

.menu-content button:hover {
}

/* ========================================
   FILTER MODALS
   ======================================== */
.filter-modal {
    display: none;
    background: var(--card);
    border: 2px solid var(--alt-border);
    z-index: 1002;
    overflow: hidden;
}

.filter-modal.active {
    display: grid;
}

.filter-modal-content {
    width: 100%;
}

.filter-modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.filter-modal-title {
    margin: 0;
    font-size: var(--text-lg);
    color: var(--white);
}

.filter-modal-options {
    overflow-y: auto;
    display: grid;
}

.filter-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    transition: background 250ms;
    background: var(--card);
    height: var(--touch-target);
    cursor: pointer;
}

.filter-option:hover {
    background: var(--card-hover);
}

.filter-option label {
    font-size: var(--text-sm);
    color: var(--text);
    cursor: pointer;
    user-select: none;
    flex: 1;
}

.filter-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--card);
    position: relative;
    transition: all 250ms ease;
}

.filter-option input[type="checkbox"]:hover {
    border-color: var(--primary);
}

.filter-option input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.filter-option input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 8px;
    width: 8px;
    height: 24px;
    border: solid var(--card);
    border-width: 0 4px 4px 0;
    transform: rotate(45deg);
}

.filter-option input[type="checkbox"]:checked + label {
    color: var(--white);
    font-weight: 500;
}


/* ========================================
   FOOTER
   ======================================== */
footer {
    grid-area: footer;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    font-size: 13px;
}

footer nav {
    text-align: center;
    margin-bottom: 8px;
}

footer ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px 20px;
}

footer a {
    color: var(--alt-white);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

footer .copyright {
    color: var(--text-dim);
    text-align: center;
    display: block;
}

/* ========================================
   CONTENT ITEM PAGE
   ======================================== */

/* Page Specific Styling */
.content-image {
    grid-area: poster;
    max-width: 100%;
    max-height: 500px;
    margin: var(--gap-sm) auto;
    background: transparent;
    overflow: hidden;
}

.content-item-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.content-item-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.content-details {
    grid-area: details;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--gap-sm);
    max-width: 400px;
    margin: 0 auto;
}

.app-actions {
    margin-bottom: var(--gap-sm);
}

/* Where to Watch */

.where-to-watch {
    margin: var(--space-2xl) 0;
}
.where-to-watch h2 {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: var(--gap-lg);
}

.platforms {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xl);
}

.platform {
    display: none;
    width: 128px;
    height: 128px;
    align-items: center;
    justify-content: center;
    opacity: .85;
}

.platform.active {
    display: flex;
}

.platform:hover {
    opacity: 1;
}

.platform img {
    width: 128px;
}


/* Related Content */
.related-content {
    font-size: var(--text-base);
    text-align: center;
    max-width: 400px;
    margin: var(--space-2xl) auto 0;
}

.related-content h2 {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: var(--space-xl);
}

.related-content ol {
    list-style: none;
    padding: 0;
    margin: var(--space-xl) auto;
}

.related-content li {
    margin-top: var(--space-md);
}

.related-content-list {
    padding: 0.75rem 1rem;
    background: var(--info);
    color: var(--white);
    transition: background-color 0.2s ease;
}

.related-content-list a {
    text-decoration: none;
    font-weight: 500;
    display: block;
    width: 100%;
}

.related-content-list:hover {
    opacity: 0.8;
}