/* === RESET === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* === TOKENS — LIGHT === */
:root {
    --bg:        #E8E5DC;
    --surface:   #F0EDE5;
    --text:      #181818;
    --muted:     #7A7870;
    --border:    #181818;
    --tag-bg:    #D0CCBF;
    --tag-wip:   #C8B89A;
    --shadow:    4px 4px 0px #181818;
    --shadow-lg: 7px 7px 0px #181818;
    --font:      'Space Grotesk', system-ui, sans-serif;
    --nav-h:     66px;
}

/* === TOKENS — DARK === */
[data-theme="dark"] {
    --bg:        #181714;
    --surface:   #201F1B;
    --text:      #E8E5DC;
    --muted:     #8A8780;
    --border:    #58554F;
    --tag-bg:    #2C2A26;
    --tag-wip:   #3A3228;
    --shadow:    4px 4px 0px #0C0B09;
    --shadow-lg: 7px 7px 0px #0C0B09;
}

/* === LOGO SVG === */
.logo-shadow { fill: var(--text); }
.logo-bg     { fill: var(--bg); stroke: var(--text); }
.logo-text   { fill: var(--text); }

/* === BASE === */
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 1rem;
    transition: background-color 0.3s, color 0.3s;
    /* Prevent horizontal overflow on mobile */
    overflow-x: hidden;
}

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

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--text); }

/* === SCROLL ANIMATIONS === */
[data-animate] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}
[data-animate].visible { opacity: 1; transform: translateY(0); }

/* === NAV === */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 2.5rem;
    background: var(--bg);
    border-bottom: 2.5px solid var(--border);
    transition: background-color 0.3s, border-color 0.3s;
}

.nav__logo { display: flex; align-items: center; transition: opacity 0.15s; }

.nav__right { display: flex; align-items: center; gap: 2rem; }

.nav__links { display: flex; gap: 1.75rem; list-style: none; }

.nav__links a {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 3px;
    /* Touch target */
    display: flex;
    align-items: center;
    min-height: 44px;
}
.nav__links a::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 2px;
    background: var(--text);
    transition: width 0.2s ease;
}

/* Hover only on pointer devices */
@media (hover: hover) {
    .nav__logo:hover { opacity: 0.65; }
    .nav__links a:hover::after { width: 100%; }
}

.theme-toggle {
    background: none;
    border: 2px solid var(--border);
    color: var(--text);
    font-size: 1rem;
    width: 40px; height: 40px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}
@media (hover: hover) {
    .theme-toggle:hover { background: var(--text); color: var(--bg); }
}

/* === HAMBURGER === */
.nav__hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px; height: 40px;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}
.nav__hamburger span {
    display: block;
    width: 22px; height: 2.5px;
    background: var(--text);
    transition: transform 0.22s ease, opacity 0.22s ease;
}
.nav--open .nav__hamburger span:nth-child(1) { transform: rotate(45deg) translate(5.5px, 5.5px); }
.nav--open .nav__hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav--open .nav__hamburger span:nth-child(3) { transform: rotate(-45deg) translate(5.5px, -5.5px); }

/* === MOBILE MENU === */
.nav__menu {
    display: contents; /* behaves as if not there on desktop */
}

/* === HERO === */
.hero {
    position: relative;
    min-height: calc(100vh - var(--nav-h));
    display: flex;
    align-items: center;
    padding: 5rem 2.5rem;
    border-bottom: 2.5px solid var(--border);
    overflow: hidden;
}

.hero__watermark {
    position: absolute;
    right: -0.05em; top: 50%;
    transform: translateY(-50%);
    font-family: 'Arial Black', Impact, sans-serif;
    font-size: clamp(120px, 28vw, 400px);
    font-weight: 900;
    color: transparent;
    -webkit-text-stroke: 2px rgba(24, 24, 24, 0.07);
    line-height: 1;
    user-select: none;
    pointer-events: none;
    letter-spacing: -0.03em;
}
[data-theme="dark"] .hero__watermark {
    -webkit-text-stroke: 2px rgba(232, 229, 220, 0.06);
}

.hero__content {
    max-width: 680px;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.7s ease 0.1s forwards;
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.hero__roles { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }

.hero__tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border: 2px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    background: var(--tag-bg);
    box-shadow: var(--shadow);
}

.hero__more {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--muted);
    margin-bottom: 1.75rem;
    transition: color 0.15s, border-color 0.15s;
    /* Touch target */
    padding: 0.5rem 0;
}
@media (hover: hover) {
    .hero__more:hover { color: var(--text); border-color: var(--text); }
}

.hero__name {
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 700;
    line-height: 0.93;
    letter-spacing: -0.04em;
    margin-bottom: 1.5rem;
}

.hero__alias {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--muted);
    letter-spacing: 0;
    vertical-align: middle;
}

.hero__desc {
    font-size: 1.05rem;
    color: var(--muted);
    max-width: 400px;
    margin-bottom: 2.5rem;
    line-height: 1.75;
}

.hero__actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    min-height: 44px;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    border: 2.5px solid var(--border);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    letter-spacing: 0.02em;
}
.btn--primary { background: var(--text); color: var(--bg); box-shadow: var(--shadow); }
.btn--outline  { background: transparent; color: var(--text); box-shadow: var(--shadow); }
.btn--sm { padding: 0.5rem 1rem; font-size: 0.8rem; min-height: 40px; }

@media (hover: hover) {
    .btn--primary:hover,
    .btn--outline:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
}

/* === LAYOUT === */
.container { max-width: 1100px; margin: 0 auto; padding: 0 2.5rem; }
.section { padding: 5rem 0; border-bottom: 2.5px solid var(--border); }
.section--alt { background: var(--surface); }

.section__title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 3rem;
    padding-bottom: 1.25rem;
    border-bottom: 2.5px solid var(--border);
    line-height: 1;
}

/* === PROJECT CARDS === */
.projects__grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.projects__grid .project-card {
    flex: 0 1 420px;
    min-width: 280px;
}

.project-card {
    border: 2.5px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: flex; flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}
@media (hover: hover) {
    .project-card:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow-lg); }
}

.project-card__preview {
    border-bottom: 2.5px solid var(--border);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--tag-bg);
    flex-shrink: 0;
}
.project-card__preview img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
@media (hover: hover) {
    .project-card:hover .project-card__preview img { transform: scale(1.03); }
}

.project-card__body {
    padding: 1.75rem;
    display: flex; flex-direction: column; gap: 0.9rem;
    flex: 1;
}

.project-card--game {
    border-width: 3px;
    flex-direction: row;
    margin-bottom: 0;
}
.project-card--game .project-card__preview {
    width: 45%;
    aspect-ratio: auto;
    border-bottom: none;
    border-right: 3px solid var(--border);
    flex-shrink: 0;
}
.project-card--game .project-card__preview--game {
    background: #1C1A16;
}
.project-card--game .project-card__body {
    flex: 1;
    gap: 1rem;
}
.project-card--game .project-card__title { font-size: 1.5rem; }

.project-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.project-card__index {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
    margin-top: 2px;
}

.project-card__tags { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; }

.tag {
    padding: 0.2rem 0.5rem;
    background: var(--tag-bg);
    border: 1.5px solid var(--border);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tag--wip {
    background: var(--tag-wip);
    animation: blink-border 2s ease-in-out infinite;
}
@keyframes blink-border {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.project-card__title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.project-card__desc {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.7;
    flex: 1;
}

.project-card__game-note {
    border-top: 1.5px solid var(--border);
    padding-top: 0.75rem;
    width: 100%;
}

.project-card__link {
    font-size: 0.82rem;
    font-weight: 600;
    border-bottom: 1.5px solid var(--text);
    align-self: flex-start;
    padding: 0.25rem 0;
    letter-spacing: 0.02em;
    transition: opacity 0.15s;
    min-height: 44px;
    display: flex;
    align-items: flex-end;
}
@media (hover: hover) {
    .project-card__link:hover { opacity: 0.5; }
}

/* === SMALL PROJECTS === */
.small-projects { margin-top: 1rem; }

.small-projects__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem;
    border: 2px solid var(--border);
    background: var(--surface);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    list-style: none;
    box-shadow: var(--shadow);
    transition: transform 0.12s, box-shadow 0.12s;
    min-height: 44px;
}
.small-projects__toggle::-webkit-details-marker { display: none; }
@media (hover: hover) {
    .small-projects__toggle:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
}

.small-projects__icon {
    font-size: 1.1rem;
    font-weight: 700;
    transition: transform 0.2s ease;
    display: inline-block;
}
details[open] .small-projects__icon { transform: rotate(45deg); }

.small-projects__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
    padding-top: 0.75rem;
}

.small-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 2px solid var(--border);
    background: var(--surface);
    box-shadow: 3px 3px 0 var(--border);
    transition: transform 0.12s, box-shadow 0.12s;
    min-height: 52px;
}
@media (hover: hover) {
    .small-card:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--border); }
}

.small-card__title { font-size: 0.875rem; font-weight: 600; flex: 1; }

.small-card__tags {
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    color: var(--muted);
    white-space: nowrap;
}

.small-card__arrow { font-size: 0.85rem; color: var(--muted); flex-shrink: 0; }

/* === SKILLS === */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2.5rem;
}

.skill-group__title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1.5px solid var(--border);
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-tags .tag { font-size: 0.78rem; padding: 0.3rem 0.7rem; }

/* === CONTACT === */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 4rem;
    align-items: start;
}

.contact-info__text {
    font-size: 1rem;
    color: var(--muted);
    line-height: 1.75;
    margin-bottom: 2rem;
}

.contact-info__links { display: flex; flex-direction: column; }

.contact-info__link {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    border-top: 1.5px solid var(--border);
    transition: padding-left 0.15s;
    gap: 0.1rem;
    min-height: 56px;
    justify-content: center;
}
.contact-info__link:last-child { border-bottom: 1.5px solid var(--border); }
@media (hover: hover) {
    .contact-info__link:hover { padding-left: 0.5rem; }
}

.contact-info__label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

.contact-info__link span:last-child { font-size: 0.9rem; font-weight: 600; }

/* === FORM === */
.contact-form { display: flex; flex-direction: column; gap: 1.25rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.form-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.form-input {
    font-family: var(--font);
    font-size: 1rem; /* ≥16px previne zoom no iOS */
    padding: 0.75rem 1rem;
    background: var(--bg);
    color: var(--text);
    border: 2.5px solid var(--border);
    outline: none;
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s, transform 0.15s;
    width: 100%;
    min-height: 48px;
    -webkit-appearance: none;
    border-radius: 0;
}
.form-input::placeholder { color: var(--muted); }
@media (hover: hover) {
    .form-input:focus { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
}
.form-input:focus { box-shadow: var(--shadow-lg); }

.form-textarea { resize: vertical; min-height: 130px; }

.form-footer { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }

.form-status {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}
.form-status.ok  { color: #5A8C6A; }
.form-status.err { color: #8C5A5A; }

/* === FOOTER === */
.footer { padding: 1.5rem 0; }
.footer__inner { display: flex; align-items: center; gap: 0.75rem; }
.footer__copy { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

/* === FLOATING CTA === */
.floating-cta {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    z-index: 200;
    display: flex;
    align-items: center;
    max-width: 280px;
    background: var(--text);
    color: var(--bg);
    border: 2.5px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (hover: hover) {
    .floating-cta:hover { transform: translate(-3px, -3px); box-shadow: 10px 10px 0 var(--border); }
}

.floating-cta__pulse {
    position: absolute;
    top: -6px; right: -6px;
    width: 14px; height: 14px;
    background: var(--tag-wip);
    border: 2px solid var(--border);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.floating-cta__text { flex: 1; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* --- Tablet / Large mobile --- */
@media (max-width: 900px) {
    .contact-layout { grid-template-columns: 1fr; gap: 2.5rem; }
    .project-card--game { flex-direction: column; }
}

/* --- Hamburger breakpoint --- */
@media (max-width: 640px) {
    /* Nav */
    .nav { padding: 0.875rem 1.25rem; }
    .nav__hamburger { display: flex; }
    .nav__right { gap: 0.75rem; }

    /* Mobile menu drawer */
    .nav__links {
        display: none;
        position: fixed;
        top: var(--nav-h);
        left: 0; right: 0;
        background: var(--bg);
        border-bottom: 2.5px solid var(--border);
        flex-direction: column;
        padding: 0.5rem 1.25rem 1rem;
        gap: 0;
        z-index: 99;
        box-shadow: 0 4px 0 var(--border);
    }
    .nav--open .nav__links { display: flex; }

    .nav__links li { border-bottom: 1px solid var(--border); }
    .nav__links li:first-child { border-top: 1px solid var(--border); }

    .nav__links a {
        font-size: 1rem;
        letter-spacing: 0.04em;
        padding: 0.9rem 0;
        min-height: 52px;
    }
    .nav__links a::after { display: none; }

    /* Hero */
    .hero { padding: 3rem 1.25rem 4rem; min-height: auto; }
    .hero__desc { font-size: 0.95rem; max-width: 100%; }

    /* Container */
    .container { padding: 0 1.25rem; }

    /* Sections */
    .section { padding: 3rem 0; }
    .section__title { margin-bottom: 2rem; }

    /* Projects */
    .projects__grid { gap: 1rem; }
    .project-card--game { flex-direction: column; }
    .project-card--game .project-card__preview {
        width: 100%;
        aspect-ratio: 16 / 9;
        border-right: none;
        border-bottom: 2.5px solid var(--border);
    }
    .project-card__body { padding: 1.25rem; }
    .project-card--game .project-card__title { font-size: 1.25rem; }

    /* Small cards */
    .small-projects__grid { grid-template-columns: 1fr; }
    .small-card__tags { display: none; } /* too tight on mobile */

    /* Skills */
    .skills-grid { grid-template-columns: 1fr; gap: 2rem; }

    /* Contact */
    .form-row { grid-template-columns: 1fr; }

    /* Floating CTA — compact */
    .floating-cta {
        bottom: 1rem;
        right: 1rem;
        max-width: 200px;
        padding: 0.6rem 0.75rem;
        font-size: 0.7rem;
    }
    .floating-cta__text {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* --- Small phones --- */
@media (max-width: 380px) {
    .hero__name { font-size: clamp(2.6rem, 12vw, 3rem); }
    .hero__actions { flex-direction: column; }
    .hero__actions .btn { width: 100%; justify-content: center; }
    .floating-cta { max-width: 170px; font-size: 0.67rem; }
}
