/* ============================================================================
   Flixoye Modern — design system + responsive/app layout
   ========================================================================== */
:root {
  --brand: #e01f26;
  --brand-dark: #b3131a;
  --ink: #15161a;
  --ink-2: #40434b;
  --muted: #7c8291;
  --bg: #ffffff;
  --surface: #f4f5f7;
  --line: #e7e8ec;
  --appbar-bg: #2b2a29;  /* matches the logo plate so the logo blends seamlessly */
  --card-radius: 14px;
  --appbar-h: 56px;
  --tabbar-h: 60px;
  --maxw: 1200px;
  --font: "Baloo Tamma 2", "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --shadow: 0 6px 22px rgba(20, 22, 28, .10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  padding-top: var(--appbar-h);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* Accessibility skip link (visible on keyboard focus) */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 200; }
.skip-link:focus {
  left: 8px; top: 8px; background: var(--brand); color: #fff; padding: 10px 16px;
  border-radius: 8px; font-weight: 700;
}

/* Comments */
.comment-list { display: flex; flex-direction: column; gap: 14px; }
.comment-list .comment-body { background: var(--surface); border-radius: 12px; padding: 14px 16px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; margin-bottom: 12px;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--brand); }
.comment-form .submit {
  background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 12px 22px; font-weight: 700; cursor: pointer;
}

/* ── App bar ──────────────────────────────────────────────────────────── */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--appbar-h); background: var(--appbar-bg); border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.appbar__inner {
  height: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.appbar__brand img { height: 34px; width: auto; }
.appbar__menu {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; padding: 9px; border: 0; background: transparent; cursor: pointer; border-radius: 10px;
}
.appbar__menu span { height: 2px; background: #fff; border-radius: 2px; transition: .2s; pointer-events: none; }
.nav-toggle { display: none; }
.nav-toggle:checked ~ .appbar .appbar__menu span:nth-child(1){ transform: translateY(6px) rotate(45deg); }
.nav-toggle:checked ~ .appbar .appbar__menu span:nth-child(2){ opacity: 0; }
.nav-toggle:checked ~ .appbar .appbar__menu span:nth-child(3){ transform: translateY(-6px) rotate(-45deg); }
.appbar__nav { display: none; margin-left: 8px; flex: 1; }
.appbar__search-btn {
  margin-left: auto; width: 40px; height: 40px; border: 0; background: transparent;
  color: #fff; cursor: pointer; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
}
.appbar__search-btn:hover, .appbar__menu:hover { background: rgba(255,255,255,.12); }

.appbar__menu-list { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.appbar__menu-list a { padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 15px; color: rgba(255,255,255,.82); }
.appbar__menu-list a:hover { background: rgba(255,255,255,.12); color: #fff; }
.appbar__menu-list .current-menu-item > a { color: #fff; background: var(--brand); }

/* Search overlay */
.search-overlay {
  position: absolute; top: var(--appbar-h); left: 0; right: 0;
  background: #fff; border-bottom: 1px solid var(--line); padding: 12px 16px; box-shadow: var(--shadow);
}
.search-overlay__form { display: flex; max-width: var(--maxw); margin: 0 auto; gap: 8px; }
.search-overlay__input {
  flex: 1; border: 2px solid var(--line); border-radius: 12px; padding: 12px 16px; font: inherit; font-size: 16px;
}
.search-overlay__input:focus { outline: none; border-color: var(--brand); }
.search-overlay__submit { border: 0; background: var(--brand); color: #fff; border-radius: 12px; width: 50px; cursor: pointer; }

/* ── Mobile drawer ────────────────────────────────────────────────────── */
.drawer-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 110; display: none; }
.nav-toggle:checked ~ .drawer-scrim { display: block; }
body:has(.nav-toggle:checked) { overflow: hidden; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 82%; max-width: 320px; background: #fff; z-index: 120;
  transform: translateX(-100%); transition: transform .26s ease; padding: 14px 16px; overflow-y: auto;
  box-shadow: 4px 0 30px rgba(0,0,0,.2); -webkit-overflow-scrolling: touch;
}
.nav-toggle:checked ~ .drawer { transform: translateX(0); }
.drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.drawer__head img { height: 32px; }
.drawer__close { border: 0; background: transparent; font-size: 30px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.drawer__menu { list-style: none; margin: 8px 0; padding: 0; }
.drawer__menu li { border-bottom: 1px solid var(--line); }
.drawer__menu a { display: block; padding: 14px 6px; font-weight: 600; font-size: 16px; }
.drawer__menu a:hover { color: var(--brand); }
.drawer__social { display: flex; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.drawer__social a { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ── Sections & rails ─────────────────────────────────────────────────── */
.section { margin: 22px 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 16px; margin-bottom: 12px; }
.section__head h2 { font-size: 20px; font-weight: 700; }
.section__head a { font-size: 13px; color: var(--brand); font-weight: 700; }

.rail {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 16px 8px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > .card { flex: 0 0 74%; max-width: 300px; scroll-snap-align: start; }

/* ── Card ─────────────────────────────────────────────────────────────── */
.card { display: flex; flex-direction: column; }
.card__media {
  position: relative; display: block; aspect-ratio: 16/9; border-radius: var(--card-radius);
  overflow: hidden; background: var(--surface);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card:hover .card__media img { transform: scale(1.04); }
.card__ph { position: absolute; inset: 0; background: linear-gradient(135deg,#eceef2,#dfe2e8); }
.card__chip {
  position: absolute; left: 10px; top: 10px; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .3px; padding: 4px 10px; border-radius: 20px;
}
.card__title {
  margin-top: 9px; font-weight: 600; font-size: 15px; color: var(--ink); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card:hover .card__title { color: var(--brand); }
.card__meta { margin-top: 3px; font-size: 12px; color: var(--muted); }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero { position: relative; }
.hero__media { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; }
.hero__body {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px; color: #fff;
  background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,.85) 100%);
}
.hero__chip { align-self: flex-start; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; padding: 5px 12px; border-radius: 20px; margin-bottom: 10px; }
.hero__title { font-size: 22px; font-weight: 700; text-shadow: 0 2px 12px rgba(0,0,0,.5); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Grid ─────────────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 12px; padding: 0 16px; }

/* ── Article (single) ─────────────────────────────────────────────────── */
.article { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }
.article__chip { display: inline-block; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; padding: 5px 14px; border-radius: 20px; margin: 18px 0 12px; }
.article__title { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.article__meta { display: flex; gap: 12px; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.article__hero { border-radius: 16px; overflow: hidden; margin-bottom: 20px; aspect-ratio: 16/9; background: var(--surface); }
.article__hero img { width: 100%; height: 100%; object-fit: cover; }
.article__body { font-size: 18px; line-height: 1.75; color: var(--ink-2); }
.article__body p { margin: 0 0 18px; }
.article__body h2 { font-size: 23px; margin: 28px 0 12px; color: var(--ink); }
.article__body h3 { font-size: 20px; margin: 22px 0 10px; color: var(--ink); }
.article__body img { border-radius: 12px; margin: 12px 0; }
.article__body iframe { width: 100%; aspect-ratio: 16/9; height: auto; border: 0; border-radius: 12px; margin: 12px 0; }
.article__body a { color: var(--brand); font-weight: 600; }
.article__body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 15px; }
.article__body td, .article__body th { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }

.share { display: flex; gap: 10px; margin: 24px 0; flex-wrap: wrap; }
.share a { padding: 9px 16px; border-radius: 10px; background: var(--surface); font-weight: 600; font-size: 14px; }
.share a:hover { background: var(--brand); color: #fff; }

/* ── Movie hub page ───────────────────────────────────────────────────── */
.movie__hero { position: relative; background: #15161a; }
.movie__backdrop { width: 100%; aspect-ratio: 16/9; object-fit: cover; opacity: .55; }
.movie__hero-body { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px; color: #fff; background: linear-gradient(180deg, rgba(0,0,0,0) 20%, rgba(0,0,0,.85) 100%); }
.movie__status { align-self: flex-start; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; padding: 5px 12px; border-radius: 20px; margin-bottom: 8px; }
.movie__title { font-size: 26px; font-weight: 700; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.movie__title-kn { margin: 4px 0 0; font-size: 17px; color: #d7d9df; }
.movie__facts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 13px; color: #e6e7ea; }

.movie__wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }
.movie__trailer { margin: 18px 0; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.movie__trailer iframe { width: 100%; aspect-ratio: 16/9; height: auto; border: 0; display: block; }
.movie__section { margin: 24px 0; }
.movie__section h2 { font-size: 21px; font-weight: 700; margin-bottom: 12px; }

/* Where to watch */
.wtw { background: linear-gradient(135deg, #fff, #f7f8fb); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin: 20px 0; box-shadow: var(--shadow); }
.wtw__title { font-size: 19px; font-weight: 700; margin-bottom: 14px; }
.wtw__list { display: grid; gap: 10px; }
.wtw__item { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border: 2px solid var(--line); border-radius: 12px; transition: .15s; }
.wtw__item:hover { border-color: var(--brand); background: #fff; transform: translateY(-1px); }
.wtw__platform { font-weight: 700; font-size: 16px; }
.wtw__type { color: var(--brand); font-weight: 700; font-size: 14px; }
.wtw__empty { color: var(--ink-2); font-size: 15px; line-height: 1.6; margin: 0; }

.movie__details { width: 100%; border-collapse: collapse; font-size: 15px; }
.movie__details th, .movie__details td { border: 1px solid var(--line); padding: 11px 14px; text-align: left; vertical-align: top; }
.movie__details th { width: 40%; background: var(--surface); font-weight: 700; color: var(--ink); }

/* Movie card grid on archive */
.movies-filter { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }
.movies-filter a { font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 20px; background: var(--surface); }
.movies-filter a:hover, .movies-filter a.is-active { background: var(--brand); color: #fff; }

@media (min-width: 768px) {
  .movie__title { font-size: 34px; }
  .movie__backdrop { aspect-ratio: 21/9; max-height: 460px; }
  .wtw__list { grid-template-columns: 1fr 1fr; }
}

/* ── Bottom tab bar (mobile app nav) ──────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  /* height = bar + iOS home-indicator inset, so the inset padding doesn't squish icons */
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.98);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line); display: flex;
}
.tabbar__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.tabbar__item svg { opacity: .8; }
.tabbar__item.is-active { color: var(--brand); }
.tabbar__item.is-active svg { opacity: 1; }

/* ── Release calendar ─────────────────────────────────────────────────── */
.cal__list { display: grid; gap: 10px; padding: 0 16px; max-width: 760px; margin: 0 auto; }
.cal__item { display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: 12px; padding: 8px; transition: .15s; }
.cal__item:hover { background: #fff; box-shadow: var(--shadow); }
.cal__thumb { flex: 0 0 92px; width: 92px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: #e6e7ea; }
.cal__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cal__body { min-width: 0; }
.cal__title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; font-size: 15px; }
.cal__date { display: block; margin-top: 3px; font-size: 12.5px; color: var(--brand); font-weight: 700; }
.cal__empty { color: var(--muted); padding: 8px 16px; max-width: 760px; margin: 0 auto; }

/* ── PWA install banner ───────────────────────────────────────────────── */
.pwa-install {
  position: fixed; left: 12px; right: 12px; z-index: 130;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px);
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 14px 44px rgba(0,0,0,.24); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  transform: translateY(160%); opacity: 0; transition: transform .35s ease, opacity .35s ease;
}
.pwa-install.show { transform: translateY(0); opacity: 1; }
.pwa-install__icon { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #2b2a29; padding: 5px; flex: 0 0 auto; }
.pwa-install__text { flex: 1; min-width: 0; line-height: 1.3; }
.pwa-install__text strong { display: block; font-size: 15px; color: var(--ink); }
.pwa-install__text span { font-size: 12.5px; color: var(--muted); }
.pwa-install__btn { background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 11px 18px; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; flex: 0 0 auto; }
.pwa-install__close { border: 0; background: transparent; font-size: 26px; color: var(--muted); cursor: pointer; line-height: 1; padding: 0 2px; flex: 0 0 auto; }
@media (min-width: 768px) {
  .pwa-install { left: auto; right: 20px; bottom: 20px; max-width: 400px; }
}

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer { background: #15161a; color: #c7cbd4; margin-top: 30px; }
.site-footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 26px 16px 20px; }
.site-footer__keywords { display: flex; flex-wrap: wrap; gap: 8px 10px; justify-content: center; }
.site-footer__keywords a { font-size: 13px; font-weight: 600; color: #c7cbd4; background: #23252b; padding: 7px 15px; border-radius: 20px; }
.site-footer__keywords a:hover { background: var(--brand); color: #fff; }
.site-footer__copy { border-top: 1px solid #23252b; padding: 16px; text-align: center; }
.site-footer__tag { font-size: 13px; color: #9aa0ad; line-height: 1.65; margin: 0 auto 8px; max-width: 720px; }
.site-footer__tag strong { color: #c7cbd4; }
.site-footer__legal { font-size: 12.5px; color: #7c8291; margin: 0; }
.site-footer__legal a { font-weight: 600; }
.site-footer__legal a:hover { color: #fff; }

/* ── Archive/search header ────────────────────────────────────────────── */
.page-head { padding: 22px 16px 4px; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head p { color: var(--muted); margin: 6px 0 0; }
.pagination { display: flex; gap: 8px; justify-content: center; padding: 26px 16px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 9px 14px; border-radius: 10px; background: var(--surface); font-weight: 600; font-size: 14px; }
.pagination .current { background: var(--brand); color: #fff; }

/* ============================================================================
   DESKTOP (>= 768px): top nav shows, bottom tab bar hides, multi-column
   ========================================================================== */
@media (min-width: 768px) {
  :root { --appbar-h: 64px; }
  body { padding-bottom: 0; }
  .appbar__menu { display: none; }
  .appbar__nav { display: block; }
  .appbar__brand img { height: 40px; }
  .tabbar { display: none; }

  .rail > .card { flex-basis: 300px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 22px 18px; }

  /* Homepage: hero + trending sidebar */
  .home-top { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; padding: 22px 16px 0; max-width: var(--maxw); margin: 0 auto; }
  .home-top .hero__title { font-size: 30px; }
  .hero__media { border-radius: 16px; }

  .trending { background: var(--surface); border-radius: 16px; padding: 16px; }
  .trending h2 { font-size: 18px; margin-bottom: 12px; }
  .trending__item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .trending__item:last-child { border-bottom: 0; }
  .trending__num { font-size: 20px; font-weight: 800; color: var(--brand); min-width: 24px; }
  .trending__title { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

  .article { max-width: 820px; }
  .article__title { font-size: 36px; }
  .section { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
}

@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

/* Home-top is single column on mobile — keep a consistent side gutter and round
   the hero so nothing runs flush into the screen corners. */
@media (max-width: 767px) {
  .home-top { display: block; padding: 12px 16px 0; }
  .trending { display: none; }
  .hero__media { border-radius: 14px; }
  .hero__body { border-radius: 14px; }
  /* let the last rail card breathe on the right when scrolled to the end */
  .rail { scroll-padding-left: 16px; }
  .rail::after { content: ""; flex: 0 0 4px; }
}
