/* =========================================
   🧩 UI COMPONENTS & CARDS
   ========================================= */

/* LOADING SCREEN */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #1e1e20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.7s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.logo-container { margin-bottom: 60px; }

.svg-logo {
    width: 350px;
    height: auto;
    overflow: visible;
}

.draw-path {
    fill: none;
    stroke: #ffffff;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 8px rgba(193, 168, 10, 0.623));
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

@keyframes writeText { to { stroke-dashoffset: 0; } }

.path-P      { animation: writeText 1.5s ease-out 0.0s forwards; }
.path-A      { animation: writeText 5s ease-in 0.0s forwards;}
.path-e      { animation: writeText 3s ease-in-out 0.5s forwards; }
.path-l      { animation: writeText 4s ease-out 1s forwards; }
.path-i-stem { animation: writeText 4s ease-in-out 0.8s forwards; }
.path-leaf   { animation: writeText 2s ease-in-out 0.8s forwards; }
.path-x-1    { animation: writeText 3s ease-out 0.8s forwards; }
.path-x-2    { animation: writeText 3s ease-out 0.8s forwards; }
.path-I      { animation: writeText 2s ease-in-out 0.8s forwards; }

.loading-wrapper {
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 2px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: #ffffff;
    border-radius: 20px;
    width: 0%;
    position: relative;
    animation: fillBar 2.6s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 12px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 10px 4px rgba(255, 255, 255, 0.9), 0 0 20px 8px rgba(255, 255, 255, 0.4);
}

@keyframes fillBar {
    0% { width: 0%; }
    100% { width: 100%; }
}

.loading-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    letter-spacing: 4px;
    color: #888888;
    text-transform: uppercase;
}

.percentage {
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 1px;
}

.loader-footer {
    position: absolute;
    bottom: 40px;
    font-size: 10px;
    letter-spacing: 6px;
    color: #555555;
    text-transform: uppercase;
    text-align: center;
    width: 100%;
}

/* LIGHT BULB */
.bulb-wire-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}

.bulb-wire-path {
    fill: none;
    stroke: #383c48;
    stroke-width: 2.2;
    stroke-linecap: round;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
    transition: stroke 0.6s ease;
}

body.light-mode .bulb-wire-path {
    stroke: #807765;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.bulb-assembly {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    margin-left: -40px;
    transform-origin: top center;
    opacity: 0;
    pointer-events: none;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
}

.bulb-assembly.ready {
    opacity: 1;
    pointer-events: auto;
}

.bulb-btn {
    position: relative;
    width: 80px;
    height: 60px;
    background: none;
    border: none;
    padding: 0;
    cursor: grab;
    cursor: -webkit-grab;
    display: block;
    line-height: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.bulb-btn:active,
.bulb-btn.is-dragging {
    cursor: grabbing;
    cursor: -webkit-grabbing;
}

.bulb-shadow {
    width: 46px;
    height: 10px;
    margin-top: 8px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, var(--shadow) 0%, transparent 75%);
    opacity: 0.8;
    transition: opacity 0.4s ease;
}

.bulb-img {
    width: 150px;
    height: auto;
    display: block;
    position: absolute;
    top: 0;
    left: -109px;
    transform: translateX(-50%);
    transition: opacity 0.6s ease;
    pointer-events: none;
    rotate: 180deg;
    margin-top: -20px;
    user-select: none;
    -webkit-user-drag: none;
}

.bulb-img--off { opacity: 1; }
.bulb-img--on  { opacity: 0; }

body.light-mode .bulb-img--off { opacity: 0; }
body.light-mode .bulb-img--on  { opacity: 1; }

/* POST CARDS */
.post-card {
    position: relative;
    overflow: hidden;
    grid-column: span 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 32px;
    box-shadow: 0 15px 35px var(--shadow);
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.25s ease-out, border-color 0.3s ease, box-shadow 0.3s ease;
}

.post-card.show { opacity: 1; transform: translateY(0); }
.post-card:nth-child(2).show { transition-delay: 0.1s; }
.post-card:nth-child(3).show { transition-delay: 0.2s; }

.post-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.16), transparent 55%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.post-card:hover {
    border-color: var(--accent-soft);
    box-shadow: 0 20px 45px var(--shadow);
}

.post-card:hover::before { opacity: 1; }
.post-card.featured { grid-column: span 2; }

.post-media {
    width: 100%;
    height: 160px;
    border-radius: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-soft), var(--surface));
    color: var(--accent);
    font-size: 2.4rem;
}

.post-media img.post-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

.tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 14px;
}

.post-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

.post-card p {
    color: var(--text-muted);
    font-size: 0.96rem;
    line-height: 1.7;
    font-weight: 300;
}

.post-card code {
    background: var(--surface-glass);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 0.88em;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.post-date { color: var(--text-muted); font-size: 0.85rem; }

.post-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.post-link i { font-size: 0.75rem; }

/* PROJECT CARDS */
.project-card {
    grid-column: span 1;
    perspective: 1200px;
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.project-card.show { opacity: 1; transform: translateY(0); }
.project-card:nth-child(2).show { transition-delay: 0.1s; }
.project-card:nth-child(3).show { transition-delay: 0.2s; }

.card-inner {
    position: relative;
    width: 100%;
    min-height: 400px;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.project-card.flipped .card-inner { transform: rotateY(180deg); }

.card-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 34px 30px;
    box-shadow: 0 15px 35px var(--shadow);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card-face[aria-hidden="true"] { pointer-events: none; }

.project-card:hover .card-face {
    border-color: var(--accent-soft);
    box-shadow: 0 20px 45px var(--shadow);
}

.card-back {
    transform: rotateY(180deg);
    justify-content: center;
    text-align: center;
}

.card-back p { margin-bottom: 26px; }

.project-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1.4rem;
    margin-bottom: 22px;
}

.project-icon img.project-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.project-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.project-card p {
    color: var(--text-muted);
    font-size: 0.94rem;
    line-height: 1.7;
    font-weight: 300;
    margin-bottom: 20px;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.project-tags span {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 20px;
}

.project-links {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.project-links a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.project-links a:hover { color: var(--accent); }

.flip-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    transition: color 0.3s ease, transform 0.3s ease;
}

.flip-btn:hover { transform: translateX(2px); }
.card-back .flip-btn { margin: 0 auto; }

/* CONTACT FORM */
.contact-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 600px;
    background: var(--surface-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 50px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}

.contact-container.show { opacity: 1; transform: translateY(0); }

.contact-container h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--text), var(--text-muted));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.contact-container p {
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 1rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.input-group {
    position: relative;
    width: 100%;
    text-align: left;
}

.input-group input,
.input-group textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    padding: 10px 0;
    font-size: 1.1rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.3s ease;
    resize: none;
}

.input-group input:focus,
.input-group textarea:focus { border-bottom: 2px solid var(--accent); }

.input-group label {
    position: absolute;
    top: 10px;
    left: 0;
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    transition: all 0.3s ease;
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label,
.input-group textarea:focus ~ label,
.input-group textarea:not(:placeholder-shown) ~ label {
    top: -20px;
    font-size: 0.85rem;
    color: var(--accent);
}

.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 15px;
    background: linear-gradient(90deg, var(--gold-1), var(--gold-2));
    color: #1a1608;
    border: none;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--accent-soft);
}

.send-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px var(--accent-soft);
}

.send-btn i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.send-btn:hover i { transform: translateX(5px) translateY(-5px); }

.form-status {
    margin-top: 15px;
    font-size: 0.95rem;
    font-weight: 600;
    min-height: 20px;
}
.status-success { color: #00ff88; }
.status-error { color: #ff5f5f; }