/* ============================================
   MAREK KOVAR — CREATIVE TECHNOLOGIST PORTFOLIO
   Editorial Minimal Design
   ============================================ */

/* --- Variables --- */
:root {
    --bg: #F5F0EB;
    --bg-card: #FFFFFF;
    --text: #1A1714;
    --text-muted: #8A8279;
    --accent: #B8530D;
    --border: #E5DED5;
    --border-dark: #C9C0B4;
    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: 'Figtree', -apple-system, sans-serif;
    --max-width: 1200px;
    --section-gap: clamp(80px, 12vw, 140px);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Subtle noise texture */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 clamp(24px, 5vw, 48px);
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.15;
}

h2 { font-size: clamp(2rem, 4vw, 3.2rem); margin-bottom: 0.5em; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }

.section-label {
    display: block;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.section-title {
    margin-bottom: 3rem;
}

/* --- Navigation --- */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: background 0.4s, box-shadow 0.4s, backdrop-filter 0.4s;
}

#navbar.scrolled {
    background: rgba(245, 240, 235, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 var(--border);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 clamp(24px, 5vw, 48px);
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 0.05em;
    transition: opacity 0.3s;
}
.nav-logo:hover { opacity: 0.6; }

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.3s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--text);
    transition: width 0.3s var(--ease-out);
}

.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 1.5px;
    background: var(--text);
    transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle.open span:first-child { transform: translateY(3.75px) rotate(45deg); }
.nav-toggle.open span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

/* --- Hero --- */
#hero {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 120px clamp(24px, 5vw, 48px) 0;
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
}

.hero-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-line {
    width: 0;
    height: 1px;
    background: var(--border-dark);
    margin-bottom: 2rem;
    animation: lineGrow 0.8s var(--ease-out) forwards;
}

@keyframes lineGrow {
    to { width: 100%; }
}

.hero-name {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.hero-name-line {
    font-size: clamp(4rem, 14vw, 10rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
}

.hero-name-italic {
    font-style: italic;
    padding-left: clamp(1rem, 5vw, 4rem);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.hero-disciplines {
    font-family: var(--font-body);
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    font-weight: 400;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-bottom: 2.5rem;
}

.hero-disciplines .dot {
    opacity: 0.4;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    transition: gap 0.3s var(--ease-out);
}

.hero-cta:hover { gap: 0.75rem; }

.hero-cta svg {
    animation: bounceDown 2s var(--ease-in-out) infinite;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

/* Hero entrance animations */
.hero-anim {
    opacity: 0;
    transform: translateY(30px);
    animation: heroReveal 0.7s var(--ease-out) forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes heroReveal {
    to { opacity: 1; transform: translateY(0); }
}

/* Marquee */
.hero-marquee {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    border-top: 1px solid var(--border);
    padding: 14px 0;
}

.marquee-track {
    display: flex;
    gap: 3rem;
    width: max-content;
    animation: marqueeScroll 25s linear infinite;
}

.marquee-track span {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--border-dark);
    white-space: nowrap;
}

@keyframes marqueeScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* --- About --- */
#about {
    padding: var(--section-gap) 0;
}

.about-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
    margin: 2.5rem 0 4rem;
}

.about-photo {
    position: relative;
    overflow: hidden;
}

.about-photo img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    filter: grayscale(20%);
    transition: filter 0.5s;
}

.about-photo:hover img { filter: grayscale(0%); }

.about-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid var(--border);
    pointer-events: none;
}

.about-text h2 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    margin-bottom: 1.25rem;
    max-width: 500px;
}

.about-text p {
    color: var(--text-muted);
    max-width: 520px;
    margin-bottom: 1rem;
}

/* Discipline Cards */
.disciplines-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}

.discipline-card {
    background: var(--bg);
    padding: clamp(1.5rem, 3vw, 2rem);
    transition: background 0.4s;
}

.discipline-card:hover {
    background: var(--bg-card);
}

.discipline-number {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--border-dark);
    margin-bottom: 0.75rem;
    line-height: 1;
}

.discipline-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.discipline-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- Portfolio --- */
#portfolio {
    padding: var(--section-gap) 0;
    background: var(--bg-card);
}

.portfolio-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
}

.filter-btn {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    color: var(--text-muted);
    transition: color 0.3s;
    position: relative;
}

.filter-btn::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--text);
    transform: scaleX(0);
    transition: transform 0.3s var(--ease-out);
}

.filter-btn:hover { color: var(--text); }
.filter-btn.active { color: var(--text); }
.filter-btn.active::after { transform: scaleX(1); }

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.portfolio-item {
    cursor: pointer;
    transition: opacity 0.4s, transform 0.4s var(--ease-out);
}

.portfolio-item.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.portfolio-thumb {
    aspect-ratio: 4/3;
    overflow: hidden;
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
}

.portfolio-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-out);
}

.portfolio-item:hover .portfolio-thumb img {
    transform: scale(1.05);
}

/* Text-only portfolio thumbnails (for web projects) */
.portfolio-thumb--text {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg, #1a1a2e);
    border: none;
}

.portfolio-thumb-url {
    font-family: 'Courier New', monospace;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.05em;
}

.portfolio-thumb--text::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 14px 0 0 rgba(255, 255, 255, 0.15), 28px 0 0 rgba(255, 255, 255, 0.15);
}

/* Play button overlay for video items */
.portfolio-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.portfolio-item:hover .portfolio-play-btn {
    opacity: 1;
}

.portfolio-info {
    padding: 1rem 0;
}

.portfolio-info h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.portfolio-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

/* --- Services --- */
#services {
    padding: var(--section-gap) 0;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}

.service-card {
    background: var(--bg);
    padding: clamp(2rem, 4vw, 3rem);
    transition: background 0.4s;
}

.service-card:hover { background: var(--bg-card); }

.service-number {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 3rem;
    color: var(--border-dark);
    line-height: 1;
    display: block;
    margin-bottom: 1rem;
}

.service-card h3 {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-bottom: 0.75rem;
}

.service-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 380px;
}

/* --- Resume --- */
#resume {
    padding: var(--section-gap) 0;
    background: var(--bg-card);
}

.resume-block {
    margin-bottom: 3.5rem;
}

.resume-block:last-child { margin-bottom: 0; }

.resume-block-title {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.resume-entries {
    display: flex;
    flex-direction: column;
}

.resume-entry {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 2rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.resume-entry:last-child { border-bottom: none; }

.resume-year {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-top: 0.15rem;
    white-space: nowrap;
}

.resume-details h4 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.resume-org {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    display: block;
    margin-bottom: 0.35rem;
}

.resume-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- Contact --- */
#contact {
    padding: var(--section-gap) 0;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(3rem, 6vw, 5rem);
    align-items: start;
    margin-top: 2rem;
}

.contact-lead {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: 2rem;
}

.contact-details {
    margin-bottom: 2rem;
}

.contact-email {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    margin-bottom: 0.35rem;
    transition: color 0.3s;
}

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

.contact-location {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.contact-social {
    display: flex;
    gap: 1.25rem;
}

.contact-social a {
    color: var(--text-muted);
    transition: color 0.3s, transform 0.3s;
}

.contact-social a:hover {
    color: var(--text);
    transform: translateY(-2px);
}

/* Contact Form */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.form-group {
    position: relative;
}

.form-group input,
.form-group textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 1rem 0 0.75rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    outline: none;
    transition: border-color 0.3s;
    resize: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--text);
}

.form-group label {
    position: absolute;
    left: 0;
    top: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.3s var(--ease-out);
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group textarea:focus + label,
.form-group textarea:not(:placeholder-shown) + label {
    top: -0.25rem;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.form-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    align-self: flex-start;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bg-card);
    background: var(--text);
    padding: 1rem 2rem;
    transition: background 0.3s, gap 0.3s;
}

.form-submit:hover {
    background: var(--accent);
    gap: 0.75rem;
}

/* --- Footer --- */
#footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-copy, .footer-tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-tagline { font-style: italic; }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 23, 20, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
    padding: 2rem;
}

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

.modal {
    background: var(--bg-card);
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s var(--ease-out);
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.75rem;
    color: var(--text-muted);
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 50%;
    transition: color 0.3s;
}

.modal-close:hover { color: var(--text); }

.modal-image {
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--bg);
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg);
}

.modal-image .modal-text-card {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
}

.modal-body {
    padding: 2rem;
}

.modal-body h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.modal-tags span {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--accent);
}

.modal-body p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text);
    padding-bottom: 2px;
    border-bottom: 1px solid var(--text);
    transition: color 0.3s, border-color 0.3s, gap 0.3s;
}

.modal-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    gap: 0.75rem;
}

/* --- Scroll Reveal --- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.disciplines-grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.disciplines-grid .reveal:nth-child(3) { transition-delay: 0.2s; }
.disciplines-grid .reveal:nth-child(4) { transition-delay: 0.3s; }

.services-grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.services-grid .reveal:nth-child(3) { transition-delay: 0.2s; }
.services-grid .reveal:nth-child(4) { transition-delay: 0.3s; }

/* --- Responsive --- */
@media (max-width: 1024px) {
    .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
    .disciplines-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        background: var(--bg);
        flex-direction: column;
        padding: 100px 2rem 2rem;
        gap: 1.5rem;
        transform: translateX(100%);
        transition: transform 0.4s var(--ease-out);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
    }

    .nav-links.open { transform: translateX(0); }

    .nav-links a {
        font-size: 1rem;
    }

    .nav-toggle { display: flex; }

    .hero-name-italic { padding-left: 0.5rem; }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .about-photo {
        max-width: 240px;
    }

    .disciplines-grid { grid-template-columns: 1fr; }
    .services-grid { grid-template-columns: 1fr; }
    .contact-grid { grid-template-columns: 1fr; }

    .resume-entry {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .portfolio-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }

    .footer-inner {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .portfolio-grid { grid-template-columns: 1fr; }

    .portfolio-filters {
        gap: 0;
    }

    .filter-btn {
        padding: 0.6rem 0.75rem;
        font-size: 0.75rem;
    }

    .hero-marquee { display: none; }
}

/* --- Selection color --- */
::selection {
    background: var(--accent);
    color: var(--bg-card);
}

/* --- Scrollbar (webkit) --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
