/* /breathe/: the breathing exercise. The shared styles are in /commons/growth/growth.css. */

.breathe-heading {
    margin-top: 10px;
    font-size: 34px;
    line-height: 1.2;
}

.pattern-chips {
    margin-top: 20px;
}

.pattern-chips .pill {
    text-decoration: none;
}

.pill-timing {
    margin-left: 4px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
}

.breathe {
    margin-top: 24px;
    padding: 24px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(12, 22, 64, 0.6);
}

.breathe-pattern-name {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
}

/* The circle: grows as you breathe in, shrinks as you breathe out */
.stage {
    position: relative;
    width: min(100%, 320px);
    aspect-ratio: 1;
    margin: 20px auto 0;
}

.stage-ring {
    position: absolute;
    inset: 0;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 50%;
}

.stage-circle {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 45%),
        radial-gradient(circle, #9a5cff 0%, #7b2bff 55%, #4b1aa8 100%);
    box-shadow: 0 0 60px 10px rgba(123, 43, 255, 0.45), inset 0 0 40px rgba(255, 255, 255, 0.12);
    transform: scale(0.42);
    will-change: transform;
}

.breathe[data-step="hold_full"] .stage-circle,
.breathe[data-step="hold_empty"] .stage-circle {
    animation: hold-glow 2.4s ease-in-out infinite;
}

@keyframes hold-glow {
    50% {
        box-shadow: 0 0 80px 18px rgba(154, 92, 255, 0.55), inset 0 0 40px rgba(255, 255, 255, 0.18);
    }
}

.stage-text {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 4px;
    text-align: center;
    pointer-events: none;
}

.stage-phase {
    max-width: 12em;
    padding: 0 12px;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 500;
    font-size: 24px;
    line-height: 1.25;
    text-shadow: 0 2px 12px rgba(7, 12, 36, 0.6);
}

.stage-count {
    min-height: 1.2em;
    font-size: 40px;
    font-weight: 300;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 12px rgba(7, 12, 36, 0.6);
}

.stage-progress {
    margin-top: 16px;
    font-size: 14px;
    text-align: center;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

/* Controls */

.controls {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.controls-start .icon-pause,
.controls-start--pause .icon-play {
    display: none;
}

.controls-start--pause .icon-pause {
    display: block;
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.control-select {
    width: auto;
    min-width: 0;
    max-width: 100%;
    padding: 10px 36px 10px 14px;
    font-size: 15px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='white' stroke-opacity='0.7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
}

.control-select option {
    background: var(--night-raised);
    color: var(--text);
}

.control {
    flex: 1 1 auto;
    min-width: 0;
}

.control:first-child .control-select {
    width: 100%;
}

/* A switch */
.toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--text-soft);
    cursor: pointer;
}

.toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.toggle-track {
    position: relative;
    flex: none;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    transition: background-color 0.15s ease;
}

.toggle-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s ease;
}

.toggle input:checked + .toggle-track {
    background: var(--violet);
}

.toggle input:checked + .toggle-track::after {
    transform: translateX(18px);
}

.toggle input:focus-visible + .toggle-track {
    outline: 2px solid var(--violet-bright);
    outline-offset: 3px;
}

.link-button {
    justify-self: center;
    padding: 6px 10px;
    border: 0;
    background: none;
    font-size: 14px;
    color: var(--text-soft);
    text-decoration: underline;
    cursor: pointer;
}

.share-row {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.share-row .btn {
    min-width: 200px;
}

/* The end */

.finished {
    margin-top: 22px;
    text-align: center;
    border-color: rgba(154, 92, 255, 0.5);
    background: rgba(123, 43, 255, 0.12);
}

.finished:focus {
    outline: none;
}

.finished h2 {
    font-size: 26px;
    line-height: 1.3;
}

.finished p {
    margin-top: 8px;
    color: var(--text-soft);
}

.finished .actions {
    justify-content: center;
}

/* Your own pattern */

.custom {
    margin-top: 22px;
    padding: 16px 18px;
}

.custom summary {
    font-weight: 600;
    cursor: pointer;
}

.custom-hint {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-faint);
}

.custom-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0 16px;
}

.custom-field + .custom-field {
    margin-top: 0;
}

.custom-field span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-soft);
}

.custom-field .input {
    padding: 10px 12px;
    font-variant-numeric: tabular-nums;
}

/* How to, and the other patterns */

.breathe-aside {
    display: grid;
    gap: 24px;
}

.howto h2 {
    font-size: 20px;
    font-weight: 600;
}

.howto h3 {
    margin-top: 20px;
    font-size: 16px;
    font-weight: 600;
}

.howto p {
    margin-top: 8px;
    color: var(--text-soft);
}

.howto-steps {
    margin-top: 14px;
    padding-left: 0;
    counter-reset: step;
    display: grid;
    gap: 10px;
}

.howto-steps li {
    position: relative;
    padding-left: 36px;
    color: var(--text-soft);
    counter-increment: step;
}

.howto-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 1px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(123, 43, 255, 0.3);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.howto-note {
    font-size: 14px;
    color: var(--text-faint) !important;
}

.pattern-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.pattern-list a {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: rgba(255, 255, 255, 0.03);
    text-decoration: none;
}

.pattern-list a:hover,
.pattern-list a:focus-visible {
    border-color: var(--violet-bright);
}

.pattern-list-name {
    font-weight: 600;
}

.pattern-list-copy {
    font-size: 14px;
    color: var(--text-soft);
}

@media (min-width: 880px) {
    .breathe-heading {
        font-size: 44px;
    }

    .breathe {
        padding: 28px 28px;
    }

    .stage {
        width: 340px;
    }

    .stage-phase {
        font-size: 28px;
    }

    .breathe-aside {
        position: sticky;
        top: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stage-circle {
        transform: scale(0.8) !important;
        opacity: 0.6;
    }
}
