/* at-moment card kit: base layout + dock + toast + reveal.
   Each design sets its own colours through the custom properties below
   and styles everything else in its own index.html. */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    background: var(--page-bg, #e8e5e0);
    display: flex;
    justify-content: center;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
p, h1, h2, h3, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Stage: the phone-sized card ---------- */
.stage {
    position: relative;
    width: 100%;
    max-width: 450px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg, #fff);
    color: var(--ink, #222);
    isolation: isolate;
}
@media (min-width: 451px) {
    .stage { box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 30px 80px -20px rgba(0,0,0,.35); }
}

/* Content sits under the cover from the start, so the opening animation reveals it */
.content {
    position: absolute;
    inset: 0;
    overflow-x: hidden;
    overflow-y: hidden;
    overscroll-behavior: contain;
    scrollbar-width: none;
    padding-bottom: 120px; /* clears the dock */
    z-index: 1;
}
.content::-webkit-scrollbar { display: none; }
.is-open .content { overflow-y: auto; }

.cover {
    position: absolute;
    inset: 0;
    z-index: 20;
    cursor: pointer;
}
.is-open .cover { pointer-events: none; }
.is-done .cover { display: none; }

.open-btn {
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
}
.open-btn:focus-visible,
.dock__btn:focus-visible,
.action:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 3px; }

/* ---------- Scroll reveal (only when JS runs) ---------- */
.js [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 1s cubic-bezier(.22,1,.36,1), transform 1s cubic-bezier(.22,1,.36,1);
    transition-delay: var(--d, 0ms);
}
.js [data-reveal="zoom"] { transform: scale(.92); }
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="left"] { transform: translateX(-26px); }
.js [data-reveal="right"] { transform: translateX(26px); }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Countdown base ---------- */
.cd {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    text-align: center;
}
.cd__n { display: block; font-variant-numeric: tabular-nums; }
.cd__l { display: block; }

/* ---------- Generic action button inside content ---------- */
.action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    border: 0;
}
.action svg { width: 16px; height: 16px; flex: none; }

/* ---------- Dock (built by card-kit.js) ---------- */
[data-dock] {
    position: absolute;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 30;
    display: flex;
    gap: 2px;
    padding: 6px;
    border-radius: 999px;
    background: var(--dock-bg, rgba(255,255,255,.85));
    color: var(--dock-fg, #222);
    border: 1px solid var(--dock-line, rgba(0,0,0,.06));
    box-shadow: 0 12px 30px -10px rgba(0,0,0,.35);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transform: translate(-50%, 160%);
    transition: transform .9s cubic-bezier(.22,1,.36,1) .3s;
}
.is-open [data-dock] { transform: translate(-50%, 0); }
.dock__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 58px;
    height: 50px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background .25s;
}
.dock__btn:hover { background: var(--dock-hover, rgba(0,0,0,.06)); }
.dock__btn svg { width: 19px; height: 19px; }
.dock__btn span {
    font: 500 9px/1 var(--dock-font, system-ui, sans-serif);
    letter-spacing: .06em;
    text-transform: uppercase;
}
.dock__btn--music[aria-pressed="true"] { color: var(--dock-accent, var(--accent, currentColor)); }
.eq rect { transform-origin: 50% 100%; transform-box: fill-box; }
.dock__btn--music[aria-pressed="true"] .eq rect { animation: eq 1s ease-in-out infinite; }
.dock__btn--music[aria-pressed="true"] .eq rect:nth-child(2) { animation-delay: -.35s; }
.dock__btn--music[aria-pressed="true"] .eq rect:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

/* ---------- Toast ---------- */
.toast {
    position: absolute;
    left: 50%;
    top: 18px;
    z-index: 40;
    max-width: calc(100% - 40px);
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(20,20,20,.88);
    color: #fff;
    font: 500 13px/1.3 system-ui, sans-serif;
    text-align: center;
    transform: translate(-50%, -150%);
    opacity: 0;
    transition: transform .45s cubic-bezier(.22,1,.36,1), opacity .3s;
    pointer-events: none;
}
.toast.is-shown { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Credit footer ---------- */
.credit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 36px 20px 10px;
    font: 400 10px/1.4 var(--dock-font, system-ui, sans-serif);
    letter-spacing: .18em;
    text-transform: uppercase;
    opacity: .75;
}
.credit a { color: inherit; text-decoration: none; display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.credit img { width: 74px; height: auto; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        transition-delay: 0ms !important;
    }
}
