/* ═══════════════════════════════════════════════════════════
   YED Premium Theme v4
   Edge-to-edge footer, auto-hide header, dense layout
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── TOKENS ──────────────────────────────────────────────── */
:root {
    --bg-page:       #f0f4f8;
    --bg-card:       #ffffff;
    --bg-footer:     #0f172a;
    --accent:        #2563eb;
    --accent-light:  #3b82f6;
    --accent-glow:   rgba(37, 99, 235, 0.12);
    --accent-hover:  #1d4ed8;
    --text-primary:  #1e293b;
    --text-body:     #475569;
    --text-muted:    #94a3b8;
    --border:        rgba(0, 0, 0, 0.07);
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.06);
    --shadow-md:     0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg:     0 12px 40px rgba(0,0,0,0.12);
    --radius:        14px;
    --radius-lg:     18px;
    --transition:    0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── GLOBAL RESET ────────────────────────────────────────── */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
}

body {
    background: var(--bg-page) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    color: var(--text-body) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body, input, select, textarea {
    font-family: 'Inter', -apple-system, sans-serif !important;
    color: var(--text-body) !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', -apple-system, sans-serif !important;
    color: var(--text-primary) !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
    text-transform: none !important;
}

a:hover { color: var(--accent) !important; }
strong, b { color: var(--text-primary) !important; }
p { line-height: 1.75 !important; color: var(--text-body) !important; }

/* ═══════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════ */

#wrapper {
    display: flex !important;
    flex-direction: column !important;
    max-width: 100% !important;
    width: 100% !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

#main {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 1.8em 2em !important;
    float: none !important;
    flex: 1 !important;
}

@media screen and (min-width: 1500px) {
    #main { max-width: 1360px !important; }
}

/* ═══════════════════════════════════════════════════════════
   HEADER — Transparent → Shadow on scroll → Hides on scroll down
   ═══════════════════════════════════════════════════════════ */

#header {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                box-shadow 0.3s ease,
                backdrop-filter 0.3s ease !important;
    padding: 0.6em 1.5em !important;
}

/* State: user scrolled down → solid background */
#header.header-solid {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    box-shadow: 0 1px 20px rgba(0,0,0,0.06) !important;
    border-bottom: 1px solid var(--border) !important;
}

/* State: user scrolling down → hide */
#header.header-hidden {
    transform: translateY(-100%) !important;
}

/* Bigger nav text */
#header h1 a {
    color: var(--text-primary) !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    font-size: 1.35em !important;
}

#header nav.links a {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
    font-size: 0.95em !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    transition: color var(--transition) !important;
    position: relative !important;
}

#header nav.links a::after {
    content: '' !important;
    position: absolute !important;
    bottom: -4px !important;
    left: 50% !important;
    width: 0 !important;
    height: 2.5px !important;
    background: var(--accent) !important;
    transition: width 0.3s ease, left 0.3s ease !important;
    border-radius: 2px !important;
}

#header nav.links a:hover::after {
    width: 100% !important;
    left: 0 !important;
}

#header nav.links a:hover {
    color: var(--accent) !important;
}

#header nav.main a {
    color: var(--text-primary) !important;
    font-size: 1.1em !important;
}

/* Push content below fixed header */
#main {
    padding-top: 5em !important;
}

/* ─── POST CARDS — Dense, full-width ──────────────────────── */
article.post {
    background: var(--bg-card) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm) !important;
    border: 1px solid var(--border) !important;
    overflow: hidden;
    transition: box-shadow 0.4s ease, transform 0.4s ease !important;
    margin-bottom: 1.6em !important;
}

article.post:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-4px);
}

article.post > header {
    padding: 1.4em 1.8em 0.3em !important;
}

article.post > header .title h2 {
    font-size: 1.5em !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
    margin-bottom: 0.15em !important;
    line-height: 1.3 !important;
}

article.post > header .title h2 a {
    color: var(--text-primary) !important;
    transition: color var(--transition) !important;
    border-bottom: none !important;
}

article.post > header .title h2 a:hover { color: var(--accent) !important; }

article.post > header .title p {
    color: var(--text-muted) !important;
    font-size: 0.88em !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    margin-bottom: 0 !important;
}

article.post > header .meta time {
    color: var(--text-muted) !important;
    font-weight: 500 !important;
    font-size: 0.82em !important;
}

/* Post images */
article.post .image.featured {
    margin: 0 !important;
    overflow: hidden !important;
}

article.post .image.featured img {
    border-radius: 0 !important;
    width: 100% !important;
    display: block !important;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

article.post:hover .image.featured img {
    transform: scale(1.04);
}

/* Post body — tighter padding */
article.post > p,
article.post section.post p {
    padding: 0 1.8em !important;
    color: var(--text-body) !important;
    font-size: 0.92em !important;
    line-height: 1.8 !important;
    margin-bottom: 1em !important;
}

article.post > footer {
    padding: 0 1.8em 1.4em !important;
}

/* ─── BUTTONS ─────────────────────────────────────────────── */
.button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
    background: var(--accent) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-family: 'Inter', sans-serif !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding: 0.8em 2em !important;
    font-size: 0.86em !important;
    box-shadow: 0 2px 12px rgba(37,99,235,0.3) !important;
    transition: all var(--transition) !important;
    cursor: pointer;
    position: relative !important;
    overflow: hidden !important;
}

.button:hover,
input[type="submit"]:hover {
    background: var(--accent-hover) !important;
    color: #fff !important;
    box-shadow: 0 6px 24px rgba(37,99,235,0.4) !important;
    transform: translateY(-2px);
}

.button:active { transform: scale(0.97) translateY(0) !important; }

.button.large { padding: 0.9em 2.2em !important; font-size: 0.9em !important; }

/* ═══════════════════════════════════════════════════════════
   FOOTER — Edge-to-edge, NO white gaps
   ═══════════════════════════════════════════════════════════ */

#sidebar {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    margin-left: calc(-50vw + 50%) !important;
    padding: 0 !important;
    position: relative !important;
    float: none !important;
    display: block !important;
    order: 99 !important;
    background: var(--bg-footer) !important;
    border: none !important;
    text-align: center !important;
    min-height: auto !important;
    height: auto !important;
    box-sizing: border-box !important;
}

/* Also kill any wrapper margin/padding that creates gaps */
#wrapper {
    overflow: hidden !important;
}

/* Avatar + Name row */
#sidebar #intro {
    padding: 2.5em 2em 1em !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1.2em !important;
}

#sidebar #intro .logo,
#intro .logo {
    display: inline-block !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    border: none !important;
    overflow: visible !important;
    width: auto !important;
    height: auto !important;
    background: none !important;
    padding: 0 !important;
}

/* KILL the white SVG diamond/triangle pseudo-element */
#sidebar #intro .logo::before,
#sidebar #intro .logo::after,
#intro .logo::before,
#intro .logo::after,
#sidebar .logo::before,
#sidebar .logo::after {
    display: none !important;
    content: none !important;
    background: none !important;
    background-image: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Clean circle avatar — NO border, no frame whatsoever */
#sidebar #intro .logo img,
#intro .logo img {
    width: 54px !important;
    height: 54px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    margin: 0 !important;
    display: block !important;
}

#sidebar #intro header { text-align: left !important; }

#sidebar #intro h2 {
    color: #fff !important;
    font-size: 1.15em !important;
    margin: 0 !important;
    font-weight: 700 !important;
}

/* Blurb text */
#sidebar .blurb {
    padding: 0 2em 1em !important;
    text-align: center !important;
    max-width: 650px !important;
    margin: 0 auto !important;
}

#sidebar .blurb h2 { display: none !important; }

#sidebar .blurb p {
    color: rgba(255,255,255,0.55) !important;
    font-size: 0.82em !important;
    text-align: center !important;
    line-height: 1.7 !important;
    margin-bottom: 0.8em !important;
}

#sidebar .blurb .actions { margin: 0 !important; }

#sidebar .blurb .button {
    background: rgba(255,255,255,0.08) !important;
    color: rgba(255,255,255,0.8) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    box-shadow: none !important;
    font-size: 0.78em !important;
    padding: 0.6em 1.5em !important;
}

#sidebar .blurb .button:hover {
    background: rgba(255,255,255,0.15) !important;
    color: #fff !important;
}

/* Social icons */
#sidebar #footer,
#sidebar section#footer {
    padding: 1em 2em 1.8em !important;
    text-align: center !important;
    border-top: 1px solid rgba(255,255,255,0.06) !important;
    max-width: 100% !important;
    margin: 0 !important;
}

#sidebar #footer .icons,
section#footer .icons {
    display: flex !important;
    justify-content: center !important;
    gap: 1.8em !important;
    list-style: none !important;
    padding: 0.8em 0 0.6em !important;
    margin: 0 !important;
}

#sidebar #footer .icons a,
section#footer .icons a {
    color: rgba(255,255,255,0.4) !important;
    font-size: 18px !important;
    transition: color 0.3s ease, transform 0.3s ease !important;
    border-bottom: none !important;
}

#sidebar #footer .icons a:hover,
section#footer .icons a:hover {
    color: var(--accent-light) !important;
    transform: scale(1.2) !important;
}

#sidebar #footer .copyright,
#sidebar .copyright,
section#footer .copyright {
    color: rgba(255,255,255,0.2) !important;
    font-size: 0.72em !important;
    text-align: center !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

#sidebar #footer .copyright a,
section#footer .copyright a { color: rgba(255,255,255,0.3) !important; }

/* Standalone footer (about page etc) */
body > section#footer,
body > div + section#footer {
    background: var(--bg-footer) !important;
    padding: 1.5em 2em !important;
    margin: 0 !important;
    text-align: center !important;
}

body > section#footer .icons a {
    color: rgba(255,255,255,0.4) !important;
    border-bottom: none !important;
}

body > section#footer .icons a:hover { color: var(--accent-light) !important; }

body > section#footer .copyright {
    color: rgba(255,255,255,0.2) !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* ─── MENU (mobile) ───────────────────────────────────────── */
#menu {
    background: #fff !important;
    color: var(--text-body) !important;
    box-shadow: var(--shadow-lg) !important;
}

#menu .links a h3 { color: var(--text-primary) !important; }
#menu .links a p { color: var(--text-muted) !important; }
#menu .links a:hover h3 { color: var(--accent) !important; }

/* ─── PAGINATION ──────────────────────────────────────────── */
.pagination .button,
.actions.pagination .button {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

.pagination .button:hover,
.actions.pagination .button:hover {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
}

.pagination .button.disabled,
.actions.pagination .button.disabled { opacity: 0.3 !important; pointer-events: none; }

/* ─── INFO CARDS ──────────────────────────────────────────── */
.info-cards > div {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: all var(--transition) !important;
}

.info-cards > div:hover { box-shadow: var(--shadow-md) !important; transform: translateY(-2px) !important; }
.info-cards a { color: var(--accent) !important; font-weight: 500 !important; }

/* ─── CV ──────────────────────────────────────────────────── */
.cv-header h2 {
    font-size: clamp(1.5em, 4vw, 2em) !important;
    font-weight: 800 !important;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.cv-header p { color: var(--text-muted) !important; font-weight: 500 !important; }

#cv h3 {
    color: var(--accent) !important; font-size: 1.05em !important; font-weight: 700 !important;
    border-bottom: 2px solid var(--accent-glow); padding-bottom: 0.4em; margin-bottom: 0.8em;
}

/* ─── LISTS ───────────────────────────────────────────────── */
article.post ul li, #cv ul li {
    position: relative; padding-left: 1.4em; margin-bottom: 0.4em; color: var(--text-body) !important;
}

article.post ul li::before, #cv ul li::before {
    content: '▸'; position: absolute; left: 0; color: var(--accent); font-weight: 700; font-size: 1em;
}

/* ─── IMAGES ──────────────────────────────────────────────── */
.image.featured { overflow: hidden; }
span.image.featured { border-radius: var(--radius-lg) !important; overflow: hidden; box-shadow: var(--shadow-md) !important; }
span.image.featured img { border-radius: var(--radius-lg) !important; }

/* ═══════════════════════════════════════════════════════════
   SEARCH MODAL
   ═══════════════════════════════════════════════════════════ */

.search-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.6); backdrop-filter: blur(12px);
    z-index: 9998; opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.search-overlay.active { opacity: 1; pointer-events: all; }

.search-modal {
    position: fixed; top: 10vh; left: 50%;
    transform: translateX(-50%) scale(0.92);
    width: min(92vw, 680px); background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 32px 100px rgba(0,0,0,0.25);
    z-index: 9999; opacity: 0; pointer-events: none;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); overflow: hidden;
}
.search-modal.active { opacity: 1; pointer-events: all; transform: translateX(-50%) scale(1); }

.search-modal-input-wrap {
    display: flex; align-items: center; padding: 1.1em 1.4em;
    border-bottom: 1px solid var(--border); gap: 0.8em;
}
.search-modal-input-wrap .search-icon { color: var(--accent); font-size: 1.1em; flex-shrink: 0; }
.search-modal-input-wrap input {
    flex: 1; border: none !important; outline: none !important;
    font-size: 1.1em !important; font-family: 'Inter', sans-serif !important;
    color: var(--text-primary) !important; background: transparent !important;
    padding: 0.4em 0 !important; box-shadow: none !important;
}
.search-modal-input-wrap input::placeholder { color: var(--text-muted); }
.search-modal-input-wrap .search-kbd {
    background: var(--bg-page); border: 1px solid var(--border); border-radius: 6px;
    padding: 3px 10px; font-size: 0.72em; color: var(--text-muted); font-weight: 500;
}

.search-results { max-height: 55vh; overflow-y: auto; padding: 0.3em 0; }
.search-result-item {
    display: flex; align-items: center; gap: 1em; padding: 0.7em 1.4em;
    cursor: pointer; transition: background 0.15s ease; border-bottom: none !important;
}
.search-result-item:hover { background: var(--bg-page); }
.search-result-item img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.search-result-info { flex: 1; min-width: 0; }
.search-result-title { font-weight: 600; color: var(--text-primary); font-size: 0.92em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-subtitle { font-size: 0.8em; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.search-result-badge { background: var(--accent-glow); color: var(--accent); font-size: 0.7em; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
.search-no-results { text-align: center; padding: 2.5em; color: var(--text-muted); font-size: 0.92em; }
.search-hint { text-align: center; padding: 2em; color: var(--text-muted); font-size: 0.85em; }

/* ─── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

::selection { background: var(--accent); color: #fff; }

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {
    article.post { opacity: 0; transform: translateY(30px); }

    article.post.is-visible {
        animation: cardIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }
    article.post:nth-child(2).is-visible { animation-delay: 0.06s; }
    article.post:nth-child(3).is-visible { animation-delay: 0.12s; }
    article.post:nth-child(4).is-visible { animation-delay: 0.18s; }
    article.post:nth-child(5).is-visible { animation-delay: 0.24s; }
    article.post:nth-child(6).is-visible { animation-delay: 0.3s; }
    article.post:nth-child(7).is-visible { animation-delay: 0.36s; }
    article.post:nth-child(8).is-visible { animation-delay: 0.42s; }

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

    /* Continuous micro-float */
    article.post.is-visible {
        animation: cardIn 0.65s cubic-bezier(0.22,1,0.36,1) forwards,
                   microFloat 8s ease-in-out 1.5s infinite;
    }
    @keyframes microFloat {
        0%, 100% { transform: translateY(0); }
        50%      { transform: translateY(-2px); }
    }

    /* Footer */
    #sidebar { opacity: 0; transform: translateY(15px); }
    #sidebar.is-visible { animation: slideUp 0.5s ease forwards; }
    @keyframes slideUp {
        from { opacity: 0; transform: translateY(15px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Page load */
    #main { animation: fadeIn 0.5s ease forwards; }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
}

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media screen and (max-width: 980px) {
    #main { padding: 4.5em 1em 1.2em !important; }
    article.post { border-radius: var(--radius) !important; }
    #sidebar #intro { flex-direction: column !important; gap: 0.5em !important; }
    #sidebar #intro header { text-align: center !important; }
    #header h1 a { font-size: 1.15em !important; }
    #header nav.links a { font-size: 0.85em !important; }
}

@media screen and (max-width: 736px) {
    #main { padding: 4em 0.6em 0.8em !important; }
    article.post { border-radius: 12px !important; margin-bottom: 1em !important; }
    article.post > header { padding: 1em 1.2em 0.3em !important; }
    article.post > p, article.post section.post p { padding: 0 1.2em !important; }
    article.post > footer { padding: 0 1.2em 1em !important; }
    .button.large { padding: 0.75em 1.6em !important; font-size: 0.85em !important; }
    #header h1 a { font-size: 1em !important; }
}
