/* =========================================================
   Spider-Man Comic Theme — Portfolio
   ========================================================= */

:root {
    --red: #E62429;
    --darkred: #A81219;
    --blue: #1A4C8B;
    --lblue: #2B6CB0;
    --yellow: #FFD23F;
    --ink: #0B0E1A;
    --web: #F5F5F5;
    --panel-bg: rgba(255, 255, 255, 0.035);
    --panel-border: #0B0E1A;
}

body {
    background-color: var(--ink);
    color: #fff;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ---------- Typography helpers ---------- */
.font-comic {
    font-family: 'Bangers', cursive;
    letter-spacing: 0.03em;
}

.comic-title {
    color: var(--red);
    -webkit-text-stroke: 2px var(--ink);
    text-shadow: 4px 4px 0 var(--ink), 6px 6px 0 rgba(26, 76, 139, 0.6);
}

.comic-kicker {
    display: inline-block;
    font-family: 'Bangers', cursive;
    font-size: 1.4rem;
    background: var(--red);
    color: #fff;
    padding: 0.15rem 0.9rem;
    border: 3px solid var(--ink);
    border-radius: 6px;
    transform: rotate(-4deg);
    box-shadow: 4px 4px 0 var(--ink);
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.comic-kicker--blue { background: var(--blue); }
.comic-kicker--yellow { background: var(--yellow); color: var(--ink); }

.section-head { margin-bottom: 3rem; position: relative; }
.section-head h2 { line-height: 0.95; }

/* ---------- Background overlays ---------- */
.halftone-overlay {
    background-image: radial-gradient(rgba(230, 36, 41, 0.06) 1px, transparent 1.5px);
    background-size: 22px 22px;
}

/* ---------- Navbar ---------- */
.comic-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1.2rem;
    background: rgba(11, 14, 26, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 3px solid var(--red);
    border-radius: 16px;
    box-shadow: 5px 5px 0 var(--ink), 0 0 0 2px var(--ink) inset;
}

.nav-link {
    position: relative;
    padding-bottom: 2px;
    transition: color 0.2s;
}
.nav-link::after {
    content: "";
    position: absolute;
    left: 0; bottom: -4px;
    height: 3px; width: 0;
    background: var(--red);
    transition: width 0.25s ease;
    border-radius: 2px;
}
.nav-link:hover { color: #fff; }
.nav-link:hover::after { width: 100%; }

.mobile-menu {
    position: fixed;
    top: 88px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    width: 88%;
    max-width: 340px;
    z-index: 49;
    display: none;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
}
.mobile-menu.open {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}
.mobile-link {
    padding: 0.7rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    color: #e2e8f0;
    transition: background 0.2s, color 0.2s;
}
.mobile-link:hover { background: rgba(230, 36, 41, 0.15); color: #fff; }

/* ---------- Buttons ---------- */
.comic-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.85rem 1.6rem;
    background: var(--red);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border: 3px solid var(--ink);
    border-radius: 12px;
    box-shadow: 4px 4px 0 var(--ink);
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    cursor: pointer;
}
.comic-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
    background: var(--darkred);
}
.comic-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--ink);
}
.comic-btn--sm { padding: 0.5rem 1rem; font-size: 0.85rem; width: auto; }
.comic-btn--ghost {
    background: var(--blue);
}
.comic-btn--ghost:hover { background: var(--lblue); }

.comic-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(230, 36, 41, 0.12);
    border: 2px solid var(--red);
    border-radius: 9999px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

/* ---------- Cards (comic panel) ---------- */
.comic-card {
    position: relative;
    background: var(--panel-bg);
    border: 3px solid rgba(245, 245, 245, 0.12);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    will-change: transform;
    overflow: hidden;
}
.comic-card:hover {
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red), 8px 8px 0 rgba(230, 36, 41, 0.25);
    transform: translateY(-4px);
}

.corner-halftone {
    position: absolute;
    top: -40px; left: -40px;
    width: 160px; height: 160px;
    background-image: radial-gradient(rgba(230, 36, 41, 0.5) 2px, transparent 2.5px);
    background-size: 12px 12px;
    border-radius: 50%;
    opacity: 0.5;
    pointer-events: none;
}
.corner-halftone--br { top: auto; left: auto; bottom: -40px; right: -40px; background-image: radial-gradient(rgba(43, 108, 176, 0.5) 2px, transparent 2.5px); }

.map-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 70% 30%, rgba(26, 76, 139, 0.35), transparent 60%),
        radial-gradient(circle at 20% 80%, rgba(230, 36, 41, 0.25), transparent 55%);
    pointer-events: none;
}

/* ---------- Hero ---------- */
.hero-spider {
    position: absolute;
    top: -10px;
    right: 4%;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 1;
}
.hero-spider .thread {
    width: 2px;
    height: 120px;
    background: linear-gradient(to bottom, transparent, rgba(245, 245, 245, 0.5));
}
.spider-bob {
    animation: spiderBob 3.2s ease-in-out infinite;
    filter: drop-shadow(0 6px 12px rgba(230, 36, 41, 0.4));
}
@keyframes spiderBob {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(18px) rotate(2deg); }
}

.scroll-hint {
    position: absolute;
    bottom: 24px;
    left: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #94a3b8;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    font-weight: 600;
}
.scroll-hint i { animation: bobDown 1.6s ease-in-out infinite; }
@keyframes bobDown { 0%,100%{transform:translateY(0)} 50%{transform:translateY(6px)} }

/* ---------- Tech badge / tag ---------- */
.tech-badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(245, 245, 245, 0.12);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}
.tech-badge:hover {
    background: rgba(230, 36, 41, 0.2);
    border-color: var(--red);
    color: #fff;
    transform: translateY(-2px);
}

.tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    background: rgba(26, 76, 139, 0.25);
    border: 1px solid rgba(43, 108, 176, 0.5);
    color: #cbd5e1;
}

.comic-icon-btn {
    flex-shrink: 0;
    width: 42px; height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(245, 245, 245, 0.15);
    transition: all 0.2s;
}
.comic-icon-btn:hover {
    background: var(--red);
    border-color: var(--ink);
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0 var(--ink);
}

/* ---------- Project thumb ---------- */
.project-thumb {
    width: 100%;
    height: 260px;
    border-radius: 12px;
    border: 3px solid rgba(245, 245, 245, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.project-thumb img {
    max-width: 76%;
    max-height: 76%;
    object-fit: contain;
    transition: transform 0.4s ease;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5));
}
.comic-card:hover .project-thumb img { transform: scale(1.08) rotate(-2deg); }

/* ---------- Journey timeline ---------- */
.web-timeline {
    position: relative;
    padding-left: 44px;
}
.web-timeline::before {
    content: "";
    position: absolute;
    left: 15px;
    top: 0; bottom: 0;
    width: 4px;
    background: repeating-linear-gradient(
        to bottom,
        var(--red) 0, var(--red) 10px,
        transparent 10px, transparent 18px
    );
    border-radius: 2px;
}
.web-node { position: relative; margin-bottom: 1.5rem; }
.web-node-dot {
    position: absolute;
    left: -44px;
    top: 22px;
    width: 22px; height: 22px;
    background: var(--red);
    border: 4px solid var(--ink);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--red);
}
.web-node-card { padding: 1.5rem; }

.year-tag {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--yellow);
}
.role-tag {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 2px solid currentColor;
}
.role-tag--red { color: var(--red); }
.role-tag--blue { color: var(--lblue); }
.role-tag--yellow { color: var(--yellow); }

/* ---------- Hero: 2 spider medallions ---------- */
.hero-medallions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
    pointer-events: none;
    z-index: 1;
}

.hero-medallion {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--ink);
    box-shadow: 5px 5px 0 var(--ink);
    color: #fff;
    animation: medallionFloat 4.4s ease-in-out infinite;
    flex-shrink: 0;
}
.hero-medallion::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    width: 2px;
    height: 0;
    background: linear-gradient(to top, rgba(245, 245, 245, 0.5), transparent);
    transform: translateX(-50%);
}
.hero-medallion--red  { background: var(--red);  rotate: -7deg; }
.hero-medallion--blue { background: var(--blue); rotate: 6deg; animation-delay: -2.2s; }
.hero-medallion svg   { width: 34px; height: 34px; filter: drop-shadow(0 2px 5px rgba(0,0,0,.45)); }

@keyframes medallionFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

@media (min-width: 1200px) {
    .hero-medallions {
        position: absolute;
        top: 34%;
        right: 4%;
        margin-bottom: 0;
        flex-direction: column;
        gap: 1.25rem;
    }
    .hero-medallion { width: 68px; height: 68px; }
    .hero-medallion svg { width: 38px; height: 38px; }
    .hero-medallion::before { height: 52px; }
}

/* ---------- Guestbook FAB ---------- */
.guest-fab {
    position: fixed;
    right: 24px;
    bottom: 100px;
    z-index: 890;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem 0.55rem 0.6rem;
    border: 3px solid var(--ink);
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--red), var(--darkred));
    color: #fff;
    font-family: 'Bangers', cursive;
    font-size: 1rem;
    letter-spacing: 0.06em;
    box-shadow: 4px 4px 0 var(--ink), 0 8px 28px rgba(230, 36, 41, .35);
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s, opacity 0.25s;
    animation: fabIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.8s both;
    user-select: none;
    white-space: nowrap;
}
.guest-fab:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink), 0 10px 32px rgba(230,36,41,.45); }
.guest-fab:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.guest-fab-icon {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.22);
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    flex-shrink: 0;
}
.guest-fab-icon svg { width: 16px; height: 16px; }

.guest-fab-count {
    min-width: 22px; height: 22px;
    padding: 0 5px;
    border-radius: 9999px;
    background: var(--yellow);
    color: var(--ink);
    display: inline-flex; align-items: center; justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 800;
    border: 2px solid var(--ink);
}

body.chat-open .guest-fab {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.92);
}

@keyframes fabIn {
    from { opacity: 0; transform: translateY(16px) scale(0.88); }
    to   { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
    .guest-fab { right: 16px; bottom: 96px; padding: 0.5rem 0.7rem 0.5rem 0.55rem; font-size: 0.9rem; }
}

/* ---------- Guestbook overlay & drawer ---------- */
.guestbook-overlay {
    position: fixed; inset: 0; z-index: 940;
    background: rgba(3, 5, 12, .74);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.28s;
}
.guestbook-overlay.open { opacity: 1; pointer-events: auto; }

.guestbook-drawer {
    position: fixed; top: 0; right: 0;
    width: min(520px, 100vw);
    height: 100dvh; height: 100vh; /* fallback */
    z-index: 950;
    display: flex; flex-direction: column;
    background: rgba(11, 14, 26, .98);
    border-left: 3px solid var(--red);
    box-shadow: -20px 0 60px rgba(0,0,0,.65);
    transform: translateX(102%);
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.guestbook-drawer::after {
    content: "";
    position: absolute; inset: 0; z-index: 0;
    background-image: radial-gradient(rgba(230,36,41,.065) 1px, transparent 1.5px);
    background-size: 20px 20px;
    pointer-events: none;
}
.guestbook-drawer > * { position: relative; z-index: 1; }
.guestbook-drawer.open { transform: translateX(0); }

/* ---------- Drawer header ---------- */
.gb-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: linear-gradient(135deg, rgba(230,36,41,.15), rgba(26,76,139,.15));
    border-bottom: 3px solid var(--red);
    flex-shrink: 0;
}
.gb-brand { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.gb-brand-icon {
    width: 42px; height: 42px; flex-shrink: 0;
    border-radius: 11px;
    background: var(--red);
    border: 3px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    display: flex; align-items: center; justify-content: center;
}
.gb-brand-icon svg { width: 24px; height: 24px; color: #fff; }
.gb-title {
    font-family: 'Bangers', cursive;
    font-size: 1.7rem; line-height: 1; letter-spacing: 0.04em; color: #fff;
}
.gb-title span { color: var(--red); }
.gb-subtitle { font-family: monospace; font-size: 0.62rem; color: #94a3b8; letter-spacing: 0.07em; margin-top: 0.15rem; }
.gb-header-right { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.gb-mode {
    font-size: 0.55rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
    padding: 0.2rem 0.4rem; border-radius: 4px; border: 1px solid;
}
.gb-mode--live    { color: #4ade80; background: rgba(74,222,128,.1); border-color: rgba(74,222,128,.35); }
.gb-mode--preview { color: var(--yellow); background: rgba(255,210,63,.1); border-color: rgba(255,210,63,.35); }
.gb-count-pill {
    font-size: 0.65rem; font-weight: 700; color: #cbd5e1;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
    padding: 0.25rem 0.45rem; border-radius: 6px; white-space: nowrap;
}
.gb-close {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.35rem 0.5rem; border-radius: 8px;
    border: 2px solid rgba(245,245,245,.18); background: rgba(255,255,255,.05);
    color: #cbd5e1; font-size: 0.82rem; cursor: pointer;
    transition: all 0.2s;
}
.gb-close:hover { color: #fff; border-color: var(--red); background: rgba(230,36,41,.18); }
.gb-close-esc { font-size: 0.5rem; color: #64748b; letter-spacing: 0.07em; }

/* ---------- Drawer notice & toast ---------- */
.gb-notice {
    margin: 0.6rem 1rem 0; flex-shrink: 0;
    padding: 0.6rem 0.8rem;
    border: 2px dashed rgba(255,210,63,.45);
    background: rgba(255,210,63,.07); color: #fde68a;
    font-size: 0.7rem; line-height: 1.5; border-radius: 10px;
}
.gb-notice[hidden] { display: none; }

.gb-toast {
    position: absolute; top: 80px; left: 1rem; right: 1rem; z-index: 10;
    padding: 0.65rem 0.85rem;
    border-radius: 10px; border: 2px solid var(--red);
    background: #101827; color: #fff;
    font-size: 0.75rem; font-weight: 600;
    box-shadow: 4px 4px 0 rgba(0,0,0,.5);
    opacity: 0; transform: translateY(-8px); pointer-events: none;
    transition: opacity 0.22s, transform 0.22s;
}
.gb-toast.show { opacity: 1; transform: none; }
.gb-toast--error   { border-color: #f87171; background: #2a0d11; }
.gb-toast--success { border-color: #4ade80; background: #061b12; }

/* ---------- Auth area ---------- */
.gb-auth { padding: 0.8rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.gb-auth-card {
    border: 2px solid rgba(245,245,245,.12);
    border-radius: 14px;
    background: rgba(255,255,255,.035);
    padding: 0.8rem;
}
.gb-auth-head {
    display: flex; align-items: center; gap: 0.45rem;
    font-size: 0.72rem; font-weight: 800; color: #e2e8f0;
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.35rem;
}
.gb-auth-head i { color: var(--red); }
.gb-auth-desc { font-size: 0.7rem; color: #94a3b8; line-height: 1.5; margin-bottom: 0.7rem; }
.gb-auth-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.gb-auth-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    padding: 0.55rem 0.6rem;
    border-radius: 9px; border: 2px solid var(--ink);
    font-weight: 800; font-size: 0.76rem; cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.gb-auth-btn--github { background: #fff;       color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.gb-auth-btn--google { background: var(--blue); color: #fff;       box-shadow: 3px 3px 0 var(--ink); }
.gb-auth-btn:hover   { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.gb-auth-btn:active  { transform: translate(1px,1px);   box-shadow: 1px 1px 0 var(--ink); }

/* profile (logged-in) */
.gb-profile { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.gb-profile-main { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.gb-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    border: 2px solid var(--red); background: rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: #fff; font-size: 0.78rem;
    flex-shrink: 0; overflow: hidden;
}
.gb-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.gb-profile-name-row { display: flex; align-items: center; gap: 0.35rem; }
.gb-profile-name { font-size: 0.8rem; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.gb-demo-badge { font-size: 0.52rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.1rem 0.35rem; border-radius: 4px; background: rgba(255,210,63,.2); color: var(--yellow); border: 1px solid rgba(255,210,63,.4); }
.gb-profile-meta { font-size: 0.65rem; color: #94a3b8; display: flex; align-items: center; gap: 0.3rem; margin-top: 0.15rem; }
.gb-signout {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.67rem; font-weight: 700; color: #94a3b8;
    border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04);
    border-radius: 7px; padding: 0.35rem 0.5rem; cursor: pointer;
    transition: all 0.2s; flex-shrink: 0; white-space: nowrap;
}
.gb-signout:hover { color: #fff; border-color: var(--red); background: rgba(230,36,41,.15); }

/* ---------- Message list ---------- */
.gb-list {
    flex: 1; overflow-y: auto; overscroll-behavior: contain;
    padding: 1rem 1rem 0.5rem;
    display: flex; flex-direction: column; gap: 1.1rem;
    scrollbar-width: thin; scrollbar-color: rgba(230,36,41,.45) transparent;
}
.gb-list::-webkit-scrollbar { width: 5px; }
.gb-list::-webkit-scrollbar-thumb { background: rgba(230,36,41,.4); border-radius: 3px; }

.gb-state {
    margin: auto; text-align: center; color: #94a3b8;
    font-size: 0.8rem; display: flex; flex-direction: column;
    align-items: center; gap: 0.6rem; padding: 2.5rem 1rem;
}
.gb-state i { color: var(--red); font-size: 1.5rem; }

.gb-empty {
    text-align: center; padding: 2rem 1rem; color: #94a3b8;
    font-size: 0.82rem; display: flex; flex-direction: column;
    align-items: center; gap: 0.55rem;
}
.gb-empty svg { width: 56px; height: 56px; color: var(--red); opacity: 0.8; }
.gb-empty strong { font-family: 'Bangers', cursive; font-size: 1.6rem; letter-spacing: 0.04em; color: #fff; font-weight: 400; }

.gb-load-more {
    align-self: center;
    padding: 0.45rem 0.8rem;
    border-radius: 8px; border: 2px solid rgba(245,245,245,.18);
    background: rgba(255,255,255,.05); color: #94a3b8;
    font-size: 0.68rem; font-weight: 700; cursor: pointer;
    transition: all 0.2s;
}
.gb-load-more:hover { border-color: var(--red); color: #fff; background: rgba(230,36,41,.12); }

/* ---------- Message item ---------- */
.gb-item { display: flex; flex-direction: column; gap: 0.5rem; animation: gbPop 0.3s ease-out; }

.gb-row { display: flex; align-items: flex-end; gap: 0.55rem; }
.gb-row--own { flex-direction: row-reverse; }

.gb-avatar-sm {
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid rgba(245,245,245,.2);
    background: var(--blue); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.7rem; flex-shrink: 0; overflow: hidden;
}
.gb-row--own .gb-avatar-sm { border-color: var(--red); background: var(--darkred); }
.gb-avatar-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

.gb-bubble-wrap { display: flex; flex-direction: column; max-width: 82%; }
.gb-row--own .gb-bubble-wrap { align-items: flex-end; }

.gb-meta { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.gb-row--own .gb-meta { flex-direction: row-reverse; }
.gb-name { font-family: 'Bangers', cursive; font-size: 1rem; letter-spacing: 0.04em; color: var(--red); }
.gb-row--own .gb-name { color: var(--yellow); }
.gb-own-badge { font-size: 0.5rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; padding: 0.1rem 0.3rem; border-radius: 4px; background: rgba(255,210,63,.2); color: var(--yellow); border: 1px solid rgba(255,210,63,.4); }
.gb-provider { font-size: 0.62rem; color: #64748b; }
.gb-pinned { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.52rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--yellow); background: rgba(255,210,63,.12); border: 1px solid rgba(255,210,63,.3); border-radius: 4px; padding: 0.1rem 0.3rem; }

.gb-bubble {
    position: relative;
    padding: 0.65rem 0.8rem;
    border-radius: 14px; border: 2px solid rgba(245,245,245,.13);
    background: rgba(255,255,255,.05); color: #e2e8f0;
    font-size: 0.82rem; line-height: 1.55;
    white-space: pre-wrap; overflow-wrap: anywhere;
    border-bottom-left-radius: 4px;
}
.gb-row--own .gb-bubble {
    background: linear-gradient(135deg, rgba(230,36,41,.88), rgba(168,18,25,.92));
    border-color: rgba(230,36,41,.55); color: #fff;
    border-bottom-left-radius: 14px; border-bottom-right-radius: 4px;
}

.gb-delete {
    position: absolute; top: 0.3rem; right: 0.3rem;
    width: 22px; height: 22px; border-radius: 6px;
    border: none; background: rgba(0,0,0,.35);
    color: #94a3b8; font-size: 0.68rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.15s, color 0.15s;
}
.gb-row--own .gb-delete { right: auto; left: 0.3rem; }
.gb-bubble:hover .gb-delete { opacity: 1; }
.gb-delete:hover { color: #f87171; }
@media (hover: none) { .gb-delete { opacity: 0.7; } }

.gb-foot { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.2rem; }
.gb-row--own .gb-foot { justify-content: flex-end; }
.gb-date { color: #475569; font-size: 0.6rem; font-family: monospace; }
.gb-action {
    background: none; border: none; padding: 0;
    color: #64748b; font-size: 0.62rem; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.2rem;
}
.gb-action:hover { color: var(--red); }
.gb-reply-count { color: #475569; font-size: 0.6rem; font-family: monospace; }

/* ---------- Nested replies ---------- */
.gb-replies {
    margin-left: 2.5rem;
    padding-left: 0.85rem;
    border-left: 2px dashed rgba(230,36,41,.32);
    display: flex; flex-direction: column; gap: 0.8rem;
}
.gb-reply { display: flex; gap: 0.45rem; align-items: flex-start; }
.gb-reply .gb-avatar-sm { width: 26px; height: 26px; font-size: 0.62rem; }
.gb-reply .gb-bubble { font-size: 0.78rem; }
.gb-reply .gb-name { font-size: 0.9rem; }

/* ---------- Locked / Composer ---------- */
.gb-locked {
    flex-shrink: 0;
    padding: 0.8rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
    border-top: 2px solid rgba(230,36,41,.4);
    background: rgba(11,14,26,.97);
    display: flex; gap: 0.55rem; align-items: flex-start;
    color: #94a3b8; font-size: 0.76rem; line-height: 1.5;
}
.gb-locked[hidden] { display: none; }
.gb-locked i { color: var(--yellow); margin-top: 0.12rem; flex-shrink: 0; }

.gb-composer {
    flex-shrink: 0;
    padding: 0.75rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    border-top: 2px solid rgba(230,36,41,.4);
    background: rgba(11,14,26,.97);
    display: flex; flex-direction: column; gap: 0.45rem;
}
.gb-composer[hidden] { display: none; }

.gb-reply-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    padding: 0.35rem 0.55rem;
    border-radius: 8px; background: rgba(26,76,139,.22); border: 1px solid rgba(43,108,176,.4);
    color: #cbd5e1; font-size: 0.68rem;
}
.gb-reply-bar[hidden] { display: none; }
.gb-reply-bar strong { color: var(--yellow); }
.gb-reply-bar button { background: none; border: none; color: #94a3b8; cursor: pointer; padding: 0.1rem 0.2rem; line-height: 1; }
.gb-reply-bar button:hover { color: #fff; }

.gb-composer-row { display: flex; align-items: flex-end; gap: 0.5rem; }

.gb-textarea {
    flex: 1; resize: none;
    min-height: 54px; max-height: 120px;
    padding: 0.6rem 0.7rem;
    border-radius: 12px; border: 2px solid rgba(245,245,245,.15);
    background: rgba(255,255,255,.05); color: #fff;
    font-family: inherit; font-size: 0.82rem; line-height: 1.5;
    outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.gb-textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(230,36,41,.2); }
.gb-textarea::placeholder { color: #64748b; }

.gb-send {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 11px; border: 3px solid var(--ink);
    background: var(--red); color: #fff; font-size: 0.95rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.gb-send:hover:not(:disabled) { background: var(--darkred); transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.gb-send:active:not(:disabled) { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }
.gb-send:disabled { opacity: 0.45; cursor: not-allowed; }

.gb-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.gb-counter { font-size: 0.6rem; color: #64748b; font-family: monospace; }
.gb-counter.is-low  { color: var(--yellow); }
.gb-counter.is-over { color: #f87171; }
.gb-hint { font-size: 0.58rem; color: #334155; }

/* ---------- Guestbook keyframes ---------- */
@keyframes gbPop {
    from { opacity: 0; transform: translateY(7px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Responsive: drawer mobile ---------- */
@media (max-width: 640px) {
    .guestbook-drawer { width: 100%; border-left: none; border-top: 3px solid var(--red); }
    .gb-header { padding: 0.8rem 0.85rem; }
    .gb-title { font-size: 1.5rem; }
    .gb-brand-icon { width: 36px; height: 36px; }
    .gb-brand-icon svg { width: 20px; height: 20px; }
    .gb-count-pill { display: none; }
    .gb-close-esc { display: none; }
    .gb-list { padding: 0.8rem 0.8rem 0.4rem; gap: 0.9rem; }
    .gb-replies { margin-left: 1.8rem; }
    .gb-hint { display: none; }
    .guest-fab-label { display: none; }
}
@media (max-width: 380px) { .gb-mode { display: none; } }

/* ---------- Contact ---------- */
.contact-card { border-color: rgba(230, 36, 41, 0.35); }
.contact-glow {
    position: absolute;
    width: 320px; height: 320px;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}
.contact-glow--red { top: -120px; right: -80px; background: rgba(230, 36, 41, 0.25); }
.contact-glow--blue { bottom: -120px; left: -80px; background: rgba(26, 76, 139, 0.3); }

.social-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(245, 245, 245, 0.12);
    transition: all 0.25s;
}
.social-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--red);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--ink);
}

/* ---------- Scroll spider ---------- */
#scroll-spider {
    position: fixed;
    right: 14px;
    top: 0;
    color: var(--red);
    z-index: 40;
    pointer-events: none;
    filter: drop-shadow(0 0 8px rgba(230, 36, 41, 0.6));
    transition: top 0.1s linear;
    transform: translateY(-50%);
}

/* ---------- Reveal animations ---------- */
/* Content is ALWAYS visible. The entrance animation only plays when the
   observer adds .visible, so a failed/stale script can never blank the page. */
.reveal-anim { opacity: 1; transform: none; }

@keyframes revealUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

html.js-ready .reveal-anim.visible {
    animation: revealUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.delay-100 { animation-delay: 100ms !important; }
.delay-200 { animation-delay: 200ms !important; }

/* ---------- Cursor ---------- */
canvas#bg-canvas {
    position: fixed !important;
    top: 0; left: 0;
    z-index: -10;
}

#cursor-dot {
    position: fixed;
    top: 0; left: 0;
    width: 8px; height: 8px;
    background-color: var(--red);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 0 10px var(--red), 0 0 20px rgba(230, 36, 41, 0.6);
    transition: transform 0.1s ease-out;
}

#cursor-ring {
    position: fixed;
    top: 0; left: 0;
    width: 36px; height: 36px;
    border: 2px solid rgba(43, 108, 176, 0.7);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 999;
    animation: cursorRotate 5s linear infinite;
    transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
}
#cursor-ring::before {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px dashed rgba(230, 36, 41, 0.5);
    border-radius: 50%;
}
@keyframes cursorRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
#cursor-ring::after {
    content: "";
    position: absolute;
    top: -4px; left: 50%;
    width: 6px; height: 6px;
    background: var(--red);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--red);
}

.click-effect {
    position: fixed;
    border: 2px solid var(--red);
    border-radius: 50%;
    pointer-events: none;
    z-index: 998;
    transform: translate(-50%, -50%);
    animation: websplat 0.6s ease-out forwards;
}
@keyframes websplat {
    0% { width: 0; height: 0; opacity: 1; border-width: 4px; }
    100% { width: 90px; height: 90px; opacity: 0; border-width: 1px; }
}

.cursor-trail {
    position: fixed;
    width: 3px; height: 3px;
    background: var(--red);
    border-radius: 50%;
    pointer-events: none;
    z-index: 997;
    transform: translate(-50%, -50%);
    opacity: 0.6;
}

body.hovering-link #cursor-dot {
    transform: translate(-50%, -50%) scale(1.6);
    background-color: var(--yellow);
}
body.hovering-link #cursor-ring {
    width: 54px; height: 54px;
    border: 2px solid var(--red);
    animation: cursorRotate 1.6s linear infinite;
}

#cursor-glow {
    position: fixed;
    top: 0; left: 0;
    width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(230, 36, 41, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: screen;
}

/* =========================================================
   Chatbot
   ========================================================= */
.chat-toggle {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 60px; height: 60px;
    border-radius: 50%;
    border: 3px solid var(--ink);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--red), var(--blue));
    box-shadow: 0 8px 30px rgba(230, 36, 41, 0.5);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: chatPulse 2.5s infinite;
}
.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 40px rgba(230, 36, 41, 0.7);
}
.chat-toggle.active {
    animation: none;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
@keyframes chatPulse {
    0%, 100% { box-shadow: 0 8px 30px rgba(230, 36, 41, 0.5); }
    50% { box-shadow: 0 8px 30px rgba(230, 36, 41, 0.5), 0 0 0 12px rgba(230, 36, 41, 0.08); }
}

.chat-panel {
    position: fixed;
    bottom: 100px; right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 140px);
    border: 3px solid var(--red);
    border-radius: 1.25rem;
    z-index: 901;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    background: rgba(11, 14, 26, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.chat-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 2px solid rgba(230, 36, 41, 0.3);
}
.chat-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--red), var(--blue));
    border: 2px solid var(--ink);
}
.chat-close {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(245, 245, 245, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    cursor: pointer;
    transition: background 0.2s ease;
}
.chat-close:hover { background: rgba(255, 255, 255, 0.15); }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(230, 36, 41, 0.4);
    border-radius: 3px;
}

.chat-msg { display: flex; width: 100%; }
.chat-msg--user { justify-content: flex-end; }
.chat-msg--bot { justify-content: flex-start; }

.chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.55;
    word-wrap: break-word;
}
.chat-msg--user .chat-bubble {
    background: linear-gradient(135deg, var(--red), var(--darkred));
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg--bot .chat-bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(245, 245, 245, 0.12);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}
.chat-bubble code {
    background: rgba(230, 36, 41, 0.25);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.82rem;
}

.chat-typing { display: flex; gap: 5px; align-items: center; }
.chat-typing span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--red);
    animation: chatTyping 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.chat-suggest-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
}
.chat-suggest {
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 9999px;
    background: rgba(230, 36, 41, 0.12);
    border: 1px solid rgba(230, 36, 41, 0.35);
    color: #fca5a5;
    cursor: pointer;
    transition: all 0.2s ease;
}
.chat-suggest:hover {
    background: rgba(230, 36, 41, 0.3);
    color: #fff;
}

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 14px 16px;
    border-top: 2px solid rgba(230, 36, 41, 0.3);
}
.chat-form textarea {
    flex: 1;
    resize: none;
    max-height: 120px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 2px solid rgba(245, 245, 245, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s ease;
}
.chat-form textarea:focus { border-color: rgba(230, 36, 41, 0.7); }
.chat-form textarea::placeholder { color: #94a3b8; }

.chat-send {
    width: 42px; height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid var(--ink);
    background: linear-gradient(135deg, var(--red), var(--blue));
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.chat-send:hover:not(:disabled) { transform: scale(1.08); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .hero-spider { right: -10px; transform: scale(0.7); }
    .web-timeline { padding-left: 34px; }
    .web-node-dot { left: -34px; }
    .comic-title { -webkit-text-stroke: 1.5px var(--ink); text-shadow: 3px 3px 0 var(--ink); }
}

@media (max-width: 480px) {
    .chat-panel {
        right: 16px; left: 16px;
        width: auto;
        bottom: 92px;
        height: calc(100vh - 120px);
        max-height: calc(100vh - 120px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spider-bob, .chat-toggle, .scroll-hint i, .hero-medallion, .guest-fab { animation: none !important; }
    .reveal-anim, html.js-ready .reveal-anim.visible {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .guestbook-drawer, .guestbook-overlay { transition: none !important; }
}
