/* ============================================================
   JADS Daily Song — Frontend
   3x2 grid desktop, 2-col mobile, square tiles, hover play, modal
   Inherits Astra global colors (--ast-global-color-*) when available.
   ============================================================ */

.jads-week-grid {
	--jads-radius: 14px;
	--jads-gap: 12px;

	/* Astra global color variables with sensible fallbacks.
	   Astra exposes: --ast-global-color-2 (body text), -3 (headings),
	   -4 (link), -5 (link-hover), -8 (border). */
	--jads-text:        var( --ast-global-color-3, var( --ast-global-color-2, #1a1a1a ) );
	--jads-text-muted:  var( --ast-global-color-2, #555 );
	--jads-border:      var( --ast-global-color-8, rgba( 0, 0, 0, 0.12 ) );
	--jads-accent:      var( --ast-global-color-0, #1a1a1a );
	--jads-link-hover:  var( --ast-global-color-5, #000 );

	--jads-text-on-art: #fff;
	--jads-overlay:     rgba( 0, 0, 0, 0.45 );

	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	grid-auto-rows: 1fr;
	gap: var( --jads-gap );
	position: relative;
	color: var( --jads-text );
	font-family: inherit; /* respect Astra typography */
}

/* Maintain square aspect ratio across the grid */
.jads-tile {
	position: relative;
	aspect-ratio: 1 / 1;
	border-radius: var(--jads-radius);
	overflow: hidden;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	color: var(--jads-text);
	transition: transform .25s ease, box-shadow .25s ease;
	cursor: default;
}

.jads-tile--filled {
	cursor: pointer;
}

.jads-tile--filled:hover,
.jads-tile--filled:focus-within {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Today gets a subtle ring */
.jads-tile--today {
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12) inset;
}

/* ------- Week tile (cell 1) ------- */
.jads-tile--week {
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.jads-week-tile-inner {
	padding: 16px;
}

.jads-week-tile-number {
	font-size: clamp(20px, 3vw, 32px);
	font-weight: 700;
	letter-spacing: -0.02em;
	margin-bottom: 4px;
}

.jads-week-tile-range {
	font-size: clamp(13px, 1.4vw, 16px);
	opacity: 0.75;
}

/* Season hooks — placeholder, fill with animations in v2 */
.jads-season-spring .jads-week-tile-inner::before,
.jads-season-summer .jads-week-tile-inner::before,
.jads-season-autumn .jads-week-tile-inner::before,
.jads-season-winter .jads-week-tile-inner::before { content: ""; display: block; }

/* ------- Empty day tile ------- */
.jads-tile--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.jads-day-label {
	font-size: clamp(15px, 1.8vw, 20px);
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var( --jads-text-muted );
	opacity: 0.85;
}

/* ------- Filled day tile hover overlay ------- */
.jads-tile-hover {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 12px;
	color: var(--jads-text-on-art);
	background: linear-gradient(180deg, rgba(0,0,0,0) 30%, var(--jads-overlay) 100%);
	opacity: 0;
	transition: opacity .25s ease;
	text-align: center;
}

.jads-tile--filled:hover .jads-tile-hover,
.jads-tile--filled:focus-within .jads-tile-hover {
	opacity: 1;
}

.jads-play-btn,
.jads-permalink-btn {
	background: rgba(255, 255, 255, 0.95);
	color: #111;
	border: none;
	border-radius: 999px;
	padding: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform .15s ease;
	text-decoration: none;
	font-weight: 600;
}

.jads-play-btn:hover,
.jads-permalink-btn:hover {
	transform: scale(1.08);
}

.jads-permalink-btn {
	padding: 8px 16px;
	font-size: 13px;
}

.jads-tile-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: 12px;
	line-height: 1.3;
	text-shadow: 0 1px 3px rgba(0,0,0,0.5);
	max-width: 100%;
}

.jads-tile-artist {
	font-weight: 700;
	opacity: 0.95;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.jads-tile-title {
	opacity: 0.85;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ------- Weekend mix tile (Friday) ------- */
.jads-tile--mix {
	background-image: linear-gradient(135deg, #2a1a3e 0%, #4a2c5f 50%, #1f1330 100%),
		radial-gradient(ellipse at top, rgba(255,255,255,0.15), transparent 50%);
	color: var(--jads-text-on-art);
}

.jads-tile--mix.jads-tile--filled[style*="background-image"] {
	/* When real artwork loaded, inline style overrides the gradient */
}

.jads-mix-art-fallback {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background-image:
		radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.15), transparent 60%),
		radial-gradient(ellipse at 70% 70%, rgba(255,255,255,0.08), transparent 60%);
}

.jads-mix-art-text {
	font-size: clamp(16px, 2vw, 22px);
	font-weight: 700;
	color: #fff;
	text-align: center;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

/* ------- Carousel navigation ------- */
.jads-week-nav {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding-top: 8px;
	font-size: 14px;
	color: var( --jads-text );
}

.jads-nav-prev,
.jads-nav-next {
	background: transparent;
	border: 1px solid var( --jads-border );
	border-radius: 999px;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: inherit;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.jads-nav-prev:hover,
.jads-nav-next:hover {
	background: rgba( 0, 0, 0, 0.05 );
	color: var( --jads-link-hover );
}

.jads-nav-prev[disabled],
.jads-nav-next[disabled] {
	opacity: 0.25;
	cursor: not-allowed;
}

.jads-nav-label {
	font-weight: 600;
	min-width: 180px;
	text-align: center;
}

/* ------- Modal player ------- */
.jads-modal[hidden] { display: none; }

.jads-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.jads-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.78);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

.jads-modal-content {
	position: relative;
	width: 100%;
	max-width: 820px;
	background: #000;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.jads-modal-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	background: rgba(0,0,0,0.6);
	color: #fff;
	border: none;
	border-radius: 999px;
	width: 36px;
	height: 36px;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.jads-modal-close:hover {
	background: rgba(0,0,0,0.85);
}

.jads-modal-player {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
}

.jads-modal-player iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

.jads-modal-meta {
	padding: 12px 16px;
	color: #fff;
	font-size: 14px;
	background: rgba(0,0,0,0.6);
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.jads-modal-meta-artist { font-weight: 700; }
.jads-modal-meta-title { opacity: 0.85; }
.jads-modal-meta a {
	display: inline-block;
	margin-top: 6px;
	color: #aad8ff; /* keep light blue on dark modal regardless of theme */
	text-decoration: underline;
	font-size: 13px;
}

/* ============================================================
   MOBILE — 2-column layout
   week tile spans full width on top, then Mon/Tue, Wed/Thu, Fri/—
   ============================================================ */

@media (max-width: 767px) {
	.jads-week-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}

	.jads-tile--week {
		grid-column: 1 / -1;
		aspect-ratio: 5 / 2; /* wide, not square, on mobile */
	}

	.jads-week-nav {
		font-size: 13px;
		gap: 10px;
	}

	.jads-nav-label {
		min-width: 140px;
	}

	/* When week-tile is HIDDEN via attribute, days revert to 2-col still */
	.jads-week-grid[data-show-week-tile="0"] .jads-tile {
		aspect-ratio: 1 / 1;
	}
}

/* Optional swipe affordance on mobile — touch users get hover-style overlay
   on tap; the modal opens on second tap (handled in JS). */
@media (hover: none) {
	.jads-tile--filled .jads-tile-hover {
		opacity: 0;
	}
	.jads-tile--filled.is-tapped .jads-tile-hover {
		opacity: 1;
	}
}
