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

input, textarea, button {
    font-family: inherit;
}

:root {
    --white: #ffffff;
    --off-white: #edf2ef;
    --black: #000000;
    --primary: #326273;
    --font-small: clamp(14px, 1vw + 9px, 16px);
    --font-medium: clamp(18px, 1.5vw + 12px, 24px);
    --font-large: clamp(20px, 1.8vw + 12px, 26px);
    --font: 'Libre Baskerville', Georgia, serif;
    --page-padding: clamp(15px, 4vw, 40px);
}

html, body {
    font-family: var(--font);
    background-color: var(--off-white);
    color: var(--black);
}

/* ===== NAVBAR ===== */
.navbar-wrapper {
    position: relative;
    margin: 15px var(--page-padding) 0;
}

.navbar {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 2px solid var(--primary);
}

.navbar-logo {
    font-size: var(--font-large);
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.navbar-menu {
    display: flex;
    gap: clamp(20px, 3vw, 35px);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.navbar-menu .nav-link {
    font-size: var(--font-small);
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.navbar-menu .nav-link:hover {
    opacity: 0.7;
}

.navbar-menu .nav-link.active {
    opacity: 0.7;
}

.navbar-social {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.navbar-social-label {
    font-size: 11px;
    color: var(--primary);
    opacity: 0.7;
    white-space: nowrap;
}

.navbar-social-icons {
    display: flex;
    gap: 10px;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    transition: opacity 0.2s;
}

.social-icon.linkedin {
    color: #0A66C2;
}

.social-icon.facebook {
    color: #1877F2;
}

.social-icon svg {
    width: 100%;
    height: 100%;
}

.social-icon:hover {
    opacity: 0.6;
}

.burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin-left: auto;
}

.burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary);
    margin: 5px 0;
}

/* ===== SECTION DIVIDER ===== */
.section-divider {
    border: none;
    border-top: 2px solid var(--primary);
    margin: 0 var(--page-padding);
}

/* ===== SECTIONS ===== */
.section {
    padding: clamp(25px, 5vw, 50px) var(--page-padding);
}

body.subpage-mode {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.subpage-mode .navbar-wrapper {
    flex-shrink: 0;
}

.subpage {
    display: none;
    flex-direction: column;
}

.subpage.active {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.subpage.active ~ .site-footer {
    display: none;
}

.page-title {
    text-align: center;
    font-size: var(--font-large);
    font-weight: 700;
    margin-bottom: 12px;
}

.page-subtitle {
    text-align: center;
    font-size: var(--font-small);
    opacity: 0.7;
    margin-bottom: clamp(25px, 5vw, 50px);
}

/* ===== PROJECTS GRID ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(12px, 2vw, 20px);
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

.project-card {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    background-color: var(--primary);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.project-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.project-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: transparent;
    transition: background 0.3s;
}

.project-name {
    color: var(--white);
    font-size: var(--font-small);
    font-weight: 700;
    text-align: center;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.project-short-desc {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    color: var(--white);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s 0.05s, transform 0.25s 0.05s;
}

.project-card:hover img {
    opacity: 0.6;
}

.project-card:hover .project-overlay {
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.project-card:hover .project-short-desc {
    opacity: 1;
    transform: translateY(0);
}

/* ===== KONTAKT ===== */
.kontakt-wrapper {
    display: flex;
    gap: clamp(30px, 5vw, 60px);
    max-width: 960px;
    margin: 0 auto;
    align-items: flex-start;
    flex: 1;
    min-height: 0;
}

.kontakt-form-container {
    flex: 1;
    max-width: 500px;
}

#contact-form {
    border: 2px solid var(--primary);
    border-radius: 4px;
    overflow: hidden;
}

.form-top-row {
    display: flex;
}

.form-top-row .form-field {
    border: none;
    border-bottom: 1px solid var(--primary);
    padding: clamp(12px, 1.5vw, 16px);
    font-size: var(--font-small);
    line-height: normal;
    background: var(--white);
    outline: none;
    min-width: 0;
}

.form-top-row .form-field:first-child {
    flex: 0 0 35%;
    border-right: 1px solid var(--primary);
}

.form-top-row .form-field:last-child {
    flex: 1;
}

.form-message {
    display: block;
    width: 100%;
    min-height: 200px;
    max-height: 350px;
    border: none;
    padding: clamp(12px, 1.5vw, 16px);
    font-size: var(--font-small);
    line-height: normal;
    background: var(--white);
    outline: none;
    resize: none;
    overflow-y: auto;
}

.resize-handle {
    height: 14px;
    background: var(--white);
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resize-handle::before {
    content: '';
    width: 30px;
    height: 6px;
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
}

.form-bottom {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.send-btn {
    font-size: var(--font-small);
    padding: 12px 40px;
    background: var(--white);
    color: var(--black);
    border: 2px solid var(--primary);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.send-btn:hover {
    background: var(--primary);
    color: var(--white);
}

.form-status {
    font-size: var(--font-small);
    opacity: 0;
    transition: opacity 0.3s;
}

.form-status.show { opacity: 1; }
.form-status.success { color: #2e7d32; }
.form-status.error { color: #c62828; }

.kontakt-info-title {
    font-size: var(--font-medium);
    font-weight: 700;
    margin-bottom: 15px;
}

.kontakt-info {
    padding-top: 0;
}

.kontakt-info p {
    font-size: var(--font-small);
    margin-bottom: 0;
    line-height: 1.6;
}

.kontakt-info-divider {
    border: none;
    border-top: 1px solid var(--primary);
    opacity: 0.3;
    margin: 10px 0;
}

/* ===== FOOTER ===== */
.site-footer {
    margin-top: 0;
}

.site-footer .section-divider {
    margin-bottom: 0;
}

.footer-content {
    padding: clamp(20px, 4vw, 35px) var(--page-padding);
    text-align: center;
}

.footer-contact {
    font-size: var(--font-small);
    color: var(--primary);
    margin-bottom: 8px;
}

.footer-copy {
    font-size: 13px;
    opacity: 0.5;
}

/* ===== OM MIG ===== */
.om-mig-wrapper {
    display: flex;
    gap: clamp(30px, 5vw, 60px);
    max-width: 960px;
    margin: 0 auto;
    align-items: center;
}

.om-mig-photo-container {
    flex-shrink: 0;
    width: clamp(160px, 22vw, 260px);
    aspect-ratio: 3 / 4;
    border: 2px solid var(--primary);
    border-radius: 4px;
    overflow: hidden;
    background: var(--white);
    margin-left: clamp(-10px, -2vw, 0px);
}

.om-mig-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.om-mig-text {
    flex: 1;
    min-width: 0;
}

.om-mig-text p {
    font-size: var(--font-small);
    line-height: 1.7;
    margin-bottom: clamp(10px, 1.5vw, 14px);
}

.om-mig-text p:last-child {
    margin-bottom: 0;
}

/* ===== RESPONSIVE: Tablet (burger menu) ===== */
@media (max-width: 900px) {
    .navbar-menu {
        display: none;
        position: fixed;
        inset: 0;
        left: 0;
        transform: none;
        background: var(--off-white);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 30px;
        z-index: 100;
    }

    .navbar-menu.open {
        display: flex;
    }

    .navbar-menu .nav-link {
        font-size: var(--font-medium);
    }

    .burger {
        display: block;
        z-index: 101;
    }

    .navbar-social {
        display: none;
    }

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

    .kontakt-wrapper {
        flex-direction: column;
        gap: 30px;
        align-items: stretch;
    }

    .kontakt-form-container {
        max-width: 100%;
        width: 100%;
    }
}

/* ===== RESPONSIVE: Small tablet / large phone ===== */
@media (max-width: 650px) {
    .om-mig-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .om-mig-photo-container {
        width: clamp(140px, 40vw, 200px);
    }

    .om-mig-text {
        text-align: center;
    }
}

/* ===== RESPONSIVE: Phone ===== */
@media (max-width: 500px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .form-top-row {
        flex-direction: column;
    }

    .form-top-row .form-field:first-child {
        flex: auto;
        border-right: none;
        border-bottom: 1px solid var(--primary);
    }

    .form-bottom {
        justify-content: center;
    }

    .kontakt-info {
        text-align: center;
    }
}

/* ===== SUBPAGE COMPONENTS ===== */
.subpage-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex-shrink: 0;
    margin: 0 var(--page-padding);
    padding: 15px 0;
    border-bottom: 2px solid var(--primary);
}

.back-btn {
    font-family: var(--font);
    font-size: var(--font-small);
    color: var(--black);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    justify-self: start;
}

.back-btn:hover {
    opacity: 0.7;
}

.subpage-nav-title {
    font-size: var(--font-large);
    font-weight: 700;
    color: var(--black);
    white-space: nowrap;
    text-align: center;
}

.subpage-nav-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-self: end;
    justify-content: flex-end;
}

.tag {
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid var(--primary);
    border-radius: 2px;
    color: var(--primary);
    white-space: nowrap;
    opacity: 0.8;
}

.subpage-content {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: clamp(20px, 4vw, 40px);
    padding: clamp(18px, 2.5vw, 28px) var(--page-padding);
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    align-items: flex-start;
    overflow: hidden;
}

.subpage-left {
    flex: 1;
    min-width: 0;
}

.subpage-headline {
    font-size: var(--font-medium);
    font-weight: 700;
    margin-bottom: clamp(10px, 1.5vw, 14px);
    line-height: 1.3;
}

.subpage-desc {
    font-size: var(--font-small);
    line-height: 1.7;
    margin-bottom: clamp(7px, 1vw, 10px);
    opacity: 0.82;
}

.subpage-details {
    margin-top: clamp(12px, 1.8vw, 18px);
    padding-top: clamp(12px, 1.8vw, 16px);
    border-top: 1px solid rgba(50, 98, 115, 0.25);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-row {
    display: flex;
    gap: 10px;
    font-size: var(--font-small);
}

.detail-label {
    font-weight: 700;
    color: var(--primary);
    min-width: 105px;
    flex-shrink: 0;
}

.detail-value {
    opacity: 0.82;
}

.subpage-right {
    flex-shrink: 0;
    width: clamp(220px, 38%, 360px);
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.subpage-right img {
    flex: 1;
    width: 100%;
    min-height: 0;
    object-fit: cover;
    object-position: center top;
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid var(--primary);
    display: block;
}

/* ===== SUBPAGE RESPONSIVE ===== */
@media (max-width: 750px) {
    .subpage-nav {
        grid-template-columns: auto 1fr;
        row-gap: 8px;
    }

    .subpage-nav-title {
        text-align: right;
        font-size: var(--font-small);
    }

    .subpage-nav-tags {
        grid-column: 1 / -1;
        justify-self: start;
        justify-content: flex-start;
    }

    .subpage-content {
        flex-direction: column;
        overflow-y: auto;
    }

    .subpage-right {
        width: 100%;
        max-width: 100%;
        align-self: auto;
        height: 260px;
    }

    .subpage-right img {
        flex: none;
        height: 100%;
    }
}
