@font-face {
  font-family: Manrope;
  src: url('./assets/manrope.woff2') format('woff2');
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page-gutter: 24px;
  --preview-inset: clamp(18px, 2.7vw, 52px);
  --card-inset: max(40px, var(--preview-inset));
  font-family: Manrope, Arial, sans-serif;
  color: #eeeeec;
  background: #101010;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, iframe:focus-visible { outline: 2px solid #bfbfbc; outline-offset: 5px; }

.site-header {
  padding: 72px var(--page-gutter) 0;
  display: grid;
  justify-items: center;
}
.wordmark { flex-shrink: 0; font-size: 24px; font-weight: 750; line-height: 1.25; letter-spacing: -.05em; }
.wordmark > span:not(.swap-letter) { font-weight: 450; color: #c0c0bd; }

.intro { text-align: center; padding: 42px 24px 72px; }
h1 {
  overflow-wrap: break-word;
  margin: 0;
  color: #fff;
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 60px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.05em;
}
.heading-line { display: block; }
.heading-piece { display: inline-block; white-space: nowrap; }
.heading-letter { display: inline-block; }
.socials { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 8px 16px; font-size: 20px; line-height: 1.5; }
.socials > span { color: #a3a39f; }
.socials a { color: #b4b4b0; }
:is(.site-header, .socials) a { white-space: nowrap; }
:is(.site-header, .socials) a:is(:hover, :focus-visible, .is-swapping) { color: #fff; }
.wordmark:is(:hover, :focus-visible, .is-swapping) > span:not(.swap-letter) { color: inherit; }
.swap-letter { position: relative; display: inline-block; pointer-events: none; }
.swap-front { display: block; }
.swap-back { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .heading-playing:not(.heading-complete) .heading-letter {
    animation: heading-reveal 500ms linear both;
    animation-delay: calc(var(--step, 0) * 40ms);
  }
  .heading-playing .intro-subtitle {
    opacity: 0;
    transition: opacity 240ms ease-out;
  }
  .heading-playing.heading-complete .intro-subtitle { opacity: 1; }
  @keyframes heading-reveal {
    0% { opacity: 0; transform: translateY(-40px); }
    20% { opacity: 0; transform: translateY(-44.5px); }
    32% { opacity: 0; transform: translateY(-38px); }
    40% { opacity: 0; transform: translateY(-24px); }
    53% { opacity: 0; transform: translateY(5px); }
    60% { opacity: 0; transform: translateY(5.3px); }
    71% { opacity: .17; transform: translateY(5.5px); }
    80% { opacity: .48; transform: translateY(5px); }
    90% { opacity: .78; transform: translateY(3px); }
    100% { opacity: 1; transform: none; }
  }
  :is(.site-header, .socials) a { perspective: 16.67em; }
  .wordmark > span:not(.swap-letter), .swap-letter {
    transform-style: preserve-3d;
  }
  .swap-letter { transform: translateZ(-.5lh); }
  .swap-front, .swap-back { backface-visibility: hidden; }
  .swap-front { transform: translateZ(.5lh); }
  .swap-back {
    display: block;
    position: absolute;
    inset: 0;
    transform: rotateX(-90deg) translateZ(.5lh);
    opacity: 0;
    pointer-events: none;
  }
  .is-swapping :is(.swap-letter, .swap-front, .swap-back) {
    animation: var(--swap-animation) 600ms linear both;
    animation-delay: calc(var(--step) * 30ms);
  }
  .swap-letter { --swap-animation: swap-turn; }
  .swap-front { --swap-animation: swap-front-out; }
  .swap-back { --swap-animation: swap-back-in; }
  @keyframes swap-turn {
    from { transform: translateZ(-.5lh) rotateX(0deg); }
    30% { transform: translateZ(-.5lh) rotateX(62deg); }
    56% { transform: translateZ(-.5lh) rotateX(88deg); }
    73% { transform: translateZ(-.5lh) rotateX(90deg); }
    to { transform: translateZ(-.5lh) rotateX(90deg); }
  }
  @keyframes swap-front-out {
    0% { opacity: 1; filter: blur(0); }
    26% { opacity: .44; filter: blur(.04em); }
    60%, 100% { opacity: 0; filter: blur(.067em); }
  }
  @keyframes swap-back-in {
    0%, 10% { opacity: 0; filter: blur(.067em); }
    32% { opacity: .62; filter: blur(.03em); }
    64%, 100% { opacity: 1; filter: blur(0); }
  }
}

.intro-subtitle { margin: 16px 0 0; font-size: 20px; line-height: 1.6; text-wrap: balance; color: #8e8e8a; }

.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 var(--page-gutter); }
.project-card { min-width: 0; container-type: inline-size; }
:is([aria-labelledby="title-yuzhny-sever"], .viewer[aria-owns="preview-yuzhny-sever"]) { --glow: 38 110 116; --glow-secondary: 211 193 166; --preview-background: #e4d9ce; --preview-poster: url('./assets/yuzhny-sever-preview.9ce2e33d0a.webp'); }
:is([aria-labelledby="title-selle"], .viewer[aria-owns="preview-selle"]) { --glow: 143 68 80; --glow-secondary: 223 205 182; --preview-background: #000; --preview-poster: url('./assets/selle-preview.c29ccb53d9.webp'); }
:is([aria-labelledby="title-piano"], .viewer[aria-owns="preview-piano"]) { --glow: 89 139 207; --glow-secondary: 192 179 166; --preview-background: #000d10; --preview-poster: url('./assets/piano-preview.abd5e0b853.webp'); }
:is([aria-labelledby="title-spiderman"], .viewer[aria-owns="preview-spiderman"]) { --glow: 255 0 51; --glow-secondary: 162 166 171; --preview-background: #000101; --preview-poster: url('./assets/nit-preview.87d680028e.webp'); }
:is([aria-labelledby="title-dracula"], .viewer[aria-owns="preview-dracula"]) { --glow: 221 179 107; --glow-secondary: 84 69 51; --preview-background: #100e0d; --preview-poster: url('./assets/temno-preview.webp'); }
:is([aria-labelledby="title-wash"], .viewer[aria-owns="preview-wash"]) { --glow: 200 172 142; --glow-secondary: 114 138 149; --preview-poster: url('./assets/wash-preview.361b19e6bc.webp'); }
.stage {
  position: relative;
  display: grid;
  grid-template-columns: var(--card-inset) minmax(0, 1fr) var(--card-inset);
  grid-template-rows: auto auto;
  background: #1c1c1c;
  padding: var(--card-inset) 0 0;
  border-radius: 12px;
  overflow: hidden;
}
:is(.stage, .viewer)::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 28% 82%, rgb(var(--glow) / .34), transparent 73%),
    radial-gradient(ellipse at 82% 10%, rgb(var(--glow-secondary) / .23), transparent 67%);
  opacity: 1;
  transition: opacity .4s ease-out;
}
.viewport-slot { grid-column: 2; aspect-ratio: 16 / 9; }
.viewport { position: relative; width: 100%; height: 100%; overflow: clip; border-radius: 4px; background: var(--preview-background, #161616); }
.viewport:has(iframe:not(.is-loaded)) {
  background: var(--preview-poster) center / contain no-repeat var(--preview-background, #161616);
}
iframe { display: block; border: 0; background: var(--preview-background, #161616); }
iframe:not(.is-loaded) { visibility: hidden; }
.viewport iframe { width: 1440px; height: 810px; transform: scale(var(--frame-scale, .4)); transform-origin: top left; }
:is([aria-labelledby="title-wash"], [aria-labelledby="title-yuzhny-sever"]) .viewport iframe { width: 1920px; height: 1080px; }
.caption { position: relative; min-width: 0; grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 16px; min-height: var(--card-inset); padding: 2px 6px 6px; }
.project-info { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.project-info h2 { margin: 0; color: rgb(255 255 255 / 85%); font-size: 16px; font-weight: 500; line-height: 1.5; }
.project-info p { margin: 0; color: rgb(255 255 255 / 65%); font-size: 15px; line-height: 1.5; }
:is([aria-labelledby="title-piano"], [aria-labelledby="title-yuzhny-sever"]) .project-info p { white-space: normal; text-wrap: pretty; }
.actions { display: flex; align-items: center; flex-shrink: 0; gap: 2px; }
.actions .icon-button { width: 32px; height: 32px; }
@container (330px < width <= 344px) {
  .actions .icon-button { width: 28px; }
}
@container (max-width: 330px) {
  .caption { gap: 8px; padding-inline: 4px; }
  .actions { gap: 0; }
  .actions .icon-button { width: 24px; }
}
@media (width > 960px) and (hover: hover) and (pointer: fine) {
  .stage::before { opacity: 0; }
  .project-card:is(:hover, :focus-within) .stage::before { opacity: 1; }
  .project-info, .actions { opacity: 0; transition: opacity .16s ease-out; }
  .project-card:is(:hover, :focus-within) :is(.project-info, .actions) { opacity: 1; }
}
.icon-button { width: 44px; height: 44px; padding: 0; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: rgb(255 255 255 / 50%); transition: color .18s; line-height: 1; }
.icon-button:is(:hover, :focus-visible) { color: #fff; }
.icon-library { position: absolute; pointer-events: none; }
.action-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.site-footer { display: grid; justify-items: center; gap: 16px; text-align: center; padding: 92px var(--page-gutter); font-size: 15px; line-height: 1.5; }
.copyright { margin: 0; color: rgb(192 192 189 / 50%); }
.skip-link { position: fixed; top: 12px; left: 12px; padding: 12px 18px; background: #eee; color: #111; z-index: 100; transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }


@media (min-width: 1800px) { :root { --page-gutter: 32px; } .intro { padding-bottom: 93px; } }
@media (max-width: 960px) {
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .actions .expand { display: none; }
}
@media (width < 960px) {
  .gallery { gap: 2px; padding-inline: 0; background: #000; }
  .stage { border-radius: 0; }
}
@media (max-width: 760px) {
  :root { --page-gutter: 12px; --preview-inset: 20px; }
  .site-header { padding-top: 62px; }
  h1 { font-size: 36px; }
  .intro { padding: 42px 18px 48px; }
  .intro-subtitle { margin-top: 12px; }
  .site-footer { padding-block: 84px; }
}
@media (max-width: 480px) {
  .socials { display: grid; grid-template-columns: repeat(3, max-content); justify-items: center; column-gap: 20px; }
  .socials > span { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

body.is-viewing {
  --viewer-inset: calc(2 * var(--card-inset));
  --viewer-art-width: min(
    calc(100vw - 2 * var(--viewer-inset)),
    calc((100dvh - 2 * var(--viewer-inset)) * 16 / 9)
  );
  --viewer-art-height: calc(var(--viewer-art-width) * 9 / 16);
  overflow: hidden;
}
.viewer { position: fixed; inset: 0; z-index: 50; background: #1c1c1c; }
.viewer-shell {
  display: grid;
  position: absolute;
  inset-inline: 0;
  top: 50%;
  translate: 0 -50%;
  height: calc(var(--viewer-art-height) + 2 * var(--viewer-inset));
  grid-template: var(--viewer-inset) minmax(0, 1fr) var(--viewer-inset) / minmax(0, 1fr) var(--viewer-art-width) minmax(0, 1fr);
  align-items: center;
  justify-items: center;
}
.project-card.is-viewing { container-type: normal; }
.project-card.is-viewing .viewport {
  position: fixed;
  z-index: 51;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: var(--viewer-art-width);
  height: var(--viewer-art-height);
}
.viewer-shell .icon-button:focus-visible { color: #fff; }
.viewer-close { grid-area: 1 / 3; }
.viewer-prev { grid-area: 2 / 1; }
.viewer-next { grid-area: 2 / 3; }
.viewer-caption { grid-area: 3 / 1 / 4 / -1; text-align: center; width: 100%; padding: 0 8px 4px; margin: 0; white-space: nowrap; overflow-x: auto; font-size: 15px; line-height: 1.5; color: #aaa; scrollbar-width: none; }
.viewer-caption span { margin-inline-start: 8px; }
.viewer-caption strong { color: #eee; font-weight: 600; }
.viewer-shell .viewer-close { width: 38px; height: 38px; }
.viewer-shell :is(.viewer-prev, .viewer-next) { width: 100%; height: 100%; }
.icon-button:focus-visible { outline: 2px solid #ddd; outline-offset: 2px; }
.actions .icon-button[data-pointer-return]:focus { outline: none; }
.viewer-shell :is(.viewer-prev, .viewer-next):focus-visible { outline-offset: -4px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .icon-button .action-icon { transition: transform .18s ease-out; }
  .viewer-prev:hover .action-icon { transform: translateX(-2px); }
  .viewer-next:hover .action-icon { transform: translateX(2px); }
  .viewer-close:hover .action-icon { transform: rotate(90deg); }
}
