:root {
    color-scheme: light dark;

    --background: #ffffff;
    --foreground: #111111;
    --muted: #858585;
    --border: #e5e5e5;

    --card-border: #dedede;
    --shadow-color: 0, 0, 0;

    --button-bg: #080808;
    --button-text: #ffffff;

    --transition: 300ms ease;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --background: #0b0b0b;
        --foreground: #f5f5f5;
        --muted: #999999;
        --border: #292929;

        --card-border: #3a3a3a;
        --shadow-color: 0, 0, 0;

        --button-bg: #f5f5f5;
        --button-text: #111111;
    }
}

:root[data-theme="light"] {
    color-scheme: light;

    --background: #ffffff;
    --foreground: #111111;
    --muted: #858585;
    --border: #e5e5e5;

    --card-border: #dedede;
    --shadow-color: 0, 0, 0;

    --button-bg: #080808;
    --button-text: #ffffff;
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --background: #0b0b0b;
    --foreground: #f5f5f5;
    --muted: #999999;
    --border: #292929;

    --card-border: #3a3a3a;
    --shadow-color: 0, 0, 0;

    --button-bg: #f5f5f5;
    --button-text: #111111;
}

:root[data-active-theme="light"] {
    color-scheme: light;
}

:root[data-active-theme="dark"] {
    color-scheme: dark;
}

/* ========================================
   2. RESET & BASE
======================================== */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;

    background: var(--background);
    color: var(--foreground);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;

    transition:
        background var(--transition),
        color var(--transition);
}

button,
a {
    font: inherit;
}

button {
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--muted);
    outline-offset: 5px;
}

::selection {
    background: var(--foreground);
    color: var(--background);
}

/* ========================================
   3. PAGE LAYOUT
======================================== */

.site-shell {
    width: min(100% - 76px, 1600px);
    min-height: 100vh;
    margin-inline: auto;

    display: flex;
    flex-direction: column;
}

/* ========================================
   4. HEADER
======================================== */

.header {
    min-height: 104px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    border-bottom: 1px solid var(--border);
}

.wordmark {
    display: inline-block;

    font-size: clamp(24px, 2.5vw, 36px);
    font-weight: 750;
    letter-spacing: -1.8px;
    line-height: 1.1;
}

.theme-toggle {
    width: 52px;
    height: 52px;
    flex-shrink: 0;

    display: grid;
    place-items: center;

    border: 1px solid var(--muted);
    border-radius: 50%;

    background: transparent;
    cursor: pointer;

    transition:
        background var(--transition),
        transform var(--transition);
}

.theme-icon { display:block; width:18px; height:18px; }
.theme-icon-moon { display:none; }
:root[data-active-theme="dark"] .theme-icon-sun { display:none; }
:root[data-active-theme="dark"] .theme-icon-moon { display:block; }

.theme-toggle:hover {
    background: var(--border);
    transform: rotate(12deg);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   5. HERO LAYOUT
======================================== */

.hero {
    flex: 1;

    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    align-items: center;
    gap: clamp(36px, 5vw, 80px);

    padding-block: 42px 80px;
}

.hero-content {
    min-width: 0;
}

/* ========================================
   6. HERO TYPOGRAPHY
======================================== */

.hero-title {
    margin: 0;

    font-size: clamp(48px, 6.5vw, 100px);
    font-weight: 720;
    letter-spacing: -0.075em;
    line-height: 1.04;
}

.hero-title span {
    display: block;

    color: var(--muted);
    font-weight: 450;
    letter-spacing: -0.065em;
}

.hero-description {
    max-width: 660px;
    margin: 26px 0 0;

    color: var(--foreground);

    font-size: clamp(16px, 1.45vw, 20px);
    font-weight: 400;
    line-height: 1.65;
}

/* ========================================
   7. DISCOVER BUTTON
======================================== */

.hero-actions {
    margin-top: 32px;
}

.discover-button {
    min-height: 60px;
    padding: 0 22px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 30px;

    border: 1px solid var(--button-bg);
    border-radius: 10px;

    background: var(--button-bg);
    color: var(--button-text);

    font-size: 16px;
    font-weight: 600;

    cursor: pointer;

    transition:
        opacity var(--transition),
        transform var(--transition);
}

.discover-button:hover {
    opacity: 0.88;
    transform: translateY(-2px);
}

.discover-button svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   8. LOGO STAGE
======================================== */

.hero-visual {
    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-stage {
    position: relative;

    width: min(100%, 410px);
    aspect-ratio: 1 / 1;

    display: grid;
    place-items: center;

    perspective: 1000px;
}

/* Floating card */

.logo-object {
    position: relative;
    z-index: 2;

    width: 76%;
    aspect-ratio: 1 / 1;

    animation: logo-float 4s ease-in-out infinite;
    will-change: transform;
}

/* Border is the frame, not a filled background */

.logo-face {
    position: absolute;
    inset: 0;

    overflow: hidden;

    border: 1px solid var(--card-border);
    border-radius: 22%;

    background: transparent;

    box-shadow:
        0 2px 3px rgba(var(--shadow-color), 0.04),
        0 14px 28px rgba(var(--shadow-color), 0.035);

    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}

/* Both images occupy the same space */

.logo-image {
    position: absolute;
    inset: 0;

    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
    object-position: center;

    user-select: none;
    pointer-events: none;

    transition: opacity 500ms ease;
}

/* Light logo is visible by default */

.logo-image--light {
    opacity: 1;
}

/* Dark logo is hidden by default */

.logo-image--dark {
    opacity: 0;
}

/* Fade between logo assets when theme changes */

:root[data-active-theme="dark"] .logo-image--light {
    opacity: 0;
}

:root[data-active-theme="dark"] .logo-image--dark {
    opacity: 1;
}

:root[data-active-theme="light"] .logo-image--light {
    opacity: 1;
}

:root[data-active-theme="light"] .logo-image--dark {
    opacity: 0;
}

/* ========================================
   9. LOGO SHADOW
======================================== */

.logo-shadow {
    position: absolute;
    z-index: 1;

    left: 50%;
    bottom: 5%;

    width: 78%;
    height: 10%;

    border-radius: 50%;
    background: var(--foreground);

    opacity: 0.78;
    filter: blur(1px);

    transform: translateX(-50%) scale(1);

    animation: shadow-breathe 4s ease-in-out infinite;
    will-change: transform, opacity, filter;

    transition: background var(--transition);
}

/* ========================================
   10. FLOATING ANIMATIONS
   Shared by the homepage logo and the profile photo. Each page tunes
   the movement through custom properties, so the keyframes live once.
======================================== */

@keyframes logo-float {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(var(--float-offset, -24px));
    }
}

@keyframes shadow-breathe {
    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: var(--shadow-opacity, 0.78);
        filter: blur(var(--shadow-blur, 1px));
    }

    50% {
        transform: translateX(-50%) scale(0.78, 0.72);
        opacity: var(--shadow-opacity-mid, 0.38);
        filter: blur(var(--shadow-blur-mid, 5px));
    }
}

/* ========================================
   11. FOOTER
======================================== */

.footer {
    min-height: 76px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    border-top: 1px solid var(--border);

    color: var(--muted);

    font-size: 10px;
    letter-spacing: 0.6px;
}

.footer-label {
    display: flex;
    align-items: center;
    gap: 12px;

    color: var(--foreground);
}

.footer-label i {
    width: 3px;
    height: 3px;

    border-radius: 50%;
    background: var(--muted);
}

/* ========================================
   12. TABLET
======================================== */

@media (max-width: 900px) {
    .site-shell {
        width: min(100% - 48px, 720px);
    }

    .hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 48px;

        padding-block: 44px 64px;
    }

    .hero-title {
        font-size: clamp(54px, 10vw, 82px);
    }

    .hero-visual {
        width: 100%;
    }

    .logo-stage {
        width: min(78%, 340px);
    }
}

/* ========================================
   13. MOBILE
======================================== */

@media (max-width: 520px) {
    .site-shell {
        width: calc(100% - 36px);
    }

    .header {
        min-height: 78px;
    }

    .wordmark {
        font-size: clamp(19px, 5.3vw, 27px);
        letter-spacing: -1.2px;
    }

    .theme-toggle {
        width: 42px;
        height: 42px;
    }

    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }

    .hero {
        gap: 42px;
        padding-block: 38px 54px;
    }

    .hero-title {
        font-size: clamp(42px, 10.8vw, 60px);
        letter-spacing: -0.07em;
    }

    .hero-title span {
        letter-spacing: -0.06em;
    }

    .hero-description {
        margin-top: 20px;
        font-size: 15px;
        line-height: 1.8;
    }

    .discover-button {
        min-height: 54px;
        gap: 24px;
        font-size: 15px;
    }

    .logo-stage {
        width: min(90%, 300px);
    }

    .footer {
        min-height: 76px;
        padding-block: 20px;

        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 12px;

        font-size: 9px;
    }
}

/* ========================================
   14. ACCESSIBILITY
======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   PAGE ENTRANCE
   One shared entrance for every page, admin included.

   Content never starts fully transparent, so the page is readable
   from the first frame. The motion moves upward on purpose: a
   downward shift on a full-height page (admin dashboard, editor)
   would create a temporary scrollbar and a layout jolt.
======================================== */

@keyframes page-enter {
    from {
        opacity: 0.6;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-shell > .header,
.site-shell > main,
.site-shell > .admin-layout,
.site-shell > .footer {
    animation: page-enter 280ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

/* Short stagger only offsets the start state; nothing is hidden.
   `backwards` leaves no transform behind after the animation ends. */
.site-shell > main,
.site-shell > .admin-layout {
    animation-delay: 40ms;
}

.site-shell > .footer {
    animation-delay: 80ms;
}
