/* XFM mobile and portrait tablet; desktop layout remains unchanged. */
@media (max-width:760px), (min-width:761px) and (max-width:1024px) and (orientation:portrait) {
  .hero {
    --mobile-bg:url('../assets/xfm-bg-day-4k.webp'); --mobile-pad:clamp(16px,5vw,42px);
    position:relative;display:flex;flex-direction:column;isolation:isolate;width:100%;aspect-ratio:auto;
    min-height:100vh;min-height:100svh;padding:0 0 calc(clamp(28px,8vw,68px) + env(safe-area-inset-bottom,0px));background:#faf9fb;overflow:hidden;
  }
  .hero[data-xfm-period="night"] {--mobile-bg:url('../assets/xfm-bg-night-4k.webp');background:#faf9fb;}
  .hero .mobile-header {display:flex;flex-direction:column;align-items:center;position:relative;inset:auto;gap:5px;padding:calc(12px + env(safe-area-inset-top,0px)) 12px 10px;z-index:6;}
  .hero .mobile-header .brand {width:clamp(150px,40vw,230px);flex:none;}
  .hero .mobile-header .brand img {width:100%!important;height:auto;max-width:none;}
  .hero .mobile-header .station-heading {border:0;padding:0;margin:0;font:800 clamp(12px,3.45vw,22px)/1.25 'SF UI Display','Noto Sans Thai',Arial,sans-serif;letter-spacing:.025em;color:#e60012;white-space:normal;text-align:center;}
  .hero .mobile-header .station-heading::after,.hero .mobile-header .subtitle {display:none;}
  .hero .art {position:relative;flex:none;width:100%;height:auto;aspect-ratio:1.54;overflow:hidden;background:var(--mobile-bg) center/100% 100% no-repeat;z-index:1;mask-image:linear-gradient(to bottom,#000 0%,#000 90%,transparent 100%);-webkit-mask-image:linear-gradient(to bottom,#000 0%,#000 90%,transparent 100%);}
  .hero .art .left,.hero .art .portrait {display:none;}
  .hero .art .cover {display:block;position:absolute;opacity:1;left:6%;top:28%;width:38%;height:auto;aspect-ratio:1;object-fit:cover;border-radius:clamp(4px,1vw,9px);z-index:4;transform:none;box-shadow:0 8px 18px #65001238;}
  .hero .vinyl-wrap {display:block;position:absolute;left:26%;top:33%;width:31.52%;height:auto;aspect-ratio:1;z-index:3;transform:none;}
  .hero .vinyl-wrap img {display:block;width:100%;height:100%;object-fit:contain;border-radius:50%;filter:drop-shadow(2px 5px 5px #58000b35);animation:spin 7s linear infinite;animation-play-state:paused;}
  .hero.playing .vinyl-wrap img {animation-play-state:running;}
  .hero .art .portrait-motion {display:block;position:absolute;left:auto;right:1%!important;top:0;width:51%;height:100%;object-fit:contain;object-position:right top;z-index:1;pointer-events:none;transform:none;animation:xfm-mobile-float 7s ease-in-out infinite;mask-image:linear-gradient(to bottom,#000 0%,#000 70%,transparent 100%);-webkit-mask-image:linear-gradient(to bottom,#000 0%,#000 70%,transparent 100%);}
  .hero.playing .art .portrait-motion {animation-duration:5s;}
  .hero .art .front-ribbon,.hero .art .cover-side-label {display:none;}
  .hero .xfm-ribbon-shine {display:none!important;}
  .hero .xfm-particles {z-index:2;}
  .hero .xfm-particles span {font-size:clamp(11px,3vw,18px);}
  .hero .copy {display:block;position:relative;inset:auto;width:100%;padding:2px var(--mobile-pad) 0;text-align:center;font-style:normal;z-index:4;}
  .hero .copy .period-headline,.hero .copy .secondary {font-family:'Antonio','Arial Narrow',Arial,sans-serif;font-weight:700;font-size:clamp(20px,5.7vw,46px);line-height:1.16;letter-spacing:-.035em;margin:0;white-space:nowrap;font-style:normal;}
  .hero .copy .period-headline span,.hero .copy .period-headline strong {display:inline;}
  .hero .copy .period-headline strong {margin-left:.14em;}
  .hero .copy .secondary {margin-top:3px;}
  .hero .copy strong,.hero .copy b {color:#e60012;}
  .hero .copy .tag {font:600 clamp(14px,4.1vw,25px)/1.5 'SF UI Display','Noto Sans Thai',Arial,sans-serif;margin:7px 0 0;white-space:normal;}
  .hero .player {display:flex;position:relative;inset:auto;width:auto;height:auto;margin:clamp(14px,4vw,30px) var(--mobile-pad) 0;padding:0;flex:1;gap:clamp(6px,1.8vw,13px);z-index:5;font-size:clamp(15px,4vw,25px);text-align:left;}
  .hero .digital-line {font-size:clamp(9px,2.55vw,16px);letter-spacing:.09em;gap:.55em;}
  .hero .now-head {min-height:1.5em;font-size:.67em;}
  .hero .song-info #songTitle {font-size:1.65em;}
  .hero .song-info p {font-size:1.15em;}
  .hero .program-line {font-size:.69em;letter-spacing:.045em;}
  .hero .player .controls {margin-top:auto;padding-top:clamp(10px,3vw,25px);width:100%;height:auto;gap:4%;justify-content:flex-start;}
  .hero .player .controls button {width:12%;max-width:60px;font-size:clamp(17px,5vw,30px);}
  .hero .player .controls #play {width:19%;max-width:95px;font-size:clamp(22px,6vw,38px);}
  .hero .player .controls #play.is-loading {font-size:0;}
  .hero .player .controls input {flex:1;width:0;min-width:24px;max-width:145px;}
  .hero::after {content:'';display:block;position:absolute;bottom:0;right:0;width:64%;height:clamp(23px,8vw,68px);background:linear-gradient(135deg,#ff3548,#e60012 55%,#aa0010);clip-path:polygon(100% 0,100% 100%,0 100%);pointer-events:none;z-index:3;}
}
@media (max-height:700px) and (max-width:760px) {
    .hero .art {aspect-ratio:1.85;}
    .hero .art .cover {top:24%;width:35%;}
    .hero .vinyl-wrap {top:29%;left:24%;width:29%;}
    .hero .mobile-header {padding-top:8px;padding-bottom:5px;}
    .hero .mobile-header .brand {width:clamp(125px,34vw,180px);}
    .hero .player {margin-top:12px;gap:6px;}
}
@keyframes xfm-mobile-float {0%,100%{translate:0 0;}50%{translate:0 -3px;}}
@media(prefers-reduced-motion:reduce){.hero .art .portrait-motion{animation:none!important;}}
/* Keep portrait tablets app-like without an oversized illustration. */
@media (min-width:761px) and (max-width:1024px) and (orientation:portrait) {
  .hero .art {width:min(100%,620px);align-self:center;aspect-ratio:1.7;}
  .hero .art .cover {top:23%;}
  .hero .vinyl-wrap {top:28%;}
  .hero .mobile-header .brand {width:190px;}
  .hero .copy .period-headline,.hero .copy .secondary {font-size:clamp(28px,4.5vw,44px);}
  .hero .player {width:min(86%,650px);align-self:center;margin-left:0;margin-right:0;font-size:clamp(18px,2.65vw,25px);}
}

/* V2 — centered sleeve, portrait behind the artwork. Mobile only. */
@media (max-width:760px), (min-width:761px) and (max-width:1024px) and (orientation:portrait) {
  .hero .art {aspect-ratio:0.88; background-size:cover; background-position:70% center;}
  .hero .art .cover {left:20%;top:12%;width:60%;height:auto;z-index:4;}
  .hero .vinyl-wrap {left:48%;top:18.3%;width:49.758%;z-index:3;}
  .hero .art .portrait-motion {right:0!important;top:-3%;width:58%;height:100%;object-fit:contain;object-position:right top;z-index:1;opacity:.88;}
  .hero .art .cover-side-label {display:block;position:absolute;left:21.3%;top:53%;height:auto;writing-mode:vertical-rl;transform:rotate(180deg);font:400 clamp(8px,2.2vw,14px)/1 'Antonio',Arial,sans-serif;letter-spacing:.15em;color:#fffC;text-shadow:0 1px 3px #0008;z-index:5;pointer-events:none;white-space:nowrap;}
  .hero .player {text-align:center;}
  .hero .digital-line,.hero .program-line {justify-content:center;}
  .hero .song-info {text-align:center;}
  .hero .song-info #songTitle,.hero .song-info p {white-space:normal;overflow-wrap:anywhere;}
  .hero .now-head {justify-content:center;gap:1em;}
  .hero .player .controls {justify-content:center;}
}
@media (max-width:760px) and (max-height:700px) {
  .hero .art {aspect-ratio:1.43;}
  .hero .art .cover {width:52%;left:24%;top:10%;}
  .hero .vinyl-wrap {width:43.124%;left:50%;top:16.35%;}
}

/* V3 — expose portrait face above centered sleeve; mobile only. */
@media (max-width:760px), (min-width:761px) and (max-width:1024px) and (orientation:portrait) {
  .hero .art {aspect-ratio:1.02;}
  .hero .art .cover {left:20%;top:32%;width:60%;}
  .hero .vinyl-wrap {left:48%;top:37.22342%;width:49.758%;}
  .hero .art .portrait-motion {top:0;right:1%!important;width:58%;height:auto;opacity:1;object-position:right top;}
  .hero .art .cover-side-label {top:auto;bottom:10%;left:21.3%;transform:rotate(180deg);}
}
@media (max-width:760px) and (max-height:700px) {
  .hero .art {aspect-ratio:1.13;}
  .hero .art .cover {left:24%;top:30%;width:52%;}
  .hero .vinyl-wrap {left:50%;top:35.01494%;width:43.124%;}
  .hero .art .portrait-motion {width:54%;}
  .hero .art .cover-side-label {left:25.3%;top:auto;bottom:14%;}
}

/* XFM Mobile V4 — artwork only. Append after existing mobile.css.
   Keeps all current sleeve, vinyl, label and player settings. */
@media (max-width:760px), (min-width:761px) and (max-width:1024px) and (orientation:portrait) {
  .hero .art {
    background-size: 260% auto;
    background-position: right top;
  }
  .hero .art .portrait-motion {
    width: 43%;
    height: auto;
    left: auto;
    right: 17% !important;
    top: -2%;
    object-fit: contain;
    object-position: center top;
  }
}
@media (max-width:760px) and (max-height:700px) {
  .hero .art .portrait-motion {
    width: 43%;
    right: 18% !important;
  }
}

