/* =========================================================
   NOTEBOOK UI — starting scaffold, not a finished design.
   Swap the handwriting font, ink color, and paper texture for
   choices that feel like YOUR notebook, not a generic one.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Gloria+Hallelujah&family=Caveat:wght@400;500;600;700&display=swap');
:root {
    /* Light mode = paper page */
    --bg-color: #f3dfb9;
    --text-color: #2b2b2b;
    --muted-text: #5a5a52;
    --ink: #2b3a67;          /* pen ink blue */
    --ink-red: #b23a3a;      /* margin line / red pen */
    --line-color: rgba(0, 0, 0, 0.18);
    --paper: #fff5d2;         /* paper background */
    --tape: rgba(255, 230, 120, 0.55);
    --highlight: #fff27a;
    --border-color: #2b2b2b;

    --font-hand: 'Gloria Hallelujah', cursive;
    --font-hand-2: 'Caveat', cursive;
}

.dark-theme {
    /* Dark mode = chalkboard */
    --bg-color: #1e2b23;
    --text-color: #f2f2ea;
    --muted-text: #b9c2b8;
    --ink: #eef0e6;
    --ink-red: #e08a8a;
    --line-color: rgba(238, 240, 230, 0.12);
    --paper: #23342a;
    --tape: rgba(255, 255, 255, 0.12);
    --highlight: #cbe89b;
    --border-color: #eef0e6;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-hand-2), sans-serif;
    font-size: 1.15rem;
    font-weight: 500;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.7;
    transition: background-color 0.3s, color 0.3s;
    position: relative;
}

/* Ruled notebook paper background + red margin line */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(var(--line-color) 1px, transparent 1px);
    background-size: 100% 2rem;
    background-position: 0 5.5rem;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    left: 48px;
    width: 2px;
    background: var(--ink-red);
    opacity: 0.35;
    z-index: -1;
}

@media (max-width: 700px) {
    body::after { display: none; }
}

h1, h2, h3 {
    font-family: var(--font-hand), cursive;
    font-weight: 700;
}

/* Header — looks like a notebook cover strip */
header {
    background-color: var(--paper);
    border-bottom: 2px dashed var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.6rem;
    margin: 0;
    color: var(--ink);
    transform: rotate(-1deg);
}

nav { display: flex; align-items: center; }

nav a {
    position: relative;
    color: var(--text-color);
    text-decoration: none;
    margin-right: 1.4rem;
    font-family: var(--font-hand-2), sans-serif;
    font-size: 1.05rem;
    padding-bottom: 2px;
}

/* hand-drawn underline using a squiggly SVG background */
nav a::after {
    content: '';
    position: absolute;
    left: 0; bottom: -3px;
    width: 100%;
    height: 6px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5 Q 10 0, 20 5 T 40 5 T 60 5 T 80 5 T 100 5' stroke='%232b3a67' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 100% 100%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dark-theme nav a::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5 Q 10 0, 20 5 T 40 5 T 60 5 T 80 5 T 100 5' stroke='%23eef0e6' stroke-width='2' fill='none'/%3E%3C/svg%3E");
}

nav a:hover::after, nav a.active-link::after { opacity: 1; }
nav a.active-link { color: var(--ink); font-weight: 700; }

#theme-btn {
    background: var(--paper);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 3px 12px 3px 12px;
    cursor: pointer;
    font-family: var(--font-hand-2), sans-serif;
    font-size: 0.95rem;
    transition: transform 0.15s ease;
}

#theme-btn:hover { transform: rotate(-2deg) scale(1.03); }

main {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 1rem 0 3.5rem;
    min-height: 70vh;
}

@media (max-width: 700px) {
    main { padding: 0 1rem; }
}

.content-section { display: none; }
.content-section.active {
    display: block;
    animation: pageFlip 0.4s ease;
}

@keyframes pageFlip {
    from { opacity: 0; transform: rotateX(6deg) translateY(10px); }
    to { opacity: 1; transform: rotateX(0) translateY(0); }
}

/* Panels — a page torn from the notebook, taped down */
.panel {
    background-color: var(--paper);
    color: var(--text-color);
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: 2px;
    box-shadow: 4px 4px 0 var(--line-color), 0 6px 16px rgba(0,0,0,0.08);
    position: relative;
    transform: rotate(-0.4deg);
}

.panel:nth-of-type(2) { transform: rotate(0.4deg); }
.panel:nth-of-type(3) { transform: rotate(-0.2deg); }

/* Tape strip decoration on each panel */
.panel::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 40px;
    width: 70px;
    height: 28px;
    background: var(--tape);
    border: 1px solid rgba(0,0,0,0.08);
    transform: rotate(-4deg);
}

.panel h2 {
    margin-top: 0;
    font-size: 1.8rem;
    color: var(--ink);
    border-bottom: 2px dashed var(--line-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.typewriter-line { font-size: 1.1rem; color: var(--muted-text); margin-top: -0.5rem; font-family: var(--font-hand-2), sans-serif; }
.typewriter-text { color: var(--ink-red); border-right: 2px solid var(--ink-red); padding-right: 4px; }

.skills-grid { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

.skill-badge {
    background-color: transparent;
    color: var(--text-color);
    padding: 0.3rem 0.9rem;
    border: 2px solid var(--ink);
    border-radius: 40% 60% 55% 45% / 50% 45% 55% 50%;
    font-family: var(--font-hand-2), sans-serif;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.skill-badge:hover { transform: rotate(-3deg) scale(1.05); background-color: var(--highlight); color: #2b2b2b; }
.skill-badge.small { padding: 0.2rem 0.6rem; font-size: 0.8rem; }

.social-links-container { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }
.contact-links { margin-bottom: 0.5rem; }

.social-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: var(--ink);
    text-decoration: underline wavy;
    border: none;
    font-family: var(--font-hand-2), sans-serif;
    font-size: 0.95rem;
    transition: transform 0.2s ease;
}

.social-tag:hover { transform: translateY(-2px) rotate(-2deg); color: var(--ink-red); }

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.75rem;
    margin-top: 1.5rem;
}

.project-card {
    border: 2px solid var(--border-color);
    padding: 1.5rem;
    background-color: var(--paper);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 3px 3px 0 var(--line-color);
    transition: transform 0.25s ease;
    position: relative;
}

.project-card::before {
    content: '';
    position: absolute;
    top: -10px;
    right: 30px;
    width: 50px;
    height: 20px;
    background: var(--tape);
    transform: rotate(6deg);
}

.project-card:nth-child(2n) { transform: rotate(1deg); }
.project-card:hover { transform: translateY(-4px) rotate(-1deg); }

.book-cover-wrap, .app-icon-wrap {
    width: 100%;
    max-width: 160px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border: 2px solid var(--border-color);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--highlight);
    filter: saturate(0.85);
}

.project-card .book-cover { width: 100%; height: 100%; object-fit: cover; filter: sepia(0.15) contrast(1.02); }
.app-icon { font-size: 3rem; }

.app-feature-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-bottom: 1rem; }

.status-badge {
    display: inline-block;
    margin-top: auto;
    padding: 0.3rem 0.8rem;
    border: 1px dashed var(--border-color);
    font-family: var(--font-hand-2), sans-serif;
    font-size: 0.85rem;
}

.project-card h3 { margin: 0 0 0.5rem; font-size: 1.3rem; color: var(--ink); }
.project-card p { color: var(--muted-text); font-size: 0.95rem; margin-bottom: 1.5rem; font-family: var(--font-hand-2), sans-serif; }

.buy-btn {
    display: inline-block;
    margin-top: auto;
    color: var(--ink-red);
    text-decoration: underline wavy;
    font-family: var(--font-hand), cursive;
    font-size: 1.05rem;
}

.buy-btn:hover { color: var(--ink); }

.experience-list { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1rem; }

.experience-item {
    background: transparent;
    border-left: 3px solid var(--ink);
    padding: 0.5rem 0 0.5rem 1.25rem;
    transition: transform 0.2s ease;
}

.experience-item:hover { transform: translateX(6px); }

.experience-item-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.experience-item-header h3 { margin: 0; font-size: 1.15rem; color: var(--ink); }

.duration-badge {
    background: var(--highlight);
    color: #2b2b2b;
    padding: 0.2rem 0.7rem;
    border: 1px solid var(--border-color);
    font-family: var(--font-hand-2), sans-serif;
    font-size: 0.85rem;
}

.experience-item p { color: var(--muted-text); margin: 0.4rem 0 0; font-family: var(--font-hand-2), sans-serif; }

.contact-form { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1.5rem; }

.contact-form input, .contact-form textarea {
    padding: 0.7rem 0.9rem;
    border: none;
    border-bottom: 2px solid var(--ink);
    border-radius: 0;
    background-color: transparent;
    color: var(--text-color);
    font-family: var(--font-hand-2), sans-serif;
    font-size: 1rem;
}

.contact-form input:focus, .contact-form textarea:focus {
    outline: none;
    border-bottom-color: var(--ink-red);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    color: var(--ink);
    padding: 0.65rem 1.5rem;
    border: 2px solid var(--ink);
    border-radius: 3px 14px 3px 14px;
    margin-top: 0.5rem;
    font-family: var(--font-hand), cursive;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn:hover { background-color: var(--ink); color: var(--paper); transform: rotate(-1deg); }

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(0,0,0,0.15);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out;
    pointer-events: none;
}
@keyframes rippleAnim { to { transform: scale(3); opacity: 0; } }
.btn, #theme-btn, #scroll-top-btn { position: relative; overflow: hidden; }

.fade-in-up { opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; }
.fade-in-up.in-view { opacity: 1; transform: translateY(0); }

footer {
    text-align: center;
    padding: 2rem;
    border-top: 2px dashed var(--border-color);
    font-size: 0.9rem;
    color: var(--muted-text);
    background-color: var(--bg-color);
    font-family: var(--font-hand-2), sans-serif;
}

.footer-socials a { color: var(--ink); text-decoration: underline wavy; margin: 0 0.5rem; }
.footer-socials a:hover { color: var(--ink-red); }

#page-loader {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-color);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#page-loader.loaded { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-mark {
    font-family: var(--font-hand), cursive;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--ink);
}

#particle-canvas { display: none; }

#scroll-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0%;
    background: var(--ink-red);
    z-index: 200;
}

#scroll-top-btn {
    position: fixed; bottom: 1.75rem; right: 1.75rem;
    width: 46px; height: 46px;
    border: 2px solid var(--border-color);
    border-radius: 40% 60% 55% 45% / 50% 45% 55% 50%;
    background-color: var(--paper);
    color: var(--ink);
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0; visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 150;
}
#scroll-top-btn.visible { opacity: 1; visibility: visible; transform: translateY(0); }
#scroll-top-btn:hover { transform: rotate(-4deg) scale(1.05); }

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