/* ==========================================================================
   /respira: "Respiră cu mine", the full breathing exercise.
   A breathing circle in the middle of a tree cross-section: every breath
   draws one more hand-drawn ring. Uses the "Hârtie & Pin" tokens from
   site-theme.css, so it follows light and dark on its own.
   ========================================================================== */

:root[data-theme] body .mj-rs { --rs-ring: var(--brand); --rs-new: var(--accent-bright); }

/* ---- Header ------------------------------------------------------------- */
:root[data-theme] body .mj-rs-head { padding: 2rem 0 1.5rem !important; border-bottom: 1px solid var(--line); text-align: left; }
:root[data-theme] body .mj-rs-eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
:root[data-theme] body .mj-rs-lead { max-width: 36rem; margin: 0; color: var(--muted); font-size: 1.12rem; line-height: 1.6; }

/* ---- Layout -------------------------------------------------------------- */
.mj-rs-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
    padding: 2.5rem 0 3rem;
    border-bottom: 1px solid var(--line);
}

/* ---- Stage ---------------------------------------------------------------- */
.mj-rs-stage-wrap { text-align: center; position: sticky; top: 90px; }
.mj-rs-stage {
    position: relative;
    display: block;
    width: min(100%, 440px);
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: default;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.mj-rs[data-mode="own"] .mj-rs-stage { cursor: pointer; }
.mj-rs-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.mj-rs-svg { display: block; width: 100%; height: 100%; overflow: visible; }

.mj-rs-core-a { stop-color: var(--accent-bright); stop-opacity: 0.85; }
.mj-rs-core-b { stop-color: var(--brand); stop-opacity: 0.9; }
.mj-rs-guide { fill: none; stroke: var(--line-strong); stroke-width: 1.4; stroke-dasharray: 3 7; }
.mj-rs-orb {
    transform-origin: 200px 200px;
    transform: scale(0.5);
    opacity: 0.6;
}

.mj-rs-rings path {
    fill: none;
    stroke: var(--rs-ring);
    stroke-width: 1.3;
    stroke-linecap: round;
    opacity: 0.42;
    transition: stroke 1.2s ease, opacity 1.2s ease;
}
.mj-rs-rings path.is-new { stroke: var(--rs-new); opacity: 0.9; }
.mj-rs-rings path.is-drawing { animation: mj-rs-draw 1.6s cubic-bezier(0.3, 0.1, 0.3, 1) both; }
@keyframes mj-rs-draw {
    from { stroke-dashoffset: var(--len); }
    to { stroke-dashoffset: 0; }
}

.mj-rs-cue {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 0.15rem;
    pointer-events: none;
}
.mj-rs-word {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 420;
    color: var(--brand-ink);
    text-shadow: 0 1px 10px rgba(19, 40, 31, 0.35);
    transition: opacity 0.4s ease;
}
:root[data-theme="dark"] .mj-rs-word { text-shadow: 0 1px 10px rgba(240, 230, 210, 0.35); }
.mj-rs[data-phase="idle"] .mj-rs-word,
.mj-rs[data-phase="done"] .mj-rs-word { color: var(--heading); text-shadow: none; }
.mj-rs-count {
    min-height: 1.4em;
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-ink);
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.mj-rs-status { margin: 1.25rem 0 0.25rem; color: var(--muted); min-height: 1.5em; }
.mj-rs-tree { margin: 0; color: var(--muted); font-size: 0.9rem; }
.mj-rs-tree button {
    border: 0;
    padding: 0;
    background: none;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 0.18em;
    font-size: inherit;
}
.mj-rs-tree button:hover { color: var(--accent); }

/* ---- Settings ------------------------------------------------------------- */
.mj-rs-settings fieldset { margin: 0 0 1.75rem; padding: 0; border: 0; min-width: 0; }
.mj-rs-settings legend {
    float: none;
    width: auto;
    margin: 0 0 0.6rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 450;
    color: var(--heading);
}

/* Radios and checkboxes: a hand-drawn ring that fills, no pill chips. */
.mj-rs-settings input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.mj-rs-option {
    position: relative;
    display: block;
    padding: 0.85rem 0 0.85rem 2.4rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    line-height: 1.5;
    cursor: pointer;
}
.mj-rs-option:last-child { border-bottom: 1px solid var(--line); }
.mj-rs-option strong { display: block; color: var(--heading); font-family: var(--font-display); font-weight: 500; font-size: 1.12rem; }
.mj-rs-option::before,
.mj-rs-check span::before,
.mj-rs-minutes span::before {
    content: "";
    position: absolute;
    left: 0.2rem;
    top: 1.05rem;
    width: 1.2rem;
    height: 1.2rem;
    border: 1.6px solid var(--line-strong);
    border-radius: 48% 52% 50% 46% / 52% 46% 54% 48%;
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.mj-rs-option:has(input:checked)::before {
    border-color: var(--accent);
    background: var(--accent-bright);
    box-shadow: inset 0 0 0 3px var(--surface);
}
.mj-rs-option:has(input:checked) strong { color: var(--accent); }
.mj-rs-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.mj-rs-minutes { display: flex; flex-wrap: wrap; gap: 0.4rem 1.75rem; }
.mj-rs-minutes label { position: relative; cursor: pointer; }
.mj-rs-minutes span { position: relative; display: inline-block; padding: 0.3rem 0 0.3rem 1.9rem; color: var(--text); }
.mj-rs-minutes span::before { left: 0; top: 0.45rem; }
.mj-rs-minutes input:checked + span { color: var(--accent); font-weight: 700; }
.mj-rs-minutes input:checked + span::before { border-color: var(--accent); background: var(--accent-bright); box-shadow: inset 0 0 0 3px var(--surface); }
.mj-rs-minutes input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.mj-rs-extras { display: grid; gap: 0.35rem; }
.mj-rs-check { position: relative; cursor: pointer; }
.mj-rs-check span { position: relative; display: inline-block; padding: 0.3rem 0 0.3rem 1.9rem; color: var(--muted); }
.mj-rs-check span::before { left: 0; top: 0.45rem; border-radius: 5px 6px 5px 7px; }
.mj-rs-check input:checked + span { color: var(--text); }
.mj-rs-check input:checked + span::before { border-color: var(--accent); background: var(--accent-bright); box-shadow: inset 0 0 0 3px var(--surface); }
.mj-rs-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- Actions --------------------------------------------------------------- */
.mj-rs-actions { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
:root[data-theme] body .mj-rs-start {
    padding: 0.95rem 2.6rem;
    font-size: 0.9rem;
    background: var(--accent) !important;
    color: var(--accent-ink) !important;
}
:root[data-theme] body .mj-rs-start:hover,
:root[data-theme] body .mj-rs-start:focus-visible { background: var(--brand) !important; color: var(--brand-ink) !important; }
.mj-rs-stop,
.mj-rs-again {
    border: 0;
    padding: 0.4rem 0;
    background: none;
    color: var(--text);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.3em;
}
.mj-rs-stop:hover,
.mj-rs-again:hover { color: var(--accent); }

/* While breathing, the settings step back so only the circle is left. */
.mj-rs[data-after] .mj-rs-settings,
.mj-rs[data-after] .mj-rs-actions,
.mj-rs[data-running] .mj-rs-settings,
.mj-rs[data-running] .mj-rs-start { display: none; }
.mj-rs[data-running] .mj-rs-layout { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
.mj-rs[data-running] .mj-rs-side { justify-self: center; }
.mj-rs[data-running] .mj-rs-stage-wrap { position: static; }

/* ---- After a session ------------------------------------------------------- */
.mj-rs-after { padding-top: 0.25rem; }
.mj-rs-after:focus { outline: none; }
:root[data-theme] body .mj-rs-after h2 { font-size: 2.2rem; font-weight: 380; margin: 0 0 0.5rem; }
.mj-rs-after > p { color: var(--muted); }
.mj-rs-ask { margin: 1.5rem 0 0.6rem; color: var(--heading) !important; font-family: var(--font-display); font-size: 1.25rem; }
.mj-rs-feel { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; }
.mj-rs-feel button {
    padding: 0.6rem 1.15rem;
    border: 1.5px solid var(--line-strong);
    border-radius: 14px 16px 13px 17px;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
.mj-rs-feel button:hover { border-color: var(--accent); color: var(--accent); }
.mj-rs-feel button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bright); color: var(--accent-ink); }
.mj-rs-reply { border-left: 2px solid var(--accent); padding: 0.1rem 0 0.1rem 1rem; margin-bottom: 1rem; }
.mj-rs-reply p { margin: 0 0 0.5rem; color: var(--text); }
.mj-rs-reply a { color: var(--accent); font-weight: 700; }
.mj-rs-safety { font-size: 0.92rem; color: var(--muted) !important; }

/* ---- Why it helps ------------------------------------------------------------ */
.mj-rs-why { max-width: 44rem; padding: 2.5rem 0 1rem; text-align: left; }
:root[data-theme] body .mj-rs-why h2 { font-size: 1.7rem; margin-bottom: 0.75rem; }
.mj-rs-why p { color: var(--muted); line-height: 1.7; }

/* ---- Phones ------------------------------------------------------------------ */
@media (max-width: 860px) {
    .mj-rs-layout { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; padding-top: 1.5rem; }
    .mj-rs-stage-wrap { position: static; }
    .mj-rs-stage { width: min(100%, 340px); }
    .mj-rs-actions { justify-content: center; }
    .mj-rs-after { text-align: left; }
    /* While breathing on a phone, keep the circle and the stop link together. */
    .mj-rs[data-running] .mj-rs-head { display: none; }
    .mj-rs[data-running] .mj-rs-stage { width: min(100%, 380px); }
}
@media (max-width: 575.98px) {
    :root[data-theme] body .mj-rs-head h1 { font-size: 2.5rem; }
    .mj-rs-word { font-size: 1.45rem; }
}

/* Reduced motion: breathe.js fades the circle instead of growing it, and the
   rings appear without being drawn. */
@media (prefers-reduced-motion: reduce) {
    .mj-rs-rings path.is-drawing { animation: none; }
    .mj-rs-rings path { transition: none; }
}
