/*
 * Jelena Healing – meditations module styles.
 * Every rule is scoped under .jm-root and every class starts with "jm-",
 * so the module never restyles the host website.
 *
 * THEME: change only the variables below to match the main site.
 * Values follow the jelenadiklic.com prototype (night background, cream
 * sections, gold accents, Cormorant Garamond + Manrope). Check them against
 * the live site's stylesheet during integration.
 */
.jm-root {
  --jm-night: #0d0b1c;
  --jm-night-2: #17132e;
  --jm-night-3: #221c40;
  --jm-cream: #f6f1e7;
  --jm-cream-2: #ece4d3;
  --jm-ink: #1c1830; /* text on cream */
  --jm-text: #f4efe6; /* text on night */
  --jm-muted: #b9b2c9;
  --jm-muted-ink: #5e5871;
  --jm-gold: #e7c27d;
  --jm-gold-deep: #b98f43;
  --jm-peach: #f3b79b;
  --jm-ok: #8fd1a8;
  --jm-warn: #f3b79b;
  --jm-danger: #f08c8c;
  --jm-danger-ink: #a23b3b;

  --jm-font-serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --jm-font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --jm-radius: 14px;
  --jm-radius-sm: 9px;
  --jm-gap: clamp(16px, 2.4vw, 28px);
  --jm-max: 1120px;
  --jm-ease: cubic-bezier(.2, .7, .2, 1);
  --jm-shadow: 0 18px 50px -28px rgba(0, 0, 0, .65);

  /* surface tokens (dark by default) */
  --jm-bg: var(--jm-night);
  --jm-surface: var(--jm-night-2);
  --jm-surface-2: var(--jm-night-3);
  --jm-fg: var(--jm-text);
  --jm-fg-muted: var(--jm-muted);
  --jm-line: rgba(231, 194, 125, .18);
  --jm-input-bg: rgba(255, 255, 255, .04);

  color: var(--jm-fg);
  background: var(--jm-bg);
  font-family: var(--jm-font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.jm-root[data-jm-theme="light"], .jm-root .jm-light {
  --jm-bg: var(--jm-cream);
  --jm-surface: #fffdf8;
  --jm-surface-2: var(--jm-cream-2);
  --jm-fg: var(--jm-ink);
  --jm-fg-muted: var(--jm-muted-ink);
  --jm-line: rgba(28, 24, 48, .12);
  --jm-input-bg: #fff;
  color: var(--jm-fg);
  background: var(--jm-bg);
}
.jm-root *, .jm-root *::before, .jm-root *::after { box-sizing: border-box; }
.jm-root a { color: var(--jm-gold); text-decoration: none; }
.jm-root a:hover { text-decoration: underline; text-underline-offset: 3px; }
.jm-root .jm-light a { color: var(--jm-gold-deep); }
.jm-root :focus-visible { outline: 2px solid var(--jm-gold); outline-offset: 3px; border-radius: 4px; }
.jm-root img { max-width: 100%; display: block; }
.jm-root h1, .jm-root h2, .jm-root h3 {
  font-family: var(--jm-font-serif); font-weight: 500; line-height: 1.12; margin: 0 0 .4em; letter-spacing: .005em;
}
.jm-root h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.jm-root h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
.jm-root h3 { font-size: 1.45rem; }
.jm-root h1 em, .jm-root h2 em { color: var(--jm-gold); font-style: italic; }
.jm-root p { margin: 0 0 1em; }

/* ---------- layout ---------- */
.jm-wrap { width: min(100% - 2 * var(--jm-gap), var(--jm-max)); margin-inline: auto; }
.jm-header { border-bottom: 1px solid var(--jm-line); background: var(--jm-night); color: var(--jm-text); }
.jm-header .jm-wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; flex-wrap: wrap; }
.jm-brand { font-family: var(--jm-font-serif); font-size: 1.35rem; color: var(--jm-text) !important; letter-spacing: .02em; }
.jm-brand span { color: var(--jm-gold); font-style: italic; }
.jm-nav { display: flex; gap: 6px 18px; flex-wrap: wrap; align-items: center; font-size: .92rem; }
.jm-nav a, .jm-nav button { color: var(--jm-muted); }
.jm-nav a[aria-current="page"] { color: var(--jm-gold); }
.jm-main { padding-block: clamp(28px, 6vw, 64px); }
.jm-eyebrow { text-transform: uppercase; letter-spacing: .24em; font-size: .72rem; color: var(--jm-gold); margin-bottom: 10px; }
.jm-lead { color: var(--jm-fg-muted); max-width: 60ch; font-size: 1.05rem; }
.jm-divider { width: 56px; height: 1px; background: var(--jm-gold); margin: 14px 0 22px; opacity: .8; }

/* ---------- buttons & forms ---------- */
.jm-btn {
  appearance: none; border: 1px solid var(--jm-gold); background: var(--jm-gold); color: #1a1426;
  font: 600 .95rem/1 var(--jm-font-sans); letter-spacing: .02em; padding: 13px 22px; border-radius: 999px;
  cursor: pointer; transition: background .25s var(--jm-ease), color .25s var(--jm-ease), opacity .2s; display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  text-decoration: none !important; min-height: 44px;
}
.jm-btn:hover { background: #f0d29a; }
.jm-btn[disabled] { opacity: .55; cursor: progress; }
.jm-btn--ghost { background: transparent; color: var(--jm-gold); }
.jm-btn--ghost:hover { background: rgba(231, 194, 125, .1); }
.jm-light .jm-btn--ghost, [data-jm-theme="light"] .jm-btn--ghost { color: var(--jm-gold-deep); border-color: var(--jm-gold-deep); }
.jm-btn--dark { background: var(--jm-night); border-color: var(--jm-night); color: var(--jm-cream); }
.jm-btn--dark:hover { background: var(--jm-night-3); }
.jm-btn--danger { background: transparent; border-color: var(--jm-danger); color: var(--jm-danger); }
.jm-light .jm-btn--danger { color: var(--jm-danger-ink); border-color: var(--jm-danger-ink); }
.jm-btn--sm { padding: 8px 14px; font-size: .85rem; min-height: 36px; }
.jm-linkbtn { appearance: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--jm-muted); }
.jm-linkbtn:hover { color: var(--jm-gold); }

.jm-form { display: grid; gap: 16px; }
.jm-field { display: grid; gap: 6px; }
.jm-field label, .jm-label { font-size: .85rem; font-weight: 600; color: var(--jm-fg-muted); letter-spacing: .02em; }
.jm-input, .jm-select, .jm-textarea {
  width: 100%; font: 400 1rem/1.4 var(--jm-font-sans); color: var(--jm-fg); background: var(--jm-input-bg);
  border: 1px solid var(--jm-line); border-radius: var(--jm-radius-sm); padding: 12px 14px; min-height: 46px;
  transition: border-color .2s;
}
.jm-textarea { min-height: 110px; resize: vertical; }
.jm-input:focus, .jm-select:focus, .jm-textarea:focus { border-color: var(--jm-gold); outline: none; }
.jm-hint { font-size: .82rem; color: var(--jm-fg-muted); }
.jm-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.jm-grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.jm-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.jm-choice { position: relative; }
.jm-choice input { position: absolute; opacity: 0; inset: 0; }
.jm-choice span {
  display: inline-block; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--jm-line); cursor: pointer; font-size: .92rem;
  transition: all .2s var(--jm-ease);
}
.jm-choice input:checked + span { background: var(--jm-gold); border-color: var(--jm-gold); color: #1a1426; font-weight: 600; }
.jm-choice input:focus-visible + span { outline: 2px solid var(--jm-gold); outline-offset: 2px; }

/* ---------- panels, alerts ---------- */
.jm-card { background: var(--jm-surface); border: 1px solid var(--jm-line); border-radius: var(--jm-radius); padding: clamp(20px, 3vw, 32px); box-shadow: var(--jm-shadow); }
.jm-auth { max-width: 460px; margin-inline: auto; }
.jm-alert { border-radius: var(--jm-radius-sm); padding: 12px 16px; font-size: .95rem; border: 1px solid; }
.jm-alert--error { border-color: rgba(240, 140, 140, .5); background: rgba(240, 140, 140, .08); color: var(--jm-danger); }
.jm-light .jm-alert--error { color: var(--jm-danger-ink); }
.jm-alert--ok { border-color: rgba(143, 209, 168, .5); background: rgba(143, 209, 168, .08); color: var(--jm-ok); }
.jm-light .jm-alert--ok { color: #23663f; }
.jm-alert--info { border-color: var(--jm-line); background: rgba(231, 194, 125, .06); color: var(--jm-fg); }
.jm-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.jm-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.jm-badge--active { color: var(--jm-ok); border-color: rgba(143, 209, 168, .4); }
.jm-badge--expired, .jm-badge--revoked, .jm-badge--not_started { color: var(--jm-peach); border-color: rgba(243, 183, 155, .4); }
.jm-light .jm-badge--active { color: #23663f; }
.jm-light .jm-badge--expired, .jm-light .jm-badge--revoked { color: #9a4a2a; }
.jm-badge--draft { color: var(--jm-fg-muted); border-color: var(--jm-line); }
.jm-mock { display: inline-block; background: var(--jm-peach); color: #3a1d10; font-weight: 700; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; padding: 3px 9px; border-radius: 6px; }

/* ---------- meditation cards ---------- */
.jm-cards { display: grid; gap: var(--jm-gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin-top: 28px; }
.jm-med { display: flex; flex-direction: column; background: var(--jm-surface); border: 1px solid var(--jm-line); border-radius: var(--jm-radius); overflow: hidden; transition: transform .35s var(--jm-ease), border-color .35s; }
.jm-med:hover { transform: translateY(-3px); border-color: rgba(231, 194, 125, .4); }
.jm-med__img { aspect-ratio: 16 / 9; background: radial-gradient(120% 120% at 30% 20%, #3a2f63 0%, var(--jm-night-2) 55%, var(--jm-night) 100%); position: relative; }
.jm-med__img img { width: 100%; height: 100%; object-fit: cover; }
.jm-med__img .jm-star { position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; opacity: .85; }
.jm-med__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.jm-med__meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--jm-fg-muted); }
.jm-med__desc { color: var(--jm-fg-muted); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.jm-med__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.jm-empty { text-align: center; padding: 48px 20px; color: var(--jm-fg-muted); }

/* ---------- player ---------- */
.jm-player-wrap { margin-top: 24px; }
.jm-player {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--jm-radius); overflow: hidden;
  border: 1px solid var(--jm-line); box-shadow: var(--jm-shadow);
}
.jm-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.jm-player__msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--jm-text); background: radial-gradient(90% 90% at 50% 30%, #2a2250 0%, var(--jm-night) 100%); }
.jm-player__msg p { max-width: 46ch; margin: 10px auto 0; color: var(--jm-muted); }
.jm-player__msg strong { font-family: var(--jm-font-serif); font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 500; display: block; }
.jm-player-info { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 14px; font-size: .88rem; color: var(--jm-fg-muted); }
.jm-facts { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 18px 0 6px; font-size: .95rem; }
.jm-facts dt { font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--jm-gold); }
.jm-facts dd { margin: 2px 0 0; }

/* ---------- admin ---------- */
.jm-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--jm-line); margin: 18px 0 24px; }
.jm-tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 16px; font: 600 .95rem var(--jm-font-sans); color: var(--jm-fg-muted); cursor: pointer; min-height: 44px; }
.jm-tab[aria-selected="true"] { color: var(--jm-fg); border-color: var(--jm-gold-deep); }
.jm-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.jm-table th { text-align: left; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--jm-fg-muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--jm-line); }
.jm-table td { padding: 12px; border-bottom: 1px solid var(--jm-line); vertical-align: top; }
.jm-table td small { color: var(--jm-fg-muted); display: block; }
.jm-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.jm-suggest { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--jm-line); border-radius: var(--jm-radius-sm); max-height: 240px; overflow: auto; background: var(--jm-surface); }
.jm-suggest li button { appearance: none; width: 100%; text-align: left; background: none; border: 0; padding: 10px 14px; font: inherit; color: var(--jm-fg); cursor: pointer; border-bottom: 1px solid var(--jm-line); }
.jm-suggest li button:hover, .jm-suggest li button:focus { background: var(--jm-surface-2); }
.jm-selected { display: inline-flex; gap: 10px; align-items: center; padding: 8px 14px; border-radius: 999px; background: var(--jm-surface-2); font-size: .92rem; }
.jm-section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .jm-table thead { display: none; }
  .jm-table, .jm-table tbody, .jm-table tr, .jm-table td { display: block; width: 100%; }
  .jm-table tr { border: 1px solid var(--jm-line); border-radius: var(--jm-radius-sm); margin-bottom: 12px; padding: 6px 4px; background: var(--jm-surface); }
  .jm-table td { border: 0; padding: 6px 12px; }
  .jm-table td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--jm-fg-muted); }
}

.jm-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.jm-fade { animation: jm-fade .45s var(--jm-ease) both; }
@keyframes jm-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .jm-root *, .jm-root *::before, .jm-root *::after { animation: none !important; transition: none !important; }
}

.jm-root [hidden] { display: none !important; }

/* readable gold on cream surfaces (contrast ≥ 4.5:1) */
.jm-root .jm-light, .jm-root[data-jm-theme="light"] { --jm-gold-deep: #7d5a1c; }
.jm-root .jm-light .jm-eyebrow, .jm-root .jm-light h1 em, .jm-root .jm-light h2 em,
.jm-root[data-jm-theme="light"] .jm-eyebrow, .jm-root[data-jm-theme="light"] h1 em { color: var(--jm-gold-deep); }

/* links styled as buttons keep the button colours (beats ".jm-root a") */
.jm-root a.jm-btn { color: #1a1426; }
.jm-root a.jm-btn--ghost { color: var(--jm-gold); }
.jm-root .jm-light a.jm-btn--ghost { color: var(--jm-gold-deep); }
.jm-root a.jm-btn--dark { color: var(--jm-cream); }
