/* ========================================
   skoogliboo — style.css
   Moody, whimsical, rustic. Not boring.
   ======================================== */

/* --- Custom Properties --- */
:root {
    --c-bg: #1c1915;
    --c-bg-light: #252119;
    --c-text: #e8dcc8;
    --c-text-dim: #a89e8e;
    --c-terracotta: #b5543e;
    --c-sage: #7a8c6e;
    --c-gold: #c9a84c;

    --f-display: 'Playfair Display', Georgia, serif;
    --f-hand: 'Caveat', cursive;
    --f-body: 'DM Sans', system-ui, sans-serif;

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Reset --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--f-body);
    background: var(--c-bg);
    color: var(--c-text);
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Dark/Light Mode Toggle --- */
.mode-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 50%;
    cursor: pointer;
    color: var(--c-text-dim);
    padding: 0;
}

.mode-toggle:hover {
    color: var(--c-text);
    border-color: var(--c-text-dim);
}

.mode-toggle__icon {
    width: 20px;
    height: 20px;
}

/* Show moon in dark mode, sun in light mode */
.mode-toggle__icon--sun {
    display: none;
}

.mode-toggle__icon--moon {
    display: block;
}

[data-mode="light"] .mode-toggle__icon--sun {
    display: block;
}

[data-mode="light"] .mode-toggle__icon--moon {
    display: none;
}

/* --- Light Mode Adjustments --- */
[data-mode="light"] body::before {
    opacity: 0.02;
}

[data-mode="light"] .letter {
    text-shadow:
        0 0 40px rgba(100, 60, 40, 0.1),
        2px 2px 0 rgba(0, 0, 0, 0.06);
}

[data-mode="light"] .hero__name::after {
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.04);
}

[data-mode="light"] .vibe__card {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow:
        4px 4px 0 rgba(0, 0, 0, 0.06),
        inset 0 0 60px rgba(0, 0, 0, 0.03);
}

[data-mode="light"] .link-card {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}

[data-mode="light"] .link-card:hover,
[data-mode="light"] .link-card:focus-visible {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

[data-mode="light"] .links::before {
    background: var(--c-text);
    opacity: 0.06;
}

/* --- Grain Overlay --- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* --- Ink Trail Canvas --- */
#ink-trail {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
}

/* --- Floating Scribbles --- */
.scribbles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    color: var(--c-text);
}

.scribble {
    position: absolute;
    animation: drift 20s ease-in-out infinite;
}

.scribble--1 {
    width: clamp(120px, 20vw, 260px);
    top: 8%;
    right: 5%;
    animation-delay: 0s;
}

.scribble--2 {
    width: clamp(80px, 15vw, 180px);
    bottom: 15%;
    left: 8%;
    animation-delay: -5s;
    animation-duration: 25s;
}

.scribble--3 {
    width: clamp(60px, 12vw, 140px);
    top: 55%;
    right: 12%;
    animation-delay: -10s;
    animation-duration: 22s;
}

.scribble--4 {
    width: clamp(50px, 10vw, 100px);
    top: 30%;
    left: 15%;
    animation-delay: -15s;
    animation-duration: 28s;
}

@keyframes drift {

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

    25% {
        transform: translate(15px, -20px) rotate(3deg);
    }

    50% {
        transform: translate(-10px, 15px) rotate(-2deg);
    }

    75% {
        transform: translate(20px, 10px) rotate(4deg);
    }
}

/* ========================================
   HERO
   ======================================== */
.hero {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 2rem;
    text-align: center;
}

.hero__name {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: clamp(3rem, 12vw, 9rem);
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--c-text);
    position: relative;
}

.letter {
    display: inline-block;
    cursor: pointer;
    transition: transform 0.4s var(--ease-out-expo);
    /* Slight organic offset per letter */
    transform: rotate(calc((var(--i) - 4.5) * 0.6deg)) translateY(calc(sin(var(--i) * 1.2) * 2px));
    text-shadow:
        0 0 40px rgba(181, 84, 62, 0.15),
        2px 2px 0 rgba(0, 0, 0, 0.3);
}

.letter:hover {
    color: var(--c-gold);
    transform: rotate(calc((var(--i) - 4.5) * -1.5deg)) translateY(-6px) scale(1.08);
}

/* Ink bleed pseudo */
.hero__name::after {
    content: 'skoogliboo';
    position: absolute;
    inset: 0;
    font-family: var(--f-display);
    font-weight: 700;
    font-size: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    color: transparent;
    -webkit-text-stroke: 1px rgba(232, 220, 200, 0.06);
    filter: blur(3px);
    pointer-events: none;
    z-index: -1;
}

/* Scroll hint arrow */
.hero__scroll-hint {
    position: absolute;
    bottom: 2rem;
    color: var(--c-text-dim);
    animation: bob 2.5s ease-in-out infinite;
    opacity: 0.5;
}

@keyframes bob {

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

    50% {
        transform: translateY(8px);
    }
}

/* ========================================
   VIBE
   ======================================== */
.vibe {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    padding: clamp(4rem, 10vh, 8rem) 2rem;
}

.vibe__card {
    max-width: 520px;
    padding: 2.5rem 2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(232, 220, 200, 0.08);
    border-radius: 2px;
    transform: rotate(-1.2deg);
    position: relative;
    /* Rough paper feel */
    box-shadow:
        4px 4px 0 rgba(0, 0, 0, 0.2),
        inset 0 0 60px rgba(0, 0, 0, 0.15);
}

.vibe__card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 10%;
    right: 15%;
    height: 3px;
    background: var(--c-terracotta);
    opacity: 0.4;
    border-radius: 1px;
}

.vibe__text {
    font-family: var(--f-hand);
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    line-height: 1.5;
    color: var(--c-text);
    letter-spacing: 0.01em;
}

.vibe__underline {
    display: block;
    width: 60%;
    margin-top: 1.5rem;
    opacity: 0.6;
}

/* ========================================
   LINKS
   ======================================== */
.links {
    position: relative;
    z-index: 1;
    padding: clamp(4rem, 10vh, 8rem) 2rem;
    text-align: center;
}

.links__heading {
    font-family: var(--f-hand);
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    font-weight: 400;
    color: var(--c-text-dim);
    margin-bottom: 3rem;
    letter-spacing: 0.05em;
}

.links__grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    max-width: 700px;
    margin: 0 auto;
}

/* --- Link Cards --- */
.link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 3rem;
    min-width: 220px;
    flex: 1 1 220px;
    max-width: 300px;
    text-decoration: none;
    color: var(--c-text);
    border: 1px solid rgba(232, 220, 200, 0.1);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
    transition:
        transform 0.5s var(--ease-out-expo);
    /* Slightly different rotations for character */
    transform: rotate(-0.8deg);
}

.link-card--etsy {
    transform: rotate(0.6deg);
}

.link-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 120%, currentColor 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.link-card:hover,
.link-card:focus-visible {
    transform: rotate(0deg) scale(1.04) translateY(-4px);
    border-color: rgba(232, 220, 200, 0.25);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    outline: none;
}

.link-card:hover::before,
.link-card:focus-visible::before {
    opacity: 0.04;
}

.link-card--insta:hover,
.link-card--insta:focus-visible {
    border-color: var(--c-terracotta);
    color: var(--c-terracotta);
}

.link-card--etsy:hover,
.link-card--etsy:focus-visible {
    border-color: var(--c-gold);
    color: var(--c-gold);
}

.link-card__icon {
    width: 40px;
    height: 40px;
    transition: transform 0.5s var(--ease-out-expo);
}

.link-card:hover .link-card__icon {
    transform: scale(1.1) rotate(-3deg);
}

.link-card__label {
    font-family: var(--f-display);
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.link-card__sublabel {
    font-family: var(--f-hand);
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--c-text-dim);
}

.link-card:hover .link-card__sublabel {
    color: var(--c-text);
}

/* --- Torn edge divider before links --- */
.links::before {
    content: '';
    display: block;
    width: 100%;
    max-width: 500px;
    height: 20px;
    margin: 0 auto 3rem;
    background: var(--c-bg);
    clip-path: polygon(0% 100%, 3% 40%, 7% 80%, 12% 30%, 18% 70%, 22% 20%,
            28% 60%, 33% 10%, 38% 55%, 43% 25%, 48% 65%, 53% 15%,
            58% 50%, 63% 5%, 68% 45%, 73% 20%, 78% 60%, 83% 10%,
            88% 50%, 93% 25%, 97% 55%, 100% 100%);
    opacity: 0.12;
    border-bottom: 1px solid rgba(232, 220, 200, 0.06);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 4rem 2rem 3rem;
}

.footer__doodle {
    width: 60px;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.footer__copy {
    font-family: var(--f-hand);
    font-size: 0.9rem;
    color: var(--c-text-dim);
    letter-spacing: 0.05em;
}

/* ========================================
   REVEAL ANIMATIONS
   ======================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger the links */
.reveal .link-card {
    opacity: 0;
    transform: translateY(20px) rotate(-0.8deg);
    transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

.reveal .link-card--etsy {
    transform: translateY(20px) rotate(0.6deg);
    transition-delay: 0.15s;
}

.reveal.is-visible .link-card {
    opacity: 1;
    transform: translateY(0) rotate(-0.8deg);
}

.reveal.is-visible .link-card--etsy {
    transform: translateY(0) rotate(0.6deg);
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    .reveal .link-card,
    .reveal .link-card--etsy {
        opacity: 1;
        transform: none;
    }

    .scribble {
        animation: none;
    }

    #ink-trail {
        display: none;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Small phones */
@media (max-width: 380px) {
    .link-card {
        padding: 2rem 1.5rem;
        min-width: 180px;
    }

    .vibe__card {
        padding: 2rem 1.5rem;
    }
}

/* Tablet and up */
@media (min-width: 768px) {
    .vibe__card {
        padding: 3rem 2.5rem;
    }

    .links__grid {
        flex-wrap: nowrap;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .hero__name {
        letter-spacing: -0.03em;
    }

    .link-card {
        padding: 3rem 3.5rem;
    }
}