/* PhimHDC V4.0 — detail-page alignment based on the paired laptop screenshots.
   Loaded AFTER detail-v1; scoped only to .phdc-detail-page.
   Reuses the original controllers, tabs, comments, favorites and player URLs. */

/* The reference title/card begin immediately to the right of the 215px rail.
   Remove the extra desktop gutter accumulated in earlier theme versions. */
@media (min-width: 801px) {
  body.phdc-detail-page .phdc-detail-main {
    margin-left: calc(var(--phdc-nav, 215px) + 0px);
    margin-right: 43px;
    margin-bottom: 46px;
  }
  body.phdc-detail-page .phdc-detail-heading {
    min-height: 45px;
    padding-left: 26px;
    margin-top: 3px;
    margin-bottom: 6px;
  }
  body.phdc-detail-page .phdc-detail-heading::before {
    top: 4px;
    bottom: 4px;
    width: 4px;
    border-radius: 4px;
  }
  body.phdc-detail-page .phdc-detail-card-body {
    grid-template-columns: minmax(0, 1fr) clamp(225px, 14.5vw, 272px);
    gap: 22px;
    min-height: clamp(345px, 22.3vw, 412px);
    padding: 8px 26px 36px 26px;
  }
  body.phdc-detail-page .phdc-detail-poster {
    width: clamp(219px, 14vw, 265px);
    aspect-ratio: 0.71;
    transform: translateY(-61px);
    margin-bottom: -61px;
    align-self: start;
    justify-self: end;
  }
}

body.phdc-detail-page .phdc-detail-heading h1 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(26px, 1.8vw, 32px);
  font-weight: 400;
  letter-spacing: -.35px;
  line-height: 1.25;
}
body.phdc-detail-page .phdc-detail-card {
  background: #151519;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .13);
}
body.phdc-detail-page .phdc-detail-chips {
  margin-top: 0;
  margin-bottom: 39px;
  gap: 7px;
  font-size: 13px;
}
body.phdc-detail-page .phdc-detail-chips span {
  padding: 5px 13px;
  min-height: 30px;
  background: #303139;
  border-radius: 6px;
  line-height: 1.4;
}
body.phdc-detail-page .phdc-detail-synopsis {
  margin-bottom: 20px;
  padding-bottom: 22px;
  border-color: #2b2b30;
}
body.phdc-detail-page .phdc-detail-synopsis h2 {
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
  margin-bottom: 3px;
}
body.phdc-detail-page .phdc-detail-synopsis p {
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
  -webkit-line-clamp: 6;
  max-width: 1040px;
}
body.phdc-detail-page .phdc-detail-definitions {
  font-size: 14px;
  line-height: 1.65;
}
body.phdc-detail-page .phdc-detail-definitions > div { margin-bottom: 7px; }
body.phdc-detail-page .phdc-detail-definitions dt { font-weight: 700; }
body.phdc-detail-page .phdc-detail-actions {
  min-height: 74px;
  padding: 14px 16px;
  gap: 12px;
  background: #19191f;
  border-top: 1px solid #28282e;
  border-radius: 0 0 16px 16px;
}
body.phdc-detail-page .phdc-detail-btn {
  height: 41px;
  min-width: 150px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 24px;
  gap: 8px;
}
body.phdc-detail-page .phdc-detail-btn svg { width: 15px; height: 15px; }
body.phdc-detail-page .phdc-detail-share { min-width: 96px; }
body.phdc-detail-page .phdc-detail-section-title h2,
body.phdc-detail-page .phdc-detail-comments > h2,
body.phdc-detail-page .phdc-detail-related > h2 {
  font-size: 28px;
  font-weight: 750;
  line-height: 1.35;
}
body.phdc-detail-page .phdc-detail-episodes { margin-top: 33px; }
body.phdc-detail-page .phdc-detail-section-title { margin-bottom: 16px; }
body.phdc-detail-page .phdc-detail-server-picker { gap: 0; }
body.phdc-detail-page .phdc-detail-server {
  min-height: 44px;
  font-size: 13px;
  border-radius: 9px;
  padding: 8px 14px;
}
body.phdc-detail-page .phdc-detail-episode-panel { padding: 20px 25px 21px; }
body.phdc-detail-page .phdc-detail-episode-grid>a {
  font-size: 13px;
  min-height: 32px;
}
body.phdc-detail-page .phdc-detail-comments { margin-top: 17px; }
body.phdc-detail-page .phdc-detail-comment-shell { margin: 0; }

/* Mid-size laptop: retain readable information without squeezing poster. */
@media (min-width: 801px) and (max-width: 1260px) {
  body.phdc-detail-page .phdc-detail-card-body {
    grid-template-columns: minmax(0,1fr) 177px;
    gap: 14px;
    min-height: 355px;
    padding: 7px 17px 25px;
  }
  body.phdc-detail-page .phdc-detail-poster {
    width: 173px;
    transform: translateY(-45px);
    margin-bottom: -45px;
  }
  body.phdc-detail-page .phdc-detail-chips { margin-bottom: 15px; }
  body.phdc-detail-page .phdc-detail-synopsis p { font-size: 13px; }
  body.phdc-detail-page .phdc-detail-definitions { font-size: 13px; }
  body.phdc-detail-page .phdc-detail-btn { height: 37px; min-width: 123px; font-size: 12px; }
}

/* Mobile keeps the existing accessible two-column layout and touch targets.
   Never force a 440px information card on a small screen. */
@media (max-width: 800px) {
  body.phdc-detail-page .phdc-detail-main { margin: 0 12px 34px; }
  body.phdc-detail-page .phdc-detail-heading { padding-left: 18px; min-height: 40px; }
  body.phdc-detail-page .phdc-detail-card-body { min-height: 0; }
  body.phdc-detail-page .phdc-detail-poster { transform: none; margin-bottom: 0; }
  body.phdc-detail-page .phdc-detail-chips { margin-bottom: 12px; }
  body.phdc-detail-page .phdc-detail-synopsis p { font-size: 12.5px; -webkit-line-clamp: 5; }
  body.phdc-detail-page .phdc-detail-definitions { font-size: 12.5px; }
  body.phdc-detail-page .phdc-detail-btn { min-width: 0; height: 36px; padding: 0 13px; font-size: 12px; }
  body.phdc-detail-page .phdc-detail-actions { min-height: 61px; padding: 10px; gap: 7px; }
  body.phdc-detail-page .phdc-detail-episodes { margin-top: 22px; }
  body.phdc-detail-page .phdc-detail-section-title h2,
  body.phdc-detail-page .phdc-detail-comments>h2,
  body.phdc-detail-page .phdc-detail-related>h2 { font-size: 22px; }
}
@media (max-width: 390px) {
  body.phdc-detail-page .phdc-detail-main { margin: 0 9px 30px; }
  body.phdc-detail-page .phdc-detail-btn { padding: 0 10px; }
}
