* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    color: #8a2f55;
    font-family: "DM Sans", sans-serif;
    -webkit-tap-highlight-color: transparent;

    /* pink plaid, made with stripes in two directions */
    background-color: #f8dbe2;
    background-image:
        repeating-linear-gradient(45deg,
            transparent 0 34px,
            rgba(52, 82, 84, 0.5) 34px 36px,
            transparent 36px 46px,
            rgba(225, 90, 130, 0.4) 46px 49px,
            rgba(225, 90, 130, 0.18) 49px 60px,
            transparent 60px 80px),
        repeating-linear-gradient(-45deg,
            transparent 0 34px,
            rgba(52, 82, 84, 0.5) 34px 36px,
            transparent 36px 46px,
            rgba(225, 90, 130, 0.4) 46px 49px,
            rgba(225, 90, 130, 0.18) 49px 60px,
            transparent 60px 80px);
    background-attachment: fixed;
}

.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 32px 16px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.title,
.subtitle {
    background: #fff7f2;
    padding: 4px 16px;
    border-radius: 999px;
}

.title {
    font-family: "DM Serif Display", serif;
    font-weight: normal;
    font-size: 30px;
    margin-bottom: 24px;

}

.subtitle {
    font-family: "DM Serif Display", serif;
    font-size: 17px;
    margin-bottom: 16px;
}

/* --- the calendar grid (phone: 4 columns × 8 rows) --- */

.calendar {
    width: 100%;
    aspect-ratio: 4 / 8;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(8, minmax(0, 1fr));
    gap: 10px;
}

/* the button itself is the pink space behind the door */
.door {
    appearance: none;
    position: relative;
    overflow: hidden;
    perspective: 700px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: #f7a8c4;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(90, 30, 55, 0.25);
    transition: scale 0.15s;
}

.door:focus {
    outline: none;
}

.door:active {
    scale: 0.97;
}

.door.wide,
.door.tall {
    font-size: 34px;
}

.door.big {
    font-size: 56px;
}

/* the door you can open today glows a little */
.door.today {
    box-shadow: 0 0 0 3px #e15a82, 0 6px 14px rgba(90, 30, 55, 0.25);
}

.door.locked {
    cursor: default;
}

/* --- what's behind the door (placeholder for now) --- */

.inside {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: "DM Sans", sans-serif;
    font-size: 14px;
    font-weight: 700;
}

.door.big .inside {
    font-size: 20px;
}

/* --- the front of the door (every style shares this) --- */

.cover {
    position: absolute;
    inset: 0;
    background: #fff7f2;
    transition: transform 0.7s cubic-bezier(0.3, 0.7, 0.3, 1), opacity 0.4s;
}

.num {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b8406f;
    font-family: "DM Serif Display", serif;
    pointer-events: none;
    transition: opacity 0.3s;
}

.door.locked .num {
    color: #d99ab3;
}

/* little round knob used on doors and drawers */
.knob {
    position: absolute;
    width: 7%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #e7b3c6;
}

/* 1. little door: swings open on the left hinge */
.style-door .panel {
    transform-origin: left center;
}

.style-door .panel .knob {
    right: 10%;
    top: 50%;
}

.style-door.opened .panel {
    transform: rotateY(-105deg);
}

/* 2. double doors: two halves swing open from the middle */
.style-double .leaf.left {
    inset: 0 50% 0 0;
    transform-origin: left center;
    box-shadow: inset -1px 0 0 #f1d3dd;
}

.style-double .leaf.right {
    inset: 0 0 0 50%;
    transform-origin: right center;
}

.style-double .leaf.left .knob { right: 8%; top: 72%; width: 8%; }
.style-double .leaf.right .knob { left: 8%; top: 72%; width: 8%; }

.style-double.opened .leaf.left { transform: rotateY(-105deg); }
.style-double.opened .leaf.right { transform: rotateY(105deg); }
.style-double.opened > .num { opacity: 0; }

/* 3. drawer: slides down and out */
.style-drawer .front .handle {
    position: absolute;
    left: 35%;
    width: 30%;
    top: 74%;
    height: 6%;
    border-radius: 999px;
    background: #e7b3c6;
}

.style-drawer.opened .front {
    transform: translateY(72%);
    box-shadow: 0 -6px 10px rgba(90, 30, 55, 0.15);
}

/* 4. envelope: flap flips up, then the envelope slides away */
.style-envelope .env-body .num {
    align-items: flex-end;
    padding-bottom: 10%;
}

.style-envelope .env-flap {
    inset: 0 0 auto 0;
    height: 55%;
    z-index: 2;
    background: #f5dbe3;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform 0.5s ease, opacity 0.3s 0.4s;
}

.style-envelope.opened .env-flap {
    transform: rotateX(180deg);
    opacity: 0;
}

.style-envelope.opened .env-body {
    transform: translateY(105%);
    transition-delay: 0.35s;
}

/* 5. gift box: lid pops off, then the box drops away */
.style-gift .box {
    background: #fff7f2 linear-gradient(to right, transparent 44%, #e15a82 44%, #e15a82 56%, transparent 56%);
}

.style-gift .lid {
    inset: 0 0 auto 0;
    height: 24%;
    z-index: 2;
    background: #fde0e8 linear-gradient(to right, transparent 44%, #c94572 44%, #c94572 56%, transparent 56%);
    box-shadow: 0 3px 0 rgba(90, 30, 55, 0.12);
    transition: transform 0.5s ease, opacity 0.4s 0.3s;
}

.style-gift .num-text {
    background: #fff7f2;
    padding: 0 0.2em;
    border-radius: 8px;
    line-height: 1.1;
}

.style-gift.opened .lid {
    transform: translateY(-120%) rotate(-12deg);
    opacity: 0;
}

.style-gift.opened .box {
    transform: translateY(105%);
    transition-delay: 0.3s;
}

/* 6. flip card: turns over */
.style-flip .card {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.style-flip.opened .card {
    transform: rotateY(180deg);
}

/* doors that were already opened before: no animation on page load */
.door.instant .cover,
.door.instant .num {
    transition: none !important;
}

/* wiggle when a locked door is tapped */
.wiggle {
    animation: wiggle 0.45s ease;
}

@keyframes wiggle {
    0%, 100% { rotate: 0deg; }
    20%      { rotate: -5deg; }
    40%      { rotate: 5deg; }
    60%      { rotate: -3deg; }
    80%      { rotate: 3deg; }
}

/* --- message at the bottom --- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    translate: -50% 20px;
    background: #fff7f2;
    color: #8a2f55;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: bold;
    box-shadow: 0 6px 16px rgba(90, 30, 55, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, translate 0.25s;
}

.toast.show {
    opacity: 1;
    translate: -50% 0;
}

/* --- laptop / MacBook: 8 columns × 4 rows, bigger --- */

@media (min-width: 700px) {
    .page {
        max-width: 1000px;
    }

    .title {
        font-size: 40px;
    }

    .calendar {
        aspect-ratio: 8 / 4;
        grid-template-columns: repeat(8, minmax(0, 1fr));
        grid-template-rows: repeat(4, minmax(0, 1fr));
        gap: 14px;
    }

    .door {
        font-size: 32px;
    }

    .door.wide,
    .door.tall {
        font-size: 40px;
    }

    .door.big {
        font-size: 76px;
    }
}

/* --- label behind an opened door --- */

/* label behind an opened door: fixed sizes so they all match */
.inside-label {
    font-size: 12px;
    text-align: center;
    line-height: 1.2;
    padding: 0 6px;
}

.door.wide .inside-label,
.door.tall .inside-label {
    font-size: 13px;
}

.door.big .inside-label {
    font-size: 16px;
}

@media (min-width: 700px) {
    .inside-label {
        font-size: 14px;
    }

    .door.wide .inside-label,
    .door.tall .inside-label {
        font-size: 15px;
    }

    .door.big .inside-label {
        font-size: 18px;
    }
}

/* --- pop-up card --- */

.hidden {
    display: none !important;
}

.viewer {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(90, 30, 55, 0.35);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease;
}

.viewer-card {
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    background: #fff7f2;
    border-radius: 18px;
    padding: 28px 24px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 20px 50px rgba(90, 30, 55, 0.35);
    animation: popIn 0.35s ease;
}

#viewer-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.viewer-close {
    appearance: none;
    align-self: center;
    background: #f7a8c4;
    color: white;
    border: none;
    border-radius: 999px;
    padding: 10px 28px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

/* shared text styles inside the card */
.card-kicker {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #c94572;
}

.card-title {
    font-family: "DM Serif Display", serif;
    font-weight: normal;
    font-size: 30px;
    line-height: 1.15;
}

.card-text {
    font-size: 17px;
    line-height: 1.55;
    color: #6e2a47;
    white-space: pre-line; /* lets \n make a new line */

}

.card-small {
    font-size: 14px;
    color: #b06a8a;
}

/* letter: left-aligned like real writing */
.type-letter #viewer-content {
    text-align: left;
}

.type-letter .card-title {
    text-align: center;
}

.card-sign {
    font-family: "DM Serif Display", serif;
    font-size: 22px;
    color: #c94572;
    text-align: left;
}

/* voucher: a ticket with dashed edges */
.voucher {
    border: 2px dashed #e15a82;
    border-radius: 14px;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fde8ee;
}

/* song: listen button */
.listen-btn {
    align-self: center;
    display: inline-block;
    background: #345254;
    color: white;
    text-decoration: none;
    border-radius: 999px;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 700;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes popIn {
    from { opacity: 0; scale: 0.9; }
    to   { opacity: 1; scale: 1; }
}

/* letters and notes in a classic serif */
.type-letter .card-text,
.type-note .card-text {
    font-family: "Times New Roman", Times, serif;
    font-size: 19px;
    line-height: 1.5;
}

/* day number in the corner of an opened door */
.inside-day {
    position: absolute;
    top: 6px;
    left: 9px;
    font-family: "DM Serif Display", serif;
    font-size: 14px;
    font-weight: normal;
    color: white;
    opacity: 0.95;
}

.door.wide .inside-day,
.door.tall .inside-day {
    font-size: 16px;
}

.door.big .inside-day {
    top: 10px;
    left: 14px;
    font-size: 20px;
}

/* a bit bigger on a laptop */
@media (min-width: 700px) {
    .inside-day {
        font-size: 16px;
    }

    .door.wide .inside-day,
    .door.tall .inside-day {
        font-size: 18px;
    }

    .door.big .inside-day {
        font-size: 24px;
    }
}

.reveal-btn {
    appearance: none;
    align-self: center;
    background: white;
    color: #b8406f;
    border: 2px solid #f7a8c4;
    border-radius: 999px;
    padding: 8px 22px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.card-answer {
    font-family: "DM Serif Display", serif;
    font-size: 20px;
    color: #c94572;
    animation: popIn 0.35s ease;
}

/* only the christmas letter (day 25) gets a wider, taller card */
.viewer-card.day-25 {
    max-width: 640px;
    max-height: 90vh;
}

/* on a phone: less padding around the card and inside it, so more text fits */
@media (max-width: 699px) {
    .viewer {
        padding: 12px;
    }

    .viewer-card.day-25 {
        padding: 22px 18px 18px;
    }
}

.viewer-close:focus {
    outline: none;
}

