/* Tea Album Library
 * Inherits your theme's fonts and text colour. Change the accent by adding to
 * Appearance → Customize → Additional CSS:   .tal-library, .tal-album-box { --tal-accent: #7a5230; }
 */
.tal-library,
.tal-album-box {
    --tal-accent: #6b4f35;
    --tal-line: rgba(127, 127, 127, 0.3);
    --tal-soft: rgba(127, 127, 127, 0.08);
}

.tal-library { margin: 1.5em 0; }

/* ---------- Controls ---------- */
.tal-library .tal-controls {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}
.tal-library .tal-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tal-library .tal-field label {
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.02em;
    opacity: 0.75;
    margin: 0;
}
.tal-library .tal-field input,
.tal-library .tal-field select {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--tal-line);
    border-radius: 8px;
    background-color: transparent;
    color: inherit;
    font: inherit;
    font-size: 16px; /* Prevents zoom on iOS. */
    box-shadow: none;
}
.tal-library .tal-field select option { color: #111; }
.tal-library .tal-field input:focus,
.tal-library .tal-field select:focus {
    outline: 2px solid var(--tal-accent);
    outline-offset: 1px;
    border-color: transparent;
}

/* ---------- Genre chips ---------- */
.tal-library .tal-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.tal-library .tal-chip {
    margin: 0;
    padding: 7px 14px;
    min-height: 0;
    border: 1px solid var(--tal-line);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.9em;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.tal-library .tal-chip:hover { border-color: var(--tal-accent); background: var(--tal-soft); color: inherit; }
.tal-library .tal-chip[aria-pressed="true"] { background: var(--tal-accent); border-color: var(--tal-accent); color: #fff; }
.tal-library .tal-chip:focus-visible { outline: 2px solid var(--tal-accent); outline-offset: 2px; }

.tal-library .tal-count { margin: 0 0 16px; font-size: 0.9em; opacity: 0.7; }

/* ---------- Grid ---------- */
.tal-library .tal-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 28px 20px;
}
.tal-library .tal-card { margin: 0; padding: 0; }
.tal-library .tal-card[hidden] { display: none; }
.tal-library .tal-card-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.tal-library .tal-cover {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1;
    margin-bottom: 10px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--tal-soft);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 18px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tal-library .tal-cover img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; max-width: none; }
.tal-library .tal-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 3em;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--tal-accent), #2f3b2f);
}
.tal-library .tal-card-link:hover .tal-cover,
.tal-library .tal-card-link:focus-visible .tal-cover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 12px 28px rgba(0, 0, 0, 0.16); }
.tal-library .tal-card-link:focus-visible { outline: none; }
.tal-library .tal-card-link:focus-visible .tal-cover { outline: 3px solid var(--tal-accent); outline-offset: 2px; }
.tal-library .tal-title { font-weight: 700; line-height: 1.3; }
.tal-library .tal-card-link:hover .tal-title { text-decoration: underline; text-underline-offset: 2px; }
.tal-library .tal-artist { margin-top: 2px; line-height: 1.3; opacity: 0.85; }
.tal-library .tal-meta { margin-top: 4px; font-size: 0.82em; line-height: 1.3; opacity: 0.6; }

.tal-library .tal-card-play {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin-top: 10px;
    padding: 6px 12px;
    border: 1px solid var(--tal-line);
    border-radius: 999px;
    color: inherit;
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.tal-library .tal-card-play svg { color: #1db954; }
.tal-library .tal-card-play:hover,
.tal-library .tal-card-play:focus-visible { border-color: #1db954; background: #1db954; color: #000; }
.tal-library .tal-card-play:hover svg,
.tal-library .tal-card-play:focus-visible svg { color: #000; }
.tal-library .tal-card { display: flex; flex-direction: column; }

/* ---------- Empty state ---------- */
.tal-library .tal-empty { padding: 40px 16px; text-align: center; border: 1px dashed var(--tal-line); border-radius: 10px; }
.tal-library .tal-empty[hidden] { display: none; }
.tal-library .tal-empty p { margin: 0 0 12px; }
.tal-library .tal-reset {
    margin: 0;
    padding: 9px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--tal-accent);
    color: #fff;
    font: inherit;
    font-size: 0.95em;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}

/* ---------- Single album page ---------- */
.tal-album-box {
    box-sizing: border-box;
    margin: 0 0 2.5em;
}
.tal-album-box .tal-album-head {
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    gap: 28px;
    align-items: center;
}
.tal-album-box .tal-album-cover {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--tal-soft);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 14px 34px rgba(0, 0, 0, 0.16);
}
.tal-album-box .tal-album-cover img { display: block; width: 100%; height: 100%; max-width: none; margin: 0; object-fit: cover; }
.tal-album-box .tal-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 5em;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--tal-accent), #2f3b2f);
}
.tal-album-box .tal-facts { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.tal-album-box .tal-facts div { margin: 0; }
.tal-album-box .tal-facts dt { margin: 0; font-size: 0.78em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.6; }
.tal-album-box .tal-facts dd { margin: 2px 0 0; padding: 0; font-weight: 600; }
.tal-album-box .tal-facts dt { padding: 0; }
.tal-album-box .tal-listen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.tal-album-box .tal-listen-label { margin-right: 4px; font-size: 0.9em; opacity: 0.7; }
.tal-album-box .tal-listen-btn {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid var(--tal-line);
    border-radius: 999px;
    color: inherit;
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}
.tal-album-box .tal-listen-btn:hover { border-color: var(--tal-accent); background: var(--tal-soft); }
.tal-album-box .tal-listen { margin-top: 22px; }
.tal-album-box .tal-player { margin-top: 28px; }
.tal-album-box .tal-player iframe { display: block; width: 100%; border: 0; border-radius: 12px; }
.tal-album-box .tal-consent {
    padding: 18px 20px;
    border-radius: 12px;
    background: var(--tal-soft);
}
.tal-album-box .tal-consent-text { margin: 0 0 14px; font-size: 0.92em; line-height: 1.5; }
.tal-album-box .tal-consent-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.tal-album-box .tal-consent-btn {
    margin: 0;
    padding: 9px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--tal-accent);
    color: #fff;
    font: inherit;
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
    cursor: pointer;
}
.tal-album-box [data-provider="spotify"] .tal-consent-btn { background: #1db954; color: #000; }
.tal-album-box .tal-consent-btn:hover { filter: brightness(0.92); }
.tal-album-box .tal-consent-btn:focus-visible { outline: 2px solid var(--tal-accent); outline-offset: 2px; }
.tal-album-box .tal-consent-remember { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 0.85em; opacity: 0.8; cursor: pointer; }
.tal-album-box .tal-consent-remember input { margin: 0; }
.tal-back { margin-top: 2em; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
    .tal-album-box .tal-album-head { grid-template-columns: 1fr; gap: 22px; }
    .tal-album-box .tal-album-cover { width: 100%; max-width: 360px; }
    .tal-album-box .tal-facts { flex-direction: row; flex-wrap: wrap; gap: 10px 28px; }
}

@media (max-width: 700px) {
    .tal-library .tal-controls { grid-template-columns: 1fr 1fr; }
    .tal-library .tal-field--search { grid-column: 1 / -1; }
    .tal-library .tal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .tal-library .tal-cover, .tal-library .tal-chip { transition: none; }
}

/* Album page header: "Listen on" on its own line above the buttons */
.tal-album-box .tal-album-info .tal-listen-label { flex-basis: 100%; margin: 0; font-size: 0.78em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.6; }
