/* ---------- Variables ---------- */
:root { 
--bg: #1a1420; 
--panel: #261d2e; 
--text: #FAF9F0;
--muted: #B9ACC3;
--link: #FA9E5C;  
--accent: #FA9E5C;
--font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif; 
}



/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: linear-gradient(rgba(21,16,25,.55), rgba(21,16,25,.85)), #151019 url("images/bg.avif") center top / cover no-repeat fixed; color: var(--text); font-family: var(--font); line-height: 1.5; }
a { color: var(--link); }
.panel { max-width: 80%; margin: 0 auto; background: #121417; border-radius: 6px; }

/* ---------- Header ---------- */
header { max-width: 1200px; margin: 0 auto; padding: 56px 24px 28px; }
h1 { margin: 0; font-size: clamp(2.4rem, 7vw, 4.5rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
header p { margin: 12px 0 0; color: var(--muted); font-size: 1.05rem; }

/* ---------- Play by IMDb ID ---------- */
.custom { max-width: 1200px; margin: 0 auto; padding: 0 24px 12px; }
.custom label { display: block; font-weight: 700; margin-bottom: 8px; }
.custom .row { display: flex; gap: 8px; max-width: 420px; margin-top: 10px; }
.custom input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 4px; border: 1px solid var(--muted); background: var(--panel); color: var(--text); }
.custom button { font: inherit; font-weight: 700; Background: var(--accent); color: black; border: 0; border-radius: 4px; padding: 10px 18px; cursor: pointer; }
.custom input:focus-visible, .custom button:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
img.imdb { height: 40px; width: auto; max-width: 100%; }
#id-error { margin: 8px 0 0; color: #ff9b8a; min-height: 1.4em; }

/* ---------- Movie grid ---------- */
.grid { max-width: 1200px; margin: 0 auto; padding: 12px 24px 72px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 28px 20px; }
.movie { all: unset; cursor: pointer; display: flex; flex-direction: column; min-width: 0; }
.movie:focus-visible .poster { outline: 3px solid var(--accent); outline-offset: 3px; }
.movie:hover .poster, .movie:focus-visible .poster { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,.5); }
.movie:hover .play, .movie:focus-visible .play { opacity: 1; }
.poster { flex: none; width: 100%; position: relative; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: var(--panel); transition: transform .2s ease, box-shadow .2s ease; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.poster .fallback { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 16px; font-weight: 800; font-size: 1.3rem; line-height: 1.1; background: linear-gradient(160deg, var(--hue, #5b3a78), #1a1420); }
.play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(26, 20, 32, .55); opacity: 0; transition: opacity .2s ease; }
.play span { width: 60px; height: 60px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.play svg { width: 24px; height: 24px; fill: #1a1420; margin-left: 3px; }
.title { margin: 10px 0 0; font-weight: 700; font-size: 1rem; line-height: 1.3; height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.year { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- Player ---------- */
dialog { width: min(1000px, 94vw); padding: 0; border: 0; border-radius: 8px; background: var(--panel); color: var(--text); overflow: hidden; }
dialog::backdrop { background: rgba(8, 5, 12, .85); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; }
.bar h2 { margin: 0; font-size: 1.1rem; }
.bar a { color: var(--muted); font-size: .9rem; }
.bar button { font: inherit; font-weight: 700; background: var(--accent); color: #1a1420; border: 0; border-radius: 4px; padding: 8px 14px; cursor: pointer; }
.bar button:focus-visible, .bar a:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.player-link { text-align: center; }
.frame { aspect-ratio: 16 / 9; background: #000; }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- Footer ---------- */
footer { min-height: 80px; padding: 10px; border-top: 1px solid #B9ACC3; text-align: center; }
footer div { margin-top: 10px; } 
.credit { max-width: 1200px; margin: 0 auto; padding: 0 24px 40px; color: var(--muted); font-size: .85rem; }

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }