/* Interactive worksheet library. Neutral rgba borders + inherited text
   colors so it reads correctly in both light and dark themes. */

/* resources.css redefines --text-dark etc. on :root, which beats the dark
   theme's values (same specificity, loaded later). Restore the dark-theme
   values inside worksheet pages. */
[data-theme="dark"] .ws-wrap {
    --text-dark: #e4e4e7;
    --primary-color: #4db8e8;
    color: #e4e4e7;
}
[data-theme="dark"] .ws-scale-points input:checked + span { color: #0f172a; }
[data-theme="dark"] .ws-wrap .ws-btn, [data-theme="dark"] .ws-wrap .ws-btn:hover { color: #0f172a; }

.ws-wrap { max-width: 880px; margin: 1.5rem auto 3rem; padding: 0 1rem; }
.ws-crumbs { font-size: 0.9rem; opacity: 0.8; margin-bottom: 1rem; }
.ws-crumbs a { color: inherit; }

.ws-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.ws-chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.85rem; font-weight: 600;
    background: rgba(82,183,136,0.15); color: #2f7d56;
    border-radius: 999px; padding: 0.3rem 0.85rem;
}
[data-theme="dark"] .ws-chip { color: #74c69d; }
.ws-intro { font-size: 1.05rem; line-height: 1.6; margin-bottom: 0.8rem; }
.ws-when { opacity: 0.8; margin-bottom: 1.5rem; }

.ws-banner {
    border-radius: 12px; padding: 0.9rem 1.1rem; margin-bottom: 1.2rem;
    background: rgba(30,77,139,0.08); border: 1px solid rgba(30,77,139,0.25);
}
.ws-banner a { font-weight: 600; }

.ws-section {
    border: 1px solid rgba(128,128,128,0.25); border-radius: 14px;
    padding: 1.2rem 1.3rem; margin-bottom: 1.1rem;
}
.ws-section h2 { font-size: 1.15rem; margin: 0 0 0.3rem; }
.ws-section-intro { opacity: 0.75; font-size: 0.92rem; margin-bottom: 0.8rem; }
.ws-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 700px) {
    .ws-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}

.ws-field { margin-bottom: 1rem; }
.ws-grid .ws-field { margin-bottom: 0; }
.ws-field:last-child { margin-bottom: 0; }
.ws-label { display: block; font-weight: 600; font-size: 1rem; margin-bottom: 0.2rem; }
.ws-help { display: block; font-size: 0.88rem; opacity: 0.72; margin-bottom: 0.45rem; }
.ws-field input[type="text"], .ws-field textarea {
    width: 100%; box-sizing: border-box;
    border: 1px solid rgba(128,128,128,0.45); border-radius: 8px;
    padding: 0.6rem 0.75rem; font: inherit; background: transparent; color: inherit;
}
.ws-field textarea { resize: vertical; line-height: 1.45; }
.ws-answer { white-space: pre-wrap; line-height: 1.5; }
.ws-empty { opacity: 0.55; font-style: italic; }

/* 0-10 scale as a row of radio pills (no JS needed) */
.ws-scale { border: 0; padding: 0; margin: 0; min-width: 0; }
.ws-scale legend.ws-label { font-size: 1rem; line-height: 1.4; padding: 0; margin-bottom: 0.2rem; border: 0; width: auto; }
.ws-scale-points { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.ws-scale-points label { position: relative; }
.ws-scale-points input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ws-scale-points span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.2rem; height: 2.2rem; border-radius: 50%;
    border: 1px solid rgba(128,128,128,0.45); cursor: pointer;
    font-weight: 600; font-size: 0.9rem; user-select: none;
}
.ws-scale-points input:checked + span {
    background: var(--primary-color, #1e4d8b); border-color: var(--primary-color, #1e4d8b); color: #fff;
    --heading-color: currentColor;
}
.ws-scale-points input:focus-visible + span { outline: 2px solid var(--accent-color, #52b788); outline-offset: 2px; }
.ws-scale-ends { display: flex; justify-content: space-between; font-size: 0.8rem; opacity: 0.7; margin-top: 0.3rem; max-width: 29rem; }

.ws-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin: 1.4rem 0; }
.ws-btn, .ws-btn-secondary, .ws-btn-locked {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-weight: 700; font-size: 0.98rem; text-decoration: none;
    border-radius: 8px; padding: 0.7rem 1.3rem; cursor: pointer; border: none;
}
.ws-btn { background: var(--primary-color, #1e4d8b); color: #fff; --heading-color: currentColor; }
.ws-btn:hover { color: #fff; opacity: 0.92; }
.ws-btn-secondary { background: transparent; color: inherit; border: 1px solid rgba(128,128,128,0.5); }
.ws-btn-locked { background: rgba(128,128,128,0.15); color: inherit; }
.ws-btn-danger { background: none; border: none; color: #b02a37; cursor: pointer; font-weight: 600; padding: 0.7rem 0.4rem; }
.ws-inline-form { display: inline; margin: 0; }

.ws-upsell {
    border-radius: var(--border-radius-lg, 20px); padding: 1.5rem 1.6rem; margin: 1.5rem 0;
    background: var(--panel-ink, #0e1322); color: #fff;
    --heading-color: currentColor;
}
.ws-upsell h3 { margin: 0 0 0.5rem; font-size: 1.1rem; color: #fff; }
.ws-upsell ul { margin: 0 0 1rem 1.1rem; padding: 0; line-height: 1.6; }
.ws-upsell a.ws-upsell-btn {
    /* white in both themes: it sits on the ink panel */
    display: inline-block; background: #fff; color: #0e1322; font-weight: 700;
    padding: 0.6rem 1.3rem; border-radius: var(--radius-btn, 10px); text-decoration: none;
}

.ws-tip { background: var(--bg-gray, #eef1f6); border-radius: var(--border-radius, 10px); padding: 0.8rem 1rem; margin: 1rem 0; }
.ws-history h3 { font-size: 1.05rem; margin: 2rem 0 0.6rem; }
.ws-history ul { list-style: none; padding: 0; margin: 0; }
.ws-history li { padding: 0.55rem 0; border-bottom: 1px solid rgba(128,128,128,0.2); display: flex; justify-content: space-between; gap: 1rem; }
.ws-history time { opacity: 0.7; font-size: 0.88rem; white-space: nowrap; }
.ws-crisis { margin-top: 2rem; font-size: 0.9rem; opacity: 0.8; }

/* Index */
.ws-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.ws-card {
    display: flex; flex-direction: column; gap: 0.4rem;
    border: 1px solid rgba(128,128,128,0.25); border-radius: var(--border-radius-lg); padding: 1.2rem;
    text-decoration: none; color: inherit; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ws-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); color: inherit; }
.ws-card-icon { font-size: 1.8rem; }
.ws-card h2 { font-size: 1.1rem; margin: 0; }
.ws-card p { margin: 0; opacity: 0.8; font-size: 0.93rem; line-height: 1.45; flex: 1; }
.ws-card-foot { display: flex; justify-content: space-between; font-size: 0.82rem; opacity: 0.75; margin-top: 0.4rem; }
.ws-compare { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1rem 0 2rem; }
@media (min-width: 700px) { .ws-compare { grid-template-columns: 1fr 1fr; } }
.ws-compare > div { border: 1px solid rgba(128,128,128,0.25); border-radius: 14px; padding: 1rem 1.2rem; }
.ws-compare h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.ws-compare ul { margin: 0 0 0 1.1rem; padding: 0; line-height: 1.6; }

@media print {
    body * { visibility: hidden; }
    .ws-print-area, .ws-print-area * { visibility: visible; }
    .ws-print-area { position: absolute; left: 0; top: 0; width: 100%; }
    .ws-no-print { display: none !important; }
    .ws-section { break-inside: avoid; }
}

/* Daily reflection library */
.rf-today {
    border-radius: var(--border-radius-xl, 28px); padding: 2rem 2rem 1.75rem; margin-bottom: 1.5rem; color: #fff;
    background: var(--panel-ink, #0e1322);
    --heading-color: currentColor;
}
.rf-today .rf-eyebrow { font-size: 0.75rem; font-weight: 700;opacity: 0.9; }
.rf-today h2 { color: #fff; font-size: 1.5rem; margin: 0.4rem 0 0.8rem; }
.rf-today .rf-body p { color: #fff; }
.rf-body p { font-size: 1.08rem; line-height: 1.7; margin: 0 0 0.9rem; }
.rf-prompt {
    border-left: 4px solid var(--accent-color, #52b788); padding: 0.6rem 1rem; margin: 1rem 0;
    font-weight: 600; font-style: italic;
}
.rf-today .rf-prompt { border-color: rgba(255,255,255,0.8); }
.rf-tools { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 0.4rem; }
.rf-today .ws-btn-secondary, .rf-today .ws-btn-secondary:hover { color: #fff; border-color: rgba(255,255,255,0.6); }
.rf-pill {
    display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 700;
    border-radius: 999px; padding: 0.2rem 0.75rem; background: rgba(82,183,136,0.15); color: #2f7d56;
}
[data-theme="dark"] .rf-pill { color: #74c69d; }
.rf-theme { margin: 1.6rem 0 0.4rem; font-size: 1.15rem; }
.rf-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
@media (min-width: 700px) { .rf-list { grid-template-columns: 1fr 1fr; } }
.rf-list a {
    display: block; height: 100%; box-sizing: border-box; border: 1px solid rgba(128,128,128,0.25);
    border-radius: 12px; padding: 0.8rem 1rem; text-decoration: none; color: inherit;
}
.rf-list a:hover { box-shadow: var(--shadow-hover); color: inherit; }
.rf-list strong { display: flex; justify-content: space-between; gap: 0.5rem; }
.rf-list small { display: block; opacity: 0.75; margin-top: 0.25rem; line-height: 1.4; }
/* What a row is, in words: "Preview" (Premium, with a free taste), "Premium",
   or "Free". Replaces the old lock icon, which read as "not for you". */
.rf-chip { font-size: var(--text-xs, 0.75rem); font-weight: 600; white-space: nowrap; color: var(--text-muted);
    border: 1px solid var(--border-color); border-radius: 999px; padding: 0.1rem 0.55rem; }
.rf-chip--free { color: var(--green-text); border-color: currentColor; }
.rf-free-note { font-size: var(--text-sm, 0.875rem); color: var(--text-muted); margin: 0 0 1rem; }
.rf-locked-label { font-size: var(--text-sm, 0.875rem); font-weight: 700; color: var(--text-muted); margin: 0; }
.rf-locked-fade { position: relative; }
.rf-locked-fade::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2.5rem;
    background: linear-gradient(to bottom, transparent, var(--bg-lighter, #f8f9fa));
}
.rf-fav-btn[aria-pressed="true"] { border-color: #e11d48; color: #e11d48; }

/* Guided programs */
.pg-bar { height: 10px; border-radius: 999px; background: rgba(128,128,128,0.2); overflow: hidden; margin: 0.4rem 0 0.3rem; }
.pg-bar > span { display: block; height: 100%; background: #52b788; border-radius: 999px; }
.pg-week { margin: 1.6rem 0 0.5rem; font-size: 1.1rem; }
.pg-days { list-style: none; padding: 0; margin: 0; border: 1px solid rgba(128,128,128,0.25); border-radius: 14px; overflow: hidden; }
.pg-days li { border-bottom: 1px solid rgba(128,128,128,0.18); }
.pg-days li:last-child { border-bottom: 0; }
.pg-days a, .pg-days .pg-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.75rem 1rem; text-decoration: none; color: inherit; }
.pg-days a:hover { background: rgba(128,128,128,0.08); color: inherit; }
.pg-num {
    flex-shrink: 0; width: 2.1rem; height: 2.1rem; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem;
    border: 1px solid rgba(128,128,128,0.45);
}
.pg-days .is-done .pg-num { background: #2d6a4f; border-color: #2d6a4f; color: #fff; --heading-color: currentColor; }
.pg-days .is-current .pg-num { background: var(--primary-color, #1e4d8b); border-color: var(--primary-color, #1e4d8b); color: #fff; --heading-color: currentColor; }
[data-theme="dark"] .pg-days .is-current .pg-num { color: #0f172a; }
.pg-days .is-locked, .pg-days .is-premium-preview { opacity: 0.65; }
.pg-title { flex: 1; }
.pg-tag { font-size: 0.78rem; font-weight: 700; opacity: 0.8; white-space: nowrap; }
.pg-action {
    border: 1px solid rgba(82,183,136,0.5); background: rgba(82,183,136,0.1);
    border-radius: 14px; padding: 1rem 1.2rem; margin: 1.4rem 0;
}
.pg-action h2 { font-size: 1rem; margin: 0 0 0.3rem;opacity: 0.85; }
.pg-action p { margin: 0 0 0.8rem; opacity: 0.85; }
.pg-celebrate {
    border-radius: 14px; padding: 1rem 1.2rem; margin-bottom: 1.2rem; color: #fff;
    background: #2e8059;
    --heading-color: currentColor;
}
.pg-celebrate a { color: #fff; font-weight: 700; }

/* Program cohorts */
.pg-cohort {
    display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin: 1.2rem 0;
    border: 1px solid rgba(45,106,79,0.35); background: rgba(82,183,136,0.08);
    border-radius: 14px; padding: 0.9rem 1.1rem; text-decoration: none; color: inherit;
}
a.pg-cohort:hover { background: rgba(82,183,136,0.15); color: inherit; }
.pg-cohort-icon { font-size: 1.7rem; line-height: 1; }
.pg-cohort-text { flex: 1 1 220px; display: flex; flex-direction: column; gap: 0.15rem; }
.pg-cohort-text span { opacity: 0.8; font-size: 0.9rem; line-height: 1.4; }
.pg-cohort-cta { font-weight: 700; white-space: nowrap; }

/* Program tracks */
.pg-helplines { border: 1px solid rgba(220,38,38,0.35); background: rgba(220,38,38,0.06); border-radius: 12px; padding: 0.8rem 1rem; margin: 1.2rem 0; font-size: 0.95rem; }
.pg-helplines ul { margin: 0.4rem 0 0 1.1rem; padding: 0; line-height: 1.7; }
.pg-tracks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin: 0.8rem 0 1.5rem; }
.pg-section-title { font-size: 1.3rem; margin: 1.8rem 0 0.2rem; }
.pg-section-sub { opacity: 0.8; margin: 0 0 0.6rem; }

/* Audio library player */
.au-player { margin: 1rem 0; display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.au-player audio { width: 100%; }
.au-transcript { margin: 1rem 0; }
.au-transcript summary { cursor: pointer; font-weight: 600; }

/* Program: last free day completed (resources/programs/_free_days_done.html) */
.ws-wrap .pg-milestone { text-align: center; border-radius: 18px; padding: 1.8rem 1.4rem 1.4rem; margin: 0 0 1.5rem;
    background: linear-gradient(135deg, rgba(124,58,237,0.10), rgba(77,184,232,0.12)); border: 1px solid rgba(124,58,237,0.25); }
.ws-wrap .pg-milestone-emoji { font-size: 2.2rem; line-height: 1; }
.ws-wrap .pg-milestone h2 { font-size: 1.35rem; margin: 0.5rem 0 0.4rem; }
.ws-wrap .pg-milestone > p { margin: 0 auto 1rem; max-width: 460px; opacity: 0.85; }
.ws-wrap .pg-milestone-next { display: flex; width: fit-content; max-width: 100%; margin: 0 auto 1.1rem; flex-direction: column; gap: 0.15rem; padding: 0.8rem 1.2rem;
    border-radius: 12px; background: rgba(255,255,255,0.75); border: 1px solid rgba(128,128,128,0.2); }
[data-theme="dark"] .ws-wrap .pg-milestone-next { background: rgba(15,23,42,0.45); }
.ws-wrap .pg-milestone-next span { font-size: 0.78rem; font-weight: 700;opacity: 0.7; }
.ws-wrap .pg-milestone-next small { opacity: 0.7; }
.ws-wrap .pg-milestone-btn { display: inline-block; }
.ws-wrap .pg-milestone-note { font-size: 0.88rem; opacity: 0.75; margin: 0.6rem 0 0.2rem; }
.ws-wrap .pg-milestone-later { font-size: 0.9rem; }

/* Audio preview for locked Premium sessions */
.au-preview { margin: 1rem 0 0; padding: 1rem 1.1rem; border-radius: 14px; background: rgba(15,118,110,0.08); border: 1px solid rgba(15,118,110,0.25); }
.au-preview-label { margin: 0 0 0.6rem; font-weight: 600; }
.au-preview audio { width: 100%; }
.au-ended-only { display: none; }
.au-after-preview.is-ended { border-style: solid !important; border-color: #764ba2 !important; box-shadow: 0 8px 24px rgba(118,75,162,0.18); }
.au-after-preview.is-ended .au-ended-only { display: inline; }

/* Share a reflection card (resources/reflections/_share.html) */
/* display: contents lets the menu wrap onto its own row inside the tools row
   (the reading card clips overflow, so an absolutely positioned menu would be cut off). */
.rf-share { display: contents; }
.rf-share-menu { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px; padding: 6px;
    background: var(--card-bg, #fff); border: 1px solid rgba(128,128,128,0.25); border-radius: 12px; box-shadow: 0 10px 28px rgba(15,45,86,0.18); }
.rf-share-menu[hidden] { display: none; }
.rf-share-menu a, .rf-share-menu button { display: flex; align-items: center; gap: 0.55rem; flex: 1 1 180px; padding: 0.55rem 0.7rem;
    border: none; background: none; border-radius: 8px; color: var(--text-dark, #2c3e50); text-decoration: none; font: inherit; font-size: 0.95rem; text-align: left; cursor: pointer; }
.rf-share-menu a:hover, .rf-share-menu button:hover { background: #f3f6fa; }
[data-theme="dark"] .rf-share-menu { background: #1f2937; border-color: #374151; }
[data-theme="dark"] .rf-share-menu a, [data-theme="dark"] .rf-share-menu button { color: #e5e7eb; }
[data-theme="dark"] .rf-share-menu a:hover, [data-theme="dark"] .rf-share-menu button:hover { background: #273244; }

/* Daily audio reminder card (resources/audio/detail.html) */
.au-reminder { margin: 1.5rem 0; padding: 1.1rem 1.2rem; border-radius: 14px; border: 1px solid rgba(30,77,139,0.22); background: rgba(30,77,139,0.05); }
.au-reminder h2 { font-size: 1.1rem; margin: 0 0 0.4rem; }
.au-reminder p { margin: 0 0 0.7rem; }
.au-reminder-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.au-reminder-form select { padding: 0.5rem 0.7rem; border-radius: 10px; border: 1px solid rgba(128,128,128,0.4); font: inherit; background: inherit; color: inherit; }
.au-reminder-note { font-size: 0.88rem; opacity: 0.8; margin: 0.7rem 0 0 !important; }
