:root {
    --bg: #050505;
    --card-bg: #0a0a0a;
    --text: #e1e1e1;
    --text-dim: #8afac2;
    --accent: #00ff9d;
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', monospace;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
}

.cyber-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 200vw;
    height: 200vh;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(500px) rotateX(60deg) translateY(-100px) translateZ(-200px);
    animation: gridMove 20s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes gridMove {
    0%   { transform: perspective(500px) rotateX(60deg) translateY(0) translateZ(-200px); }
    100% { transform: perspective(500px) rotateX(60deg) translateY(40px) translateZ(-200px); }
}

.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;

    /* Stack of subtle background layers */
    background:
        /* top-left teal glow */
        radial-gradient(
            circle at 12% 0%,
            rgba(0, 255, 157, 0.16),
            transparent 55%
        ),
        /* bottom-right purple glow */
        radial-gradient(
            circle at 88% 100%,
            rgba(88, 101, 242, 0.18),
            transparent 55%
        ),
        /* main dark vignette */
        radial-gradient(
            circle,
            transparent 40%,
            #050505 95%
        );
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 100px repeat(3, 160px);
    gap: 16px;
    width: 100%;
    max-width: 1100px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    border: 1px solid #1f1f1f;
    z-index: 1;
}

/* Gradient border effect (original behaviour) */
.card::before {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: -1;
    background: linear-gradient(45deg, #ff0055, #00ff9d, #00ccff, #ff0055);
    background-size: 400%;
    border-radius: var(--border-radius);
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: borderGlow 20s linear infinite;
}

.card::after {
    content: "";
    position: absolute;
    inset: 1px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    z-index: -1;
}

/* Hover + touch-preview share the same visual effect */
.card:hover,
.card.touch-preview {
    transform: translateY(-4px);
}

.card:hover::before,
.card.touch-preview::before {
    opacity: 1;
}

.card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

@keyframes borderGlow {
    0%   { background-position: 0 0; }
    50%  { background-position: 400% 0; }
    100% { background-position: 0 0; }
}

h2 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

p {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 600;
}

.icon {
    width: 32px;
    height: 32px;
    fill: var(--text);
    margin-bottom: auto;
    opacity: 0.8;
    transition: 0.3s;
}

.card:hover .icon,
.card.touch-preview .icon {
    opacity: 1;
    fill: var(--accent);
    filter: drop-shadow(0 0 5px var(--accent));
}

/* STATUS DOT – pinned in the corner, above everything */
.status-dot {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
    z-index: 2;
}

.card:hover .status-dot,
.card.touch-preview .status-dot {
    background: var(--accent);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 255, 157, 0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(0, 255, 157, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 157, 0); }
}

.c-header {
    grid-column: span 4;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background: rgba(10,10,10,0.8);
    backdrop-filter: blur(10px);
    border: 1px solid #333;
}

.c-header::before {
    display: none;
}

.c-header:hover {
    transform: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-box {
    width: 40px;
    height: 40px;
    background: var(--text);
    color: var(--bg);
    display: grid;
    place-items: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.clock-container {
    text-align: right;
}

.time {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.date {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.c-wide {
    grid-column: span 2;
}

.c-tall {
    grid-row: span 2;
}

/* Per-card glow overrides */
.c-jellyfin:hover::before,
.c-jellyfin.touch-preview::before {
    background: linear-gradient(45deg, #aa55ff, #5500ff);
}

.c-vscode:hover::before,
.c-vscode.touch-preview::before {
    background: linear-gradient(45deg, #007acc, #00ccff);
}

.c-vault:hover::before,
.c-vault.touch-preview::before {
    background: linear-gradient(45deg, #175429, #4fdc75);
}

.c-discord:hover::before,
.c-discord.touch-preview::before {
    background: linear-gradient(45deg, #5865F2, #9B6DFF);
}

/* STORAGE BAR STYLES */
.storage-track {
    margin-top: 10px;
    height: 4px;
    width: 100%;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}

.storage-fill {
    width: 0%;
    height: 100%;
    background: var(--text-dim);
    border-radius: 2px;
    transition: width 1s ease, background-color 0.5s ease, box-shadow 0.5s ease;
}

/* Up to tablet/phone: 2 columns, header & wide cards span both */
@media (max-width: 900px) {
    .grid-container {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .c-header,
    .c-wide {
        grid-column: 1 / -1;
    }
}

/* Very small screens (iPhone etc.): full-width cards, stacked tighter */
@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    .grid-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 12px;
    }

    .c-header,
    .c-wide,
    .c-tall {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .card {
        padding: 20px;
    }

    .status-dot {
        top: 12px;
        right: 12px;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cyber-grid {
        animation: none;
    }

    .card,
    .icon {
        transition: none;
    }

    .card:hover,
    .card.touch-preview {
        transform: none;
    }

    .card:hover .status-dot,
    .card.touch-preview .status-dot {
        animation: none;
    }
}

/* CONTACT MODAL */
.contact-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
}

.contact-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.contact-card-form {
    max-width: 420px;
    width: 100%;
    position: relative;
}

.contact-close {
    position: absolute;
    top: 14px;
    right: 18px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
}

.contact-close:hover {
    color: var(--accent);
}

.contact-muted {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.contact-card-form label {
    font-size: 0.75rem;
    margin-bottom: 6px;
    display: block;
}

.contact-card-form input,
.contact-card-form textarea {
    width: 100%;
    background: #111;
    color: #fff;
    border-radius: 8px;
    border: 1px solid #333;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-family: inherit;
}

.contact-card-form textarea {
    resize: vertical;
    min-height: 100px;
}

.contact-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.contact-submit {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--accent);
    color: #000;
}

.contact-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.contact-status {
    margin-top: 8px;
    font-size: 0.7rem;
}

.contact-status--error {
    color: #ff9f9f;
}

.contact-status--ok {
    color: #8aff8a;
}

/* Tap hint for mobile double-tap */
.tap-hint {
    position: absolute;
    bottom: 10px;
    right: 14px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 255, 157, 0.4);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 3;
}

.card.tap-hint-visible .tap-hint {
    opacity: 1;
    transform: translateY(0);
}

/* ------------------------------
   JELLYFIN BACKDROP VIDEO
   ------------------------------ */

/* Only Jellyfin card gets the video treatment */
.c-jellyfin {
    position: relative;
    overflow: hidden;
}

/* Jellyfin status-dot explicitly pinned in the correct corner */
.c-jellyfin .status-dot {
    top: 14px;
    right: 14px;
    left: auto;
    position: absolute;
    z-index: 3;
}

/* Video fills entire button, over-zoomed to hide black bars */
.c-jellyfin .card-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    opacity: 0;
    pointer-events: none;

    /* stronger blur + darker */
    filter: blur(5px) brightness(0.45) saturate(1.1);

    /* still over-zoomed to hide black bars */
    transform: scale(1.4);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 0;
}


/* Fade video in on hover / touch-preview */
.c-jellyfin:hover .card-bg-video,
.c-jellyfin.touch-preview .card-bg-video {
    opacity: 1;
    transform: scale(1.2);
}

/* All normal content sits above the video (but NOT status-dot or tap-hint) */
.c-jellyfin > *:not(.card-bg-video):not(.status-dot):not(.tap-hint) {
    position: relative;
    z-index: 1;
}

/* Discord icon: purple glow instead of green */
.c-discord .icon {
    fill: var(--text);
}

.c-discord:hover .icon,
.c-discord.touch-preview .icon {
    opacity: 1;
    fill: #ffffff;
    filter: drop-shadow(0 0 6px #5865F2);
}

/* purple status-dot pulse on Discord */
.c-discord .status-dot {
    background: #5865F2;
}

.c-discord:hover .status-dot,
.c-discord.touch-preview .status-dot {
    background: #5865F2;
    animation: pulse-discord 1.5s infinite;
}

@keyframes pulse-discord {
    0%   { box-shadow: 0 0 0 0 rgba(88, 101, 242, 0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(88, 101, 242, 0); }
    100% { box-shadow: 0 0 0 0 rgba(88, 101, 242, 0); }
}
