/* =============================================================
   Virtual Business Card — index.css
   Author:  Sakchai Promsawat
   Updated: 2026-03-15
   ============================================================= */

/* ─────────────────────────────────────────────────────────────
   1. CSS Custom Properties
   ───────────────────────────────────────────────────────────── */
:root {
    /* Brand palette */
    --clr-primary:        #6366f1;
    --clr-primary-rgb:    99, 102, 241;
    --clr-secondary:      #8b5cf6;
    --clr-secondary-rgb:  139, 92, 246;
    --clr-accent:         #ec4899;
    --clr-accent-rgb:     236, 72, 153;

    /* Background gradient stops */
    --bg-1: #0f0c29;
    --bg-2: #1a1a2e;
    --bg-3: #16213e;

    /* Text scale  (100 = lightest → 700 = darkest) */
    --txt-100: #ffffff;
    --txt-200: #e5e7eb;
    --txt-300: #c9d1d9;
    --txt-400: #9ca3af;
    --txt-500: #6b7280;
    --txt-600: #4b5563;

    /* Semantic text tokens */
    --txt-title:   #a78bfa;
    --txt-bio-em:  #c4b5fd;
    --txt-tag:     #a5b4fc;

    /* Surfaces & borders */
    --surface-card:   rgba(22, 22, 45, 0.75);
    --surface-item:   rgba(255, 255, 255, 0.03);
    --bdr-subtle:     rgba(255, 255, 255, 0.04);
    --bdr-medium:     rgba(255, 255, 255, 0.06);
    --bdr-strong:     rgba(255, 255, 255, 0.07);
    --bdr-divider:    rgba(255, 255, 255, 0.08);

    /* Border radii */
    --r-wrapper: 26px;
    --r-card:    24px;
    --r-item:    12px;
    --r-icon:     9px;
    --r-tag:     20px;
    --r-bio:     14px;
    --r-qr:      16px;

    /* Layout */
    --card-pad: 28px;

    /* Easing */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─────────────────────────────────────────────────────────────
   2. Reset
   ───────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ─────────────────────────────────────────────────────────────
   3. Base
   ───────────────────────────────────────────────────────────── */
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3));
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
    overflow-x: hidden;
}

/* ─────────────────────────────────────────────────────────────
   4. Particle Canvas
   ───────────────────────────────────────────────────────────── */
#particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* ─────────────────────────────────────────────────────────────
   5. Card Wrapper — Animated Gradient Border
   ───────────────────────────────────────────────────────────── */
.card-wrapper {
    position: relative;
    border-radius: var(--r-wrapper);
    padding: 2px;                 /* creates the visible gradient border */
    width: 100%;
    max-width: 404px;             /* card (400px) + 2 × 2px border padding */
    background: linear-gradient(135deg,
        var(--clr-primary),
        var(--clr-secondary),
        var(--clr-accent),
        var(--clr-primary));
    background-size: 300% 300%;
    animation: borderSpin 4s linear infinite, fadeUp 0.7s ease both;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    z-index: 1;
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* ─────────────────────────────────────────────────────────────
   6. Card — Glassmorphism
   ───────────────────────────────────────────────────────────── */
.card {
    width: 100%;
    max-width: 400px;
    background: var(--surface-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--r-card);
    padding: 0 0 var(--card-pad);
    color: var(--txt-200);
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Ambient orb — top-right */
.card::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -60px;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle,
        rgba(var(--clr-primary-rgb), 0.20) 0%,
        transparent 70%);
    pointer-events: none;
}

/* Ambient orb — bottom-left */
.card::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle,
        rgba(var(--clr-accent-rgb), 0.15) 0%,
        transparent 70%);
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────
   7. Card Sub-Components
   ───────────────────────────────────────────────────────────── */

/* Top accent bar */
.card-accent {
    height: 5px;
    background: linear-gradient(90deg,
        var(--clr-primary),
        var(--clr-secondary),
        var(--clr-accent));
    border-radius: var(--r-card) var(--r-card) 0 0;
    margin-bottom: var(--card-pad);
}

.card-inner {
    padding: 0 var(--card-pad);
}

/* Shimmer sweep */
.shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.07) 50%,
        transparent 60%);
    animation: shimmerSweep 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}

/* Mouse-follow glow (left / top driven by JS) */
.mouse-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(var(--clr-secondary-rgb), 0.12) 0%,
        transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: left 0.08s ease, top 0.08s ease;
    z-index: 0;
}

/* Divider */
.divider {
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        var(--bdr-divider),
        transparent);
    margin: 20px 0;
}

/* ─────────────────────────────────────────────────────────────
   8. Header
   ───────────────────────────────────────────────────────────── */
.card-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    flex-shrink: 0;
    overflow: hidden;
    animation: avatarPulse 2.5s ease-in-out infinite;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    border-radius: 50%;
}

.header-text .name {
    font-size: 24px;
    font-weight: 700;
    color: var(--txt-100);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.header-text .title {
    font-size: 15px;
    color: var(--txt-title);
    font-weight: 500;
    margin-top: 4px;
    line-height: 1.4;
    /* Reserve 2 lines so the typewriter animation doesn't cause layout shift */
    min-height: calc(15px * 1.4 * 2);
}

.header-text .company-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
}

.header-text .company-row img {
    height: 16px;
    filter: brightness(0) invert(0.55);
}

.header-text .company-name {
    font-size: 14px;
    color: var(--txt-500);
}

/* ─────────────────────────────────────────────────────────────
   9. Contact List
   ───────────────────────────────────────────────────────────── */
.contact-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--r-item);
    background: var(--surface-item);
    border: 1px solid var(--bdr-subtle);
    text-decoration: none;
    color: var(--txt-300);
    font-size: 15px;
    opacity: 0;
    animation: slideInLeft 0.4s ease forwards;
    transition:
        background    0.2s,
        color         0.2s,
        border-color  0.2s;
}

/* Staggered entrance */
.contact-item:nth-child(1) { animation-delay: 0.30s; }
.contact-item:nth-child(2) { animation-delay: 0.45s; }
.contact-item:nth-child(3) { animation-delay: 0.60s; }
.contact-item:nth-child(4) { animation-delay: 0.75s; }
.contact-item:nth-child(5) { animation-delay: 0.90s; }

.contact-item:hover {
    background:   rgba(var(--clr-primary-rgb), 0.14);
    border-color: rgba(var(--clr-primary-rgb), 0.30);
    color: var(--txt-100);
}

/* Icon badge */
.contact-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--r-icon);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.icon-linkedin { background: rgba(10,  102, 194, 0.25);                color: #60a5fa; }
.icon-email    { background: rgba(var(--clr-accent-rgb),  0.20);       color: #f472b6; }
.icon-line     { background: rgba(0,   185,   0, 0.18);                color: #4ade80; }
.icon-youtube  { background: rgba(255,   0,   0, 0.18);                color: #f87171; }
.icon-web      { background: rgba(var(--clr-primary-rgb), 0.20);       color: #818cf8; }

/* ─────────────────────────────────────────────────────────────
   10. Skill Tags
   ───────────────────────────────────────────────────────────── */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 22px;
}

.tag {
    padding: 5px 13px;
    border-radius: var(--r-tag);
    background: rgba(var(--clr-primary-rgb), 0.12);
    border: 1px solid rgba(var(--clr-primary-rgb), 0.28);
    color: var(--txt-tag);
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transform: scale(0.6);
    animation: tagPop 0.35s var(--ease-spring) forwards;
}

/* Staggered entrance (1–13 tags) */
.tag:nth-child(1)  { animation-delay: 0.80s; }
.tag:nth-child(2)  { animation-delay: 0.90s; }
.tag:nth-child(3)  { animation-delay: 1.00s; }
.tag:nth-child(4)  { animation-delay: 1.10s; }
.tag:nth-child(5)  { animation-delay: 1.20s; }
.tag:nth-child(6)  { animation-delay: 1.30s; }
.tag:nth-child(7)  { animation-delay: 1.40s; }
.tag:nth-child(8)  { animation-delay: 1.50s; }
.tag:nth-child(9)  { animation-delay: 1.60s; }
.tag:nth-child(10) { animation-delay: 1.70s; }
.tag:nth-child(11) { animation-delay: 1.80s; }
.tag:nth-child(12) { animation-delay: 1.90s; }
.tag:nth-child(13) { animation-delay: 2.00s; }

/* ─────────────────────────────────────────────────────────────
   11. Bio
   ───────────────────────────────────────────────────────────── */
.bio {
    padding: 14px 16px;
    border-radius: var(--r-bio);
    background: var(--surface-item);
    border: 1px solid var(--bdr-medium);
    font-size: 15px;
    color: var(--txt-400);
    line-height: 1.7;
    margin-bottom: 20px;
}

.bio strong {
    color: var(--txt-bio-em);
    font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────
   12. QR Section
   ───────────────────────────────────────────────────────────── */
.qr-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: var(--r-qr);
    background: var(--surface-item);
    border: 1px solid var(--bdr-strong);
    margin-bottom: 18px;
}

.qr-section img {
    width: 76px;
    height: 76px;
    border-radius: 10px;
    background: #fff;
    padding: 5px;
    flex-shrink: 0;
}

.qr-info .qr-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--txt-500);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.qr-info .qr-label i { font-size: 12px; color: var(--txt-600); }

.qr-info .qr-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--txt-200);
    margin-top: 4px;
}

.qr-info .qr-sub {
    font-size: 13px;
    color: var(--txt-500);
    margin-top: 4px;
    line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────
   13. Save Contact Button
   ───────────────────────────────────────────────────────────── */
.btn-save {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--r-bio);
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    box-shadow: 0 8px 20px rgba(var(--clr-primary-rgb), 0.35);
    color: var(--txt-100);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}

.btn-save:hover  { opacity: 0.92; transform: translateY(-2px); }
.btn-save:active { transform: translateY(0); }

/* ─────────────────────────────────────────────────────────────
   14. Footer
   ───────────────────────────────────────────────────────────── */
.card-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 11px;
    color: var(--txt-600);
}

.card-footer-sub {
    font-size: 10px;
    color: var(--txt-600);
}

/* ─────────────────────────────────────────────────────────────
   15. Typewriter Cursor
   ───────────────────────────────────────────────────────────── */
.typewriter::after {
    content: '|';
    color: var(--txt-title);
    animation: blink 0.75s step-end infinite;
}

/* =============================================================
   KEYFRAMES — grouped for easy reference
   ============================================================= */

/* Gradient border rotation */
@keyframes borderSpin {
    0%, 100% { background-position:   0% 50%; }
    50%       { background-position: 100% 50%; }
}

/* Card entrance */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Avatar breathing glow */
@keyframes avatarPulse {
    0%, 100% {
        box-shadow:
            0 0 0 3px rgba(var(--clr-primary-rgb), 0.35),
            0 8px 20px rgba(var(--clr-primary-rgb), 0.30);
    }
    50% {
        box-shadow:
            0 0 0 7px rgba(var(--clr-primary-rgb), 0.15),
            0 8px 30px rgba(var(--clr-primary-rgb), 0.50);
    }
}

/* Contact row entrance */
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Skill tag bounce-in */
@keyframes tagPop {
    to { opacity: 1; transform: scale(1); }
}

/* Shimmer sweep */
@keyframes shimmerSweep {
    0%        { left: -100%; }
    50%, 100% { left:  150%; }
}

/* Typewriter cursor blink */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}