:root {
  --bg: #f2f0eb;
  --surface: #fffdf8;
  --text: #171713;
  --muted: #77746c;
  --line: #c9c5bc;
  --accent: #ff593d;
  --private: #b72b33;
  --font: Arial, Helvetica, sans-serif;
}

html[data-theme="dark"] {
  --bg: #151513;
  --surface: #1d1d1a;
  --text: #f2efe8;
  --muted: #9f9b91;
  --line: #3d3c37;
  --accent: #ff755e;
  --private: #ff8088;
}

* { box-sizing: border-box; }
html { color-scheme: light; font-size: 16px; }
html[data-theme="dark"] { color-scheme: dark; }
body { margin: 0; color: var(--text); background: var(--bg); font: 400 14px/1.35 var(--font); }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, p, figure { margin: 0; }

.site-main { padding: 0 0 60px; }
.site-header { position: relative; display: grid; grid-template-columns: minmax(180px, .6fr) 1.4fr; gap: 24px; padding: 18px 18px 20px; border-bottom: 1px solid var(--line); }
.site-logo { width: min(190px, 24vw); margin: 0; }
.site-logo__image { width: 100%; height: auto; filter: invert(1); }
html[data-theme="dark"] .site-logo__image { filter: none; }
.porta-cat { align-self: end; }
.category-filter { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 14px; }
.category-filter a { color: var(--muted); font-size: 11px; text-decoration: none; }
.category-filter a:hover, .category-filter a.is-active { color: var(--text); }
.category-filter a.is-active::before { content: "● "; color: var(--accent); }
.back-link { display: flex; width: max-content; min-height: 34px; align-items: center; margin: 12px 0 0 auto; padding: 0 14px; border-radius: 999px; color: #fff; background: var(--accent); font-size: 11px; text-decoration: none; }
.back-link:hover { filter: brightness(.9); }
.theme-editorial .section-back { display: flex; width: max-content; margin: 0 0 50px auto; }

.portfolio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: dense; grid-auto-rows: 1px; gap: 0; padding: 0; align-items: start; }
.project-card { position: relative; display: block; min-width: 0; margin: 0; padding: 0; overflow: hidden; color: #fff; text-decoration: none; }
.project-card::after { content: ""; position: absolute; z-index: 1; inset: 35% 0 0; pointer-events: none; background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .72)); }
.project-card__media { margin: 0; padding: 0; overflow: hidden; background: var(--surface); }
.project-card__media img, .project-card__media video { display: block; width: 100%; height: auto; margin: 0; object-fit: contain; transition: transform .65s cubic-bezier(.2,.7,.2,1), filter .3s ease; }
.project-card:hover .project-card__media img, .project-card:hover .project-card__media video { transform: scale(1.015); }
.project-card__title { position: absolute; z-index: 2; right: 16px; bottom: 34px; left: 16px; padding: 0; color: #fff; font-size: clamp(18px, 1.8vw, 30px); font-weight: 400; line-height: 1; letter-spacing: -.045em; text-shadow: 0 1px 15px rgba(0, 0, 0, .42); }
.project-card__meta { position: absolute; z-index: 2; right: 16px; bottom: 15px; left: 16px; padding: 0; color: rgba(255, 255, 255, .8); font-size: 11px; text-shadow: 0 1px 9px rgba(0, 0, 0, .5); }
.project-card__private-label { color: inherit; font-size: 11px; }

.floating-menu { position: fixed; z-index: 99990; top: 16px; right: 16px; display: flex; gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(16px); }
.floating-menu__link { appearance: none; padding: 8px 11px; border: 0; border-radius: 999px; color: var(--text); background: transparent; font: 700 10px/1 var(--font); text-decoration: none; cursor: pointer; }
.floating-menu__link:hover { color: var(--surface); background: var(--text); }

.project-layout { display: grid; grid-template-columns: minmax(260px, 32vw) minmax(0, 1fr); gap: 0; padding: 0; }
.project-info { position: sticky; top: 0; min-height: 100vh; padding: 18px 32px 48px 18px; border-right: 1px solid var(--line); }
.project-info .site-logo { margin-bottom: 42px; }
.project-info .back-link { margin: 0 0 28px auto; }
.project-header h1 { max-width: 620px; font-size: clamp(36px, 5vw, 76px); font-weight: 400; line-height: .9; letter-spacing: -.065em; }
.project-text { margin: 40px 0; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: clamp(16px, 1.4vw, 23px); line-height: 1.18; }
.project-meta { color: var(--muted); font-size: 11px; }
.external-link { display: inline-flex; margin-top: 32px; padding: 10px 15px; border: 1px solid var(--text); border-radius: 999px; font-size: 11px; text-decoration: none; }
.external-link:hover { color: var(--bg); background: var(--text); }
.project-gallery { display: grid; gap: 0; }
.project-gallery img, .project-gallery video, .project-youtube { width: 100%; background: var(--surface); }
.project-youtube { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.project-youtube iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.private-access { min-height: 100vh; padding: 18px; }
.private-access__box { width: min(540px, 100%); margin-top: 16vh; }
.private-access__label, .private-access__error { color: var(--private); font-size: 11px; }
.private-access__title { margin: 8px 0 30px; font-size: clamp(42px, 7vw, 90px); line-height: .9; letter-spacing: -.06em; }
.private-access__form { display: grid; gap: 12px; }
.private-access__field { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.private-access__field input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); color: var(--text); background: var(--surface); font: inherit; }
.private-access__button { justify-self: start; min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; color: var(--bg); background: var(--text); font: 700 11px/1 var(--font); cursor: pointer; }

.reveal-auto { opacity: 0; transform: translateY(18px); transition: opacity .7s ease var(--reveal-delay, 0ms), transform .7s cubic-bezier(.2,.7,.2,1) var(--reveal-delay, 0ms); }
.reveal-auto.is-visible { opacity: 1; transform: none; }
.site-loader { position: fixed; z-index: 2147483645; inset: 0; display: grid; place-items: center; color: var(--text); background: var(--bg); transition: opacity .5s ease, visibility .5s ease; }
.site-loader__label { display: grid; place-items: center; width: min(220px, 40vw); }
.site-loader__logo, .site-transition__logo { display: block; width: 100%; height: auto; filter: invert(1); }
html[data-theme="dark"] .site-loader__logo, html[data-theme="dark"] .site-transition__logo { filter: none; }
.site-loader__bar { position: absolute; right: 18px; bottom: 18px; left: 18px; height: 8px; background: var(--line); }
.site-loader__bar::after { content: ""; display: block; width: calc(var(--loader-progress, 0) * 100%); height: 100%; background: var(--accent); transition: width .2s ease; }
.site-loaded .site-loader { visibility: hidden; opacity: 0; }
.site-transition { position: fixed; z-index: 2147483644; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; background: var(--accent); transition: opacity .36s ease; }
.site-transition__logo { width: min(220px, 40vw); transform: scale(.96); transition: transform .36s ease; }
.site-is-leaving .site-transition { opacity: 1; }
.site-is-leaving .site-transition__logo { transform: scale(1); }

@media (hover: hover) and (pointer: fine) {
  html.cursor-custom-on, html.cursor-custom-on * { cursor: none !important; }
  .custom-cursor { position: fixed; z-index: 2147483646; top: 0; left: 0; display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; color: #fff; background: var(--accent); pointer-events: none; opacity: 0; transition: opacity .12s ease, width .12s ease, height .12s ease; }
  html.cursor-custom-on .custom-cursor { opacity: 1; }
  .custom-cursor.is-small { width: 22px; height: 22px; font-size: 0; }
}

@media (max-width: 760px) {
  .site-main { padding: 0 0 40px; }
  .site-header { display: block; padding: 12px 12px 14px; }
  .porta-cat { margin-top: 18px; }
  .category-filter { justify-content: flex-start; padding-right: 80px; }
  .portfolio-grid { grid-template-columns: 1fr; gap: 0; padding: 0; }
  .project-card:nth-child(n) { padding-top: 0; }
  .project-layout { display: block; padding: 0; }
  .project-info { position: static; min-height: auto; margin: 0; padding: 12px 12px 28px; border: 0; border-bottom: 1px solid var(--line); }
  .project-header h1 { font-size: clamp(42px, 14vw, 72px); }
  .floating-menu { top: 8px; right: 8px; }
  .floating-menu__link[href*="#"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
  .reveal-auto { opacity: 1; transform: none; }
}
