/* Material Design 3 — Scr1ppy home page
   Tokens: --md-sys-color-* / --md-sys-shape-* / --md-sys-typescale-*
   Theme switched via [data-theme="light"|"dark"] on <html>.
*/

:root {
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-extra-large: 28px;
    --md-sys-shape-corner-full: 9999px;

    --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
    --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);

    --hero-max-width: 560px;
}

:root[data-theme="light"] {
    --md-sys-color-primary: #625578;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #E8DEF8;
    --md-sys-color-on-primary-container: #1E1830;

    --md-sys-color-surface: #E8E3EA;
    --md-sys-color-surface-dim: #CDC8CF;
    --md-sys-color-surface-bright: #EFEAF1;
    --md-sys-color-surface-container-lowest: #F2EDF3;
    --md-sys-color-surface-container-low: #E4DFE6;
    --md-sys-color-surface-container: #DDD8DF;
    --md-sys-color-surface-container-high: #D6D1D8;
    --md-sys-color-surface-container-highest: #CEC9D0;

    --md-sys-color-on-surface: #1C1B1E;
    --md-sys-color-on-surface-variant: #47464A;
    --md-sys-color-outline: #78767A;
    --md-sys-color-outline-variant: #B8B4BA;

    --bg-blob-1: rgba(98, 85, 120, 0.22);
    --bg-blob-2: rgba(132, 118, 156, 0.18);
    --bg-blob-3: rgba(168, 156, 192, 0.14);
    --bg-tint: #E8E3EA;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --md-sys-color-primary: #CCBFE5;
    --md-sys-color-on-primary: #342B47;
    --md-sys-color-primary-container: #4B425F;
    --md-sys-color-on-primary-container: #E8DEF8;

    --md-sys-color-surface: #141318;
    --md-sys-color-surface-dim: #141318;
    --md-sys-color-surface-bright: #3A393E;
    --md-sys-color-surface-container-lowest: #0E0D12;
    --md-sys-color-surface-container-low: #1C1B20;
    --md-sys-color-surface-container: #201F24;
    --md-sys-color-surface-container-high: #2B2A2F;
    --md-sys-color-surface-container-highest: #36353A;

    --md-sys-color-on-surface: #E6E1E6;
    --md-sys-color-on-surface-variant: #C8C5CA;
    --md-sys-color-outline: #928F94;
    --md-sys-color-outline-variant: #47464A;

    --bg-blob-1: rgba(140, 125, 175, 0.25);
    --bg-blob-2: rgba(90, 78, 120, 0.22);
    --bg-blob-3: rgba(60, 55, 80, 0.28);
    --bg-tint: #141318;

    color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg-tint);
    color: var(--md-sys-color-on-surface);
    min-height: 100vh;
    overflow-x: hidden;
    transition:
        background-color 400ms var(--md-sys-motion-easing-emphasized),
        color 400ms var(--md-sys-motion-easing-emphasized);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        radial-gradient(ellipse 60% 45% at 15% 20%, var(--bg-blob-1) 0%, transparent 60%),
        radial-gradient(ellipse 55% 50% at 85% 75%, var(--bg-blob-2) 0%, transparent 60%),
        radial-gradient(ellipse 70% 55% at 50% 100%, var(--bg-blob-3) 0%, transparent 55%);
    background-color: var(--bg-tint);
    transition: background-color 400ms var(--md-sys-motion-easing-emphasized);
}

/* ---------- Hero ---------- */

.hero {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 48px 24px;
}

.hero__inner {
    width: 100%;
    max-width: var(--hero-max-width);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero__title {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-optical-sizing: auto;
    font-size: clamp(4rem, 12vw, 7rem);
    font-weight: 300;
    font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
    letter-spacing: -0.01em;
    line-height: 1;
    margin: 0;
    color: var(--md-sys-color-on-surface);
}

.hero__divider {
    width: 64px;
    height: 1px;
    background: var(--md-sys-color-outline-variant);
    margin: 28px 0 20px;
}

.hero__subtitle {
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0 0 28px;
}

/* ---------- Social icons ---------- */

.social {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 16px;
}

.social__link {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-surface-container-highest);
    border: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition:
        background-color 300ms var(--md-sys-motion-easing-standard),
        border-color 300ms var(--md-sys-motion-easing-standard),
        color 300ms var(--md-sys-motion-easing-standard),
        transform 300ms var(--md-sys-motion-easing-emphasized);
}

.social__link:hover {
    border-color: var(--md-sys-color-primary-container);
}

.social__link svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    position: relative;
    z-index: 1;
    transition: transform 300ms var(--md-sys-motion-easing-emphasized);
}

.social__link::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--md-sys-color-primary-container);
    transform: scale(0);
    border-radius: inherit;
    transition: transform 350ms var(--md-sys-motion-easing-emphasized);
}

.social__link:hover {
    color: var(--md-sys-color-on-primary-container);
    transform: translateY(-3px);
}

.social__link:hover::before { transform: scale(1); }
.social__link:hover svg { transform: scale(1.1); }

.social__link:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 3px;
}

.social__link:active { transform: translateY(-1px) scale(0.97); }

/* ---------- Theme toggle (M3 Switch) ---------- */

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    z-index: 10;
    outline: none;
}

.theme-toggle__track {
    position: absolute;
    inset: 0;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-surface-container-highest);
    border: 2px solid var(--md-sys-color-outline);
    transition:
        background-color 400ms var(--md-sys-motion-easing-emphasized),
        border-color 400ms var(--md-sys-motion-easing-emphasized);
}

.theme-toggle__thumb {
    position: absolute;
    top: 50%;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-outline);
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    transition:
        left 450ms var(--md-sys-motion-easing-emphasized),
        width 450ms var(--md-sys-motion-easing-emphasized),
        height 450ms var(--md-sys-motion-easing-emphasized),
        background-color 400ms var(--md-sys-motion-easing-emphasized);
}

.theme-toggle__icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--md-sys-color-surface-container-highest);
    stroke-width: 2;
    position: absolute;
    transition:
        opacity 250ms var(--md-sys-motion-easing-standard),
        transform 400ms var(--md-sys-motion-easing-emphasized);
}

.theme-toggle__icon--sun circle { fill: currentColor; stroke: none; }
.theme-toggle__icon--moon { fill: currentColor; stroke: none; }

/* Light theme → show sun, thumb on RIGHT (selected = light) */
:root[data-theme="light"] .theme-toggle__track {
    background: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}
:root[data-theme="light"] .theme-toggle__thumb {
    left: 32px;
    width: 24px;
    height: 24px;
    background: var(--md-sys-color-on-primary);
    color: var(--md-sys-color-primary);
}
:root[data-theme="light"] .theme-toggle__icon--sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
:root[data-theme="light"] .theme-toggle__icon--moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.4);
}

/* Dark theme → show moon, thumb on LEFT */
:root[data-theme="dark"] .theme-toggle__thumb {
    left: 4px;
    background: var(--md-sys-color-outline);
    color: var(--md-sys-color-surface-container-highest);
}
:root[data-theme="dark"] .theme-toggle__icon--moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
:root[data-theme="dark"] .theme-toggle__icon--sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.4);
}

.theme-toggle:hover .theme-toggle__thumb {
    width: 26px;
    height: 26px;
}

.theme-toggle:focus-visible .theme-toggle__track {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 3px;
}

.theme-toggle:active .theme-toggle__thumb {
    width: 28px;
    height: 28px;
}

/* ---------- Animations ---------- */

.stagger {
    opacity: 0;
    transform: translateY(14px);
    animation: fade-in 900ms var(--md-sys-motion-easing-emphasized) both;
    animation-delay: calc(var(--stagger, 0) * 180ms + 120ms);
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(14px); filter: blur(4px); }
    to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
    .social__link { width: 52px; height: 52px; }
    .social__link svg { width: 20px; height: 20px; }
    .theme-toggle { top: 16px; right: 16px; }
}
