/* ============================================================
   PortfolioMe — Custom CSS
   Design tokens, component classes, animations
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
    --bg-base:        #050810;
    --bg-surface:     #0d1117;
    --bg-elevated:    #141b27;
    --accent-primary: #2563EB;
    --accent-glow:    #3B82F6;
    --accent-bright:  #60A5FA;
    --text-primary:   #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted:     #475569;
    --border:         #1E293B;
}

/* ── Reset / Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Noise Overlay ──────────────────────────────────────────── */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* ── Navbar ─────────────────────────────────────────────────── */
#navbar {
    background: transparent;
    border-bottom: 1px solid transparent;
}
#navbar.scrolled {
    background: rgba(5, 8, 16, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom-color: var(--border);
}
.nav-link.active {
    color: var(--accent-bright) !important;
}
.hamburger-line {
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
/* Animate hamburger → X when menu is open */
#menu-toggle.open .hamburger-line:nth-child(1) { transform: translateY(8px) rotate(45deg); }
#menu-toggle.open .hamburger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
#menu-toggle.open .hamburger-line:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    color: #fff;
    border: 1px solid var(--accent-primary);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    text-decoration: none;
}
.btn-primary:hover {
    background: var(--accent-glow);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.45);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--accent-bright);
    border: 1px solid var(--accent-primary);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    text-decoration: none;
}
.btn-outline:hover {
    background: rgba(37, 99, 235, 0.12);
    box-shadow: 0 0 18px rgba(37, 99, 235, 0.25);
    transform: translateY(-1px);
}
.btn-outline:active { transform: translateY(0); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    text-decoration: none;
}
.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--accent-bright);
    border-color: var(--accent-primary);
}

/* ── Social Icon Button ─────────────────────────────────────── */
.social-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.15s;
    text-decoration: none;
}
.social-icon-btn:hover {
    color: var(--accent-bright);
    border-color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

/* ── Section Labels ─────────────────────────────────────────── */
.section-tag {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--accent-bright);
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 9999px;
    padding: 0.25rem 0.875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}
.section-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.15;
    margin-bottom: 0.25rem;
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

/* Blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    pointer-events: none;
    animation: blobPulse 8s ease-in-out infinite;
}
.blob-1 {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, #2563EB, #1e3a8a);
    top: -120px;
    left: -80px;
    animation-delay: 0s;
}
.blob-2 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, #7c3aed, #312e81);
    top: 60px;
    right: -60px;
    animation-delay: 2.5s;
}
.blob-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #0ea5e9, #0369a1);
    bottom: 80px;
    left: 30%;
    animation-delay: 5s;
}

/* Typewriter cursor */
.typewriter-cursor {
    display: inline-block;
    animation: blink 1s step-end infinite;
    color: var(--accent-bright);
    font-weight: 300;
    margin-left: 1px;
}

/* Scroll indicator */
.scroll-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    animation: scrollBounce 2s ease-in-out infinite;
    transition: border-color 0.2s, color 0.2s;
}
.scroll-indicator:hover {
    border-color: var(--accent-primary);
    color: var(--accent-bright);
}

/* Fade-in-up entrance */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease both;
}

/* ── About ──────────────────────────────────────────────────── */
.avatar-glow-ring {
    position: absolute;
    inset: -8px;
    border-radius: 1.25rem;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #7c3aed 100%);
    opacity: 0.35;
    filter: blur(18px);
    z-index: 0;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    text-align: center;
}
.stat-number {
    font-family: 'Space Mono', monospace;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-bright);
    line-height: 1;
    margin-bottom: 0.3rem;
}
.stat-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Skills ─────────────────────────────────────────────────── */
.skill-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    padding: 1.1rem 1.25rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.skill-card:hover {
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 0 18px rgba(37, 99, 235, 0.1);
}
.skill-bar-track {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 9999px;
    overflow: hidden;
}
.skill-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 9999px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-bright));
    transition: width 0s;
}
.skill-bar-fill.animated {
    animation: skillFill 1s ease forwards;
}

/* ── Projects ───────────────────────────────────────────────── */
.tag-filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 1rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.tag-filter-btn:hover {
    border-color: rgba(37, 99, 235, 0.5);
    color: var(--accent-bright);
}
.tag-filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.project-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.project-card:hover {
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: translateY(-4px);
}
.project-card.hidden-by-filter { display: none; }

.project-thumbnail {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--bg-surface);
}

.featured-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
}

.tag-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--tag-color, #2563EB) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--tag-color, #2563EB) 35%, transparent);
    color: var(--tag-color, var(--accent-bright));
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
}

/* Project Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal-container {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 2rem;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #f87171;
}

/* prose-dark: reset list/heading styles inside modal description */
.prose-dark p   { margin-bottom: 0.75em; }
.prose-dark ul  { list-style: disc; padding-left: 1.25rem; margin-bottom: 0.75em; }
.prose-dark ol  { list-style: decimal; padding-left: 1.25rem; margin-bottom: 0.75em; }
.prose-dark li  { margin-bottom: 0.25em; }
.prose-dark h1,
.prose-dark h2,
.prose-dark h3 { color: var(--text-primary); font-family: 'Syne', sans-serif; font-weight: 700; margin-bottom: 0.5em; }

/* ── Experience Timeline ─────────────────────────────────────── */
.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}
/* Center vertical line */
.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    width: 50%;
    padding-bottom: 2.5rem;
}
.timeline-left  { align-self: flex-start; padding-right: 2.5rem; }
.timeline-right { align-self: flex-end;   padding-left:  2.5rem; }

.timeline-dot {
    position: absolute;
    top: 0.75rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.timeline-left  .timeline-dot { right: -1rem; }
.timeline-right .timeline-dot { left:  -1rem; }

.timeline-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    padding: 1.25rem 1.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.timeline-card:hover {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
}

/* Responsive timeline: stack on mobile */
@media (max-width: 767px) {
    .timeline::before { left: 1rem; }
    .timeline-item { width: 100%; padding-left: 3rem; padding-right: 0; align-self: auto; }
    .timeline-left  { padding-right: 0; }
    .timeline-right { padding-left: 3rem; }
    .timeline-left  .timeline-dot,
    .timeline-right .timeline-dot { left: 0; right: auto; }
}

/* ── Passions ────────────────────────────────────────────────── */
.passion-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem 1.75rem;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.passion-card:hover {
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 0 30px rgba(37, 99, 235, 0.12);
    transform: translateY(-3px);
}
.passion-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.875rem;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.2);
    margin-bottom: 1.25rem;
}

/* ── Contact Form ────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
}
.form-label {
    display: flex;
    align-items: center;
    font-family: 'Syne', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.45rem;
}
.form-input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-input.error,
.form-input.error-field { border-color: #ef4444; }
.form-error {
    display: block;
    margin-top: 0.35rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: #f87171;
}
.form-error.hidden { display: none; }

/* ── Toast Notifications ─────────────────────────────────────── */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 360px;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.3s ease;
    pointer-events: all;
}
.toast.removing { animation: toastOut 0.3s ease forwards; }

.toast-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.toast-body {
    flex: 1;
    min-width: 0;
}
.toast-title {
    font-family: 'Syne', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}
.toast-message {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
    transition: color 0.15s;
}
.toast-close:hover { color: var(--text-primary); }

.toast-success { border-color: rgba(16, 185, 129, 0.3); }
.toast-success .toast-icon { color: #34d399; }

.toast-error { border-color: rgba(239, 68, 68, 0.3); }
.toast-error .toast-icon { color: #f87171; }

.toast-info { border-color: rgba(96, 165, 250, 0.3); }
.toast-info .toast-icon { color: var(--accent-bright); }

/* ── Admin Table ─────────────────────────────────────────────── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
}
.admin-table thead tr {
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-family: 'Syne', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.admin-table td {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
    vertical-align: middle;
}
.admin-table tbody tr:last-child td {
    border-bottom: none;
}
.admin-table tbody tr {
    transition: background 0.15s;
}
.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ── Admin Sidebar Nav Links ─────────────────────────────────── */
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.875rem;
    border-radius: 0.625rem;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    cursor: pointer;
}
.admin-nav-link:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border);
}
.admin-nav-link.active {
    background: rgba(37, 99, 235, 0.12);
    color: var(--accent-bright);
    border-color: rgba(37, 99, 235, 0.25);
    font-weight: 600;
}
.admin-nav-link.active i {
    color: var(--accent-bright);
}

/* ── Admin Topbar (used via admin-header inline style override) ── */
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.75rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* ── Keyframe Animations ──────────────────────────────────────── */
@keyframes blobPulse {
    0%, 100% { transform: scale(1);    opacity: 0.18; }
    50%       { transform: scale(1.12); opacity: 0.24; }
}

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

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(5px); }
}

@keyframes skillFill {
    from { width: 0; }
    to   { width: var(--target-width, 0%); }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}

/* Alias used by admin.js */
@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}
