/* ============================================================
   p9r.dev — sketchbook neubrutalism
   Palette:
     #f5f0e0 sketchbook cream     #222222 marker black
     #d8d0c0 ruled-line cream     #2d3436 deep ink
     #ff6b6b patch red            #4ecdc4 patch teal
     #ffeaa7 sticky yellow        #a29bfe patch purple
     #fdcb6e highlight amber
   ============================================================ */

:root {
    --cream: #f5f0e0;
    --rule: #d8d0c0;
    --ink: #222222;
    --deep-ink: #2d3436;
    --red: #ff6b6b;
    --teal: #4ecdc4;
    --yellow: #ffeaa7;
    --purple: #a29bfe;
    --amber: #fdcb6e;

    --shadow-hard: 6px 6px 0 var(--ink);
    --shadow-soft: 3px 3px 0 rgba(0, 0, 0, 0.18);

    --radius-rough-1: 4px 12px 2px 8px;
    --radius-rough-2: 10px 3px 14px 5px;
    --radius-rough-3: 6px 14px 4px 10px;
    --radius-rough-4: 3px 8px 12px 4px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--deep-ink);
    background: var(--cream);
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 27px,
        rgba(216, 208, 192, 0.45) 27px,
        rgba(216, 208, 192, 0.45) 28px
    );
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.paper-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle at 12% 18%, rgba(255, 234, 167, 0.18) 0, transparent 40%),
        radial-gradient(circle at 88% 72%, rgba(162, 155, 254, 0.15) 0, transparent 38%),
        radial-gradient(circle at 50% 95%, rgba(78, 205, 196, 0.12) 0, transparent 35%);
}

/* ============================================================
   HERO  — sketch intro
   ============================================================ */
.hero {
    position: relative;
    min-height: 100vh;
    padding: 80px 8vw;
    z-index: 1;
}

.hero-frame {
    position: absolute;
    left: 25%;
    top: 35%;
    transform: translate(-25%, -35%) rotate(-1.5deg);
    background: var(--cream);
    border: 8px solid var(--ink);
    border-radius: var(--radius-rough-1);
    padding: 48px 56px;
    box-shadow: var(--shadow-hard);
    transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
    max-width: 640px;
}

.hero-frame:hover {
    transform: translate(-25%, -35%) rotate(0deg) scale(1.01);
    box-shadow: 8px 8px 0 var(--ink);
}

.hero-tagline {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--red);
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.hero-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(2.6rem, 9vw, 6rem);
    line-height: 0.95;
    color: var(--ink);
    letter-spacing: -0.04em;
    margin-bottom: 16px;
    text-shadow: 4px 4px 0 var(--amber);
}

.hero-sub {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    color: var(--deep-ink);
    font-weight: 500;
}

.hero-cursor {
    display: inline-block;
    font-family: 'Fira Code', monospace;
    color: var(--red);
    font-weight: 700;
    margin-left: 4px;
    animation: blink 1.05s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* hero doodles */
.doodle {
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

.doodle-arrow {
    bottom: 9%;
    right: 14%;
    transform: rotate(8deg);
    text-align: center;
}

.doodle-arrow .doodle-label {
    display: block;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--ink);
    margin-top: -8px;
    transform: rotate(-3deg);
}

.doodle-star {
    top: 12%;
    right: 18%;
    transform: rotate(-12deg);
    animation: wobble 4s ease-in-out infinite;
}

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

/* ============================================================
   STACK  — content patches
   ============================================================ */
.stack {
    position: relative;
    padding: 60px 0 120px;
    z-index: 1;
}

.patch {
    --rot: 0.5deg;
    --margin-left: 12%;
    --width: 62%;
    border: 4px solid var(--ink);
    border-radius: var(--radius-rough-1);
    padding: 32px 36px 36px;
    margin: 60px var(--margin-left);
    width: var(--width);
    transform: rotate(var(--rot));
    box-shadow: var(--shadow-hard);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    position: relative;
}

.patch:hover {
    transform: rotate(0deg) scale(1.01);
    box-shadow: 9px 9px 0 var(--ink);
}

.patch-red {
    background: var(--red);
    --rot: -1.2deg;
    --margin-left: 8%;
    --width: 64%;
    border-radius: var(--radius-rough-1);
}

.patch-teal {
    background: var(--teal);
    --rot: 1.4deg;
    --margin-left: auto;
    --width: 68%;
    margin-right: 6%;
    margin-left: auto;
    border-radius: var(--radius-rough-2);
}

.patch-purple {
    background: var(--purple);
    --rot: -0.8deg;
    --margin-left: 14%;
    --width: 60%;
    border-radius: var(--radius-rough-3);
}

.patch-yellow {
    background: var(--yellow);
    --rot: 1.1deg;
    --margin-left: 18%;
    --width: 50%;
    border-radius: var(--radius-rough-4);
}

.patch-narrow {
    --width: 48%;
}

.patch-wide {
    --width: 72%;
    --margin-left: 10%;
}

.patch-red.patch-wide {
    --rot: 0.9deg;
}

.patch-tab {
    position: absolute;
    top: -16px;
    left: 24px;
    background: var(--ink);
    color: var(--cream);
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: 3px 9px 2px 7px;
    transform: rotate(-2deg);
    letter-spacing: 0.02em;
}

.patch-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    line-height: 1.05;
    color: var(--ink);
    margin-bottom: 18px;
    letter-spacing: -0.02em;
}

.patch-body {
    font-size: 1.05rem;
    color: var(--ink);
    margin-bottom: 18px;
}

.patch-foot {
    margin-top: 16px;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
    color: var(--ink);
    opacity: 0.85;
}

/* ============================================================
   TAGS — sticker bombed
   ============================================================ */
.tag-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 8px;
    margin-top: 12px;
}

.tag {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 14px;
    border: 3px solid var(--ink);
    border-radius: 4px 10px 3px 8px;
    color: var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    transition: transform 0.18s ease-out, box-shadow 0.18s ease-out;
    cursor: default;
    user-select: none;
    display: inline-block;
}

.tag:nth-child(odd)  { transform: rotate(-2deg); }
.tag:nth-child(even) { transform: rotate(1.5deg); }
.tag:nth-child(3n)   { transform: rotate(-1deg); }
.tag:nth-child(4n)   { transform: rotate(2.5deg); }

.tag:hover {
    transform: rotate(0deg) translateY(-2px);
    box-shadow: 4px 4px 0 var(--ink);
}

.tag-red    { background: var(--red); }
.tag-teal   { background: var(--teal); }
.tag-yellow { background: var(--yellow); }
.tag-purple { background: var(--purple); }
.tag-cream  { background: var(--cream); }

/* ============================================================
   PROJECT LIST
   ============================================================ */
.project-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 8px;
}

.project {
    background: var(--cream);
    border: 3px solid var(--ink);
    border-radius: 6px 12px 4px 9px;
    padding: 18px 20px;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.18s ease-out, box-shadow 0.18s ease-out;
    transform: rotate(-0.4deg);
}

.project:nth-child(2) { transform: rotate(0.7deg); }
.project:nth-child(3) { transform: rotate(-0.9deg); }
.project:nth-child(4) { transform: rotate(0.3deg); }

.project:hover {
    transform: rotate(0deg) translateY(-3px);
    box-shadow: 5px 5px 0 var(--ink);
}

.project-name {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--ink);
    margin-bottom: 4px;
}

.project-meta {
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    color: var(--deep-ink);
    margin-bottom: 8px;
    opacity: 0.85;
}

.project-desc {
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.55;
}

/* ============================================================
   LOG LIST
   ============================================================ */
.log-list {
    list-style: none;
    counter-reset: log;
    margin-top: 8px;
}

.log-list li {
    counter-increment: log;
    padding: 10px 0 10px 30px;
    border-bottom: 2px dashed var(--ink);
    position: relative;
    font-size: 0.98rem;
    color: var(--ink);
}

.log-list li:last-child {
    border-bottom: none;
}

.log-list li::before {
    content: "✗";
    position: absolute;
    left: 0;
    top: 10px;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    color: var(--red);
    font-size: 1.05rem;
    transform: rotate(-12deg);
}

.log-date {
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
    color: var(--ink);
    background: var(--cream);
    padding: 1px 7px;
    border: 2px solid var(--ink);
    border-radius: 3px 6px 2px 5px;
    margin-right: 8px;
    display: inline-block;
    transform: rotate(-1deg);
}

/* ============================================================
   CODE BLOCK
   ============================================================ */
.code-block {
    background: var(--ink);
    color: var(--cream);
    border: 4px solid var(--ink);
    border-radius: 4px 12px 2px 8px;
    padding: 20px 22px;
    font-family: 'Fira Code', monospace;
    font-size: 0.92rem;
    line-height: 1.6;
    overflow-x: auto;
    box-shadow: inset 0 0 0 2px var(--cream);
    margin-top: 8px;
    white-space: pre;
}

.code-block code {
    color: var(--cream);
    font-family: inherit;
}

/* ============================================================
   SCRIBBLES & LINKS
   ============================================================ */
.scribble {
    text-decoration: underline wavy var(--ink);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    font-style: italic;
    background: var(--amber);
    padding: 0 4px;
    border-radius: 2px 6px 2px 4px;
}

.scribble-link {
    color: var(--ink);
    font-weight: 700;
    text-decoration: underline wavy var(--red);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    transition: color 0.15s ease-out, background 0.15s ease-out;
    padding: 0 2px;
}

.scribble-link:hover {
    background: var(--amber);
    color: var(--ink);
    text-decoration-color: var(--ink);
}

code {
    font-family: 'Fira Code', monospace;
    font-size: 0.88em;
    color: var(--ink);
}

/* ============================================================
   FOOTER — sticky notes
   ============================================================ */
.footer {
    position: relative;
    padding: 60px 8vw 120px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 40px 32px;
    z-index: 1;
}

.sticky {
    background: var(--yellow);
    border: 2px solid var(--ink);
    padding: 18px 20px 22px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.18);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%);
    font-size: 0.95rem;
    color: var(--ink);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    min-height: 130px;
}

.sticky-1 { transform: rotate(-3deg); }
.sticky-2 { transform: rotate(2deg); background: var(--teal); }
.sticky-3 { transform: rotate(-1.5deg); background: var(--purple); }
.sticky-4 { transform: rotate(2.5deg); background: var(--red); }

.sticky:hover {
    transform: rotate(0deg) translateY(-4px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.25);
}

.sticky-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    color: var(--ink);
    margin-bottom: 8px;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 4px;
    display: inline-block;
}

.sticky a {
    color: var(--ink);
}

/* ============================================================
   MARGIN DOODLES
   ============================================================ */
.margin-doodle {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0.85;
}

.margin-doodle-1 {
    top: 110vh;
    right: 4%;
    transform: rotate(15deg);
}

.margin-doodle-2 {
    top: 180vh;
    left: 3%;
    transform: rotate(-10deg);
}

.margin-doodle-3 {
    top: 260vh;
    right: 5%;
    transform: rotate(20deg);
}

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
.patch.is-hidden {
    opacity: 0;
    transform: translateY(40px) rotate(var(--rot));
}

.patch.is-shown {
    animation: drop-in 0.55s cubic-bezier(0.2, 0.8, 0.3, 1.2) forwards;
}

@keyframes drop-in {
    0% {
        opacity: 0;
        transform: translateY(40px) rotate(0deg) scale(0.96);
    }
    60% {
        opacity: 1;
        transform: translateY(-6px) rotate(calc(var(--rot) * 1.5)) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(var(--rot)) scale(1);
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .hero-frame {
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%) rotate(-1.5deg);
        max-width: 88vw;
        padding: 36px 32px;
    }
    .hero-frame:hover {
        transform: translate(-50%, -50%) rotate(0deg) scale(1.01);
    }
    .doodle-star, .doodle-arrow {
        display: none;
    }
    .patch {
        width: 86% !important;
        margin-left: 7% !important;
        margin-right: 7% !important;
    }
    .project-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .hero {
        padding: 40px 20px;
    }
    .patch {
        padding: 24px 22px;
    }
    .hero-frame {
        padding: 28px 22px;
    }
    .footer {
        padding: 40px 18px 80px;
    }
}
