/* =============================================
   BASE — reset, globals, utilities, scrollbar
   ============================================= */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    transition: background-color var(--transition-base), color var(--transition-base);
    position: relative;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='26' font-size='26'%3E%E2%AD%90%3C/text%3E%3C/svg%3E") 16 16, auto;
}

/* Minimal — no background image */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: none;
    z-index: -1;
    pointer-events: none;
}
body.dark-mode::before { background: none; }

a  { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
ul  { list-style: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
input, textarea, button { font-family: inherit; }

/* ── Layout helpers ── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section { padding: var(--section-padding); }

.section__title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
body.dark-mode .section__title {
    color: var(--text-primary);
}

.section__subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.gradient-text {
    color: var(--text-primary);
    font-weight: 800;
}

/* ── Glass card ── */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
body.dark-mode .glass-card { background: rgba(10, 10, 10, 0.9); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}
.btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}
.btn:hover::before { left: 100%; }

.btn-primary {
    background: var(--primary-color);
    color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--primary-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}
.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

.btn-block { width: 100%; justify-content: center; }

/* ── Fade-in observer helper ── */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}
.fade-in.appear {
    opacity: 1;
    transform: translateY(0);
}

/* ── Loading screen ── */
.loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loading-screen.hidden { opacity: 0; visibility: hidden; }

.loader {
    width: 50px; height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Custom cursor ── */
.cursor {
    display: none;
}
.cursor::after { content: '⭐'; }
.cursor-follower {
    display: none;
}
body.dark-mode .cursor-follower {
    display: none;
}

@media (max-width: 768px) {
    .cursor, .cursor-follower { display: none; }
    body { cursor: auto; }
}

/* ── Custom scrollbar ── */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track  { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb  { background: var(--primary-color); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* ── Back-to-top button ── */
.back-to-top {
    position: fixed;
    bottom: 2rem; right: 2rem;
    width: 50px; height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    z-index: 999;
}
.back-to-top.show { opacity: 1; visibility: visible; }
.back-to-top:hover { transform: translateY(-5px); box-shadow: var(--shadow-xl); }

/* ── Shortcut toast ── */
.shortcut-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-xl);
    z-index: 9998;
    transition: bottom 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}
.shortcut-toast.show { bottom: 2rem; }
.shortcut-toast i { color: var(--primary-color); font-size: 1.1rem; }
.shortcut-toast strong {
    background: var(--bg-tertiary);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ── Utility spacing ── */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }  .mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }

/* ── Magnetic / tilt helpers ── */
.project__card[data-tilt] { transform-style: preserve-3d; will-change: transform; }
.magnetic-btn { will-change: transform; transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1); }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .cursor, .cursor-follower { display: none !important; }
}

/* ── Print ── */
@media print {
    .header, .nav__toggle, .theme-toggle,
    .back-to-top, .hero__scroll,
    .cursor, .cursor-follower { display: none !important; }
    body { background: white; color: black; }
    .section { page-break-inside: avoid; }
}

/* ── Small screen globals ── */
@media screen and (max-width: 576px) {
    .section__title  { font-size: 2rem; }
    .hero__buttons   { flex-direction: column; }
    .btn             { width: 100%; justify-content: center; }
    .about__info     { grid-template-columns: 1fr; }
    .projects__container { grid-template-columns: 1fr; }
}

/* ── Star cursor trail ── */
.star-trail {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    display: none;
    clip-path: polygon(
        50% 0%, 56% 38%, 100% 50%,
        56% 62%, 50% 100%,
        44% 62%, 0% 50%,
        44% 38%
    );
    background: currentColor;
    box-shadow:
        0 0 8px  3px currentColor,
        0 0 20px 8px currentColor,
        0 0 35px 12px rgba(255, 215, 0, 0.5);
    will-change: transform, opacity;
    border-radius: 1px;
}
