:root {
    --cream: #fbf7ef;

    /* Theme tokens, default light */
    --text: rgba(0, 0, 0, 0.90);
    --muted: rgba(0, 0, 0, 0.68);
    --hairline: rgba(0, 0, 0, 0.12);
    --hover: rgba(0, 0, 0, 0.06);

    --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    --font-display: "Fraunces", ui-serif, Georgia, serif;
}

/* Dark layer */
body.is-dark {
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.74);
    --hairline: rgba(255, 255, 255, 0.16);
    --hover: rgba(255, 255, 255, 0.10);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--text);
    font-family: var(--font-sans);
    overflow-x: hidden;
}

/* -------------------------
   Global UI
-------------------------- */

header.ui {
    position: fixed;
    top: 18px;
    left: 32px;
    right: 32px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.pill {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    background: transparent;
    border: none;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #2b6b3f;
}

nav {
    gap: 6px;
}

nav a {
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

nav a:hover {
    background: var(--hover);
}

/* -------------------------
   Layout containers
-------------------------- */

.content {
    position: absolute;
    inset: 0;
    z-index: 10;
    width: 100%;
    padding: 128px 32px 32px;
    max-width: 1100px;
    margin: 0 auto;
}

.content-inner {
    height: 100%;
    padding: 128px 32px 32px;
    max-width: 1100px;
    margin: 0 auto;
}

.card {
    width: min(920px, 100%);
    padding: 0;
    background: transparent;
    border: none;
}

/* -------------------------
   Typography
-------------------------- */

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-variation-settings: "opsz" 96;
}

h1 {
    margin: 0 0 10px;
    font-size: 34px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

p {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: 0.002em;
    color: var(--muted);
}

strong {
    color: var(--text);
}

.hint {
    margin-top: 12px;
    font-size: 13px;
    opacity: 0.75;
}

/* -------------------------
   Horizontal chapter track
-------------------------- */

.htrack {
    position: absolute;
    inset: 0;
    z-index: 10;
    width: 200vw;
    height: 100%;
    display: grid;
    grid-template-columns: 100vw 100vw;
    transform: translate3d(0, 0, 0);
    transition: transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
}

.chapter.is-detail .htrack {
    transform: translate3d(-100vw, 0, 0);
}

.hscene {
    width: 100%;
    height: 100%;
}

/* -------------------------
   Resource grid
-------------------------- */

.resource-grid {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
}

.resource {
    grid-column: span 6;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--hairline);
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.resource:hover {
    background: var(--hover);
}

.resource-title {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.resource-meta {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

@media (max-width: 860px) {
    .resource {
        grid-column: span 12;
    }
}

/* -------------------------
   Detail view
-------------------------- */

.detail-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.detail-back {
    appearance: none;
    border: 1px solid var(--hairline);
    background: transparent;
    color: var(--text);
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
}

.detail-title {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.02em;
}

.detail-body {
    color: var(--muted);
    line-height: 1.55;
    white-space: pre-line;
}

/* -------------------------
   HERO FINAL
-------------------------- */

.hero {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: clamp(18px, 3vw, 44px);
    margin-top: 14px;
}

/* Hero headline balance */
.hero h1 {
    font-size: clamp(2.4rem, 4.2vw, 4.1rem);
    line-height: 1.03;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
}

/* Hero lead */
.lead {
    font-size: clamp(1.05rem, 1.35vw, 1.25rem);
    line-height: 1.6;
    max-width: 52ch;
}

/* Mascot container */
.hero-mascot {
    position: relative;
    width: clamp(260px, 30vw, 420px);
    max-width: 44vw;
    transform-origin: 22% 62%;
    animation: mascot-float 7.2s ease-in-out infinite;
    will-change: transform;
}

/* Mascot image */
.mascot-img {
    display: block;
    width: 100%;
    height: auto;
    animation: mascot-lean 9.5s ease-in-out infinite;
    will-change: transform;
}

/* Sparkle glow */
.hero-mascot::after {
    content: "";
    position: absolute;
    right: 18%;
    top: 20%;
    width: clamp(26px, 3.2vw, 40px);
    height: clamp(26px, 3.2vw, 40px);
    border-radius: 999px;
    background: radial-gradient(circle,
            rgba(255, 240, 170, 0.55) 0%,
            rgba(255, 240, 170, 0.0) 65%);
    opacity: 0;
    transform: scale(0.9);
    animation: sparkle-pulse 6.8s ease-in-out infinite;
    pointer-events: none;
}

/* Responsive hero */
@media (max-width: 820px) {
    .hero {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .hero-mascot {
        width: min(360px, 78vw);
        max-width: 78vw;
    }
}

/* -------------------------
   Animations
-------------------------- */

@keyframes mascot-float {
    0% {
        transform: translate3d(0, 0, 0) rotate(-0.4deg);
    }

    25% {
        transform: translate3d(0, -10px, 0) rotate(0.2deg);
    }

    50% {
        transform: translate3d(0, -16px, 0) rotate(0.5deg);
    }

    75% {
        transform: translate3d(0, -9px, 0) rotate(0.1deg);
    }

    100% {
        transform: translate3d(0, 0, 0) rotate(-0.4deg);
    }
}

@keyframes mascot-lean {
    0% {
        transform: rotate(0deg) translate3d(0, 0, 0);
    }

    35% {
        transform: rotate(-1deg) translate3d(-2px, 0, 0);
    }

    55% {
        transform: rotate(-0.2deg) translate3d(-1px, 0, 0);
    }

    80% {
        transform: rotate(0.6deg) translate3d(0, 0, 0);
    }

    100% {
        transform: rotate(0deg) translate3d(0, 0, 0);
    }
}

@keyframes sparkle-pulse {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }

    12% {
        opacity: 0.55;
        transform: scale(1.05);
    }

    22% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 0;
        transform: scale(0.85);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    .hero-mascot,
    .mascot-img,
    .hero-mascot::after {
        animation: none !important;
    }
}

/* =========================
   SERVICES GRID, MILKY PASTEL
   Light layers: creamy pastel glass
   Dark layers: darker glass (unchanged)
========================= */

.resource-grid {
    margin-top: 32px;
    gap: 20px;
}

/* Base tile, light layers */
.resource {
    position: relative;
    grid-column: span 6;

    padding: 28px;
    border-radius: 22px;
    border: none;

    /* Milky pastel glass:
     white + a hint of warmth, no gray */
    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.62),
            rgba(255, 255, 255, 0.40));

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.08);

    cursor: pointer;
    transition:
        transform 220ms ease,
        background 220ms ease,
        box-shadow 220ms ease;
}

/* Text */
.resource-title {
    font-size: clamp(1.2rem, 1.4vw, 1.35rem);
    font-weight: 650;
    letter-spacing: -0.015em;
    color: var(--text);
}

.resource-meta {
    margin-top: 10px;
    font-size: clamp(1rem, 1.1vw, 1.1rem);
    color: var(--muted);
}

/* Hover, light layers:
   deepen the same pastel tone */
.resource:hover {
    transform: translateY(-4px);

    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.28),
            rgba(255, 255, 255, 0.18));

    box-shadow:
        0 18px 48px rgba(0, 0, 0, 0.20);
}

/* Hover text flips to light */
.resource:hover .resource-title {
    color: rgba(255, 255, 255, 0.96);
}

.resource:hover .resource-meta {
    color: rgba(255, 255, 255, 0.78);
}

/* Active */
.resource:active {
    transform: translateY(-1px);
}

/* Subtle idle life */
@media (prefers-reduced-motion: no-preference) {
    .resource {
        animation: tile-idle 10s ease-in-out infinite;
    }

    .resource:nth-child(2) {
        animation-delay: -2.5s;
    }

    .resource:nth-child(3) {
        animation-delay: -5s;
    }

    .resource:nth-child(4) {
        animation-delay: -7.5s;
    }
}

@keyframes tile-idle {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-2px);
    }

    100% {
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 860px) {
    .resource {
        grid-column: span 12;
        padding: 24px 22px;
    }
}

/* -------------------------
   Dark layers (unchanged)
-------------------------- */

body.is-dark .resource {
    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.10),
            rgba(255, 255, 255, 0.06));

    box-shadow:
        0 14px 44px rgba(0, 0, 0, 0.45);
}

body.is-dark .resource:hover {
    background:
        linear-gradient(180deg,
            rgba(0, 0, 0, 0.55),
            rgba(0, 0, 0, 0.65));
}