/* =====================================================================
   richard.popelis.sk — redesign
   dark base, zero radius, thick borders, Space Grotesk + JetBrains Mono
   ===================================================================== */

:root {
    --bg: #0d0d0d;
    --bg-soft: #161616;
    --fg: #e8e8e8;
    --fg-dim: #9a9a9a;
    --accent: #e15f41;
    --line: #e8e8e8;
    --line-soft: #2a2a2a;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-bg-hover: rgba(225, 95, 65, 0.1);
    --border: 2px;
    --border-thick: 4px;
    --pad: 1.25rem;
    --gap: 1rem;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --display: "Space Grotesk", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f4f4ef;
        --bg-soft: #ffffff;
        --fg: #111111;
        --fg-dim: #5a5a5a;
        --accent: #1a1a1a;
        --line: #111111;
        --line-soft: #d8d8d0;
        --card-bg: rgba(0, 0, 0, 0.02);
        --card-bg-hover: rgba(0, 0, 0, 0.06);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: radial-gradient(
        ellipse at 50% 40%,
        var(--bg-soft) 0%,
        var(--bg) 70%
    );
}
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    color: var(--fg);
    font-family: var(--display);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}
body {
    background: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}
button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

/* ===== background layers ============================================ */

#bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -100;
    pointer-events: none;
}

#bgnoise {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -101;
    pointer-events: none;
    opacity: 0.55;
    mix-blend-mode: screen;
    background-image: url(../img/noise-min.png);
    background-repeat: repeat;
    background-size: 180px 180px;
    animation: noise-fast 0.0593s steps(2) infinite;
}
#bgnoise::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url(../img/noise-min.png);
    background-repeat: repeat;
    background-size: 320px 320px;
    opacity: 0.6;
    animation: noise-slow 1.4s steps(8) infinite;
}

@keyframes noise-fast {
    0% {
        background-position:
            0 0,
            0 0;
    }
    100% {
        background-position:
            21763px 16549px,
            -13711px 9817px;
    }
}
@keyframes noise-slow {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 4120px -2880px;
    }
}

/* ===== layout ====================================================== */

#flex {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    min-height: 100dvh;
    padding: 2rem 1rem;
}

#container {
    width: 100%;
    max-width: 920px;
    text-align: center;
}

#title {
    margin: 0 0 1rem;
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(1.8rem, 7.5vw, 5rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
    perspective: 10rem;
    white-space: nowrap;
}

#tagline {
    margin: 0 0 2.5rem;
    font-family: var(--mono);
    font-size: clamp(0.8rem, 2vw, 0.95rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fg-dim);
}

#t-at,
#t-dot {
    display: inline-block;
    transition:
        transform 0.6s cubic-bezier(0, 1.04, 0.82, 0.99),
        font-size 0.6s;
    transform: rotateY(0);
}
#t-at.hidden {
    transform: rotateY(-90deg);
    font-size: 0;
    user-select: none;
}
#t-dot.hidden {
    transform: rotateY(90deg);
    font-size: 0;
    user-select: none;
}

/* ===== social cards =============================================== */

#social {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
}

.social-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: var(--pad);
    min-height: 8rem;
    background: var(--card-bg);
    border: var(--border) solid var(--line-soft);
    color: var(--fg);
    transition:
        transform 0.25s ease,
        border-color 0.25s ease,
        background 0.25s ease;
    text-align: center;
}
.social-card:hover,
.social-card:focus-visible {
    border-color: var(--line);
    background: var(--card-bg-hover);
    transform: translate(0, -4px);
    outline: none;
}
.social-card:focus-visible {
    border-color: var(--accent);
}
.social-card .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg);
}
.social-card .logo img {
    display: block;
    width: 36px;
    height: 36px;
    filter: invert(1);
    transition: filter 0.25s ease;
}
.social-card:hover .logo img,
.social-card:focus-visible .logo img {
    filter: invert(1) brightness(1.4) sepia(1) saturate(6) hue-rotate(330deg);
}
.social-card .label {
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-dim);
}

@media (prefers-color-scheme: light) {
    .social-card .logo img {
        filter: invert(0);
    }
    .social-card:hover .logo img,
    .social-card:focus-visible .logo img {
        filter: invert(0);
    }
}

/* ===== modal ====================================================== */

dialog#cv-modal,
dialog#iban-modal,
dialog#telegram-modal {
    padding: 0;
    border: var(--border-thick) solid var(--line);
    border-radius: 0;
    background: var(--bg-soft);
    color: var(--fg);
}

dialog#cv-modal {
    width: min(640px, 95vw);
    max-height: 95dvh;
}

dialog#iban-modal,
dialog#telegram-modal {
    max-width: calc(100dvw - 8px);
}

@media (max-width: 640px) {
    dialog#cv-modal,
    dialog#iban-modal,
    dialog#telegram-modal {
        width: calc(100dvw - 8px);
        max-height: calc(100dvh - 8px);
    }
    .modal-panel {
        max-height: calc(100dvh - 8px);
    }
}

dialog#cv-modal::backdrop,
dialog#iban-modal::backdrop,
dialog#telegram-modal::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
}

.modal-iframe {
    padding: 0;
    overflow: hidden;
}
.modal-iframe iframe {
    display: block;
    width: 100%;
    height: 70vh;
    max-height: calc(86vh - 3.5rem);
    border: none;
}

.modal-panel {
    display: flex;
    flex-direction: column;
    max-height: 86vh;
}

.modal-head {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: var(--border) solid var(--line-soft);
    background: var(--bg-soft);
}
.modal-head h2 {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.modal-close {
    display: flex;
    padding: 0.25rem;
    color: var(--fg-dim);
    transition: color 0.2s;
}
.modal-close img {
    display: block;
    width: 24px;
    height: 24px;
    filter: invert(1);
}
.modal-close:hover {
    color: var(--accent);
}

@media (prefers-color-scheme: light) {
    .modal-close img {
        filter: invert(0);
    }
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    text-align: left;
}

.cv-section {
    margin: 0 0 1.75rem;
}
.cv-section:last-child {
    margin-bottom: 0;
}
.cv-section h3 {
    margin: 0 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: var(--border) solid var(--line-soft);
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fg-dim);
}
.cv-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cv-list li {
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--line-soft);
}
.cv-list li:last-child {
    border-bottom: none;
}
.cv-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}
.cv-role {
    font-weight: 500;
}
.cv-when {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--fg-dim);
}
.cv-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.cv-tags span {
    padding: 0.25rem 0.6rem;
    border: var(--border) solid var(--line-soft);
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--fg-dim);
}

/* --- cv intro ----------------------------------------------------- */

.cv-intro {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: var(--border) solid var(--line-soft);
}
.cv-name {
    margin: 0 0 0.25rem;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.02em;
}
.cv-subtitle {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: var(--fg-dim);
}
.cv-links {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--fg-dim);
}
.cv-links a {
    color: var(--fg);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    text-decoration-color: var(--line-soft);
    transition:
        color 0.2s,
        text-decoration-color 0.2s;
}
.cv-links a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

/* --- skill groups ------------------------------------------------- */

.cv-skill-group {
    margin-bottom: 0.75rem;
}
.cv-skill-group:last-child {
    margin-bottom: 0;
}
.cv-skill-group h4 {
    margin: 0 0 0.35rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-dim);
}

/* --- timeline (experience) ---------------------------------------- */

.cv-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cv-timeline li {
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--line-soft);
}
.cv-timeline li:last-child {
    border-bottom: none;
}
.cv-location {
    display: block;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--fg-dim);
    margin-bottom: 0.35rem;
}
.cv-bullets {
    list-style: disc;
    margin: 0;
    padding: 0 0 0 1.25rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--fg-dim);
}
.cv-bullets li {
    padding: 0.1rem 0;
    border-bottom: none;
}
.cv-bullets li strong {
    color: var(--fg);
}

/* ===== footer ====================================================== */

#footer {
    text-align: center;
}

#footer nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#footer a,
#footer button {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--fg-dim);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    text-decoration-color: var(--line-soft);
    transition:
        color 0.2s,
        text-decoration-color 0.2s;
}

#footer a:hover,
#footer button:hover,
#footer a:focus-visible,
#footer button:focus-visible {
    color: var(--fg);
    text-decoration-color: var(--fg-dim);
}

#footer span {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--line-soft);
    user-select: none;
}

/* --- iban modal ---------------------------------------------------- */

.iban-number {
    margin: 0;
    font-family: var(--mono);
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 0.08em;
}

/* --- telegram modal ------------------------------------------------ */

.telegram-qr {
    display: block;
    margin: 0 auto 1rem;
    color: var(--accent);
}

.telegram-link {
    display: block;
    text-align: center;
    font-family: var(--mono);
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    color: var(--fg-dim);
}

/* ===== responsive ================================================= */

@media (max-width: 640px) {
    #social {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== reduced motion ============================================= */

@media (prefers-reduced-motion: reduce) {
    #bg,
    #bgnoise,
    #bgnoise::after {
        animation: none;
    }
    #t-at,
    #t-dot {
        transition: font-size 0.2s;
        transform: none;
    }
    .social-card {
        transition: none;
    }
    .social-card:hover {
        transform: none;
    }
}
