/* ── Player section (top 50%) ─────────────────────────────── */
.player-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: calc(3vh + 0.3rem) 0 0.3rem;
}

.player-inner {
    width: 100%;
    max-width: calc(7 * (50vh - 102px - 1.25rem) / 6 + 1.5rem);
    padding: 0 1.2rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.month-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    flex-shrink: 0;
    padding-bottom: 0.3rem;
}

.month-nav-btn {
    background: none;
    border: none;
    color: white;
    font-family: 'Old Standard TT', serif;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 0.2s;
    padding: 0.2rem 0.6rem;
    line-height: 1;
}
.month-nav-btn:hover { opacity: 1; }

.month-nav-bar {
    position: fixed;
    top: 44px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1rem;
    white-space: nowrap;
}

.month-nav-bar h1 {
    font-family: 'Old Standard TT', serif;
    font-size: 16px;
    font-weight: normal;
    letter-spacing: 1px;
    margin: 0;
}

.month-nav-bar .month-nav-btn {
    font-size: 16px;
    padding: 0 0.3rem;
}

.player-row {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    position: relative;
    container-type: size;
}

.day-nav-btn {
    background: none;
    border: none;
    color: white;
    font-family: 'Old Standard TT', serif;
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 0.5rem 0.4rem;
    line-height: 1;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}
.day-nav-btn:hover { opacity: 1; }

#previous-button { right: calc(100% + 0.3rem); }
#next-button    { left:  calc(100% + 0.3rem); }

.image-container {
    aspect-ratio: 1;
    width: min(100cqw, 100cqh);
    height: auto;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background-color: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.image-container img,
.image-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.no-image-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.18);
    font-style: italic;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    pointer-events: none;
}

.play-pause-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    padding: 0;
    width: 38px;
    height: 38px;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s;
    z-index: 2;
}
.image-container:hover .play-pause-btn { opacity: 1; }
.play-icon { width: 38px; height: 38px; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.6)); }

.file-info {
    flex-shrink: 0;
    padding-top: 0.3rem;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.6rem;
    min-height: 1.6rem;
}

.file-date {
    opacity: 0.4;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.file-name {
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60vw;
}
.file-name a {
    color: white;
    text-decoration: none;
    opacity: 1;
    vertical-align: baseline;
}
.file-name a:hover { text-decoration: underline; }
.file-blog-wrap {
    white-space: nowrap;
    vertical-align: baseline;
    line-height: inherit;
}
.file-blog-wrap a {
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 0.2px;
    color: white;
    text-decoration: none;
    opacity: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60vw;
    vertical-align: baseline;
}
.file-blog-wrap a:hover { text-decoration: underline; }

.blog-entry {
    font-size: 0.57rem;
    font-style: italic;
    opacity: 0.55;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
    text-decoration: none;
    line-height: 1.3;
    display: block;
}
.blog-entry:hover { opacity: 1; text-decoration: underline; }
.cal-cell.selected .blog-entry { opacity: 0.6; color: #000; }
.cal-cell.selected .blog-entry:hover { opacity: 1; }

/* ── Calendar section (bottom 50%) ───────────────────────── */
.calendar-section {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0.4rem 1.2rem calc(0.3rem + 4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.calendar-grid-wrap {
    width: 100%;
    max-width: calc(7 * (50vh - 102px - 1.25rem) / 6 + 1.5rem);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.day-headers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    flex-shrink: 0;
}

.day-header {
    text-align: center;
    font-size: 0.6rem;
    opacity: 0.3;
    letter-spacing: 1px;
    padding: 0.1rem 0;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    align-content: start;
}

.cal-cell {
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.28rem 0.3rem;
    display: flex;
    flex-direction: column;
    background: transparent;
    cursor: default;
    position: relative;
    transition: border-color 0.15s, background-color 0.15s;
}

.cal-cell.has-files {
    cursor: pointer;
    border-color: rgba(255, 255, 255, 0.28);
}
.cal-cell.has-files:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.5);
}
.cal-cell.selected {
    background: white;
    color: #000;
    border-color: white;
}
.cal-cell.selected:hover { background: rgba(255, 255, 255, 0.92); }
.cal-cell.empty {
    opacity: 0.12;
    border-color: rgba(255, 255, 255, 0.08);
    cursor: default;
}

.day-num {
    font-weight: bold;
    font-size: 0.72rem;
    line-height: 1;
    margin-bottom: 0.05rem;
    flex-shrink: 0;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

.file-entry {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.57rem;
    opacity: 0.7;
    cursor: pointer;
    line-height: 1.15;
}
.file-entry:hover { opacity: 1; text-decoration: underline; }
.cal-cell.selected .file-entry { opacity: 0.65; color: #000; }
.cal-cell.selected .file-entry:hover { opacity: 1; }
.cal-cell.selected .file-entry.active { opacity: 1; font-weight: bold; }
.file-entry.active { opacity: 1; font-weight: bold; }

.file-more {
    font-size: 0.48rem;
    opacity: 0.5;
    cursor: pointer;
    font-style: italic;
    line-height: 1.15;
    white-space: nowrap;
}
.file-more:hover { opacity: 0.9; }
.cal-cell.selected .file-more { color: #000; opacity: 0.5; }
.cal-cell.selected .file-more:hover { opacity: 0.9; }

/* ── File Dropdown ──────────────────────────────────────────── */
#file-dropdown {
    position: fixed;
    display: none;
    z-index: 1000;
    background: rgba(12, 12, 12, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 3px;
    padding: 0.25rem 0;
    min-width: 180px;
    max-width: 300px;
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7);
}

.dd-item {
    padding: 0.32rem 0.7rem;
    font-size: 0.62rem;
    font-family: 'Old Standard TT', serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    transition: background 0.12s, color 0.12s;
}
.dd-item:hover { background: rgba(255,255,255,0.1); color: white; }
.dd-item.playing { color: white; font-weight: bold; }

/* ── Fullscreen Overlay ────────────────────────────────────── */
#fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#fullscreen-overlay.open {
    display: flex;
    opacity: 1;
}

#fullscreen-overlay.open .fullscreen-content {
    animation: fullscreen-enter 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fullscreen-enter {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.fullscreen-content {
    position: relative;
    max-width: 94vw;
    max-height: 94vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#fullscreen-overlay img,
#fullscreen-overlay video {
    max-width: 94vw;
    max-height: 94vh;
    object-fit: contain;
    border-radius: 2px;
}

#fullscreen-close {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    z-index: 100002;
    transition: color 0.2s;
}
#fullscreen-close:hover { color: white; }
#fullscreen-close svg { display: block; width: 20px; height: 20px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }

#fullscreen-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    padding: 0;
    width: 48px;
    height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    z-index: 100002;
    transition: color 0.2s, opacity 0.2s;
}
#fullscreen-play-btn.visible { display: flex; }
#fullscreen-play-btn:hover { color: white; }
#fullscreen-play-btn svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

/* mobile darkening vignette */
@media (max-width: 768px) {
    #fullscreen-overlay::before {
        content: '';
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 30vh;
        background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
        z-index: 100001;
        pointer-events: none;
    }
    #fullscreen-overlay::after {
        content: '';
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 30vh;
        background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
        z-index: 100001;
        pointer-events: none;
    }
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .player-section { padding: calc(2.5svh + 0.1rem) 0 0.2rem; flex: 1; min-height: 0; }
    /* Remove the vh-based max-width — it shrinks the player narrower than the
       calendar when viewport height is reduced (e.g. Instagram's in-app bar),
       making the player appear offset to the right relative to the calendar. */
    .player-inner { padding: 0; max-width: none; }
    .calendar-section {
        flex: none;
        height: calc(6 * (100vw - 1.02rem) / 7 + 1.29rem + 4px);
        max-height: calc((100svh - 46px - var(--footer-h)) * 2 / 3);
        padding: 0.3rem 0.6rem calc(0.2rem + 4px);
    }
    .calendar-grid-wrap  { max-width: calc(7 * ((100svh - 46px - var(--footer-h)) * 2 / 3 - 2.37rem - 4px) / 6 + 6 * 0.18rem); }

    .player-row { align-items: stretch; justify-content: center; gap: 0; container-type: normal; overflow: hidden; }
    .day-nav-btn { font-size: 16px; padding: 0.4rem 0.3rem; position: static; transform: none; top: auto; flex: 1; display: flex; align-items: center; justify-content: center; }
    #previous-button { right: auto; }
    #next-button { left: auto; }
    .image-container { width: auto; height: 100%; flex-shrink: 0; aspect-ratio: 1; }
    .file-name { font-size: 0.7rem; max-width: 55vw; }
    .day-headers         { gap: 0.18rem; }
    .day-header          { font-size: 0.52rem; }
    .calendar            { gap: 0.18rem; }
    .cal-cell            { padding: 0.18rem 0.2rem; }
    .day-num { font-size: 0.62rem; }
    .file-entry { font-size: 0.5rem; }
    .file-more { font-size: 0.48rem; }
}

/* ── Safe area insets ─────────────────────────────────────────── */
/* Push the fixed social footer above the iPhone home indicator /
   Instagram bottom bar. */
.social-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

.social-link {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
}
.social-link.soundcloud { left: 25%; }
.social-link.bandcamp { left: 50%; }
.social-link.bandcamp svg { width: 24px; height: 24px; }
.social-link.instagram { left: 75%; top: 50%; }
.social-link.instagram svg { width: 17px; height: 17px; }
