/* Advent Calendar 2026 — built from the Figma file "Untitled" (iPhone 18 Pro frame, 402×874).
   Munson (the design's serif) isn't licensed for the web here, so Gelasio stands in for it. */

@font-face {
    font-family: 'Serif';
    src: url('/adventcalendar/assets/fonts/gelasio-latin-400-normal.woff2')
        format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Serif';
    src: url('/adventcalendar/assets/fonts/gelasio-latin-400-italic.woff2')
        format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Serif';
    src: url('/adventcalendar/assets/fonts/gelasio-latin-700-normal.woff2')
        format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Serif';
    src: url('/adventcalendar/assets/fonts/gelasio-latin-700-italic.woff2')
        format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

:root {
    --cream: #fff2dd;
    --red: #931d16;
    --ink: #000;
    --muted: #898989;
    --serif: 'Munson', 'Serif', Georgia, 'Times New Roman', serif;
    --sans:
        'Neue Haas Grotesk Display Pro', 'Helvetica Neue', Helvetica, Arial,
        sans-serif;
    --s: 1; /* artboard scale, set by app.js */
    --cs: 1; /* card scale, set by app.js */
}

* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    padding: 0;
    background: var(--cream);
}
body {
    font-family: var(--serif);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}
p,
h1,
h2,
ol {
    margin: 0;
}
[hidden] {
    display: none !important;
}

/* ---------- Home screen (artboard) ---------- */
.viewport {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
}
.viewport-inner {
    width: calc(402px * var(--s));
    height: calc(874px * var(--s));
    position: relative;
}
.artboard {
    position: absolute;
    top: 0;
    left: 0;
    width: 402px;
    height: 874px;
    transform: scale(var(--s));
    transform-origin: top left;
    background: var(--cream);
}

.title {
    position: absolute;
    left: 73px;
    top: 36px;
    width: 256px;
    height: 44px;
    font-weight: 700;
}
.title svg {
    display: block;
    overflow: visible;
}
.title text {
    font-family: var(--serif);
    font-weight: 700;
    font-style: italic;
    font-size: 19px;
    fill: var(--ink);
}

.today {
    position: absolute;
    left: 193.5px;
    top: 85px;
    transform: translate(-50%, -50%);
    font-style: italic;
    font-size: 18px;
    white-space: nowrap;
}

.panel {
    position: absolute;
    left: 34.46px;
    top: 409.74px;
    width: 332.27px;
    height: 423.26px;
    background: url('/adventcalendar/assets/panel.webp') center / 100% 100%
        no-repeat;
}

.stage {
    position: absolute;
    left: 25px;
    top: 101.97px;
    width: 351.8px;
    height: 338.03px;
    z-index: 2;
    pointer-events: none;
    user-select: none;
}

.grid {
    position: absolute;
    left: 47.7px;
    top: 446.21px;
    width: 305.46px;
    display: grid;
    grid-template-columns: repeat(5, 54.851px);
    column-gap: 7.566px;
    row-gap: 18.914px;
    z-index: 1;
}

.day {
    position: relative;
    width: 54.851px;
    height: 54.851px;
    border-radius: 6.62px;
    overflow: hidden;
    /* Figma: Day block component fill — angled crayon texture filling the gaps around the box art */
    background: url('/adventcalendar/assets/block-backing.webp') center / 100%
        100% no-repeat;
    font-weight: 700;
    font-style: italic;
    font-size: 17.023px;
    line-height: 1;
    transition: transform 0.15s ease;
}
/* box art placed exactly like the Figma 'day block' layer (y −2.84, 55.16×57.69, image crop) */
.day::before {
    content: '';
    position: absolute;
    left: 0;
    top: -2.837px;
    width: 55.161px;
    height: 57.688px;
    background: url('/adventcalendar/assets/block-full.webp') -3.26px -13.22px /
        61.703px 88.338px no-repeat;
}
/* number centered on the white oval (oval center ≈ 26.9px, 24.8px in the box) */
.day span {
    position: absolute;
    left: 27.1px;
    top: 27.8px;
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: 'lnum' 1;
    transform: translate(-50%, -50%);
    white-space: nowrap;
}
.day:active {
    transform: scale(0.96);
}
.day:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 3px;
}

/* current_day variant: the glowing box */
.day.is-today {
    background-image: none;
    background-color: #ffda6b;
    box-shadow:
        0 0 15.131px 2.837px rgba(255, 211, 81, 0.6),
        0 0 4.729px 1.891px rgba(255, 211, 81, 0.95);
    animation: glow 2.4s ease-in-out infinite;
}
@keyframes glow {
    0%,
    100% {
        box-shadow:
            0 0 15.131px 2.837px rgba(255, 211, 81, 0.6),
            0 0 4.729px 1.891px rgba(255, 211, 81, 0.95);
    }
    50% {
        box-shadow:
            0 0 22px 5px rgba(255, 211, 81, 0.75),
            0 0 6px 2.5px rgba(255, 211, 81, 1);
    }
}

/* Future days: stuck — tries to pop out but can't */
.day.is-locked {
    cursor: not-allowed;
}
.day.shake {
    animation: stuck 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes stuck {
    0% {
        transform: translate(0, 0) rotate(0);
    }
    12% {
        transform: translate(-2px, -3px) rotate(-3deg) scale(1.04);
    }
    24% {
        transform: translate(2px, 0) rotate(3deg);
    }
    36% {
        transform: translate(-2px, -2px) rotate(-2.5deg) scale(1.03);
    }
    48% {
        transform: translate(2px, 0) rotate(2deg);
    }
    60% {
        transform: translate(-1.5px, -1px) rotate(-1.5deg);
    }
    72% {
        transform: translate(1px, 0) rotate(1deg);
    }
    86% {
        transform: translate(-0.5px, 0) rotate(-0.5deg);
    }
    100% {
        transform: translate(0, 0) rotate(0);
    }
}

/* Quiet "view all / view today" toggle (mainly for testing) */
.view-toggle {
    position: absolute;
    left: 50%;
    top: 841px;
    transform: translateX(-50%);
    font-family: var(--sans);
    font-size: 9px;
    letter-spacing: 0.02em;
    color: #cdbfa9;
    padding: 6px 10px;
    z-index: 3;
}
.music-toggle {
    position: absolute;
    left: 10px;
    top: 10px;
    font-family: var(--sans);
    font-size: 9px;
    letter-spacing: 0.02em;
    color: #cdbfa9;
    padding: 6px 10px;
    z-index: 3;
}
.music-toggle[aria-pressed='true'] {
    color: #931d16;
}
.music-toggle:focus {
    outline: none;
}
.music-toggle:focus-visible {
    outline: 1px solid #cdbfa9;
    border-radius: 4px;
}
.view-toggle:focus {
    outline: none;
}
.view-toggle:focus-visible {
    outline: 1px solid #cdbfa9;
    border-radius: 4px;
}

/* ---------- Overlays ---------- */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.scrim {
    position: absolute;
    inset: 0;
    background: rgba(40, 22, 10, 0.45);
    animation: fade 0.25s ease both;
}
@keyframes fade {
    from {
        opacity: 0;
    }
}

/* Day 1: card starts small so the confetti can burst out from behind it, then springs to full size */
.card-wrap.celebrate {
    animation: celebrate 1.6s cubic-bezier(0.3, 0, 0.2, 1) both;
}
.card-wrap.celebrate .card {
    animation: none;
}
@keyframes celebrate {
    0% {
        transform: scale(0.35);
        opacity: 0;
    }
    12% {
        transform: scale(0.5);
        opacity: 1;
    }
    50% {
        transform: scale(0.53);
    }
    85% {
        transform: scale(1.03);
    }
    100% {
        transform: scale(1);
    }
}

/* Day 1 confetti: crayon-textured pieces that spring out from behind the card */
.confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.confetti svg {
    position: absolute;
    left: 50%;
    top: 50%;
    overflow: visible;
    will-change: transform, opacity;
}
.confetti svg * {
    filter: url(#crayon);
}

.card-wrap {
    position: relative;
    width: calc(335px * var(--cs));
    height: calc(718px * var(--cs));
}
.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 335px;
    height: 718px;
    border-radius: 8px;
    overflow: hidden;
    transform: scale(var(--cs));
    transform-origin: top left;
    background: url('/adventcalendar/assets/card-bg.webp') center / 329px 715px
        no-repeat;
    animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes pop {
    from {
        opacity: 0;
        transform: scale(calc(var(--cs) * 0.85));
    }
}

.close {
    position: absolute;
    right: 32px;
    top: 30px;
    width: 24px;
    height: 24px;
    margin: -5px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}
.close img {
    width: 15px;
    height: 15px;
}
.close:focus {
    outline: none;
}
.close:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
    border-radius: 4px;
}

.day-heading {
    position: absolute;
    left: 31px;
    top: 37px;
    font-weight: 700;
    font-size: 16px;
    z-index: 2;
}

.card-scroll {
    position: absolute;
    top: 66px;
    bottom: 23px;
    left: calc(50% - 1px);
    transform: translateX(-50%);
    width: 277px;
    padding: 0 3px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    scrollbar-width: none;
}
.card-scroll::-webkit-scrollbar {
    display: none;
}
.card-info {
    width: 271px;
    min-height: 561px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-shrink: 0;
}

/* Verse reader */
.verse-reader {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 271px;
}
.readings {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 8px;
}
.reading-list {
    font-size: 10px;
    line-height: normal;
}
.links {
    font-family: var(--sans);
    font-style: italic;
    font-weight: 500;
    font-size: 8px;
    color: var(--red);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}
.links a {
    white-space: nowrap;
    color: inherit;
    text-decoration: underline;
    text-underline-position: from-font;
}
.verse-div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 112px;
    justify-content: center;
    margin-top: -6px;
}
.verse-text {
    font-size: 12px;
    line-height: normal;
    white-space: pre-line;
    overflow-wrap: break-word;
}
.verse-text.collapsed {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 18;
    line-clamp: 18;
    overflow: hidden;
}
.expand {
    align-self: flex-start;
    font-weight: 700;
    font-size: 10px;
    padding: 4px 0;
}
.verse-nav {
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 8px;
    padding: 4px 0;
}
.verse-nav img {
    width: 6.585px;
    height: 11.166px;
}

/* Daily activity */
.activity {
    position: relative;
    width: 271px;
    min-height: 165px;
    padding: 18px 20px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    text-align: center;
    font-weight: 700;
    background: url('/adventcalendar/assets/activity-bg.webp') center 2.83px /
        271px calc(100% - 2px) no-repeat;
}
.activity-label {
    font-size: 12px;
    text-decoration: underline;
    text-underline-position: from-font;
}
.activity-text {
    font-size: 14px;
    line-height: normal;
    max-width: 192px;
}

/* Reflections */
.reflection {
    position: relative;
    width: 271px;
    padding: 21px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 12px;
    line-height: normal;
}
/* Hand-drawn (crayon brush) border, drawn to fit each card's box */
.brush-border {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}
.brush-border rect {
    fill: none;
    stroke: var(--red);
    filter: url(#crayon);
}
.brush-main {
    stroke-width: 5;
}
.brush-soft {
    stroke-width: 6.5;
    opacity: 0.22;
}
.reflection-title {
    font-weight: 700;
}
.reflection ol {
    padding-left: 18px;
}
.reflection li + li {
    margin-top: 0;
}
.reflection-note {
    font-style: italic;
    font-size: 10px;
}

/* Copyright */
.copyright {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: var(--sans);
    font-size: 7px;
    line-height: normal;
    color: var(--muted);
    text-align: center;
    padding-bottom: 4px;
    flex-shrink: 0;
}
.copyright a {
    color: inherit;
    text-decoration: underline;
}

/* Welcome card (Opening_page) */
.welcome {
    border-radius: 8px;
}
.welcome .close {
    top: 30px;
    right: 30px;
}
.welcome-body {
    position: absolute;
    inset: 0;
    padding: 60px 80px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    font-style: italic;
    font-size: 18px;
    line-height: normal;
    text-align: center;
}
.welcome-title {
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .day.is-today {
        animation: none;
    }
    .day.shake {
        animation-duration: 0.3s;
    }
    .card,
    .scrim {
        animation: none;
    }
}
