/*
 * pomodoro -- tool-specific styles.
 *
 * The dial, the session tabs, the controls and the ambient mixer. Colours are
 * the tokens from src/tailwind/input.css, so the dark theme needs few twin
 * rules. One accent: a focus session draws its ring in the accent, a break in
 * a lighter tone of it. Shared documentation styles live in
 * src/stemkit-docs.css.
 */

:root {
    --pm-ring: 300px;                    /* dial diameter, desktop */
    --pm-accent: var(--stk-accent);
    --pm-accent-dark: var(--stk-accent-hover);
    --pm-accent-soft: var(--stk-ring);
    --pm-break: #5c93c7;                 /* brand-400 */
}
.dark { --pm-break: #92b8dd; }           /* brand-300 */
.pm-underline { text-decoration: underline; text-underline-offset: 2px; }
.pm-num { font-variant-numeric: tabular-nums; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }
.pm-dial {
    position: relative;
    width: var(--pm-ring);
    height: var(--pm-ring);
    margin: 0 auto;
}
.pm-dial svg {
    width: 100%; height: 100%;
    transform: rotate(-90deg);          /* 12 o'clock start */
    overflow: visible;
}
.pm-track { stroke: var(--stk-surface-3); }
.dark .pm-track { stroke: var(--stk-surface-2); }
.pm-progress {
    stroke: var(--pm-accent);
    transition: stroke-dashoffset 0.3s linear, stroke 0.4s ease;
}
.pm-dial[data-mode="short"] .pm-progress,
.pm-dial[data-mode="long"] .pm-progress { stroke: var(--pm-break); }
.pm-dial-face {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.375rem;
}
.pm-time {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 900;
    font-size: clamp(3.25rem, 13vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--stk-fg);
}
.pm-eyebrow {
    font-size: 0.6875rem; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.18em;
    color: var(--stk-fg-muted);
}
@keyframes pm-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
/* The session label breathes while the timer runs, which the visitor
   started; never under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
    .pm-dial[data-running="true"] .pm-eyebrow { animation: pm-breathe 3.4s ease-in-out infinite; }
}
.pm-dots { display: flex; gap: 0.375rem; margin-top: 0.25rem; }
.pm-dot {
    width: 6px; height: 6px; border-radius: 9999px;
    background: var(--stk-border-strong); transition: background 0.3s ease, transform 0.3s ease;
}
.pm-dot[data-on="true"] { background: var(--pm-accent); transform: scale(1.25); }
.dark .pm-dot[data-on="true"] { background: #5c93c7; }
.pm-ctl {
    width: 3.25rem; height: 3.25rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 1rem;
    background: var(--stk-surface-2); color: var(--stk-fg-3);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.pm-ctl:hover { background: var(--stk-surface-3); color: var(--stk-fg); }
.pm-primary {
    min-width: 9.5rem; height: 3.25rem;
    border-radius: 1rem;
    font-weight: 900; font-size: 1.0625rem; letter-spacing: -0.01em;
    color: var(--stk-accent-fg); background: var(--pm-accent);
    box-shadow: 0 10px 22px -10px rgb(31 92 150 / .75);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.pm-primary:hover { background: var(--pm-accent-dark); }
/* While running the button reads Pause: the same place, a quieter look, so
   the filled accent always means "start". */
.pm-primary[data-running="true"] {
    background: var(--stk-surface);
    color: var(--stk-accent-text);
    box-shadow: inset 0 0 0 2px var(--pm-accent);
}
.pm-primary[data-running="true"]:hover { background: var(--stk-accent-soft); }
@media (prefers-reduced-motion: no-preference) {
    .pm-ctl:hover, .pm-primary:hover { transform: translateY(-2px); }
}
.pm-modes {
    position: relative;
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem; padding: 0.3125rem;
    background: var(--stk-surface-2); border-radius: 9999px;
}
.pm-modes::before {
    content: ''; position: absolute;
    top: 0.3125rem; bottom: 0.3125rem;
    width: calc((100% - 0.625rem - 0.5rem) / 3);
    border-radius: 9999px; background: var(--stk-surface);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    transform: translateX(calc(var(--pm-i, 0) * (100% + 0.25rem)));
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    left: 0.3125rem;
}
.dark .pm-modes::before { background: var(--stk-surface-3); box-shadow: none; }
.pm-mode {
    position: relative; z-index: 1;
    padding: 0.5rem 0.25rem;
    border-radius: 9999px;
    font-size: 0.8125rem; font-weight: 700;
    color: var(--stk-fg-3);
    transition: color 0.2s ease;
    white-space: nowrap;
}
.pm-mode:hover { color: var(--stk-fg); }
.pm-mode[aria-selected="true"] { color: var(--stk-accent-text); }
.dark .pm-mode[aria-selected="true"] { color: #fff; }

/* Keyboard shortcuts under the controls. */
.pm-keys {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 0.35rem 1rem;
    padding: 0; list-style: none;
    font-size: 0.75rem; color: var(--stk-fg-3);
}
.pm-keys li { display: inline-flex; align-items: center; gap: 0.35rem; }

/* The "Set intervals" disclosure. */
.pm-disclose {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.75rem; font-weight: 700;
    color: var(--stk-fg-3);
    transition: color var(--stk-ease);
}
.pm-disclose:hover, .pm-disclose[aria-expanded="true"] { color: var(--stk-accent-text); }
.pm-chev { font-size: 0.65em; transition: transform 0.2s ease; }
.pm-disclose[aria-expanded="true"] .pm-chev { transform: rotate(180deg); }

.pm-row {
    display: grid;
    grid-template-columns: 2rem 1fr 2.75rem;
    align-items: center; gap: 0.875rem;
}
.pm-row-icon { text-align: center; color: var(--stk-fg-muted); transition: color 0.25s ease; }
.pm-row[data-active="true"] .pm-row-icon { color: var(--stk-accent-text); }
.pm-row-val {
    text-align: right; font-size: 0.6875rem; font-weight: 700;
    font-variant-numeric: tabular-nums; color: var(--stk-fg-3);
}
.pm-row[data-failed="true"] { opacity: 0.55; }
.pm-slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 18px; background: transparent; cursor: pointer;
}
.pm-slider::-webkit-slider-runnable-track {
    height: 5px; border-radius: 9999px;
    background: linear-gradient(to right,
        var(--pm-accent) 0%, var(--pm-accent) var(--pm-fill, 0%),
        var(--stk-surface-3) var(--pm-fill, 0%), var(--stk-surface-3) 100%);
}
.pm-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 15px; height: 15px; margin-top: -5px;
    border-radius: 9999px; background: #fff;
    border: 2px solid var(--pm-accent);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
    transition: transform 0.15s ease;
}
.pm-slider:hover::-webkit-slider-thumb { transform: scale(1.18); }
.pm-slider::-moz-range-track {
    height: 5px; border-radius: 9999px; background: var(--stk-surface-3);
}
.pm-slider::-moz-range-progress {
    height: 5px; border-radius: 9999px; background: var(--pm-accent);
}
.pm-slider::-moz-range-thumb {
    width: 15px; height: 15px; border-radius: 9999px;
    background: #fff; border: 2px solid var(--pm-accent);
}
.pm-slider:disabled { cursor: not-allowed; }
.pm-field {
    width: 100%; padding: 0.5rem 0.75rem;
    border: 1px solid var(--stk-border); border-radius: 0.75rem;
    background: var(--stk-bg); font-size: 0.875rem; font-weight: 600;
    font-variant-numeric: tabular-nums; color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.dark .pm-field { background: var(--stk-surface-2); border-color: var(--stk-surface-3); }
.pm-field:focus {
    outline: none; border-color: var(--pm-accent);
    box-shadow: 0 0 0 3px var(--pm-accent-soft);   /* same ring as .stk-search */
}
.pm-label {
    display: block; margin-bottom: 0.375rem;
    font-size: 0.6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--stk-fg-3);
}
.pm-kbd {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.7rem; line-height: 1;
    padding: 0.25rem 0.45rem; border-radius: 0.35rem;
    color: var(--stk-fg-3); background: var(--stk-surface-2); border: 1px solid var(--stk-border);
}
:focus-visible { outline: 2px solid var(--pm-accent); outline-offset: 2px; }
@media (max-width: 480px) {
    :root { --pm-ring: 244px; }
    .pm-ctl { width: 3rem; height: 3rem; }
    .pm-primary { min-width: 8rem; height: 3rem; }
}
@media (prefers-reduced-motion: reduce) {
    .pm-progress, .pm-modes::before, .pm-dot,
    .pm-ctl, .pm-primary, .pm-slider::-webkit-slider-thumb, .pm-chev {
        transition: none;
    }
}
