/* ==========================================================================
   Public website styles. Colors & font come from Site Settings via CSS vars.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--ink);
    background-color: var(--softer);
    background-image: var(--pattern), linear-gradient(160deg, var(--soft) 0%, var(--softer) 55%, #fff 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    padding: 0 16px;
}

.theme-rainbow {
    background-image: var(--pattern), linear-gradient(160deg, #ffe4f1 0%, #fff9c4 50%, #ffe6cf 100%);
}

/* Floating candy blobs */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(2px);
    z-index: -1;
    animation: float 12s ease-in-out infinite;
}
.blob--one { width: 18rem; height: 18rem; top: -5rem; left: -6rem; background: #fbcfe8; opacity: .55; }
.blob--two { width: 14rem; height: 14rem; bottom: -4rem; right: -4rem; background: #fde68a; opacity: .55; animation-delay: -4s; }
.blob--three { width: 9rem; height: 9rem; top: 40%; right: 8%; background: #fed7aa; opacity: .45; animation-delay: -8s; }

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-18px) scale(1.04); }
}

/* ---------- Header ---------- */
.site-header {
    max-width: 64rem;
    margin: 1.5rem auto 0;
    padding: 1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(255, 255, 255, .8);
    backdrop-filter: blur(8px);
    border: 3px solid var(--soft);
    border-radius: 2rem;
    box-shadow: 0 6px 0 color-mix(in srgb, var(--primary) 30%, transparent);
}

.brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
}

.brand__emoji {
    font-size: 2.6rem;
    line-height: 1;
    display: inline-block;
    animation: bounce 3s ease-in-out infinite;
}

.brand__logo {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-6px) rotate(-6deg); }
}

.brand__title {
    display: block;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
}

.brand__tagline {
    display: block;
    font-size: .95rem;
    opacity: .75;
    line-height: 1.3;
}

/* ---------- Menu ---------- */
.menu-toggle { display: none; }

.menu-button {
    display: none;
    cursor: pointer;
    padding: .4rem 1rem;
    border-radius: 999px;
    background: var(--soft);
    font-weight: 600;
    user-select: none;
}

.main-menu {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.main-menu__link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem 1.1rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    background: var(--softer);
    border: 2px solid var(--soft);
    transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.main-menu__link:hover {
    transform: translateY(-3px) rotate(-2deg);
    background: var(--soft);
}

.main-menu__link.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 0 color-mix(in srgb, var(--primary) 55%, #000 10%);
}

.theme-lemonade .main-menu__link.is-active { color: var(--ink); }

@media (max-width: 720px) {
    .menu-button { display: inline-block; }
    .main-menu { display: none; width: 100%; flex-direction: column; }
    .menu-toggle:checked ~ .main-menu { display: flex; }
    .main-menu__link { justify-content: center; }
    .brand__title { font-size: 1.35rem; }
}

/* ---------- Page card ---------- */
.page-card {
    max-width: 64rem;
    margin: 1.75rem auto;
    padding: clamp(1.25rem, 4vw, 3rem);
    background: #fff;
    border-radius: 2.25rem;
    border: 3px solid var(--soft);
    box-shadow: 0 10px 0 color-mix(in srgb, var(--accent) 45%, transparent);
}

.page-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 0 1.25rem;
    font-size: clamp(2rem, 6vw, 3rem);
    line-height: 1.1;
    color: var(--ink);
}

.page-title__emoji { font-size: 1.1em; }

/* ---------- Rich content ---------- */
.content > :first-child { margin-top: 0; }
.content > :last-child { margin-bottom: 0; }

.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
    line-height: 1.2;
    margin: 1.6em 0 .5em;
    color: var(--ink);
}
.content h1 { font-size: clamp(2rem, 5.5vw, 2.8rem); }
.content h2 { font-size: clamp(1.6rem, 4.5vw, 2.1rem); }
.content h3 { font-size: 1.55rem; }
.content h4 { font-size: 1.3rem; }
.content h5 { font-size: 1.15rem; }
.content h6 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; }

.content h1 { 
    background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 55%, transparent) 62%);
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
.content h1 + * { margin-top: 1em; }

.content p { margin: 0 0 1em; }
.content .lead { font-size: 1.35rem; opacity: .9; }
.content .lead p { margin-bottom: .6em; }
.content small { font-size: .82em; }

.content a {
    color: var(--ink);
    text-decoration-color: var(--primary);
    text-decoration-thickness: 3px;
    text-underline-offset: 3px;
    font-weight: 600;
}
.content a:hover { background: var(--soft); border-radius: .3em; }

.content mark {
    background: #fef08a;
    color: inherit;
    padding: 0 .2em;
    border-radius: .3em;
}

.content .color { color: var(--color); }

.content ul, .content ol { padding-left: 1.6em; margin: 0 0 1em; }
.content li { margin: .25em 0; }
.content li > p { margin: 0; }
.content ul { list-style: none; }
.content ul > li { position: relative; }
.content ul > li::before {
    content: '♥';
    position: absolute;
    left: -1.3em;
    color: var(--primary);
}
.content ol > li::marker { color: var(--primary); font-weight: 700; }

.content blockquote {
    margin: 1.5em 0;
    padding: 1em 1.4em;
    border-radius: 1.5rem;
    background: var(--softer);
    border: 3px dashed var(--primary);
    font-size: 1.2em;
}
.content blockquote p:last-child { margin: 0; }

.content hr {
    border: 0;
    height: 1.5rem;
    margin: 2em 0;
    background: none;
    text-align: center;
}
.content hr::after {
    content: '✿ ✿ ✿';
    color: var(--primary);
    letter-spacing: .6em;
}

.content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .88em;
    background: var(--soft);
    padding: .1em .4em;
    border-radius: .4em;
}
.content pre {
    background: #3f1d38;
    color: #ffe4f1;
    padding: 1em 1.25em;
    border-radius: 1.25rem;
    overflow-x: auto;
}
.content pre code { background: none; padding: 0; color: inherit; }

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 1.25rem;
    border: 4px solid #fff;
    box-shadow: 0 6px 0 var(--soft), 0 8px 24px rgba(0, 0, 0, .08);
}

.content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5em 0;
    border: 3px solid var(--soft);
    border-radius: 1.25rem;
    overflow: hidden;
    display: block;
    overflow-x: auto;
}
.content th, .content td {
    padding: .6em .9em;
    border-bottom: 2px solid var(--soft);
    border-right: 2px solid var(--soft);
    text-align: left;
    vertical-align: top;
}
.content th { background: var(--soft); }
.content tr:last-child td { border-bottom: 0; }
.content th:last-child, .content td:last-child { border-right: 0; }
.content td p, .content th p { margin: 0; }

.content details {
    margin: 1em 0;
    padding: .75em 1.1em;
    border-radius: 1.25rem;
    background: var(--softer);
    border: 3px solid var(--soft);
}
.content details summary {
    cursor: pointer;
    font-weight: 700;
}
.content details summary p { display: inline; margin: 0; }
.content details[open] summary { margin-bottom: .5em; }

.content .grid-layout {
    display: grid;
    gap: 1.25rem;
    margin: 1.5em 0;
    grid-template-columns: 1fr;
}
@media (min-width: 768px) {
    .content .grid-layout { grid-template-columns: var(--cols); }
    .content .grid-layout-col { grid-column: var(--col-span); }
}
.content .grid-layout-col {
    min-width: 0;
    padding: 1em;
    border-radius: 1.25rem;
    background: var(--softer);
}

.content [style*="text-align: center"] { text-align: center; }

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    padding: 0 0 2.5rem;
    font-weight: 500;
    opacity: .85;
}

.site-footer__year { opacity: .7; }

.site-footer__admin {
    display: inline-block;
    margin-left: .5rem;
    padding: .1rem .7rem;
    border-radius: 999px;
    font-size: .85rem;
    color: var(--ink);
    text-decoration: none;
    opacity: .6;
    border: 2px dashed var(--soft);
    transition: opacity .15s ease, background-color .15s ease;
}

.site-footer__admin:hover {
    opacity: 1;
    background: var(--soft);
}

/* ---------- Sparkle trail ---------- */
.sparkle {
    position: fixed;
    pointer-events: none;
    z-index: 50;
    font-size: 1rem;
    transform: translate(-50%, -50%);
    animation: sparkle .9s ease-out forwards;
}

@keyframes sparkle {
    to {
        opacity: 0;
        transform: translate(calc(-50% + var(--drift)), 20px) scale(.4) rotate(90deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .blob, .brand__emoji { animation: none; }
}
