/*
 * ═══════════════════════════════════════════════════════════════════════════════
 *  style.css — itsrkmahapatra.qzz.io
 *  Mobile-first. Android-inspired. Pixel-perfect across every screen.
 *  Breakpoints: 320 · 480 · 768 · 1024 · 1440
 * ═══════════════════════════════════════════════════════════════════════════════
 */

/* ── Design Tokens ───────────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --neon-blue:   #00D2FF;
    --neon-gold:   #D4AF37;
    --bg-dark:     #02040a;
    --terminal-bg: rgba(5, 8, 17, 0.9);

    /* Fluid type — scales gracefully from 320px to 1440px */
    --fs-xs:   clamp(0.6rem,   1.5vw, 0.625rem);
    --fs-sm:   clamp(0.75rem,  2vw,   0.875rem);
    --fs-base: clamp(0.875rem, 2.5vw, 1rem);
    --fs-lg:   clamp(1rem,     3vw,   1.125rem);
    --fs-xl:   clamp(1.125rem, 3.5vw, 1.25rem);
    --fs-2xl:  clamp(1.25rem,  4vw,   1.5rem);
    --fs-3xl:  clamp(1.5rem,   5vw,   1.875rem);
    --fs-4xl:  clamp(1.75rem,  6vw,   2.25rem);
    --fs-5xl:  clamp(2rem,     8vw,   3rem);

    /* Touch */
    --touch:    48px;  /* WCAG 2.5.5 minimum touch target */

    /* Safe areas — notched phones, home bars */
    --safe-t: env(safe-area-inset-top,    0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left,   0px);
    --safe-r: env(safe-area-inset-right,  0px);

    /* Easing — Material Design motion */
    --ease-std:  cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out:  cubic-bezier(0,   0, 0.2, 1);
    --ease-in:   cubic-bezier(0.4, 0, 1,   1);
    --ease-decel: cubic-bezier(0,  0, 0.2, 1);
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    /* Eliminate blue flash on Android tap */
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    /* Prevent text inflation on orientation change */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ── Body ────────────────────────────────────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont,
                 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-dark);
    color: #e2e8f0;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scroll-lock when mobile drawer is open */
body.menu-open {
    overflow: hidden;
    /* iOS: prevents bounce-scroll behind the overlay */
    position: fixed;
    width: 100%;
}

.font-mono {
    font-family: 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* ── Matrix Rain Canvas ──────────────────────────────────────────────────────── */
#matrix-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    opacity: 0.12;
    pointer-events: none;
}

/* ── Scanline Effect ─────────────────────────────────────────────────────────── */
.scanline {
    width: 100%;
    height: 2px;
    background: rgba(0, 210, 255, 0.05);
    position: fixed;
    top: 0; left: 0;
    z-index: 10;
    pointer-events: none;
    animation: scanline 8s linear infinite;
}
@keyframes scanline {
    from { top: 0;    }
    to   { top: 100%; }
}

/* ── Cyber Card ──────────────────────────────────────────────────────────────── */
.cyber-card {
    background: var(--terminal-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.05);
    transition: border-color 0.4s var(--ease-std),
                box-shadow   0.4s var(--ease-std),
                transform    0.4s var(--ease-std);
    position: relative;
    overflow: hidden;
}

/* Hover only on true pointer devices — no sticky hover on mobile */
@media (hover: hover) and (pointer: fine) {
    .cyber-card:hover {
        border-color: var(--neon-blue);
        box-shadow: 0 0 30px rgba(0, 210, 255, 0.2);
        transform: translateY(-5px);
    }
}

/* Touch: active-press feedback instead of hover */
@media (hover: none) {
    .cyber-card:active {
        border-color: var(--neon-blue);
        box-shadow: 0 0 18px rgba(0, 210, 255, 0.15);
        transform: scale(0.99);
    }
}

/* ── Material Ripple Effect ──────────────────────────────────────────────────── */
.ripple-host {
    position: relative;
    overflow: hidden;
}
.ripple {
    position: absolute;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    margin-top: -60px;
    margin-left: -60px;
    background: rgba(0, 210, 255, 0.18);
    transform: scale(0);
    animation: rippleAnim 0.65s var(--ease-out) forwards;
    pointer-events: none;
    z-index: 0;
}
.ripple-gold {
    background: rgba(212, 175, 55, 0.22);
}
@keyframes rippleAnim {
    to { transform: scale(5); opacity: 0; }
}

/* ── Desktop Navigation Links ────────────────────────────────────────────────── */
.nav-link {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9ca3af;
    transition: color 0.3s var(--ease-std);
    padding: 0.5rem 0.25rem;
    white-space: nowrap;
    min-height: var(--touch);
    display: inline-flex;
    align-items: center;
}
.nav-link:hover,
.nav-link.active { color: var(--neon-blue); }

/* ── Hamburger Button ────────────────────────────────────────────────────────── */
#menu-toggle {
    min-width:  var(--touch);
    min-height: var(--touch);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.25s var(--ease-std);
    -webkit-tap-highlight-color: transparent;
}
#menu-toggle:hover  { background: rgba(0, 210, 255, 0.08); }
#menu-toggle:active { background: rgba(0, 210, 255, 0.16); }

/* Three-bar icon */
.ham-icon {
    width: 22px;
    height: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}
.ham-icon span {
    display: block;
    height: 2px;
    background: var(--neon-blue);
    border-radius: 2px;
    transform-origin: left center;
    transition: transform 0.35s var(--ease-std),
                opacity   0.25s var(--ease-std),
                width     0.3s  var(--ease-std);
}

/* Morphs to × when open */
.ham-icon.open span:nth-child(1) { transform: rotate(45deg)  translate(1px, -1px); }
.ham-icon.open span:nth-child(2) { opacity: 0; width: 0; }
.ham-icon.open span:nth-child(3) { transform: rotate(-45deg) translate(1px,  1px); }

/* ── Mobile Drawer Navigation ────────────────────────────────────────────────── */
#mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    visibility: hidden;
    pointer-events: none;
    /* Backdrop via pseudo-element so it's below the drawer */
}
#mobile-menu-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(2, 4, 10, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.35s var(--ease-out);
}

/* The sliding panel */
.mobile-drawer {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: min(320px, 84vw);
    background: linear-gradient(160deg, rgba(5,8,20,0.99) 0%, rgba(2,4,10,0.99) 100%);
    border-left: 1px solid rgba(0, 210, 255, 0.1);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    padding-top: calc(1.5rem + var(--safe-t));
    padding-bottom: calc(1.5rem + var(--safe-b));
    padding-right: calc(1.5rem + var(--safe-r));
    transform: translateX(100%);
    transition: transform 0.35s var(--ease-out);
    box-shadow: -24px 0 80px rgba(0,0,0,0.6);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Active (open) state */
#mobile-menu-overlay.active {
    visibility: visible;
    pointer-events: auto;
}
#mobile-menu-overlay.active::before { opacity: 1; }
#mobile-menu-overlay.active .mobile-drawer { transform: translateX(0); }

/* Drawer header */
.drawer-header {
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(0, 210, 255, 0.1);
}
.drawer-status {
    font-family: 'Fira Code', monospace;
    font-size: 0.55rem;
    color: var(--neon-blue);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.35rem;
    display: block;
}
.drawer-brand {
    font-size: 1rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Individual mobile nav links */
.mobile-nav-link {
    display: flex;
    align-items: center;
    min-height: var(--touch);
    padding: 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 800;
    color: rgba(255,255,255,0.72);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: color 0.2s var(--ease-std),
                background 0.2s var(--ease-std),
                padding-left 0.25s var(--ease-std);
}
.mobile-nav-link:last-of-type { border-bottom: none; }

/* Left accent bar */
.mobile-nav-link::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: var(--neon-blue);
    border-radius: 2px;
    transition: height 0.25s var(--ease-std);
}
.mobile-nav-link.active         { color: var(--neon-blue); padding-left: 1rem; background: rgba(0,210,255,0.04); }
.mobile-nav-link.active::before { height: 55%; }
.mobile-nav-link:active         { background: rgba(0,210,255,0.06); }

.link-label { flex: 1; }
.link-arrow {
    font-family: 'Fira Code', monospace;
    font-size: 0.65rem;
    color: var(--neon-blue);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s, transform 0.2s var(--ease-std);
}
.mobile-nav-link.active .link-arrow { opacity: 1; transform: translateX(0); }

/* Drawer footer */
.drawer-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.drawer-connect {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: var(--touch);
    padding: 0.875rem;
    background: var(--neon-gold);
    color: #000;
    font-weight: 900;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
}
.drawer-connect:active {
    background: #f0c830;
    box-shadow: 0 0 20px rgba(212,175,55,0.4);
}

/* ── Typing Cursor ───────────────────────────────────────────────────────────── */
.typing-cursor::after {
    content: '_';
    animation: blink 1s step-end infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ── Timeline (About Page) ───────────────────────────────────────────────────── */
.timeline-item {
    position: relative;
    padding-left: 1.5rem;
    padding-bottom: 2.5rem;
    border-left: 1px solid rgba(255,255,255,0.1);
    margin-left: 0.75rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px; top: 4px;
    width: 9px; height: 9px;
    background: var(--neon-gold);
    border-radius: 999px;
    box-shadow: 0 0 8px var(--neon-gold);
}
.timeline-item:last-child { border-left: none; }

/* ── Genre Filter Pills (Books) ──────────────────────────────────────────────── */
.genre-btn,
.filter-btn {
    padding: 0.35rem 0.875rem;
    min-height: 36px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    transition: all 0.25s var(--ease-std);
    white-space: nowrap;
    cursor: pointer;
    color: #6b7280;
}
.genre-btn.active,
.filter-btn.active-filter {
    border-color: var(--neon-gold);
    color: var(--neon-gold);
    background: rgba(212,175,55,0.1);
}
.genre-btn:active,
.filter-btn:active { transform: scale(0.93); }

/* ── Search Input (Books) ────────────────────────────────────────────────────── */
#search-input {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(212,175,55,0.2);
    color: #e2e8f0;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: var(--fs-sm);
    width: 100%;
    min-height: var(--touch);
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: 'Fira Code', monospace;
    -webkit-appearance: none;
    appearance: none;
}
#search-input:focus {
    border-color: var(--neon-gold);
    outline: none;
    box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
}

/* ── Responsive Breakpoints ──────────────────────────────────────────────────── */

/* ≤320px — tiny phones */
@media (max-width: 320px) {
    html { font-size: 14px; }
    .mobile-drawer { width: 92vw; }
}

/* ≤480px — phones */
@media (max-width: 480px) {
    /* Tighter horizontal padding on small screens */
    .container { padding-left: 1rem !important; padding-right: 1rem !important; }

    /* Scale down large headings so they don't overflow */
    .text-5xl  { font-size: clamp(1.85rem, 9vw, 2.25rem) !important; }
    .text-4xl  { font-size: clamp(1.5rem,  7vw, 1.875rem) !important; }
    .text-8xl  { font-size: clamp(2.5rem,  13vw, 4rem) !important; }

    /* Hero: stack portrait + text vertically, centre everything */
    .hero-layout { flex-direction: column; align-items: center; text-align: center; }

    /* Cards: reduce internal padding */
    .cyber-card.p-8 { padding: 1.25rem !important; }
    .cyber-card.p-12 { padding: 1.5rem !important; }
}

/* 481px – 768px — large phones / small tablets */
@media (min-width: 481px) and (max-width: 768px) {
    .cyber-card.p-8 { padding: 1.5rem !important; }
}

/* 769px – 1024px — tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Slightly narrower outer padding */
    .container { padding-left: 2rem !important; padding-right: 2rem !important; }
}

/* ≥1440px — large desktops */
@media (min-width: 1440px) {
    html { font-size: 17px; }
}

/* ── Global Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,210,255,0.2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,210,255,0.45); }

/* ── Text Selection ──────────────────────────────────────────────────────────── */
::selection      { background: rgba(0,210,255,0.2); color: #fff; }
::-moz-selection { background: rgba(0,210,255,0.2); color: #fff; }

/* ── Focus Ring (accessibility) ─────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--neon-blue);
    outline-offset: 3px;
    border-radius: 2px;
}
