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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--p-font, Lato), sans-serif;
    background: var(--bg, #0a0a0a);
    color: var(--text, #e8e8e8);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

img,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height, 80px);
    padding: 0 2rem;
    box-sizing: border-box;
    background: linear-gradient(to bottom, rgba(10, 10, 10, 0.92), transparent);
}

.site-header__logo img {
    height: var(--logo-height, 56px);
    width: auto;
    max-height: calc(var(--header-height, 80px) - 20px);
    display: block;
}

.site-header__logo-text {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 1px;
    background: var(--text, #e8e8e8);
    transition: transform 0.3s, opacity 0.3s;
}

.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg, #0a0a0a);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s, visibility 0.35s;
}

.menu-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.menu-overlay__close {
    position: absolute;
    top: 1.25rem;
    right: 2rem;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

.menu-overlay__list {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: center;
}

.menu-overlay__list li {
    margin: 1.5rem 0;
}

.menu-overlay__list a {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: opacity 0.2s;
}

.menu-overlay__list a:hover {
    opacity: 0.6;
}

.showreel {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 100vh;
    background: #000;
}

.showreel video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.intro {
    max-width: 900px;
    margin: 4rem auto;
    padding: 0 2rem;
    text-align: center;
}

.intro__headline {
    font-family: var(--h-font, Montserrat), sans-serif;
    margin: 0 0 1rem;
    letter-spacing: 0.06em;
}

h2.intro__headline {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 400;
    text-transform: uppercase;
    color: var(--h1-color, var(--text, #e8e8e8));
}

.intro__subtitle {
    font-family: var(--p-font, Lato), sans-serif;
    font-size: 1.05rem;
    color: var(--text-muted, #999);
    margin: 0;
    line-height: 1.6;
}

.intro__subtitle p {
    margin: 0 0 0.65em;
}

.intro__subtitle p:last-child {
    margin-bottom: 0;
}

.cta-block__title {
    font-family: var(--h-font, Montserrat), sans-serif;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 400;
    margin: 0 0 0.5rem;
    letter-spacing: 0.04em;
    color: var(--h1-color, var(--text, #e8e8e8));
}

.cta-block__subtitle {
    color: var(--text-muted, #999);
    margin: 0 0 1.5rem;
    text-transform: lowercase;
}

.cta-block__about {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns, 3), 1fr);
    gap: var(--grid-gap, 2px);
    padding: 0 0 4rem;
}

.project-infinite-sentinel {
    width: 100%;
    height: 1px;
    margin: 0;
    padding: 0;
    visibility: hidden;
    pointer-events: none;
}

.project-infinite-status {
    text-align: center;
    color: var(--text-muted, #888);
    font-size: 0.85rem;
    padding: 0 1rem 3rem;
    min-height: 1.5rem;
}

@media (max-width: 900px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.project-card {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--surface, #141414);
}

.project-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card:hover .project-card__image {
    transform: scale(1.03);
}

.project-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.project-card__overlay--center {
    justify-content: center;
    align-items: center;
    text-align: center;
    background: rgba(0, 0, 0, 0.55);
}

.project-card:hover .project-card__overlay {
    opacity: 1;
}

.project-card__line {
    margin: 0;
    line-height: 1.2;
    max-width: 92%;
}

.project-card__line + .project-card__line {
    margin-top: 0.4rem;
}

.project-card__line--text {
    font-size: 0.85rem;
    font-family: var(--p-font, Lato), sans-serif;
    color: var(--text-muted, #aaa);
    font-weight: 400;
}

.project-card__title,
.project-card__line.project-card__title {
    font-weight: 500;
    margin: 0;
    line-height: 1.15;
}

.project-card__title--h1 {
    font-size: var(--h1-size, 2.5rem);
    font-family: var(--h-font, Montserrat), sans-serif;
    color: var(--h1-color, inherit);
}

.project-card__title--h2 {
    font-size: var(--h2-size, 1.75rem);
    font-family: var(--h-font, Montserrat), sans-serif;
    color: var(--h2-color, inherit);
}

.project-card__title--h3 {
    font-size: 1.25rem;
    font-family: var(--h-font, Montserrat), sans-serif;
}

.page-header {
    padding: calc(var(--header-height, 80px) + 4rem) 2rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.page-header h1 {
    font-family: var(--h-font, Montserrat), sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 400;
    margin: 0 0 0.5rem;
    letter-spacing: 0.02em;
}

.project-hero {
    width: 100%;
    max-height: var(--hero-max-height, min(70vh, 900px));
    overflow: hidden;
}

.project-hero img {
    width: 100%;
    height: var(--hero-max-height, min(70vh, 900px));
    object-fit: cover;
}

.project-detail {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem 5rem;
}

.project-detail__header {
    margin-bottom: 2rem;
}

.project-detail__title {
    margin: 0;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.project-detail__year {
    margin: 0.5rem 0 0;
    line-height: 1.2;
}

.project-detail__meta {
    display: flex;
    flex-direction: column;
    margin-bottom: 3rem;
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 2px;
    overflow: hidden;
    font-size: 0.92rem;
    color: var(--text-muted, #999);
}

.project-detail__meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border, #2a2a2a);
}

.project-detail__meta-row:last-child {
    border-bottom: none;
}

.project-detail__meta-cell {
    padding: 1rem 1.25rem;
    border-right: 1px solid var(--border, #2a2a2a);
    min-width: 0;
}

.project-detail__meta-cell:last-child {
    border-right: none;
}

.project-detail__meta-label,
.project-detail__section-label {
    display: block;
    letter-spacing: 0.1em;
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.project-detail__description,
.project-detail__tools-value {
    font-family: var(--p-font, Lato), sans-serif;
    font-size: var(--p-size, 1rem);
    line-height: var(--p-line-height, 1.7);
    color: var(--p-color, var(--text, #e8e8e8));
    margin: 0 0 2rem;
}

.project-detail__tools {
    margin-bottom: 2rem;
}

.project-detail__meta--bottom {
    margin-top: 2.5rem;
    margin-bottom: 0;
}

.project-detail__video {
    margin: 0 0 2.5rem;
}

.project-detail__video video {
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #000;
}

.project-detail__video--embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.project-detail__video--embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.project-detail__meta-value {
    color: var(--text, #e8e8e8);
    line-height: 1.45;
    word-wrap: break-word;
}

.project-detail__meta-value a {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.project-detail__meta-value a:hover {
    opacity: 0.75;
}

.project-detail__meta-placeholder {
    color: var(--text-muted, #666);
}

@media (max-width: 640px) {
    .project-detail__meta-row {
        grid-template-columns: 1fr;
    }

    .project-detail__meta-cell {
        border-right: none;
        border-bottom: 1px solid var(--border, #2a2a2a);
    }

    .project-detail__meta-row:last-child .project-detail__meta-cell:last-child {
        border-bottom: none;
    }
}

.project-detail--after-content {
    padding-top: 0;
}

/* WYSIWYG block: full viewport width, natural media height */
.project-wysiwyg {
    width: 100%;
    margin: 0 0 2.5rem;
    font-family: var(--p-font, Lato), sans-serif;
    font-size: var(--p-size, 1rem);
    line-height: var(--p-line-height, 1.7);
    color: var(--p-color, var(--text, #e8e8e8));
}

.project-wysiwyg__inner {
    width: 100%;
    max-width: none;
}

.project-wysiwyg__inner p,
.project-wysiwyg__inner li,
.project-wysiwyg__inner blockquote {
    margin: 0 0 1.25rem;
    padding-left: clamp(1rem, 4vw, 2.5rem);
    padding-right: clamp(1rem, 4vw, 2.5rem);
}

/* TinyMCE wraps each image in <p> — drop paragraph + image margins stacking */
.project-wysiwyg__inner p:empty,
.project-wysiwyg__inner p:has(> br:only-child) {
    display: none;
    margin: 0;
    padding: 0;
}

.project-wysiwyg__inner p:has(> img),
.project-wysiwyg__inner p:has(> video),
.project-wysiwyg__inner figure {
    margin: 0 0 0.35rem;
    padding: 0;
    line-height: 0;
}

.project-wysiwyg__inner > img,
.project-wysiwyg__inner > video,
.project-wysiwyg__inner > iframe,
.project-wysiwyg__inner p img,
.project-wysiwyg__inner p video,
.project-wysiwyg__inner figure img,
.project-wysiwyg__inner figure video,
.project-wysiwyg__inner td img,
.project-wysiwyg__inner td video {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin: 0;
    padding: 0;
    object-fit: contain;
    object-position: center;
    vertical-align: top;
}

.project-wysiwyg__inner > img,
.project-wysiwyg__inner > video {
    margin-bottom: 0.35rem;
}

.project-wysiwyg__inner iframe {
    aspect-ratio: 16 / 9;
    min-height: 0;
    border: 0;
    margin-bottom: 0.35rem;
}

.project-wysiwyg__inner table {
    width: 100%;
    max-width: 100%;
    margin: 0 0 0.35rem;
    border-collapse: collapse;
    border-spacing: 0;
}

.project-wysiwyg__inner td,
.project-wysiwyg__inner th {
    padding: 0.2rem;
    vertical-align: top;
    line-height: 0;
}

/* Generic page body (about, etc.) */
.project-detail__body {
    font-family: var(--p-font, Lato), sans-serif;
    font-size: var(--p-size, 1rem);
    line-height: var(--p-line-height, 1.7);
    color: var(--p-color, var(--text, #e8e8e8));
}

.project-detail__body img,
.project-detail__body video {
    display: block;
    max-width: 100%;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.cta-block {
    margin: 4rem 2rem;
    padding: 3rem;
    background: var(--surface, #141414);
    text-align: center;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.cta-block__contacts {
    margin: 1.5rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.cta-block__contacts--social {
    gap: 1rem;
}

.cta-block__icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--border, #333);
    border-radius: 50%;
    color: var(--link-color, var(--text, #e8e8e8));
    transition: opacity 0.2s, border-color 0.2s, transform 0.2s;
}

.cta-block__icon-link:hover {
    opacity: 0.85;
    border-color: var(--link-hover-color, var(--text-muted, #888));
    transform: translateY(-1px);
}

.cta-block__icon-link svg {
    display: block;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cta-block__contacts a:hover {
    opacity: 0.7;
}

.projects-carousel {
    margin: 3rem auto 2rem;
    padding: 0 2rem;
    max-width: 1200px;
}

.projects-carousel__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    margin-bottom: 1.25rem;
}

.projects-carousel__title {
    margin: 0;
    width: 100%;
    text-align: center;
    font-family: var(--h-font, Montserrat), sans-serif;
    font-size: var(--h2-size, 1.75rem);
    font-weight: 400;
    color: var(--h2-color, var(--h1-color, var(--text, #e8e8e8)));
}

.projects-carousel__nav {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.projects-carousel__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--border, #333);
    background: transparent;
    color: var(--text, #e8e8e8);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    transition: opacity 0.2s, background 0.2s, border-color 0.2s;
}

.projects-carousel__arrow:hover:not(:disabled) {
    border-color: var(--accent, #fff);
    background: rgba(255, 255, 255, 0.06);
}

.projects-carousel__arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

.projects-carousel--arrows-circle .projects-carousel__arrow {
    border-radius: 50%;
}

.projects-carousel--arrows-bold .projects-carousel__arrow {
    border-radius: 6px;
    background: var(--surface, #141414);
    border-color: var(--border, #333);
    font-weight: 700;
}

.projects-carousel--arrows-minimal .projects-carousel__arrow {
    border: none;
    background: none;
    font-size: 1.75rem;
    width: 2rem;
    height: 2rem;
}

.projects-carousel__viewport {
    overflow: hidden;
}

.projects-carousel__track {
    display: flex;
    gap: var(--carousel-gap, 12px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
}

.projects-carousel__track::-webkit-scrollbar {
    display: none;
}

.projects-carousel__slide {
    flex: 0 0 calc((100% - (var(--carousel-visible, 3) - 1) * var(--carousel-gap, 12px)) / var(--carousel-visible, 3));
    scroll-snap-align: start;
    min-width: 0;
}

.projects-carousel__slide .project-card {
    height: 100%;
}

.projects-carousel__slide .project-card__line--text {
    display: none;
}

@media (max-width: 900px) {
    .projects-carousel__slide {
        flex-basis: calc((100% - var(--carousel-gap, 12px)) / 2);
    }
}

@media (max-width: 560px) {
    .projects-carousel__slide {
        flex-basis: 85%;
    }
}

.content-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 8rem 2rem 5rem;
}

.content-page h2 {
    font-weight: 400;
    font-size: 1.5rem;
}

.admin-body {
    background: #111;
    min-height: 100vh;
}

.admin-nav {
    background: #1a1a1a;
    padding: 1rem 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid #333;
}

.admin-nav a {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.admin-nav a:hover {
    opacity: 1;
}

.admin-main {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 1.25rem 2rem 2rem;
    box-sizing: border-box;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid #333;
}

.admin-form label {
    display: block;
    margin: 1rem 0 0.35rem;
    font-size: 0.85rem;
    color: #aaa;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="email"],
.admin-form input[type="number"],
.admin-form input[type="url"],
.admin-form select,
.admin-form textarea {
    width: 100%;
    max-width: 600px;
    padding: 0.6rem 0.75rem;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #eee;
    font: inherit;
}

.admin-form textarea {
    min-height: 120px;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--accent, #fff);
    color: var(--bg, #0a0a0a);
    border: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1rem;
    text-decoration: none;
    line-height: 1.2;
    box-sizing: border-box;
    transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}

a.btn {
    text-align: center;
}

.btn--primary {
    background: #007bff;
    color: #fff;
}

.btn--primary:hover {
    background: #0069d9;
}

.btn--secondary {
    background: transparent;
    color: #eee;
    border: 1px solid #444;
}

.btn--secondary:hover {
    border-color: #666;
    background: rgba(255, 255, 255, 0.04);
}

.btn--compact {
    padding: 0.45rem 0.9rem;
    font-size: 0.78rem;
    margin-top: 0;
}

.admin-table__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.admin-inline-form {
    display: inline;
    margin: 0;
}

.admin-form--danger {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #333;
}

.flash {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: #1a3a1a;
    border: 1px solid #2a5a2a;
}

.flash--error {
    background: #3a1a1a;
    border-color: #5a2a2a;
}

.menu-sortable {
    list-style: none;
    padding: 0;
}

.menu-sortable li {
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #1a1a1a;
    border: 1px solid #333;
    cursor: grab;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.media-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
