/* ============================================
   TOKENS
   ============================================ */

:root {
    --bg: #fafaf8;
    --bg-panel: rgba(250, 250, 248, 0.88);
    --text: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #999;
    --accent: #8b5a4b;
    --accent-hover: #6d4539;
    --accent-secondary: #4a8a7e;
    --link: #5e6b75;
    --border: #e0ded8;
    --card: #f3f2ef;
    --dot: rgba(0, 0, 0, 0.015);
    --tab-active-bg: rgba(139, 90, 75, 0.08);
    --win-bar-bg: rgba(0, 0, 0, 0.03);
    --hover-glow: rgba(139, 90, 75, 0.04);

    --font-pixel: 'VT323', monospace;
    --font-mono: 'Space Mono', 'Courier New', monospace;

    --sidebar-w: 336px;
}

[data-theme="dark"] {
    --bg: #0e0e0e;
    --bg-panel: rgba(18, 18, 18, 0.92);
    --text: #ddd;
    --text-secondary: #b0b0b0;
    --text-muted: #555;
    --accent: #d4826a;
    --accent-hover: #e09980;
    --accent-secondary: #4fd1c5;
    --link: #8aa8c0;
    --border: #252525;
    --card: #161616;
    --dot: rgba(255, 255, 255, 0.015);
    --tab-active-bg: rgba(212, 130, 106, 0.1);
    --win-bar-bg: rgba(255, 255, 255, 0.03);
    --hover-glow: rgba(212, 130, 106, 0.06);
}

/* ============================================
   RESET
   ============================================ */

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

html {
    font-size: 15px;
    height: 100%;
}

body {
    font-family: var(--font-mono);
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: rgba(139, 90, 75, 0.18);
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--accent);
}

button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}

/* ============================================
   BACKGROUND
   ============================================ */

#shader-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.1;
    will-change: transform;
    image-rendering: auto;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px);
    background-size: 18px 18px;
    pointer-events: none;
    z-index: 1;
}

/* ============================================
   LAYOUT — TWO PANEL
   ============================================ */

.layout {
    position: relative;
    z-index: 2;
    display: flex;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

/* ============================================
   WINDOW TITLE BARS
   ============================================ */

.win-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--win-bar-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    user-select: none;
}

/* Container for mobile action buttons + toggle arrow, pushed to the right */
.win-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* Mobile action icons — hidden on desktop */
.mobile-action-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.mobile-action-btn:hover,
.mobile-action-btn:active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--hover-glow);
}

/* Label under mobile action buttons — hidden on desktop */
.mobile-action-label {
    display: none;
}

/* Mobile inline social links — hidden on desktop */
.mobile-social-inline {
    display: none;
}

.win-dots {
    display: flex;
    gap: 5px;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    transition: transform 0.15s, opacity 0.15s;
}

.dot:hover {
    transform: scale(1.3);
}

.dot-r {
    background: #ff5f57;
}

.dot-y {
    background: #febc2e;
}

.dot-g {
    background: #28c840;
}

.win-title {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(12px);
    transition: border-color 0.3s;
}

.sidebar:hover {
    border-color: color-mix(in srgb, var(--accent) 25%, var(--border));
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0;
    overflow-y: auto;
    scrollbar-width: none;
}

.sidebar-inner::-webkit-scrollbar {
    display: none;
}

/* Avatar */
.avatar-frame {
    margin: 20px 20px 16px;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    background: var(--card);
    position: relative;
    transition: border-color 0.3s;
}

.avatar-frame:hover {
    border-color: var(--accent);
}

/* Scanline overlay on avatar */
.avatar-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px);
    pointer-events: none;
    animation: scanline-drift 8s linear infinite;
}

@keyframes scanline-drift {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(20px);
    }
}

.avatar-frame:hover .avatar-glyph {
    opacity: 0.85;
    text-shadow: 0 0 30px rgba(139, 90, 75, 0.3);
}

/* Avatar image */
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform 0.4s ease;
}

.avatar-frame:hover .avatar-img {
    transform: scale(1.04);
}

/* Sidebar hero — vertical on desktop */
.sidebar-hero {
    display: flex;
    flex-direction: column;
}

.hero-text {
    /* On desktop, just contains the name/subtitle as before */
}

/* Mobile toggle — hidden on desktop */
.mobile-toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.15s;
}

.mobile-toggle:hover {
    color: var(--accent);
}

/* Sidebar details — always visible on desktop */
.sidebar-details {
    display: block;
}

.name {
    font-family: var(--font-pixel);
    font-size: 2.4rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1;
    color: var(--text);
    padding: 0 20px;
}

.subtitle {
    font-family: var(--font-pixel);
    font-size: 1.15rem;
    color: var(--text-muted);
    padding: 4px 20px 0;
    line-height: 1.4;
}

.cursor {
    color: var(--accent);
    animation: blink 0.8s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Sidebar sections */
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 14px 20px;
}

.sidebar-section {
    padding: 0 20px;
}

.sidebar-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 8px;
    opacity: 0.7;
}

.social-links {
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex-wrap: nowrap;
}

.social-links a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    flex: 1;
    color: var(--text-muted);
    transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
}

.social-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--hover-glow);
    transform: translateY(-2px);
}

.social-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.social-label {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.04em;
    text-transform: lowercase;
}

.email-link {
    font-size: 0.75rem;
    color: var(--link);
    word-break: break-all;
    display: block;
    margin-bottom: 8px;
    transition: color 0.15s;
}

.email-link:hover {
    color: var(--accent);
}

.contact-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Bottom actions */
.sidebar-bottom {
    margin-top: auto;
    padding-bottom: 16px;
}

.sidebar-actions {
    display: flex;
    gap: 6px;
    padding: 0 20px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    transition: all 0.2s;
    cursor: pointer;
}

.action-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--hover-glow);
    transform: translateY(-1px);
}

.action-label {
    font-family: var(--font-pixel);
    font-size: 0.9rem;
}

.footer-text {
    font-size: 0.6rem;
    color: var(--text-muted);
    opacity: 0.4;
    padding: 10px 20px 0;
}

/* ============================================
   CONTENT PANEL
   ============================================ */

.content-panel {
    flex: 1;
    min-width: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(12px);
    transition: border-color 0.3s;
}

.content-panel:hover {
    border-color: color-mix(in srgb, var(--accent) 15%, var(--border));
}

/* ============================================
   TAB BAR
   ============================================ */

.tab-bar {
    display: flex;
    gap: 0;
    padding: 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.tab {
    font-family: var(--font-pixel);
    font-size: 1.22rem;
    color: var(--text-muted);
    padding: 12px 22px;
    border: none;
    border-right: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
    letter-spacing: 0.04em;
}

.tab:last-child {
    border-right: none;
}

.tab:hover {
    color: var(--text);
    background: var(--win-bar-bg);
}

.tab.active {
    color: var(--accent);
    background: var(--tab-active-bg);
    text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

/* ============================================
   TAB CONTENT
   ============================================ */

.tab-content {
    flex: 1;
    min-height: 0;
    position: relative;
}

.tab-pane {
    display: none;
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.tab-pane.active {
    display: block;
}

.tab-pane.visible {
    opacity: 1;
    transform: translateY(0);
}

.pane-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 28px 36px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.pane-scroll::-webkit-scrollbar {
    width: 4px;
}

.pane-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.pane-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ============================================
   SECTION TITLES
   ============================================ */

.section-title {
    font-family: var(--font-pixel);
    font-size: 1.7rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 18px;
    letter-spacing: 0.04em;
}

.sub-title {
    font-family: var(--font-pixel);
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--accent-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.04em;
}

.sub-divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

.tab-pane p {
    font-size: 0.9rem;
    line-height: 1.85;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.005em;
}

.tab-pane p:last-child {
    margin-bottom: 0;
}

/* ============================================
   TAGS
   ============================================ */

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.tag-list span {
    font-size: 0.72rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 3px 12px;
    border-radius: 2px;
    letter-spacing: 0.02em;
    transition: all 0.2s;
    cursor: default;
}

.tag-list span:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--hover-glow);
    transform: translateY(-1px);
}

.tag-list.small span {
    font-size: 0.65rem;
    padding: 2px 9px;
}

/* ============================================
   NEWS SCROLL BAR (inside about)
   ============================================ */

.news-scroll-bar {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--hover-glow);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.news-scroll-bar::-webkit-scrollbar {
    width: 3px;
}

.news-scroll-bar::-webkit-scrollbar-track {
    background: transparent;
}

.news-scroll-bar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.news-scroll-bar .news-item {
    display: flex;
    gap: 12px;
    align-items: baseline;
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    line-height: 1.55;
    transition: background 0.15s, padding-left 0.2s;
}

.news-scroll-bar .news-item:last-child {
    border-bottom: none;
}

.news-scroll-bar .news-item:hover {
    background: var(--hover-glow);
    padding-left: 18px;
}

.news-scroll-bar .news-item strong {
    color: var(--text);
}

.date {
    font-family: var(--font-pixel);
    font-size: 1.05rem;
    color: var(--accent);
    min-width: 90px;
    flex-shrink: 0;
}

/* ============================================
   PUBLICATIONS
   ============================================ */

.pub {
    margin-bottom: 24px;
    padding: 16px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    border-radius: 4px;
    transition: background 0.2s, border-color 0.2s;
}

.pub:hover {
    background: var(--hover-glow);
}

.pub:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.pub-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    font-family: var(--font-pixel);
    font-size: 0.95rem;
    color: var(--accent);
    letter-spacing: 0.06em;
}

.pub-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 6px;
}

.pub-info {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pub-info.muted {
    color: var(--text-muted);
}

.pub-info em {
    font-style: normal;
    color: var(--accent);
    font-weight: 700;
}

/* ============================================
   PROJECTS
   ============================================ */

.proj {
    margin-bottom: 22px;
    padding: 16px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
    border-radius: 4px;
    transition: background 0.2s, border-color 0.2s;
}

.proj:hover {
    background: var(--hover-glow);
}

.proj:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.proj-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.proj-name {
    font-family: var(--font-pixel);
    font-size: 1.4rem;
    color: var(--text);
    transition: color 0.15s;
}

.proj:hover .proj-name {
    color: var(--accent);
}

.proj-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.proj-links a {
    font-family: var(--font-pixel);
    font-size: 0.95rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 1px 10px 2px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
    white-space: nowrap;
}

.proj-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--hover-glow);
    transform: translateY(-1px);
}

/* demo link slightly bolder than source */
.proj-links a:first-child {
    color: var(--accent-secondary);
    border-color: color-mix(in srgb, var(--accent-secondary) 40%, var(--border));
}

.proj-links a:first-child:hover {
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
    background: color-mix(in srgb, var(--accent-secondary) 6%, transparent);
}

.proj-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 8px;
}

/* ============================================
   NOTES PLACEHOLDER
   ============================================ */

.notes-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    min-height: 300px;
}

.notes-icon {
    font-size: 2.8rem;
    color: var(--accent);
    opacity: 0.3;
    margin-bottom: 16px;
    display: block;
    animation: pulse-icon 3s ease-in-out infinite;
}

@keyframes pulse-icon {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.05);
    }
}

.notes-msg {
    font-family: var(--font-pixel);
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.notes-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ============================================
   GLITCH
   ============================================ */

.glitch {
    position: relative;
    display: inline-block;
    cursor: default;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    padding: inherit;
    box-sizing: border-box;
    text-align: inherit;
}

.glitch:hover::before,
.glitch:hover::after {
    opacity: 1;
}

.glitch:hover::before {
    clip-path: inset(0 0 65% 0);
    animation: g-top 0.12s infinite linear alternate-reverse;
}

.glitch:hover::after {
    clip-path: inset(60% 0 0 0);
    animation: g-bot 0.12s infinite linear alternate-reverse;
}

@keyframes g-top {

    0%,
    90% {
        transform: translate(0);
    }

    92% {
        transform: translate(-3px, 1px);
    }

    95% {
        transform: translate(3px, -1px);
    }

    100% {
        transform: translate(0);
    }
}

@keyframes g-bot {

    0%,
    88% {
        transform: translate(0);
    }

    90% {
        transform: translate(2px, 1px);
    }

    94% {
        transform: translate(-3px, 0);
    }

    100% {
        transform: translate(0);
    }
}

/* ============================================
   SCRAPER MODAL
   ============================================ */

.scraper-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.scraper-overlay.active {
    opacity: 1;
    visibility: visible;
}

.scraper-modal {
    max-width: 640px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.scraper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.scraper-actions {
    display: flex;
    gap: 8px;
}

.scraper-copy-btn {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--bg);
    background: var(--accent);
    padding: 4px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.scraper-copy-btn:hover {
    opacity: 0.8;
}

.scraper-copy-btn.copied {
    background: #22c55e;
}

.scraper-close-btn {
    font-size: 0.95rem;
    color: var(--text-muted);
    padding: 2px 6px;
    cursor: pointer;
    transition: color 0.15s;
}

.scraper-close-btn:hover {
    color: var(--text);
}

.scraper-content {
    padding: 16px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.75;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ============================================
   RESPONSIVE — TABLET & PHONE
   ============================================ */

@media (max-width: 860px) {

    /* --- Layout --- */
    body {
        overflow-y: auto;
    }

    .layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 8px;
        gap: 8px;
    }

    /* --- Sidebar: compact card --- */
    .sidebar {
        width: 100%;
        flex-shrink: 0;
        border-radius: 8px;
    }

    /* Show mobile toggle */
    .mobile-toggle {
        display: inline-flex;
        align-items: center;
    }

    /* Show mobile action icons in win-bar — prominent pill style with labels */
    .mobile-action-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1px;
        width: auto;
        height: auto;
        padding: 4px 10px 3px;
        font-size: 0.75rem;
        border-radius: 6px;
        background: var(--hover-glow);
        border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
        color: var(--text-secondary);
    }

    .mobile-action-btn:hover,
    .mobile-action-btn:active {
        background: color-mix(in srgb, var(--accent) 12%, transparent);
        border-color: var(--accent);
        color: var(--accent);
    }

    .mobile-action-label {
        display: block;
        font-family: var(--font-pixel);
        font-size: 0.6rem;
        letter-spacing: 0.06em;
        line-height: 1;
        color: var(--text-muted);
        text-transform: lowercase;
    }

    /* Mobile inline social links — visible row below name */
    .mobile-social-inline {
        display: flex;
        gap: 6px;
        padding: 6px 16px 10px;
    }

    .mobile-social-inline a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 7px 12px;
        border: 1px solid var(--border);
        border-radius: 5px;
        color: var(--text-muted);
        font-size: 0.72rem;
        text-decoration: none;
        transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
        flex: 1;
    }

    .mobile-social-inline a:hover {
        color: var(--accent);
        border-color: var(--accent);
        background: var(--hover-glow);
        transform: translateY(-1px);
    }

    .mobile-social-inline .social-icon {
        width: 17px;
        height: 17px;
        flex-shrink: 0;
    }

    .mobile-social-name {
        font-family: var(--font-mono);
        font-size: 0.58rem;
        letter-spacing: 0.04em;
        text-transform: lowercase;
    }

    /* Hide the desktop sidebar-bottom on mobile (buttons are in win-bar now) */
    .sidebar-bottom {
        display: none;
    }

    .toggle-icon {
        font-size: 0.6rem;
        transition: transform 0.25s;
    }

    .sidebar.expanded .toggle-icon {
        transform: rotate(180deg);
    }

    /* Hero: horizontal layout — small avatar beside name */
    .sidebar-hero {
        flex-direction: row;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
    }

    .avatar-frame {
        width: 64px;
        height: 64px;
        min-width: 64px;
        margin: 0;
        aspect-ratio: 1 / 1;
        border-radius: 6px;
    }

    .hero-text {
        min-width: 0;
        flex: 1;
    }

    .name {
        font-size: 1.6rem;
        padding: 0;
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: clip;
    }

    .subtitle {
        font-size: 0.9rem;
        padding: 2px 0 0;
        text-align: left;
    }

    /* Sidebar details: collapsed by default */
    .sidebar-details {
        display: none;
        padding: 0 16px 12px;
    }

    .sidebar.expanded .sidebar-details {
        display: block;
        animation: slide-down 0.25s ease;
    }

    @keyframes slide-down {
        from {
            opacity: 0;
            transform: translateY(-6px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .sidebar-divider {
        margin: 10px 0;
    }

    /* Socials: compact horizontal on mobile */
    .social-links {
        gap: 6px;
    }

    .social-links a {
        padding: 6px 8px;
        font-size: 0.72rem;
    }

    .social-icon {
        width: 14px;
        height: 14px;
    }

    .social-label {
        font-size: 0.52rem;
    }

    /* Contact compact */
    .sidebar-section {
        text-align: left;
    }

    .contact-note {
        font-size: 0.68rem;
        line-height: 1.5;
    }

    /* Actions: inline */
    .sidebar-bottom {
        padding-bottom: 4px;
    }

    .sidebar-actions {
        justify-content: flex-start;
        gap: 8px;
    }

    .footer-text {
        font-size: 0.55rem;
        padding: 6px 0 0;
    }

    /* --- Content panel: fills remaining space --- */
    .content-panel {
        flex: 1;
        min-height: 60vh;
        border-radius: 8px;
    }

    /* Tab bar: sticky, scrollable */
    .tab-bar {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-panel);
        backdrop-filter: blur(12px);
    }

    .tab {
        font-size: 1.05rem;
        padding: 10px 16px;
        flex-shrink: 0;
    }

    /* Content padding */
    .pane-scroll {
        padding: 18px 16px;
    }

    /* Section titles */
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 14px;
    }

    .sub-title {
        font-size: 1.2rem;
    }

    /* Cards */
    .pub {
        padding: 12px;
        margin-bottom: 16px;
        padding-bottom: 16px;
    }

    .pub-name {
        font-size: 0.88rem;
    }

    .proj {
        padding: 12px;
        margin-bottom: 16px;
        padding-bottom: 16px;
    }

    .proj-head {
        flex-direction: column;
        gap: 4px;
    }

    .proj-name {
        font-size: 1.2rem;
    }

    /* News items */
    .news-scroll-bar {
        max-height: 160px;
    }

    .news-scroll-bar .news-item {
        flex-direction: column;
        gap: 2px;
        padding: 8px 12px;
    }

    .date {
        min-width: auto;
        font-size: 0.95rem;
    }

    /* Tags */
    .tag-list {
        gap: 5px;
    }

    .tag-list span {
        font-size: 0.68rem;
        padding: 2px 8px;
    }

    /* Notes */
    .notes-placeholder {
        padding: 40px 16px;
        min-height: 200px;
    }

    .notes-msg {
        font-size: 1.5rem;
    }

    /* Scraper modal */
    .scraper-overlay {
        padding: 12px;
    }

    .scraper-modal {
        max-height: 85vh;
        border-radius: 8px;
    }
}

/* ============================================
   RESPONSIVE — SMALL PHONE
   ============================================ */

@media (max-width: 480px) {

    .layout {
        padding: 6px;
        gap: 6px;
    }

    .sidebar-hero {
        padding: 10px 12px;
        gap: 10px;
    }

    .avatar-frame {
        width: 52px;
        height: 52px;
        min-width: 52px;
    }

    .social-links a {
        padding: 5px 6px;
    }

    .social-icon {
        width: 13px;
        height: 13px;
    }

    .social-label {
        font-size: 0.5rem;
    }

    /* Mobile inline social links — tighter on small phones */
    .mobile-social-inline {
        padding: 4px 12px 8px;
        gap: 4px;
    }

    .mobile-social-inline a {
        padding: 4px 7px;
        gap: 4px;
    }

    .mobile-social-inline .social-icon {
        width: 11px;
        height: 11px;
    }

    .mobile-social-name {
        font-size: 0.48rem;
    }

    /* Compact action buttons on small phones */
    .mobile-action-btn {
        padding: 3px 7px 2px;
        font-size: 0.68rem;
    }

    .mobile-action-label {
        font-size: 0.52rem;
    }

    .name {
        font-size: 1.35rem;
    }

    .subtitle {
        font-size: 0.82rem;
    }

    .tab {
        font-size: 0.92rem;
        padding: 8px 11px;
    }

    .pane-scroll {
        padding: 14px 12px;
    }

    .section-title {
        font-size: 1.35rem;
    }

    .pub-name {
        font-size: 0.82rem;
    }

    .proj-desc {
        font-size: 0.78rem;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {

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

    html {
        scroll-behavior: auto;
    }
}

@media print {

    #shader-bg,
    body::before,
    .sidebar-actions,
    .win-bar,
    .mobile-toggle {
        display: none;
    }

    .layout {
        display: block;
    }

    .sidebar {
        width: 100%;
        border: none;
    }

    .sidebar-details {
        display: block !important;
    }

    .content-panel {
        border: none;
    }

    .tab-pane {
        display: block !important;
        position: static !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .tab-bar {
        display: none;
    }

    .pane-scroll {
        overflow: visible;
        height: auto;
    }
}