/*
Theme Name: new_v3
Description: Night-stage redesign of Mitsukemashita Music. Fixed side rail on the left (logo, nav, latest, socials), cover mosaic on the right with one big tile. Same data model as new_v2.
Version: 3.0.0
Text Domain: new_v3
*/

:root {
    --night: #140d26; --panel: #1f1538; --panel-2: #2b1d4d; --ink: #fff3fa; --soft: #b9a9d6; --line: #3a2a63;
    --pink: #ff4f9a; --cyan: #31d3e0; --gold: #f4a93c; --lav: #c9b6f2;
    --rail: 360px; --cover-w: 16; --cover-h: 9;
    --rail-bg: linear-gradient(180deg, #34175e 0%, #2a1a63 45%, #0f3a55 100%);
    --font-display: 'Dela Gothic One', sans-serif;
    /* System fonts: no extra font download for the body text, Japanese glyphs come from the device */
    --font-body: 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'Yu Gothic', Meiryo, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color-scheme: dark;
}
body.cover-1-1 { --cover-w: 1; --cover-h: 1; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--night); color: var(--ink); font: 400 16px/1.7 var(--font-body); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
.screen-reader-text { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--ink); color: var(--night); padding: 8px 14px; border-radius: 8px; z-index: 99999; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 22px; }
.nw { white-space: nowrap; }

/* Shell: fixed rail on the left, scrolling stage on the right */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 28px; padding: 30px 28px 26px; background: var(--rail-bg); border-right: 4px solid; border-image: linear-gradient(180deg, var(--pink), var(--gold), var(--cyan)) 1; }
.rail::-webkit-scrollbar { display: none; }
.stage { min-width: 0; padding: 0 6px; }

/* Logo + nav */
.logo-area img { display: block; width: 100%; max-width: 280px; height: auto; filter: drop-shadow(0 4px 16px rgba(255,79,154,.4)); }
.main-nav { margin-top: 18px; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.main-nav a { display: inline-block; padding: 2px 0; font: 400 28px/1.3 var(--font-display); transition: transform .2s, color .2s; }
.main-nav a:hover, .main-nav a:focus-visible, .main-nav .current-menu-item > a { color: var(--pink); transform: translateX(6px); outline: none; }

/* Rail intro + buttons */
.hero-sub { margin: 0 0 14px; font: 700 21px/1.4 var(--font-body); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 22px; border-radius: 99px; font: 700 16px/1.3 var(--font-body); border: 2px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; transition: transform .2s; }
.btn:hover { transform: translateY(-2px); }
.btn.main { background: var(--pink); border-color: var(--pink); color: var(--night); }
.btn:focus-visible, .chip:focus-visible, .pl:focus-visible, .cap a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* Latest slider (3 newest posts stacked in one grid cell) */
.latest-slider { display: grid; }
.latest-slide { grid-area: 1 / 1; background: rgba(255,255,255,.08); border-radius: 18px; padding: 12px; display: grid; gap: 8px; justify-items: start; opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility .8s; }
.latest-slide.active { opacity: 1; visibility: visible; }
.latest-slide .cover { width: 100%; }
.latest-slide h2 { margin: 0; font-size: 16px; line-height: 1.4; }
.rail-foot { margin-top: auto; }
.connect .widget, .social-grid { display: flex; gap: 8px; flex-wrap: wrap; }

/* Covers (image or gradient placeholder) */
.cover { display: grid; place-items: center; position: relative; width: 100%; aspect-ratio: var(--cover-w) / var(--cover-h); border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, var(--a, #ff8fbd), var(--b, #8fe3ea)); color: #fff; font: 400 40px/1 var(--font-display); text-shadow: 0 2px 12px rgba(0,0,0,.3); }
.cover .ph { position: relative; z-index: 0; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.tag { position: absolute; left: 10px; top: 10px; z-index: 2; background: rgba(255,255,255,.9); color: var(--night); font: 700 13px/1 var(--font-body); padding: 6px 10px; border-radius: 99px; text-shadow: none; }
.play-dot { position: absolute; right: 10px; top: 10px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; background: var(--pink); color: var(--night); display: grid; place-items: center; font-size: 13px; text-shadow: none; }
.meta { margin: 0; color: var(--soft); font-size: 14px; }

/* Sections */
.section { padding: 44px 0 0; }
.stage .section:first-child, main > .section:first-child { padding-top: 24px; }
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 24px; padding: 0 16px 18px; text-align: left; }
.section h2 { font: 400 clamp(30px, 4vw, 52px)/1.1 var(--font-display); margin: 0; }
.lead { color: var(--soft); margin: 6px 0 0; max-width: 46ch; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 2px solid var(--line); background: var(--panel); color: var(--ink); padding: 6px 16px; border-radius: 99px; font: 700 14px/1.4 var(--font-body); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); color: var(--night); }

/* Cover mosaic: tight gaps, the first tile is the big one */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; transition: opacity .4s ease; }
@media (min-width: 900px)  { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.song { position: relative; aspect-ratio: var(--cover-w) / var(--cover-h); border-radius: 14px; overflow: hidden; background: var(--panel); }
.grid .cover { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.song:hover .cover img { transform: scale(1.05); }
#ajax-songs-container > .song:first-child { grid-column: span 2; aspect-ratio: calc(var(--cover-w) * 2) / var(--cover-h); }
@media (min-width: 900px) { #ajax-songs-container > .song:first-child { grid-row: span 2; aspect-ratio: auto; align-self: stretch; min-height: 220px; } }

/* Caption on top of the tile: title always visible, details on hover or keyboard focus */
.cap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; gap: 2px; padding: 46px 14px 12px; text-align: left; background: linear-gradient(0deg, rgba(20,13,38,.95) 0%, rgba(20,13,38,.7) 55%, rgba(20,13,38,0) 100%); pointer-events: none; }
.cap a { pointer-events: auto; }
.cap h3 { margin: 0; font-size: 14px; line-height: 1.35; color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#ajax-songs-container > .song:first-child .cap h3 { font-size: clamp(17px, 2vw, 24px); }
.cap .meta, .cap .links { max-height: 0; opacity: 0; overflow: hidden; transition: max-height .25s ease, opacity .25s ease; }
.cap .meta { display: flex; gap: 10px; font-size: 13px; }
.cap .links { display: flex; gap: 14px; font-size: 13px; font-weight: 700; }
.cap .links a { border-bottom: 2px solid var(--cyan); }
.cap .links a:hover { border-color: var(--pink); }
.song:hover .meta, .song:hover .links, .song:focus-within .meta, .song:focus-within .links { max-height: 40px; opacity: 1; }

/* Downloads: same tiles as the songs, gold button instead of a link row */
.grid.dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1100px) { .grid.dl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.dl-song .cover { font-size: clamp(30px, 4vw, 52px); }
.dl-song .cap { padding-top: 56px; }
.dl-song .cap .btn { pointer-events: auto; justify-self: start; margin-top: 6px; padding: 4px 16px; font-size: 13px; background: var(--gold); border-color: var(--gold); color: var(--night); }
.progress { width: calc(100% - 32px); height: 3px; border-radius: 3px; background: var(--cyan); margin: 14px 16px 0; transform: scaleX(0); transform-origin: left; }
.progress.dl { background: var(--gold); }
.empty { color: var(--soft); grid-column: 1 / -1; padding: 0 16px; }

/* Social buttons (old .social-btn classes keep working) */
.social-btn { display: inline-flex; justify-content: center; padding: 9px 18px; border-radius: 99px; font-weight: 700; font-size: 14px; color: #fff !important; }
.social-yt { background: #ff0000; } .social-x { background: #000; } .social-spotify { background: #1db954; } .social-insta { background: #e1306c; }

.about-box { background: var(--panel); border: 2px solid var(--line); border-radius: 22px; padding: 28px 24px; margin: 0 10px; text-align: left; }
.about-box p { max-width: 60ch; margin: 0 0 10px; }

/* Single + archive */
.entry { padding: 28px 16px 0; max-width: 780px; text-align: left; }
.entry h1 { font: 400 clamp(28px, 5vw, 42px)/1.25 var(--font-display); margin: 0 0 22px; }
.entry .cover { max-width: 560px; margin: 0 0 22px; }
body.cover-1-1 .entry .cover { max-width: 360px; }
.entry-content { background: var(--panel); border: 2px solid var(--line); border-radius: 22px; padding: 28px 24px; margin-top: 26px; line-height: 1.8; }
.pagination { margin-top: 36px; display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px; }
.pagination .page-numbers { padding: 8px 16px; border-radius: 99px; background: var(--panel); border: 2px solid var(--line); font-weight: 700; }
.pagination .current { background: var(--pink); border-color: var(--pink); color: var(--night); }

footer.site-footer { margin: 64px 10px 0; padding: 22px 6px 34px; border-top: 2px solid var(--line); color: var(--soft); font-size: 14px; text-align: left; }
footer.site-footer .wrap { max-width: none; padding: 0; }
footer.site-footer p { margin: 0; }
body.has-player footer.site-footer { padding-bottom: 130px; }

/* Sticky shuffle player: centered in the stage, light pill on the dark page */
.sticky-player { position: fixed; left: calc(var(--rail) + (100% - var(--rail)) / 2); transform: translateX(-50%); bottom: 14px; width: min(520px, calc(100% - var(--rail) - 28px)); background: var(--ink); color: var(--night); border-radius: 99px; padding: 8px 10px 8px 22px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 34px rgba(0,0,0,.5); z-index: 9999; text-align: left; }
.sticky-player.playing { box-shadow: 0 0 0 3px var(--cyan), 0 12px 34px rgba(0,0,0,.5); }
.player-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
#player-artist { font-size: 11px; color: #c2246b; font-weight: 700; }
#player-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--pink); color: var(--night); font-size: 16px; cursor: pointer; }
.pl.alt { background: rgba(20,13,38,.12); color: var(--night); width: 38px; height: 38px; }

/* Small screens: the rail turns into a normal header on top */
@media (max-width: 899px) {
    .shell { display: block; }
    .rail { position: static; height: auto; overflow: visible; gap: 20px; padding: 22px 18px; border-right: 0; border-bottom: 4px solid; border-image: linear-gradient(90deg, var(--pink), var(--gold), var(--cyan)) 1; }
    .logo-area img { max-width: 220px; }
    .main-nav { margin-top: 12px; }
    .main-nav ul { display: flex; gap: 18px; }
    .main-nav a { font-size: 20px; }
    .latest-slider { max-width: 420px; }
    .sticky-player { left: 50%; width: min(520px, calc(100% - 28px)); }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .latest-slide, .grid, .cover img, .cap .meta, .cap .links, .main-nav a { transition: none; } }

/* Texts that were removed in the options leave no gap */
.player-text span:empty, .cap .links:empty { display: none; }

/* Side rail link widgets (Navigation Menu, Links, Custom HTML) */
.rail-links { display: grid; gap: 18px; text-align: left; }
.rail-title { margin: 0 0 6px; font: 700 15px/1.3 var(--font-body); color: var(--lav); }
.rail-links ul, .rail-links .wp-block-navigation__container { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail-links .wp-block-navigation { display: block; }
.rail-links a { display: inline-block; padding: 3px 0; font-size: 16px; line-height: 1.4; color: var(--ink); border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.rail-links a:hover, .rail-links a:focus-visible, .rail-links .current-menu-item > a { color: var(--pink); border-bottom-color: var(--pink); outline: none; }
.rail-links p { margin: 0 0 6px; color: var(--soft); font-size: 15px; }
.rail-links .sub-menu { padding-left: 14px; }
@media (max-width: 899px) { .rail-links ul, .rail-links .wp-block-navigation__container { display: flex; flex-wrap: wrap; gap: 4px 16px; } }
