/* KRMovies — Layout & Page Structure
   Hero, Search, Detail Modal, Page Headers, Footer */

/* ========================================
   APP SHELL
   ======================================== */

.app {
  min-height: 100vh;
  padding-bottom: 100px;
  position: relative;
  z-index: 1;
}

@media (min-width: 900px) {
  .app {
    padding-bottom: 60px;
  }
}

/* ========================================
   HERO BANNER
   ======================================== */

.hero {
  position: relative;
  height: clamp(420px, 70vh, 720px);
  overflow: hidden;
  margin-left: calc(var(--pad-x) * -1);
  margin-right: calc(var(--pad-x) * -1);
}

.hero__art {
  position: absolute;
  inset: 0;
  transition: opacity 600ms ease;
}

.hero__art-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  filter: saturate(0.7);
}

.hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 40%, rgba(11,10,8,0.6) 75%, var(--ink) 95%);
}

@media (max-width: 899px) {
  .hero__scrim {
    background: linear-gradient(180deg, transparent 0%, transparent 35%, rgba(11,10,8,0.65) 65%, var(--ink) 95%);
  }
}

.hero__content {
  position: absolute;
  left: calc(var(--pad-x) - 6vw);
  right: var(--pad-x);
  bottom: 64px;
  max-width: 620px;
  z-index: 2;
}

@media (max-width: 899px) {
  .hero__content {
    left: var(--pad-x);
    bottom: 36px;
  }
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--ember);
  font-weight: 700;
  margin-bottom: var(--s-3);
  text-transform: uppercase;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--t-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  color: var(--bone);
  margin: 0 0 var(--s-4);
  animation: krmovies-set var(--dur-set) var(--ease-set);
  
  /* Grid-break #1: Title bleeds left into margin */
  margin-left: -6vw;
  padding-left: 6vw;
}

@media (max-width: 768px) {
  .hero__title {
    margin-left: -3vw;  /* Less bleed on mobile */
    padding-left: 3vw;
  }
}

.hero__meta {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--t-meta);
  line-height: var(--lh-meta);
  color: var(--bone-muted);
  margin-bottom: var(--s-4);
}

.hero__meta > * {
  white-space: nowrap;
  flex-shrink: 0;
}

.hero__meta-star {
  color: var(--ember);
}

.hero__desc {
  font-size: var(--t-body);
  line-height: var(--lh-body);
  color: var(--bone-muted);
  max-width: 480px;
  margin-bottom: var(--s-4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 900px) {
  .hero__desc {
    font-size: 15px;
  }
}

.hero__cta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Hero index (replaces auto-rotate dots) */
.hero__index {
  position: absolute;
  bottom: 28px;
  right: var(--pad-x);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 899px) {
  .hero__index {
    flex-direction: row;
    bottom: 20px;
    right: 20px;
  }
}

.hero__index-num {
  color: var(--bone-faint);
  cursor: pointer;
  position: relative;
  padding-bottom: 2px;
}

.hero__index-num--active {
  color: var(--ember);
}

.hero__index-num--active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--ember);
  animation: krmovies-draw var(--dur-draw) var(--ease-set);
}

.hero__index-num:hover {
  color: var(--bone);
}

/* Hero trailer */
.hero__trailer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw;
  min-height: 100%;
  min-width: 177.78vh;
  transform: translate(-50%, -50%);
  border: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms ease;
}

.hero__trailer-mute {
  position: absolute;
  bottom: 18px;
  right: 18px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.55);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 200ms;
  backdrop-filter: blur(4px);
}

.hero__trailer-mute:hover {
  background: rgba(255,255,255,0.2);
}

/* ========================================
   PAGE HEADER
   ======================================== */

.pagehead {
  padding: var(--s-5) var(--pad-x) var(--s-2);
}

.pagehead__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--ember);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.pagehead__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--t-h1);
  line-height: var(--lh-h1);
  letter-spacing: var(--ls-h1);
  color: var(--bone);
  margin: 0;
  animation: krmovies-set var(--dur-set) var(--ease-set);
}

.pagehead__sub {
  font-size: var(--t-body);
  color: var(--bone-muted);
  margin-top: 10px;
  max-width: 600px;
}

/* ========================================
   SEARCH BAR
   ======================================== */

.search-bar {
  position: relative;
  padding: var(--s-4) 0;
  margin: 0 var(--pad-x);
  border-bottom: 1px solid var(--hairline);
}

.search-bar-wrapper {
  position: relative;
  width: 100%;
}

.search-bar__hairline {
  position: absolute;
  bottom: -21px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--hairline);
  pointer-events: none;
}

.search-bar__progress {
  height: 100%;
  background: var(--ember);
  width: 0%;
  transition: width 200ms ease;
}

.search-bar::before {
  content: "FIND ▸";
  position: absolute;
  left: 0;
  top: var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--bone-faint);
  letter-spacing: var(--ls-caption);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: var(--s-2) 0 var(--s-2) 80px;
  background: transparent;
  color: var(--bone);
  border: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--t-h2);
  line-height: var(--lh-h2);
  letter-spacing: var(--ls-h2);
  outline: none;
}

.search-input::placeholder {
  color: var(--bone-faint);
}

/* Search progress underline (ember segment that grows) */
.search-bar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: var(--ember);
  transition: width 200ms var(--ease-set);
}

.search-bar--active::after {
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bone-faint);
  font-size: 20px;
  pointer-events: none;
  display: none;
}

.search-clear {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--bone-muted);
  font-size: 18px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-clear.visible {
  display: flex;
}

.search-clear:hover {
  background: var(--paper-hi);
  color: var(--bone);
}

/* Search typeahead */
.search-typeahead {
  display: none;
  position: absolute;
  left: var(--pad-x);
  right: var(--pad-x);
  top: calc(100% + var(--s-2));
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  z-index: 300;
  overflow: hidden;
  box-shadow: var(--lift-2);
  max-height: 60vh;
  overflow-y: auto;
}

.search-typeahead.open {
  display: block;
}

.search-typeahead__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  cursor: pointer;
  border-bottom: 1px solid var(--hairline);
  counter-increment: result;
}

.search-typeahead__item:last-child {
  border-bottom: 0;
}

.search-typeahead__item::before {
  content: counter(result, decimal-leading-zero) " ·";
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bone-faint);
  font-weight: 700;
  flex-shrink: 0;
}

.search-typeahead__item:hover,
.search-typeahead__item--active {
  background: var(--paper-hi);
}

.search-typeahead__thumb {
  width: 34px;
  height: 50px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--paper-hi);
  flex-shrink: 0;
  filter: saturate(0.6);
}

.search-typeahead__thumb--person {
  height: 34px;
  border-radius: 50%;
}

.search-typeahead__info {
  flex: 1;
  min-width: 0;
}

.search-typeahead__title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-typeahead__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bone-muted);
  margin-top: 2px;
}

.search-count {
  padding: var(--s-3) var(--pad-x);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--bone-faint);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
}

/* ========================================
   DETAIL MODAL
   ======================================== */

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--scrim);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  animation: krmovies-fade-in 200ms ease;
}

.detail {
  width: 100%;
  max-width: 920px;
  max-height: 92vh;
  background: var(--ink);
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hairline);
  box-shadow: var(--lift-2);
  animation: krmovies-rise 280ms var(--ease-set);
}

@media (max-width: 899px) {
  .detail {
    border-radius: 0;
    max-height: 100vh;
    height: 100vh;
  }
}

.detail__art {
  height: 320px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

@media (min-width: 900px) {
  .detail__art {
    height: 420px;
  }
}

.detail__close {
  position: absolute;
  top: var(--s-4);
  right: var(--s-4);
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.detail__close:hover {
  background: rgba(0,0,0,0.8);
}

.detail__body {
  padding: var(--s-5) var(--s-5) var(--s-5);
  overflow-y: auto;
  flex: 1;
}

@media (min-width: 900px) {
  .detail__body {
    padding: var(--s-5) var(--pad-x) var(--s-5);
    display: grid;
    grid-template-columns: 60% 40%;
    gap: var(--s-6);
  }
}

.detail__main {
  /* Left column on desktop */
}

.detail__sidebar {
  /* Right column on desktop */
}

.detail__kind-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--ember);
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.detail__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0 0 var(--s-3);
  color: var(--bone);
}

.detail__meta {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--t-meta);
  color: var(--bone-muted);
  margin-bottom: var(--s-4);
}

.detail__meta-star {
  color: var(--ember);
}

.detail__hd {
  padding: 2px 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.detail__coming-badge {
  background: rgba(79, 70, 229, 0.25);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail__desc {
  font-size: 15px;
  line-height: 1.65;
  color: var(--bone);
  opacity: 0.85;
  margin-bottom: var(--s-4);
}

.detail__cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: var(--s-5);
}

.detail__watch-coming {
  opacity: 0.65;
  cursor: default !important;
  pointer-events: none;
}

.detail__sect {
  margin-top: var(--s-4);
}

.detail__sect h3 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--t-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  margin: 0 0 var(--s-3);
  color: var(--bone-muted);
}

/* Spec sheet (right column) */
.detail__factgrid {
  display: grid;
  gap: var(--s-4);
}

.detail__fact-k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-faint);
  margin-bottom: 4px;
}

.detail__fact-v {
  font-size: 14px;
  color: var(--bone);
}

/* Episode list */
.detail__episodes {
  display: grid;
  gap: var(--s-2);
}

.detail__ep {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: 10px var(--s-3);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 150ms;
}

.detail__ep:hover {
  border-color: var(--ember);
}

.detail__ep-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--bone-faint);
  flex-shrink: 0;
}

.detail__ep-thumb {
  width: 80px;
  aspect-ratio: 16/9;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  display: none;
  background: var(--paper-hi);
  overflow: hidden;
}

.detail__ep:hover .detail__ep-thumb {
  display: block;
}

.detail__ep-info {
  flex: 1;
  min-width: 0;
}

.detail__ep-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.detail__ep-sub {
  font-size: 12px;
  color: var(--bone-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail__ep-dur {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bone-faint);
  flex-shrink: 0;
}

.detail__more-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
  padding: var(--s-6) var(--pad-x) var(--s-5);
  background: var(--ink-2);
  border-top: 1px solid var(--hairline);
  margin-top: var(--s-7);
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-5);
  margin-bottom: var(--s-5);
}

.footer__col h4 {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--ember);
  font-weight: 700;
  margin-bottom: var(--s-3);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.footer__link {
  color: var(--bone-muted);
  font-size: var(--t-body-sm);
  cursor: pointer;
}

.footer__link:hover {
  color: var(--bone);
}

.footer__colophon {
  padding-top: var(--s-4);
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bone-faint);
  text-align: center;
}
