/* ── Self-hosted Inter Font ───────────────────────── */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url(fonts/inter-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url(fonts/inter-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0a;
    --purple: #7928ca;
    --pink: #ff0080;
    --blue: #0070f3;
    --cyan: #00dfd8;
    --tile-bg: rgba(255, 255, 255, 0.05);
    --tile-border: rgba(255, 255, 255, 0.08);
    --tile-border-hover: rgba(255, 255, 255, 0.18);
    --tile-radius: 24px;
    --grid-gap: 16px;
}

html {
    background: var(--bg);
    color: #e0e0e0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Loading Screen ───────────────────────────────── */
.loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-text {
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
}

.loader-bar {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.loader-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--purple), var(--pink), var(--blue));
    transition: width 0.15s linear;
}

/* ── Mesh Gradient Canvas ─────────────────────────── */
#mesh-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    image-rendering: auto;
}

/* ── Bento Grid ───────────────────────────────────── */
.bento-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--grid-gap);
    max-width: 820px;
    width: 100%;
}

/* ── Tile Base ────────────────────────────────────── */
.tile {
    position: relative;
    background: var(--tile-bg);
    border: 1px solid var(--tile-border);
    border-radius: var(--tile-radius);
    padding: 28px 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    cursor: default;
    transform-style: preserve-3d;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
    /* Entrance animation — start hidden */
    opacity: 0;
}

.tile::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--tile-radius);
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(255, 255, 255, 0.03) 0%,
        transparent 70%
    );
    pointer-events: none;
}

.tile:hover {
    border-color: var(--tile-border-hover);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ── Tile Labels ──────────────────────────────────── */
.tile-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
}

.tile h2 {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.tile-stat {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

.tile-detail {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 6px;
}

.tile-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

/* ── Gradient Text ────────────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, var(--purple), var(--pink), var(--blue), var(--cyan));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 6s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ── Hero Tile ────────────────────────────────────── */
.tile-hero {
    grid-column: span 2;
}

.tile-hero h1 {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}

.typing-line {
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 10px;
    min-height: 1.4em;
}

.typing-line::after {
    content: '|';
    animation: blink-cursor 0.8s step-end infinite;
    color: var(--purple);
    font-weight: 300;
    margin-left: 1px;
}

@keyframes blink-cursor {
    50% { opacity: 0; }
}

/* ── TYPO3 Tile ───────────────────────────────────── */
.tile-typo3 .tile-icon {
    color: var(--pink);
    margin-bottom: 8px;
}

/* ── Time Tile ────────────────────────────────────── */
.time-display {
    font-size: 42px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.weather {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.weather-icon {
    font-size: 28px;
    line-height: 1;
}

.weather-temp {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
}

/* ── GitHub Tile ──────────────────────────────────── */
.tile-github {
    grid-column: span 2;
}

.github-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.github-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.github-header-text h2 {
    margin: 0;
}

.github-bio {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
    line-height: 1.3;
}

.tile-github h2 a {
    transition: color 0.2s;
}

.tile-github h2 a:hover {
    color: var(--purple);
}

.github-graph {
    display: grid;
    grid-template-columns: repeat(52, 1fr);
    gap: 2px;
    margin-top: 16px;
}

.github-graph .week {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.github-graph .day {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
}

.github-graph .day.l1 { background: rgba(121, 40, 202, 0.3); }
.github-graph .day.l2 { background: rgba(121, 40, 202, 0.5); }
.github-graph .day.l3 { background: rgba(121, 40, 202, 0.7); }
.github-graph .day.l4 { background: rgba(121, 40, 202, 0.95); }

/* ── Bavaria Tile ─────────────────────────────────── */
.tile-emoji {
    font-size: 40px;
    margin-bottom: 8px;
    line-height: 1;
}

/* ── Tech Radar Tile ──────────────────────────────── */
.radar {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 4px auto 8px;
}

.radar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radar-ring.ring-1 { width: 40px; height: 40px; }
.radar-ring.ring-2 { width: 76px; height: 76px; }
.radar-ring.ring-3 { width: 112px; height: 112px; }

.radar-orb {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    z-index: 1;
    white-space: nowrap;
}

.radar-orb.core {
    width: 28px;
    height: 28px;
    background: rgba(121, 40, 202, 0.5);
    border: 1px solid rgba(121, 40, 202, 0.7);
    animation: orbit-core 12s linear infinite;
}

.radar-orb.mid {
    width: 24px;
    height: 24px;
    background: rgba(0, 112, 243, 0.4);
    border: 1px solid rgba(0, 112, 243, 0.6);
    animation: orbit-mid 18s linear infinite;
}

.radar-orb.outer {
    width: 22px;
    height: 22px;
    background: rgba(0, 223, 216, 0.3);
    border: 1px solid rgba(0, 223, 216, 0.5);
    animation: orbit-outer 24s linear infinite;
}

/* Offset each orb on its ring */
.radar-orb.core:nth-child(4) { animation-delay: 0s; }
.radar-orb.core:nth-child(5) { animation-delay: -6s; }
.radar-orb.mid:nth-child(6) { animation-delay: 0s; }
.radar-orb.mid:nth-child(7) { animation-delay: -9s; }
.radar-orb.outer:nth-child(8) { animation-delay: 0s; }
.radar-orb.outer:nth-child(9) { animation-delay: -12s; }

@keyframes orbit-core {
    from { transform: rotate(0deg) translateX(18px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(18px) rotate(-360deg); }
}

@keyframes orbit-mid {
    from { transform: rotate(0deg) translateX(34px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(34px) rotate(-360deg); }
}

@keyframes orbit-outer {
    from { transform: rotate(0deg) translateX(50px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(50px) rotate(-360deg); }
}

/* Center the orbits */
.radar-orb {
    top: 50%;
    left: 50%;
    margin-left: -12px;
    margin-top: -12px;
}

.radar-orb.core { margin-left: -14px; margin-top: -14px; }

/* ── Currently Using Tile ─────────────────────────── */
.now-using-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 4px;
}

.now-using-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.now-using-text h2 {
    font-size: 17px;
    transition: opacity 0.3s;
}

.now-using-text .tile-detail {
    margin-top: 2px;
}

/* ── 3D Print Tile ────────────────────────────────── */
.print-animation {
    position: relative;
    height: 60px;
    margin-bottom: 10px;
    overflow: hidden;
}

.print-bed {
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 1px;
}

.print-layers {
    position: absolute;
    bottom: 3px;
    left: 10%;
    right: 10%;
    display: flex;
    flex-direction: column-reverse;
}

.print-layers .layer {
    height: 3px;
    border-radius: 1px;
    margin-top: 1px;
    transform-origin: left;
    animation: layer-draw 0.6s ease-out forwards;
}

@keyframes layer-draw {
    from { transform: scaleX(0); opacity: 0; }
    to { transform: scaleX(1); opacity: 1; }
}

.print-nozzle {
    position: absolute;
    top: 2px;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
    animation: nozzle-move 2s ease-in-out infinite;
}

@keyframes nozzle-move {
    0%, 100% { left: 10%; }
    50% { left: calc(90% - 12px); }
}

/* ── Krawoli Mode Tile ────────────────────────────── */
.tile-krawoli-mode {
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.tile-krawoli-mode:hover {
    border-color: rgba(255, 0, 128, 0.3);
    box-shadow: 0 0 40px rgba(255, 0, 128, 0.1);
}

.tile-krawoli-mode.active {
    border-color: rgba(255, 0, 128, 0.5);
    background: rgba(255, 0, 128, 0.08);
}

/* ── Physics Mode Overrides ───────────────────────── */
.bento-grid.physics-active {
    display: block;
    position: relative;
    width: 100%;
    max-width: 820px;
}

.bento-grid.physics-active .tile {
    position: absolute;
}

.bento-grid.physics-chaos .tile {
    border-color: rgba(255, 0, 128, 0.25);
    box-shadow: 0 0 30px rgba(121, 40, 202, 0.2), 0 0 60px rgba(255, 0, 128, 0.08);
    transition: none;
}

/* ── Bottom Gradient Wave ─────────────────────────── */
.bottom-wave {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 180px;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 100% at 20% 100%, rgba(0, 112, 243, 0.6) 0%, transparent 60%),
        radial-gradient(ellipse 60% 100% at 45% 100%, rgba(121, 40, 202, 0.5) 0%, transparent 55%),
        radial-gradient(ellipse 50% 100% at 65% 100%, rgba(255, 0, 128, 0.45) 0%, transparent 55%),
        radial-gradient(ellipse 40% 100% at 85% 100%, rgba(255, 120, 50, 0.5) 0%, transparent 55%);
    filter: blur(25px);
    transform-origin: bottom center;
    animation: wave-pulse 4s ease-in-out infinite;
}

@keyframes wave-pulse {
    0%, 100% { opacity: 0.5; transform: scaleY(0.8); }
    50% { opacity: 1; transform: scaleY(1.5); }
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 700px) {
    body {
        padding: 16px;
        align-items: flex-start;
    }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .tile {
        padding: 20px 18px;
        border-radius: 18px;
    }

    .tile-hero h1 {
        font-size: 36px;
    }

    .time-display {
        font-size: 32px;
    }

    .tile-hero,
    .tile-github {
        grid-column: span 2;
    }
}

@media (max-width: 400px) {
    .tile-hero h1 {
        font-size: 28px;
    }

    .time-display {
        font-size: 26px;
    }

    .github-graph {
        gap: 1px;
    }
}
