/*
 * The public pages people send each other: /play/, /gift/, /breathe/, /soundscape/, /year/.
 * A layer on the site's design (/commons/dm.css): the audio player, the share panel, form
 * fields and the page grids. Page-specific styles live next to each page.
 */

:root {
    color-scheme: dark;
    /* The names these pages' styles use, in the site's palette */
    --night-raised: #0f1a4a;
    --night-high: #17245e;
    --line: var(--hairline);
    --line-strong: rgba(242, 244, 255, 0.22);
    --text: var(--ink);
    --text-soft: var(--haze);
    --text-faint: var(--faint);
    --violet-bright: #9b6bff;
    --violet-glow: rgba(123, 43, 255, 0.8);
    --radius-small: var(--radius-sm);
}

/* The shared artwork, blurred into the sky behind the page (clipped, so the blur can't widen it) */
.backdrop {
    position: absolute;
    inset: 0 0 auto 0;
    z-index: -1;
    height: 620px;
    overflow: hidden;
    background-size: 0 0;
    pointer-events: none;
    /* Fades out, so the sky shows through below it whatever its shade there */
    -webkit-mask-image: linear-gradient(180deg, #000 35%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 35%, transparent 100%);
}

.backdrop::before {
    content: "";
    position: absolute;
    inset: -80px;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    filter: blur(70px) saturate(1.15);
    opacity: 0.4;
}

.backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(7, 12, 36, 0.15) 0%, rgba(7, 12, 36, 0.55) 100%);
}

/* The page, inside <main class="sky"> */

.page {
    display: grid;
    gap: 32px;
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 28px var(--gutter) 56px;
}

/* Grid items can shrink below their content (long links, unbroken words) */
.page > * {
    min-width: 0;
}

.page--narrow {
    max-width: calc(640px + 2 * var(--gutter));
}

/* Type */

.page h1 {
    margin-top: 8px;
    font-family: var(--serif);
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.1;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.serif {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.page h2.serif {
    font-size: clamp(28px, 3.6vw, 34px);
    line-height: 1.15;
    text-wrap: balance;
}

.lede {
    margin-top: 14px;
    font-size: clamp(17px, 2vw, 19px);
    line-height: 1.55;
    color: var(--haze);
}

.label {
    font-size: 14px;
    color: var(--faint);
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 14px;
    color: var(--haze);
}

.meta:empty {
    display: none;
}

.meta li + li::before {
    content: "·";
    margin: 0 18px 0 -10px;
    color: var(--faint);
}

.description {
    margin-top: 22px;
    color: var(--haze);
    overflow-wrap: anywhere;
}

/* Buttons (the rest are .btn in dm.css) */

.btn[disabled] {
    opacity: 0.6;
    cursor: default;
}

.btn--ghost {
    background: rgba(242, 244, 255, 0.04);
}

.button-icon {
    width: 20px;
    height: 20px;
    flex: none;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.actions > .btn {
    flex: 1 1 180px;
}

/* A raised panel */

.card {
    padding: clamp(22px, 3.4vw, 32px);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(242, 244, 255, 0.07) 0%, rgba(242, 244, 255, 0.025) 100%);
}

/* The app offer (a .trial-card from dm.css) */

.offer .h3 {
    overflow-wrap: anywhere;
}

.open-in-app {
    margin-top: 18px;
    text-align: center;
    font-size: 15px;
    color: var(--haze);
}

.open-in-app a {
    color: var(--ink);
    font-weight: 700;
}

/* Audio player */

.player {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 26px;
    padding: 12px 20px 12px 12px;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: rgba(12, 22, 64, 0.66);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.player-toggle {
    position: relative;
    flex: none;
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--violet) 0%, #4f5df0 100%);
    box-shadow: 0 12px 30px -10px var(--violet-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.player-toggle:hover,
.player-toggle:focus-visible {
    box-shadow: 0 16px 36px -10px rgba(123, 43, 255, 1), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.player-toggle:active {
    transform: scale(0.95);
}

.player-toggle svg {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 26px;
    height: 26px;
    fill: #fff;
}

.player-toggle .icon-play {
    transform: translateX(2px);
}

.player-toggle .icon-pause,
.player--playing .player-toggle .icon-play {
    display: none;
}

.player--playing .player-toggle .icon-pause {
    display: block;
}

.player-spinner {
    position: absolute;
    inset: -4px;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: spin 0.9s linear infinite;
    transition: opacity 0.2s ease;
}

.player--loading .player-spinner {
    opacity: 1;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.player-body {
    flex: 1;
    min-width: 0;
}

.player-track {
    position: relative;
    height: 6px;
    border-radius: 3px;
    background: rgba(242, 244, 255, 0.14);
}

.player-progress {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--lavender));
}

.player-limit {
    position: absolute;
    top: -5px;
    bottom: -5px;
    width: 2px;
    margin-left: -1px;
    border-radius: 1px;
    background: var(--gold);
}

.player-seek {
    position: absolute;
    inset: -12px 0;
    width: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.player-times {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

.player-note {
    margin-top: 12px;
    font-size: 14px;
    color: var(--faint);
}

.guide-picker {
    margin-top: 20px;
}

.guide-picker ul {
    padding: 0;
    list-style: none;
}

.guide-picker ul,
.guide-single {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.guide-picker button,
.guide-single {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px 6px 6px;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: var(--panel);
    font-size: 15px;
    font-weight: 600;
}

.guide-single {
    display: inline-flex;
    margin-top: 18px;
    color: var(--haze);
}

.guide-picker button {
    cursor: pointer;
}

.guide-picker button[aria-checked="true"] {
    border-color: var(--accent);
    background: rgba(140, 158, 255, 0.16);
}

.guide-picker img,
.guide-single img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.guide-picker button:not(:has(img)),
.guide-single:not(:has(img)) {
    padding-left: 16px;
}

/* Shown when a preview ends */
.preview-end {
    margin-top: 20px;
    padding: 22px;
    border: 1px solid rgba(255, 207, 115, 0.32);
    border-radius: var(--radius);
    background: rgba(255, 207, 115, 0.07);
}

.preview-end h2 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 26px;
    line-height: 1.2;
}

.preview-end p {
    margin-top: 8px;
    color: var(--haze);
}

.preview-end .btn {
    margin-top: 16px;
}

/* Forms */

.field {
    display: grid;
    gap: 8px;
}

.field + .field {
    margin-top: 20px;
}

.field label,
.field legend {
    font-size: 15px;
    font-weight: 700;
}

.field .hint {
    font-size: 13px;
    font-weight: 400;
    color: var(--faint);
}

.input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: rgba(242, 244, 255, 0.04);
    color: var(--ink);
    font: inherit;
    font-size: 16px;
}

.input::placeholder {
    color: var(--faint);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(140, 158, 255, 0.08);
}

textarea.input {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

.counter {
    justify-self: end;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

/* A row of choices you can press (.chip in dm.css is a label, not a button) */

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(242, 244, 255, 0.04);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.pill[aria-pressed="true"] {
    border-color: var(--accent);
    background: rgba(140, 158, 255, 0.16);
}

.form-error {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 92, 120, 0.12);
    color: #ffb3c0;
    font-size: 15px;
}

@media (hover: hover) {
    .pill:hover {
        border-color: var(--accent);
    }
}

/* Share panel (browsers without a share sheet) */

.share-panel {
    width: min(420px, calc(100% - 32px));
    padding: 0;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    background: var(--night-mid);
    color: var(--ink);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}

.share-panel::backdrop {
    background: rgba(4, 7, 22, 0.66);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.share-panel-inner {
    padding: 22px;
}

.share-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.share-panel h2 {
    font-family: var(--serif);
    font-size: 26px;
    font-weight: 600;
}

.share-panel-close {
    width: 40px;
    height: 40px;
    margin-right: -8px;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.share-panel-close svg {
    width: 22px;
    height: 22px;
}

.share-panel-url {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(242, 244, 255, 0.05);
    font-size: 14px;
    color: var(--haze);
    overflow-wrap: anywhere;
}

.share-panel-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.share-panel-options a,
.share-panel-options button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(242, 244, 255, 0.04);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.share-panel-options a:hover,
.share-panel-options button:hover {
    border-color: var(--accent);
}

/* Toast */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 60;
    padding: 12px 20px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--night);
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translate(-50%, 16px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast--visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Wider screens: the main column on the left, the offer beside it */

@media (min-width: 880px) {
    .page {
        padding-top: 48px;
        padding-bottom: 80px;
    }

    .page--split {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        gap: 56px;
        align-items: start;
    }

    .page--split > .offer,
    .page--split > aside {
        position: sticky;
        top: calc(var(--header-height) + 24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .player-spinner {
        animation-duration: 2.4s;
    }

    .player-toggle,
    .pill,
    .toast {
        transition: none;
    }
}
