/* Tiup Lilin (ulang-tahun/tiup-lilin): luxe art-deco champagne party */

:root {
    --ec-bg: #fde7d9;
    --ec-bg2: #f48db6;
    --ec-ink: #3d0a2a;
    --ec-muted: #8a3b62;
    --ec-accent: #e0207a;
    --ec-accent-soft: #ff8fbf;
    --ec-cake: #fff6ec;
    --ec-cake2: #ff8fbf;
    --ec-champagne: #f3d9b1;
    --ec-card: #fffaf3;
    --ec-card-ink: #3d0a2a;
    --ec-deep: #c8166b;
    /* rich foil gold, the same in every colour variant */
    --tl-foil: linear-gradient(135deg, #a8741a, #ffe9a6 28%, #d4a63c 50%, #fff1c2 72%, #9a6614);
    --tl-gold: #c9962e;
    --tl-display: 'Playfair Display', 'Times New Roman', serif;
    --tl-script: 'Great Vibes', 'Playfair Display', cursive;
    --tl-caps: 'Josefin Sans', system-ui, sans-serif;
    --tl-text: 'Lora', Georgia, serif;
    /* deco lattice: fans and diamonds in thin gold over the ground */
    --tl-deco: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cg fill='none' stroke='%23c9962e' stroke-opacity='.34' stroke-width='1'%3E%3Cpath d='M0 80a40 40 0 0 1 80 0M10 80a30 30 0 0 1 60 0M20 80a20 20 0 0 1 40 0'/%3E%3Cpath d='M40 40v-12M40 80V60'/%3E%3C/g%3E%3Cpath d='m40 4 4 4-4 4-4-4Z' fill='%23c9962e' fill-opacity='.45'/%3E%3C/svg%3E");
}

body.tl {
    background:
        var(--tl-deco) 0 0 / 80px 80px,
        radial-gradient(ellipse at 50% 0%, color-mix(in srgb, #fff 55%, transparent), transparent 55%),
        radial-gradient(circle at 10% 90%, color-mix(in srgb, var(--ec-accent) 30%, transparent), transparent 45%),
        linear-gradient(180deg, var(--ec-bg) 0%, color-mix(in srgb, var(--ec-bg) 45%, var(--ec-bg2)) 50%, var(--ec-bg2) 100%);
    background-attachment: fixed;
    color: var(--ec-ink);
    font-family: var(--tl-text);
    font-size: 1.04rem;
    line-height: 1.8;
}
.tl-defs { position: absolute; }

.tl-confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.tl-confetti i { position: absolute; left: 0; top: 0; display: block; will-change: transform, opacity; }

/* ---------- shared ornaments ---------- */
.tl-fan { position: absolute; width: 4.4rem; height: 4.4rem; overflow: visible; pointer-events: none; }
.tl-fan--tl { top: 0; left: 0; }
.tl-fan--tr { top: 0; right: 0; transform: scaleX(-1); }
.tl-fan--bl { bottom: 0; left: 0; transform: scaleY(-1); }
.tl-fan--br { bottom: 0; right: 0; transform: scale(-1); }
.tl-divider { display: block; width: 12rem; height: auto; margin: .3rem auto; overflow: visible; }
.tl-divider--small { width: 9rem; }

/* ---------- cover: the cake in a deco frame ---------- */
.tl-cover {
    --ec-open-ms: 650;
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .5rem;
    min-height: 100vh;
    padding: 2.8rem 1.5rem 2.2rem;
    overflow: hidden;
    text-align: center;
    transition: opacity .6s ease;
}
.ec-js .tl-cover {
    background:
        var(--tl-deco) 0 0 / 80px 80px,
        radial-gradient(ellipse at 50% 62%, color-mix(in srgb, #fff 60%, transparent), transparent 46%),
        radial-gradient(circle at 10% 90%, color-mix(in srgb, var(--ec-accent) 30%, transparent), transparent 45%),
        linear-gradient(180deg, var(--ec-bg) 0%, color-mix(in srgb, var(--ec-bg) 45%, var(--ec-bg2)) 50%, var(--ec-bg2) 100%);
}
.tl-frame { position: absolute; inset: 12px; pointer-events: none; }
.tl-frame::before { content: ''; position: absolute; inset: 6px; border: 2px solid transparent; border-image: var(--tl-foil) 1; }
.tl-frame::after { content: ''; position: absolute; inset: 12px; border: 1px solid transparent; border-image: var(--tl-foil) 1; opacity: .75; }
.tl-frame .tl-fan { width: 5rem; height: 5rem; }

.tl-glints { position: absolute; inset: 0; pointer-events: none; }
.tl-glints span {
    position: absolute; left: var(--x); top: var(--y);
    width: var(--s); height: var(--s);
    background: var(--tl-foil);
    clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
    opacity: .85;
}
.tl-glints span:nth-child(3n) { clip-path: none; width: calc(var(--s) * .7); height: calc(var(--s) * .35); transform: rotate(var(--r)); }
@media (prefers-reduced-motion: no-preference) {
    .tl-glints span { animation: tl-twinkle 3s ease-in-out var(--d) infinite; }
}
@keyframes tl-twinkle { 0%, 100% { opacity: .15; scale: .5; } 50% { opacity: 1; scale: 1.1; } }

.tl-cover__from { position: relative; }
.tl-cover__from .ec-from__label { font-family: var(--tl-caps); font-size: .68rem; letter-spacing: .4em; color: var(--ec-muted); opacity: 1; }
.tl-cover__from .ec-from__name { font-family: var(--tl-script); font-size: 2.1rem; line-height: 1.15; color: var(--ec-ink); }
.tl-cover__to { position: relative; }
.tl-cover__to .ec-recipient__greeting { font-family: var(--tl-caps); font-size: .72rem; letter-spacing: .4em; color: var(--ec-muted); }
.tl-cover__to .ec-recipient__name {
    max-width: 20rem;
    font-family: var(--tl-display); font-style: italic; font-weight: 600;
    font-size: clamp(2.3rem, 11vw, 3.1rem); line-height: 1.05;
    color: var(--ec-ink);
    text-wrap: balance;
}

/* the cake with a balloon cluster on each side */
.tl-party { position: relative; width: 100%; max-width: 24rem; display: flex; justify-content: center; margin-top: 2.6rem; }
.tl-balloons { position: absolute; top: -2.4rem; width: 30%; height: auto; overflow: visible; filter: drop-shadow(0 10px 12px color-mix(in srgb, var(--ec-ink) 22%, transparent)); }
.tl-balloons--left { left: -3%; }
.tl-balloons--right { right: -3%; }
@media (prefers-reduced-motion: no-preference) {
    .tl-balloons, .tl-hero-balloons { animation: tl-bob 4.6s ease-in-out infinite; }
    .tl-balloons--right, .tl-hero-balloons--right { animation-delay: -2.1s; }
}
@keyframes tl-bob { 0%, 100% { translate: 0 0; rotate: -1.5deg; } 50% { translate: 0 -8px; rotate: 1.5deg; } }

.tl-cake { position: relative; width: min(62vw, 250px); touch-action: none; user-select: none; -webkit-user-select: none; }
.tl-cake svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 18px 22px color-mix(in srgb, var(--ec-ink) 30%, transparent)); }
.tl-tier { fill: var(--ec-cake); stroke: color-mix(in srgb, var(--tl-gold) 55%, transparent); stroke-width: .8; }
.tl-tier--accent { fill: var(--ec-cake2); }
.tl-pearl { fill: #fffaf0; stroke: color-mix(in srgb, var(--tl-gold) 60%, transparent); stroke-width: .6; }

/* candles stand on the top tier (its top edge is 88/300 of the picture, its sides 84 and 176 of 260) */
.tl-candles {
    position: absolute; left: 35%; right: 35%; bottom: calc(100% - 88 / 300 * 100%);
    display: flex; justify-content: space-between; align-items: flex-end;
}
.tl-candle {
    position: relative;
    width: 8px; height: 42px;
    padding: 0; border: 0; border-radius: 2px 2px 1px 1px;
    background:
        repeating-linear-gradient(-55deg, transparent 0 5px, color-mix(in srgb, #d4a63c 75%, transparent) 5px 7px),
        linear-gradient(90deg, #f3ece0, #ffffff 45%, #e9dfcf);
    box-shadow: 0 0 0 .6px color-mix(in srgb, var(--tl-gold) 70%, transparent);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.tl-candle:nth-child(2n) { height: 36px; background: repeating-linear-gradient(-55deg, transparent 0 5px, color-mix(in srgb, #fff 70%, transparent) 5px 7px), linear-gradient(90deg, color-mix(in srgb, var(--ec-accent) 80%, black), var(--ec-accent) 45%, color-mix(in srgb, var(--ec-accent) 75%, black)); }
.tl-candle:nth-child(3) { height: 48px; }
/* a generous touch area around each thin candle */
.tl-candle::before { content: ''; position: absolute; inset: -36px -12px -6px; }
.tl-candle:focus-visible { outline: 1px solid var(--tl-gold); outline-offset: 4px; }
.tl-flame {
    position: absolute; left: 50%; bottom: 100%;
    width: 13px; height: 24px; margin: 0 0 2px -6.5px;
    border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
    background: radial-gradient(circle at 50% 72%, #fff 0 18%, #ffe066 30%, #ff9f1c 64%, rgb(255 90 30 / 0) 72%);
    box-shadow: 0 0 18px 7px rgb(255 196 80 / .5);
    transform-origin: 50% 100%;
    transition: transform .25s ease, opacity .25s ease;
}
.tl-smoke {
    position: absolute; left: 50%; bottom: 100%;
    width: 8px; height: 30px; margin-left: -4px;
    border-radius: 50%;
    background: linear-gradient(to top, color-mix(in srgb, var(--ec-ink) 35%, transparent), transparent);
    filter: blur(2px);
    opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
    .tl-flame { animation: tl-flicker 1.1s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -170ms); }
}
@keyframes tl-flicker {
    0% { transform: rotate(-4deg) scaleY(1); }
    50% { transform: rotate(3deg) scaleY(1.12); }
    100% { transform: rotate(-2deg) scaleY(.94); }
}
.tl-candle.is-out .tl-flame { animation: none; transform: scale(.1); opacity: 0; }
.tl-candle.is-out .tl-smoke { animation: tl-smoke 1.4s ease-out forwards; }
@keyframes tl-smoke {
    0% { opacity: .9; transform: translateY(0) scaleX(1); }
    100% { opacity: 0; transform: translateY(-34px) scaleX(2.2); }
}

.tl-hint { position: relative; margin: .9rem 0 0; display: flex; align-items: center; gap: .6rem; font-family: var(--tl-display); font-style: italic; font-size: 1.05rem; color: var(--ec-muted); }
.tl-hint__count {
    padding: .05rem .6rem; border-radius: 999px;
    background: var(--tl-foil);
    color: #4a2a05; font-family: var(--tl-caps); font-style: normal; font-size: .78rem; font-weight: 600; letter-spacing: .08em;
    font-variant-numeric: tabular-nums;
}
.tl-skip {
    position: relative;
    padding: .3rem .8rem; border: 0; background: none; cursor: pointer;
    color: var(--ec-muted); font: inherit; font-size: .78rem; letter-spacing: .04em;
    text-decoration: underline; text-underline-offset: 3px;
}
.ec-opening .tl-cover { opacity: 0; }

/* ---------- the card: a short scroll ---------- */
.tl-page {
    position: relative;
    width: 100%; max-width: 32rem;
    margin: 0 auto;
    padding: 0 1.1rem;
    overflow-x: clip;
}

/* hero: a sunburst behind an ivory deco plaque */
.tl-hero {
    position: relative;
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3.4rem 0 3.6rem;
}
.tl-sunburst {
    position: absolute; left: 50%; top: 50%; width: 170%; max-width: 44rem; height: auto; translate: -50% -50%; pointer-events: none;
    -webkit-mask-image: radial-gradient(circle, #000 45%, transparent 70%); mask-image: radial-gradient(circle, #000 45%, transparent 70%);
}
@media (prefers-reduced-motion: no-preference) {
    .tl-sunburst { animation: tl-spin 90s linear infinite; }
}
@keyframes tl-spin { to { rotate: 360deg; } }
.tl-bunting { position: absolute; left: -1.1rem; right: -1.1rem; top: .8rem; width: calc(100% + 2.2rem); height: auto; overflow: visible; filter: drop-shadow(0 4px 4px color-mix(in srgb, var(--ec-ink) 20%, transparent)); }
.tl-hero-balloons { position: absolute; bottom: 6%; width: 31%; height: auto; overflow: visible; filter: drop-shadow(0 10px 12px color-mix(in srgb, var(--ec-ink) 22%, transparent)); }
.tl-hero-balloons--left { left: -4%; }
.tl-hero-balloons--right { right: -4%; }

.tl-hero__inner {
    position: relative;
    width: min(84vw, 320px);
    padding: 3.4rem 1.6rem 1.8rem;
    margin-top: 2.6rem;
    background: var(--ec-card);
    color: var(--ec-card-ink);
    text-align: center;
    /* a double gold rule drawn with shadows so the picture mode keeps it */
    box-shadow:
        inset 0 0 0 5px var(--ec-card), inset 0 0 0 6.5px #c9962e, inset 0 0 0 10px var(--ec-card), inset 0 0 0 11px color-mix(in srgb, #c9962e 70%, transparent),
        0 0 0 3px color-mix(in srgb, #d4a63c 85%, transparent), 0 30px 50px -26px color-mix(in srgb, var(--ec-card-ink) 60%, transparent);
}
.tl-hero__inner .tl-fan { width: 3rem; height: 3rem; }
.tl-hero__inner .tl-fan--tl { top: 12px; left: 12px; }
.tl-hero__inner .tl-fan--tr { top: 12px; right: 12px; }
.tl-hero__inner .tl-fan--bl { bottom: 12px; left: 12px; }
.tl-hero__inner .tl-fan--br { bottom: 12px; right: 12px; }
.tl-crest {
    position: absolute; left: 50%; top: 0; width: 6rem; height: 6rem; translate: -50% -58%;
    overflow: visible; filter: drop-shadow(0 5px 7px color-mix(in srgb, var(--ec-card-ink) 30%, transparent));
}
.tl-hero__to .ec-recipient__greeting { font-family: var(--tl-caps); font-size: .7rem; letter-spacing: .42em; color: color-mix(in srgb, var(--ec-card-ink) 60%, transparent); }
.tl-hero__to .ec-recipient__name { font-family: var(--tl-script); font-size: clamp(2.2rem, 10vw, 2.8rem); line-height: 1.15; color: var(--ec-deep); }
.tl-hero__title {
    /* rich gold that reads on ivory: deep bronze, a warm shine, a soft shadow */
    --ec-foil-1: #6e4206;
    --ec-foil-2: #e2ad3f;
    --ec-foil-3: #9c6410;
    filter: drop-shadow(0 1px 0 #fff8e6) drop-shadow(0 3px 4px color-mix(in srgb, var(--ec-card-ink) 28%, transparent));
    margin: .5rem 0 .3rem;
    font-family: var(--tl-display); font-style: italic; font-weight: 600;
    font-size: clamp(2.2rem, 10.5vw, 2.9rem); line-height: 1.02;
    text-wrap: balance;
    overflow-wrap: break-word;
    padding: 0 .1em .12em;
}
.tl-scroll { position: absolute; bottom: 1rem; left: 0; right: 0; margin: 0; text-align: center; font-family: var(--tl-display); font-style: italic; color: var(--ec-muted); }
@media (prefers-reduced-motion: no-preference) {
    .tl-scroll span { display: inline-block; animation: tl-arrow 1.8s ease-in-out infinite; }
}
@keyframes tl-arrow { 50% { transform: translateY(5px); } }

/* photos: a pile of prints in chamfered foil-gold deco frames */
.tl-gallery { padding: .5rem 0 3rem; text-align: center; }
.tl-photos { width: min(76%, 17rem); margin: 0 auto; }
.tl-photos .ec-photos__item {
    margin: 0; padding: 7px;
    background: var(--tl-foil);
    clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
}
.tl-photos img {
    width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
    border: 3px solid var(--ec-card);
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}
.tl-gallery__hint { margin: 1.4rem 0 0; font-family: var(--tl-display); font-style: italic; color: var(--ec-muted); }

/* the letter: ivory card with deco fans, a crest watermark */
.tl-letter {
    position: relative;
    margin-top: 1rem;
    padding: 3.6rem clamp(1.7rem, 8vw, 2.8rem) 4.2rem;
    background-color: var(--ec-card);
    color: var(--ec-card-ink);
    box-shadow: 0 2px 3px color-mix(in srgb, var(--ec-card-ink) 8%, transparent), 0 36px 64px -34px color-mix(in srgb, var(--ec-card-ink) 60%, transparent);
}
.tl-letter::before { content: ''; position: absolute; inset: 12px; border: 1px solid transparent; border-image: var(--tl-foil) 1; pointer-events: none; }
.tl-letter .tl-fan { width: 4rem; height: 4rem; }
.tl-letter .tl-fan--tl { top: 6px; left: 6px; }
.tl-letter .tl-fan--tr { top: 6px; right: 6px; }
.tl-letter .tl-fan--bl { bottom: 6px; left: 6px; }
.tl-letter .tl-fan--br { bottom: 6px; right: 6px; }
.tl-letter__watermark { position: absolute; left: 50%; top: 50%; width: 13rem; height: 13rem; translate: -50% -50%; opacity: .07; pointer-events: none; }
.tl-letter__message { position: relative; font-size: 1.08rem; color: color-mix(in srgb, var(--ec-card-ink) 92%, transparent); }
/* an illuminated initial */
.tl-letter__message .ec-initial {
    float: left; margin: .12em .16em 0 0; padding: .06em .16em .04em;
    font-family: var(--tl-display); font-weight: 600; font-size: 3.1em; line-height: .9;
    color: #fff6e6;
    background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--ec-deep) 60%, white), var(--ec-deep) 70%);
    border: 2px solid #d4a63c;
    outline: 1px solid #d4a63c; outline-offset: 2px;
}
.tl-letter__sign { position: relative; margin-top: 2rem; text-align: center; }
.tl-letter__closing { margin: .4rem 0 0; font-family: var(--tl-display); font-style: italic; font-size: 1.15rem; color: color-mix(in srgb, var(--ec-card-ink) 70%, transparent); }
.tl-signature { color: var(--ec-card-ink); }
.tl-signature text { font-family: var(--tl-script); }

/* a gold coin seal on two ribbon ends */
.tl-seal { position: absolute; left: 50%; bottom: -2.2rem; width: 4.4rem; height: 4.4rem; translate: -50% 0; }
.tl-seal__ribbon { position: absolute; top: 2.2rem; width: 1.6rem; height: 3.2rem; background: linear-gradient(90deg, color-mix(in srgb, var(--ec-deep) 80%, black), color-mix(in srgb, var(--ec-deep) 75%, white) 50%, color-mix(in srgb, var(--ec-deep) 80%, black)); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); }
.tl-seal__ribbon--left { left: .6rem; transform: rotate(16deg); }
.tl-seal__ribbon--right { right: .6rem; transform: rotate(-16deg); }
.tl-seal__coin {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 28%, #fff4c8, #e2b347 40%, #b07d1f 75%, #7f5410);
    box-shadow: 0 6px 12px -4px color-mix(in srgb, var(--ec-card-ink) 55%, transparent), inset 0 0 0 4px color-mix(in srgb, #8a5a10 70%, transparent), inset 0 0 0 6px #ffe9a6;
}
.tl-seal__coin span { font-family: var(--tl-display); font-style: italic; font-weight: 600; font-size: 1.9rem; line-height: 1; color: #5a3a06; text-shadow: 0 1px 0 #fff1c2; }

.tl-actions { margin-top: 4.4rem; color: var(--ec-ink); }
.tl-actions .ec-actions__button { border-color: var(--tl-gold); background: color-mix(in srgb, var(--ec-card) 70%, transparent); color: var(--ec-card-ink); }
.tl-tap-hint { margin: .6rem 0 0; text-align: center; font-size: .78rem; color: var(--ec-muted); }
.tl-branding { color: var(--ec-muted); }

@media (min-width: 768px) {
    .tl-page { max-width: 34rem; }
}

/* picture mode: the hero and the letter fit the stage */
.ec-image .tl-hero { padding: 3.6rem 0 1.6rem; }
.ec-image .tl-letter { margin-bottom: 3rem; }
/* the picture maker fills a gradient border-image across the whole box: a plain gold rule there */
.ec-image .tl-letter::before { border-image: none; border-color: #c9962e; }
