/*
Theme Name: Reelhouse
Theme URI: https://example.com/reelhouse
Author: Reelhouse
Author URI: https://example.com
Description: A Netflix-style single-movie & series streaming theme with a custom "Movie" post type, genre taxonomy, per-episode video links, and automatic episode thumbnail fallback to the parent title's featured image.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: reelhouse
*/

:root{
  --bg:#0b0b0d; --panel:#141417; --panel-raised:#1b1b1f;
  --line:rgba(245,244,240,0.09);
  --ink:#f5f4f0; --ink-dim:#a7a5a0; --ink-faint:#6f6d69;
  --gold:#cda45e; --gold-bright:#e6c17d;
  --wine:#7a2333; --wine-bright:#a5324a;
  --radius:6px;
  color-scheme:dark;
  padding-top:env(safe-area-inset-top,0px);
  padding-bottom:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box;}
html{scroll-padding-top:env(safe-area-inset-top,0px);}
html,body{height:100%;}
body{margin:0;background:var(--bg);color:var(--ink);font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;-webkit-font-smoothing:antialiased;}
h1,h2,h3,.display{font-family:'Fraunces',Georgia,serif;}
a{color:inherit;text-decoration:none;}
button{font-family:inherit;}
img{max-width:100%;display:block;}
::-webkit-scrollbar{width:8px;height:8px;}
::-webkit-scrollbar-thumb{background:#2a2a2e;border-radius:8px;}
::-webkit-scrollbar-track{background:transparent;}

/* ---------- Top bar (shared) ---------- */
.topbar{
  position:sticky; top:0; z-index:40;
  padding:calc(16px + env(safe-area-inset-top,0px)) clamp(18px,4vw,48px) 16px;
  display:flex; align-items:center; justify-content:space-between; gap:24px;
  background:linear-gradient(180deg, rgba(11,11,13,0.95), rgba(11,11,13,0.55) 70%, transparent);
  backdrop-filter:blur(6px);
}
.topbar.solid{background:linear-gradient(180deg, rgba(11,11,13,0.98), rgba(11,11,13,0.85) 80%); border-bottom:1px solid var(--line);}
.brand{display:flex; align-items:center; gap:10px; font-family:'Fraunces',serif; font-weight:600; font-size:19px;}
.brand img{height:26px;width:auto;border-radius:6px;}
.brand-mark{width:26px;height:26px;border-radius:50%; background:conic-gradient(from 220deg,var(--wine-bright),var(--gold),var(--wine-bright)); flex:none;}
.nav{display:flex; align-items:center; gap:26px; font-size:14px; color:var(--ink-dim); font-weight:500;}
.nav ul{list-style:none;display:flex;gap:26px;margin:0;padding:0;}
.nav a{transition:color .2s ease;}
.nav a:hover, .nav .current-menu-item a{color:var(--ink);}
.nav .current-menu-item a{color:var(--gold-bright);}
.back-link{display:flex; align-items:center; gap:8px; color:var(--ink-dim); font-size:14px; font-weight:500; transition:color .2s ease;}
.back-link:hover{color:var(--ink);}
.back-link svg{width:16px;height:16px;}
@media (max-width:700px){ .nav{display:none;} }

/* ---------- Buttons ---------- */
.btn{display:inline-flex; align-items:center; gap:9px; padding:12px 22px; border-radius:4px; font-size:14.5px; font-weight:600; cursor:pointer; border:1px solid transparent; transition:transform .15s ease, background .2s ease;}
.btn:active{transform:scale(.97);}
.btn-primary{background:var(--gold-bright); color:#1a1207;}
.btn-primary:hover{background:#f2d29a;}
.btn-ghost{background:rgba(245,244,240,0.08); color:var(--ink); border-color:var(--line); backdrop-filter:blur(4px);}
.btn-ghost:hover{background:rgba(245,244,240,0.15);}
.btn svg{width:16px;height:16px;}

/* ---------- Hero (home) ---------- */
.hero{
  position:relative; min-height:78vh; display:flex; align-items:flex-end;
  padding:0 clamp(18px,4vw,48px) 56px; margin-top:-84px; padding-top:84px;
  background-size:cover; background-position:center;
}
.hero-scrim{
  position:absolute; inset:0;
  background:linear-gradient(180deg, rgba(11,11,13,0.15) 0%, rgba(11,11,13,0.45) 55%, var(--bg) 100%), linear-gradient(90deg, rgba(11,11,13,0.55), transparent 60%);
}
.hero-inner{position:relative; max-width:620px;}
.hero-badge{display:inline-flex; align-items:center; gap:8px; color:var(--gold-bright); font-size:12.5px; font-weight:600; letter-spacing:.03em; margin-bottom:14px;}
.hero h1{font-size:clamp(34px,6vw,58px); font-weight:600; line-height:1.03; margin:0 0 16px; letter-spacing:-0.01em;}
.hero p{color:var(--ink-dim); font-size:15.5px; line-height:1.65; max-width:52ch; margin:0 0 28px;}
.hero-actions{display:flex; gap:12px; flex-wrap:wrap;}

/* ---------- Rows (home) ---------- */
.rows{padding:6px clamp(18px,4vw,48px) 70px; display:flex; flex-direction:column; gap:38px;}
.row-head{display:flex; align-items:baseline; justify-content:space-between; margin-bottom:14px;}
.row-head h2{font-size:19px; font-weight:600; margin:0;}
.row-head span{font-size:12.5px; color:var(--ink-faint);}
.row-track{display:flex; gap:14px; overflow-x:auto; padding-bottom:8px; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch;}

.card{position:relative; flex:none; width:230px; scroll-snap-align:start; cursor:pointer;}
.card-thumb{position:relative; width:100%; aspect-ratio:16/9; border-radius:6px; overflow:hidden; background:#181a1f no-repeat center/cover; transition:transform .25s ease;}
.card:hover .card-thumb{transform:translateY(-4px); box-shadow:0 16px 34px -14px rgba(0,0,0,0.7);}
.card-thumb::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,0.6));}
.card-play, .ep-play, .poster-play{
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); z-index:2;
  border-radius:50%; background:rgba(11,11,13,0.5); border:1px solid rgba(245,244,240,0.5);
  display:flex; align-items:center; justify-content:center;
  transition:opacity .2s ease, background .2s ease, transform .2s ease;
}
.card-play{width:38px;height:38px; opacity:0;}
.card:hover .card-play{opacity:1;}
.card-play:hover, .poster:hover .poster-play:hover{background:var(--wine); border-color:var(--wine-bright); transform:translate(-50%,-50%) scale(1.08);}
.card-play svg{width:13px;height:13px;fill:var(--ink); margin-left:1px;}
.card-badge, .poster-rating{position:absolute; top:8px; left:8px; z-index:2; font-size:10.5px; font-weight:700; letter-spacing:.03em; color:var(--gold-bright); background:rgba(11,11,13,0.55); padding:2px 7px; border-radius:3px;}
.poster-rating{left:auto;right:8px;}
.card-meta{padding:9px 2px 0;}
.card-title, .poster-title{font-size:13.5px; font-weight:600; margin:0 0 3px;}
.card-sub, .poster-sub{font-size:11.5px; color:var(--ink-faint);}

/* ---------- Browse / archive grid ---------- */
.page-head{padding:40px clamp(18px,4vw,48px) 0;}
.page-head h1{font-size:clamp(28px,4vw,38px); font-weight:600; margin:0 0 18px;}
.filters{display:flex; gap:10px; flex-wrap:wrap; padding:0 clamp(18px,4vw,48px) 30px;}
.chip{padding:8px 16px; border-radius:20px; font-size:13px; font-weight:500; color:var(--ink-dim); border:1px solid var(--line); cursor:pointer; transition:background .2s ease, color .2s ease, border-color .2s ease;}
.chip:hover{color:var(--ink); border-color:rgba(245,244,240,0.25);}
.chip.on{background:var(--gold-bright); color:#1a1207; border-color:var(--gold-bright);}
.grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(168px,1fr)); gap:22px 16px; padding:0 clamp(18px,4vw,48px) 40px;}
.poster{cursor:pointer;}
.poster-thumb{position:relative; width:100%; aspect-ratio:2/3; border-radius:6px; overflow:hidden; background:#181a1f no-repeat center/cover; transition:transform .25s ease;}
.poster:hover .poster-thumb{transform:translateY(-5px); box-shadow:0 18px 36px -14px rgba(0,0,0,0.75);}
.poster-thumb::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.65));}
.poster-play{width:42px;height:42px; opacity:0;}
.poster:hover .poster-play{opacity:1;}
.poster-play svg{width:14px;height:14px;fill:var(--ink); margin-left:1px;}
.poster-meta{padding:9px 1px 0;}
.empty{padding:60px clamp(18px,4vw,48px); text-align:center; color:var(--ink-faint);}
.pagination{display:flex; gap:8px; padding:0 clamp(18px,4vw,48px) 60px; flex-wrap:wrap;}
.pagination a, .pagination span{padding:8px 14px; border:1px solid var(--line); border-radius:4px; font-size:13px; color:var(--ink-dim);}
.pagination .current{background:var(--gold-bright); color:#1a1207; border-color:var(--gold-bright);}

/* ---------- Single title (player) ---------- */
.stage{display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:28px; max-width:1400px; margin:0 auto; padding:0 clamp(18px,4vw,48px) 60px;}
@media (max-width:980px){ .stage{grid-template-columns:1fr; padding-bottom:40px;} }
.player-col{min-width:0;}
.player-wrap{position:relative; width:100%; aspect-ratio:16/9; background:#000 radial-gradient(circle at 50% 40%, #1c1c20, #08080a 75%); border-radius:var(--radius); overflow:hidden; box-shadow:0 20px 60px -20px rgba(0,0,0,0.8);}
.player-wrap video, .player-wrap iframe{width:100%; height:100%; object-fit:cover; display:block; background:#000; border:0;}
.player-cover{position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:linear-gradient(180deg, rgba(0,0,0,0.15), rgba(0,0,0,0.55)), #181a1f no-repeat center/cover; cursor:pointer; transition:opacity .45s ease;}
.player-cover.hidden{opacity:0; pointer-events:none;}
.play-btn{width:78px; height:78px; border-radius:50%; background:rgba(11,11,13,0.55); border:1.5px solid rgba(245,244,240,0.45); display:flex; align-items:center; justify-content:center; transition:transform .25s ease, background .25s ease, border-color .25s ease;}
.player-cover:hover .play-btn{transform:scale(1.07); background:var(--wine); border-color:var(--wine-bright);}
.play-btn svg{width:26px;height:26px;margin-left:4px;fill:var(--ink);}
.cover-label{position:absolute; left:24px; bottom:20px; font-size:13px; letter-spacing:.03em; color:var(--ink-dim);}
.no-video-msg{position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:var(--ink-faint); font-size:14px; text-align:center; padding:20px;}

.info{padding-top:26px;}
.meta-row{display:flex; align-items:center; gap:12px; flex-wrap:wrap; font-size:13.5px; color:var(--ink-dim); margin-bottom:10px;}
.badge{border:1px solid var(--line); padding:3px 9px; border-radius:4px; color:var(--gold-bright); font-weight:600; font-size:12px;}
.dot{width:3px;height:3px;border-radius:50%;background:var(--ink-faint);}
h1.title{font-size:clamp(28px,4vw,42px); font-weight:600; line-height:1.08; margin:0 0 14px; letter-spacing:-0.01em;}
.synopsis{max-width:64ch; color:var(--ink-dim); font-size:15.5px; line-height:1.65; margin:0 0 26px;}
.actions{display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:34px;}
.divider{height:1px; background:var(--line); margin:6px 0 30px;}
.cast-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:18px 24px; margin-bottom:10px;}
.cast-grid dt{font-size:11.5px; text-transform:uppercase; letter-spacing:.08em; color:var(--ink-faint); margin-bottom:4px;}
.cast-grid dd{margin:0; font-size:14px; color:var(--ink);}

.sidebar{min-width:0;}
.sidebar-head{display:flex; align-items:baseline; justify-content:space-between; padding-top:26px; margin-bottom:14px;}
.sidebar-head h2{font-size:19px; font-weight:600; margin:0;}
.sidebar-head span{font-size:12.5px; color:var(--ink-faint);}
.ep-list{display:flex; flex-direction:column; gap:10px;}
.ep-item{display:flex; gap:12px; align-items:center; padding:8px; border-radius:var(--radius); cursor:pointer; border:1px solid transparent; transition:background .2s ease, border-color .2s ease;}
.ep-item:hover{background:var(--panel);}
.ep-item.active{background:var(--panel-raised); border-color:var(--line);}
.ep-item.active .ep-title{color:var(--gold-bright);}
.ep-thumb{position:relative; flex:none; width:128px; aspect-ratio:16/9; border-radius:4px; overflow:hidden; background:#181a1f no-repeat center/cover;}
.ep-thumb::after{content:"";position:absolute; inset:0; background:linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.55));}
.ep-num{position:absolute; top:6px; left:7px; z-index:2; font-size:10.5px; font-weight:700; color:rgba(245,244,240,.75); letter-spacing:.03em;}
.ep-play{width:30px;height:30px;}
.ep-play svg{width:11px;height:11px;fill:var(--ink); margin-left:1px;}
.ep-dur{position:absolute; right:6px; bottom:5px; z-index:2; font-size:10.5px; color:var(--ink-dim);}
.ep-body{min-width:0;}
.ep-title{font-size:13.5px; font-weight:600; margin:0 0 3px; line-height:1.3; color:var(--ink);}
.ep-sub{font-size:12px; color:var(--ink-faint); line-height:1.4;}
@media (max-width:980px){
  .sidebar-head{padding-top:8px;}
  .ep-list{flex-direction:row; overflow-x:auto; gap:12px; padding-bottom:6px; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch;}
  .ep-item{flex-direction:column; align-items:stretch; width:180px; flex:none; scroll-snap-align:start;}
  .ep-thumb{width:100%;}
}
.footnote{max-width:1400px; margin:0 auto; padding:0 clamp(18px,4vw,48px) 40px; color:var(--ink-faint); font-size:12px;}

@media (max-width:600px){ .hero{min-height:64vh;} .card{width:180px;} }
@media (prefers-reduced-motion: reduce){ *{transition-duration:0.001ms !important;} }
