/* Original eight design colours + two pet-only fur colours. */
:root {
    --ivory: #FAF6F0;
    --cream: #F0E5DA;
    --peony: #E8BCC9;
    --rose: #C58E9F;
    --sage: #A6B49A;
    --olive: #71806A;
    --ink: #57454B;
    --gold: #D2B68B;
    --pet-dark: #36312F;
    --tabby: #9C8063;
    color-scheme: light;
    font-family: Georgia,'Times New Roman',serif;
    color: var(--ink);
    background: var(--cream);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

*,*::before,*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 280px;
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
    color: inherit;
}

button:focus-visible, video:focus-visible {
    outline: 2px solid var(--olive);
    outline-offset: 5px;
}

[hidden] {
    display: none!important;
}

.art-library {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

.letter {
    max-width: 440px;
    min-height: 100vh;
    margin: 0 auto;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--ivory);
    padding: 0 clamp(30px,8.4vw,40px);
    text-align: center;
}

@media (min-width:500px) {
    .letter {
        box-shadow: 0 0 65px #57454b12;
    }
}

.letter-content {
    position: relative;
    z-index: 1;
    padding-top: calc(38px + env(safe-area-inset-top,0px));
    padding-bottom: calc(42px + env(safe-area-inset-bottom,0px));
}

.garden {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.stem {
    fill: none;
    stroke: var(--sage);
    stroke-width: 1.15;
    stroke-linecap: round;
}

.sprig {
    fill: none;
    stroke: var(--olive);
    stroke-width: .7;
    stroke-linecap: round;
    opacity: .85;
}

.bloom-inner {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 1.15s cubic-bezier(.17,.75,.32,1),opacity .75s;
    transform: scale(.18);
    opacity: 0;
}

.bloom-inner.is-blooming {
    transform: scale(1);
    opacity: 1;
}

.kicker {
    font: 600 10px/1.4 system-ui,sans-serif;
    letter-spacing: .32em;
    text-transform: uppercase;
    color: var(--olive);
    margin: 0 0 22px;
}

h1,h2,p,figure {
    margin: 0;
}

h1 {
    font-weight: 400;
    font-size: clamp(32px,9.8vw,43px);
    font-style: italic;
    line-height: 1.13;
    letter-spacing: -.055em;
    text-wrap: balance;
}

.tiny-heart {
    font-size: 25px;
    line-height: 1;
    color: var(--rose);
    margin: 10px 0 4px;
}

.hero {
    margin-bottom: 39px;
}

.hero-companions {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(102px,1.25fr) minmax(0,1fr);
    align-items: center;
    gap: 1px;
    margin: 8px -7px 0;
}

.hero-companions p {
    font-style: italic;
    font-size: 14px;
    line-height: 1.5;
}

.hero-animal {
    width: 100%;
    max-width: 93px;
    display: block;
    margin: auto;
    overflow: visible;
}

.hero-tail {
    transform-box: fill-box;
    transform-origin: 85% 85%;
    animation: tail-wag 4.8s ease-in-out infinite;
}

@keyframes tail-wag {
    0%,65%,100% {
        transform: rotate(0);
    }
    72%,88% {
        transform: rotate(-13deg);
    }
    80%,96% {
        transform: rotate(10deg);
    }
}

.prose {
    font-size: 16px;
    line-height: 1.75;
    max-width: 32ch;
    margin: 0 auto;
}

.prose + .prose {
    margin-top: 13px;
}

.prose.intro {
    margin-bottom: 0;
}

.prose .opening {
    font-size: 18px;
    display: block;
    margin-bottom: 8px;
}

h2 {
    font-size: 26px;
    line-height: 1.2;
    font-weight: 400;
    font-style: italic;
    letter-spacing: -.035em;
    margin: 0 0 12px;
}

.mini-note {
    font-size: 14px;
    line-height: 1.6;
    font-style: italic;
}

.photo-moment {
    position: relative;
    margin: 88px auto 0;
    width: 87%;
    max-width: 300px;
}

.photo-moment.second {
    margin-top: 90px;
    width: 88%;
}

.photo-frame {
    padding: 9px 9px 12px;
    position: relative;
    z-index: 1;
    background: var(--ivory);
    border: 1px solid var(--cream);
    box-shadow: 0 7px 22px #57454b16,0 1px 3px #57454b13;
    transform: rotate(-4deg);
}

.second .photo-frame {
    transform: rotate(3deg);
}

.photo-frame.tilt-right {
    transform: rotate(4deg);
}

.photo-visual {
    aspect-ratio: 4/3;
    background: var(--cream);
    overflow: hidden;
    position: relative;
}

.photo-visual img,.photo-visual svg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-frame figcaption {
    font-size: 14px;
    line-height: 1.4;
    font-style: italic;
    padding-top: 12px;
}

/* A peek consists of a clipped, moving head and a separate fixed set of paws. */
.peek {
    border: 0;
    background: transparent;
    padding: 0;
    position: absolute;
    top: -72px;
    width: 112px;
    height: 92px;
    right: 4px;
    z-index: 2;
    cursor: pointer;
    touch-action: manipulation;
}

.peek svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    display: block;
}

.peek-head {
    transform: translateY(0);
}

.peek.in-view .peek-head {
    animation: peek 8.4s ease-in-out infinite;
}

.peek.is-peek-a-boo .peek-head {
    animation: peek-tap 1.9s ease-in-out both;
}

@keyframes peek {
    0%,18%,52%,100% {
        transform: translateY(0);
    }
    27%,36% {
        transform: translateY(73px);
    }
    42% {
        transform: translateY(-3px);
    }
    63%,72% {
        transform: translateY(73px);
    }
    79% {
        transform: translateY(0);
    }
}

@keyframes peek-tap {
    0%,100% {
        transform: translateY(0);
    }
    24%,42% {
        transform: translateY(73px);
    }
    64% {
        transform: translateY(-4px);
    }
    76% {
        transform: translateY(0);
    }
}

.peek-paws {
    transform: none!important;
    animation: none!important;
}

.second .peek {
    left: 7px;
    right: auto;
    top: -70px;
}

.second .peek.in-view .peek-head {
    animation-delay: -2.1s;
}

.second .peek.is-peek-a-boo .peek-head {
    animation-delay: 0s;
}

.paw-trail {
    color: var(--rose);
    height: 70px;
    width: 133px;
    margin: 15px auto 0;
    display: block;
    overflow: visible;
    transform: rotate(-7deg);
}

.paw-trail.mirrored {
    transform: scaleX(-1) rotate(-7deg);
}

.paw-trail .print {
    opacity: .5;
    --step: 0;
}

.paw-trail .print:nth-child(2) {
    --step: 1;
}

.paw-trail .print:nth-child(3) {
    --step: 2;
}

.paw-trail.in-view .print {
    animation: footstep 2s ease-out both;
    animation-delay: calc(var(--step)*.21s);
}

@keyframes footstep {
    0% {
        opacity: 0;
    }
    100% {
        opacity: .5;
    }
}

.divider {
    display: block;
    width: 152px;
    height: 44px;
    overflow: visible;
    margin: 0 auto 27px;
    color: var(--sage);
}

.divider.roomy {
    margin-top: 38px;
    margin-bottom: 30px;
}

.divider.gift-divider {
    margin-block: 28px;
}

.gift-card {
    position: relative;
    isolation: isolate;
    width: min(100%, 310px);
    min-height: 210px;
    margin: 20px auto 0;
    border: 1px solid var(--gold);
    background: var(--ivory);
    box-shadow: 0 5px 15px #57454b18;
}

.gift-toggle {
    position: absolute;
    inset: 0;
    display: block;
    list-style: none;
    cursor: pointer;
    touch-action: manipulation;
}

.gift-toggle::-webkit-details-marker {
    display: none;
}

.gift-toggle:focus-visible {
    outline: 2px solid var(--olive);
    outline-offset: 4px;
}

.gift-front {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    perspective: 650px;
    pointer-events: none;
}

/* Two paper panels tied together with a rose-coloured ribbon. */
.gift-front::before,
.gift-front::after {
    content: "";
    position: absolute;
    inset-block: 0;
    width: 50%;
    background: linear-gradient(to bottom, transparent 31%, var(--rose) 31% 32%, var(--peony) 32% 44%, var(--rose) 44% 45%, transparent 45%), var(--cream);
    outline: 1px solid var(--gold);
    outline-offset: -7px;
    backface-visibility: hidden;
    transition: transform .7s cubic-bezier(.4, 0, .2, 1);
}

.gift-front::before {
    left: 0;
    transform-origin: left center;
    border-right: 1px solid var(--gold);
}

.gift-front::after {
    right: 0;
    transform-origin: right center;
}

.gift-seal,
.gift-address {
    position: absolute;
    left: 50%;
    z-index: 1;
    transform: translate(-50%, -50%);
    transition: opacity .2s, transform .3s;
}

.gift-seal {
    top: 38%;
    width: 54px;
    height: 54px;
    padding: 5px;
    border: 1px solid var(--gold);
    border-radius: 50%;
    background: var(--ivory);
    box-shadow: 0 2px 4px #57454b26;
}

.gift-seal svg {
    display: block;
    width: 100%;
    height: 100%;
}

.gift-address {
    top: 66%;
    white-space: nowrap;
    font-size: 24px;
    font-style: italic;
    background: var(--cream);
    padding-inline: .4em;
}

.gift-action {
    position: absolute;
    inset: auto 0 0;
    z-index: 3;
    display: grid;
    place-items: center;
    min-height: 44px;
    font: italic 14px/1.4 Georgia, serif;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gift-card .when-open,
.gift-card[open] .when-closed {
    display: none;
}

.gift-action .when-closed {
    padding-inline: .5em;
    background: var(--cream);
}

.gift-card[open] .when-open {
    display: inline;
}

.gift-card[open] .gift-front::before {
    transform: rotateY(-100deg);
}

.gift-card[open] .gift-front::after {
    transform: rotateY(100deg);
}

.gift-card[open] .gift-seal,
.gift-card[open] .gift-address {
    opacity: 0;
    transform: translate(-50%, -65%);
}

.gift-message {
    position: relative;
    z-index: 1;
    margin: 0 0 44px;
    padding: 28px 24px 8px;
    text-align: left;
    line-height: 1.6;
    transform-origin: center top;
}

.gift-card[open] .gift-message {
    animation: unfold-note .65s .12s backwards;
}

@keyframes unfold-note {
    from {
        opacity: 0;
        transform: perspective(500px) rotateX(-24deg) translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.video-moment {
    margin-top: 0;
}

.video-moment .prose {
    margin-bottom: 20px;
}

.video-frame {
    position: relative;
    background: var(--ink);
    border-radius: 11px;
    overflow: hidden;
    box-shadow: 0 6px 18px #57454b13;
    aspect-ratio: 16/9;
}

.video-frame video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--ink);
}

.video-placeholder {
    height: 100%;
    display: grid;
    place-content: center;
    gap: 10px;
    color: var(--ivory);
    text-align: center;
    background: radial-gradient(ellipse at 50% 20%,#c58e9f26,transparent 76%),var(--ink);
}

.video-placeholder .play-symbol {
    margin: auto;
    width: 47px;
    height: 47px;
    border-radius: 50%;
    background: var(--ivory);
    display: grid;
    place-items: center;
    color: var(--ink);
}

.video-placeholder .play-symbol svg {
    width: 19px;
    height: 19px;
    margin-left: 3px;
}

.video-placeholder span {
    font: 500 10px/1.6 system-ui,sans-serif;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.sleepy-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: left;
    margin: 10px 0 0;
}

.sleepy-row .mini-note {
    max-width: 19ch;
}

.sleepy-puppy {
    display: block;
    width: 117px;
    min-width: 105px;
    overflow: visible;
}

.sleepy-puppy .breathing {
    transform-box: fill-box;
    transform-origin: center bottom;
}

.sleepy-puppy.in-view .breathing {
    animation: breathing 3.4s ease-in-out infinite;
}

@keyframes breathing {
    0%,100% {
        transform: scale(1,1);
    }
    50% {
        transform: scale(1.025,1.065);
    }
}

.sleepy-puppy .zzz:nth-of-type(2) {
    --i: 1;
    font-size: 14px;
}

.sleepy-puppy .zzz:nth-of-type(3) {
    --i: 2;
    font-size: 15px;
}

.sleepy-puppy .zzz {
    --i: 0;
    fill: var(--olive);
    font: italic 13px Georgia,serif;
    opacity: .55;
}

.sleepy-puppy.in-view .zzz {
    animation: doze 3.6s ease-out infinite;
    animation-delay: calc(var(--i)*1.2s);
}

@keyframes doze {
    0% {
        transform: translate(0,7px) scale(.7);
        opacity: 0;
    }
    20% {
        opacity: .8;
    }
    75% {
        opacity: .55;
    }
    100% {
        transform: translate(8px,-18px) scale(1.2);
        opacity: 0;
    }
}

.wish {
    margin: 0 auto;
}

.wish .prose {
    max-width: 30ch;
}

.wish strong {
    font-weight: 400;
    font-style: italic;
    color: var(--ink);
}

.small-bouquet {
    width: 119px;
    height: 96px;
    display: block;
    margin: 15px auto 1px;
    overflow: visible;
}

.small-bouquet .sway {
    transform-origin: 60px 87px;
    animation: sway 5s ease-in-out infinite;
}

@keyframes sway {
    0%,100% {
        transform: rotate(-2deg);
    }
    50% {
        transform: rotate(2deg);
    }
}

.last-video {
    margin-top: 35px;
}

.closing {
    margin: 34px auto 0;
}

.closing h2 {
    font-size: 31px;
}

.signature {
    font-size: 15px;
    line-height: 1.7;
    font-style: italic;
    margin: 16px 0 0;
}

.end-mark {
    color: var(--rose);
    font-size: 24px;
    margin: 17px 0 0;
}

.footer-note {
    font: 500 9px/1.6 system-ui,sans-serif;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--olive);
    margin-top: 13px;
}

@media(max-width:340px) {
    .letter {
        padding-inline: 26px;
    }
    h1 {
        font-size: 31px;
    }
    .hero-companions p {
        font-size: 12px;
    }
    .photo-moment {
        width: 90%;
    }
    .sleepy-row .mini-note {
        font-size: 13px;
    }
}

@media(prefers-reduced-motion:reduce) {
    *,*::before,*::after {
        animation: none!important;
        transition: none!important;
    }
    .bloom-inner {
        transform: none!important;
        opacity: 1!important;
    }
    .peek-head {
        transform: none!important;
    }
    .zzz {
        opacity: .55!important;
    }
}

/* The invitation uses the same paper, ink and Georgia lettering as the birthday letter. */
.invitation {
    padding-block: calc(25px + env(safe-area-inset-top, 0px)) calc(38px + env(safe-area-inset-bottom, 0px));
}

.invitation::before {
    content: "";
    position: absolute;
    inset: 12px 10px;
    border: 1px solid var(--cream);
    pointer-events: none;
}

.invitation-header {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gold);
}

.envelope {
    display: block;
    width: 142px;
    height: auto;
    margin: 0 auto 12px;
}

.invitation-header .mini-note {
    max-width: 30ch;
    margin: 10px auto 0;
    text-wrap: balance;
}

.questions {
    margin: 24px 0;
    padding-left: 1.55rem;
    text-align: left;
}

.questions li + li {
    margin-top: 19px;
}

.questions li::marker {
    color: var(--olive);
    font: italic 15px Georgia, serif;
}

.questions label {
    display: block;
    margin-bottom: 7px;
    font-size: 17px;
    line-height: 1.4;
}

.questions select,
.questions input {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 9px 12px;
    border: 1px solid var(--sage);
    border-radius: 6px;
    background-color: var(--ivory);
    color: var(--ink);
    font: 16px/1.4 Georgia, "Times New Roman", serif;
}

.questions select {
    cursor: pointer;
}

.questions input::placeholder {
    color: var(--ink);
    opacity: .76;
}

#birthday-word {
    -webkit-text-security: disc;
}

#birthday-word::placeholder {
    -webkit-text-security: none;
}

.questions :is(input, select):focus-visible,
.open-letter:focus-visible {
    outline: 2px solid var(--olive);
    outline-offset: 3px;
}

.questions .secret-question {
    margin-top: 26px;
}

.field-hint {
    margin-top: 8px;
    font-size: 14px;
    font-style: italic;
    line-height: 1.4;
}

.delivery-countdown {
    margin: 0 auto 16px;
    padding-top: 17px;
    border-top: 1px solid var(--cream);
}

.countdown-clock {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 12px auto 0;
    max-width: 17rem;
    font: 12px/1.4 system-ui, sans-serif;
}

.countdown-clock span + span {
    border-inline-start: 1px solid var(--cream);
}

.countdown-clock b {
    display: block;
    font: 26px/1.1 Georgia, serif;
    font-variant-numeric: lining-nums tabular-nums;
}

.delivery-status:not(:empty) {
    margin-bottom: 12px;
    font-style: italic;
}

.open-letter {
    width: 100%;
    min-height: 48px;
    padding: 10px 16px;
    border: 1px solid var(--ink);
    border-radius: 6px;
    background: var(--ink);
    color: var(--ivory);
    font-size: 18px;
    cursor: pointer;
}

.open-letter span {
    margin-left: 5px;
    color: var(--peony);
}

.open-letter:disabled {
    opacity: .6;
    cursor: default;
}

