/* ==========================================================================
   Portfolio — base styles: tokens, type scale, grid, motion.
   ========================================================================== */

/* ---------- Font ----------------------------------------------------------
   TeX Gyre Heros (free, GUST Font License — see fonts/GUST-FONT-LICENSE.txt),
   a free Helvetica-style grotesque. size-adjust 101.5% tunes its width.
   Heros has no Medium, so 500 uses Regular and is thickened in the
   "Medium emulation" block under the type scale. 700 uses Bold.
--------------------------------------------------------------------------- */
@font-face { font-family: "hn"; src: url("../fonts/texgyreheros-regular.woff2") format("woff2"), url("../fonts/texgyreheros-regular.otf") format("opentype"); font-weight: 300 500; font-style: normal; font-display: swap; size-adjust: 101.5%; }
@font-face { font-family: "hn"; src: url("../fonts/texgyreheros-bold.woff2") format("woff2"), url("../fonts/texgyreheros-bold.otf") format("opentype"); font-weight: 600 700; font-style: normal; font-display: swap; size-adjust: 101.5%; }
/* Used only while the font files load */
@font-face {
  font-family: "hn Fallback";
  src: local("Arial");
  ascent-override: 95.98%;
  descent-override: 21.11%;
  line-gap-override: 0%;
  size-adjust: 101.37%;
}

/* ---------- Tokens -------------------------------------------------------- */
:root {
  --neutral-950: #0d0d0d;
  --neutral-925: #111111;
  --neutral-900: #161615;
  --neutral-875: #1c1c1b;
  --neutral-850: #262626;
  --neutral-825: #222222;
  --neutral-750: #3a3a3a;
  --neutral-600: #636363;
  --neutral-500: #7c7c7c;
  --neutral-100: #e5e5e5;
  --neutral-50: #f2f2f0;

  --color-bg-page: var(--neutral-950);
  --color-bg-surface: var(--neutral-925);
  --color-bg-elevated: var(--neutral-900);
  --color-bg-placeholder: var(--neutral-875);
  --color-bg-placeholder-light: var(--neutral-50);
  --color-bg-control: var(--neutral-850);
  --color-bg-control-active: var(--neutral-750);
  --color-bg-popover: var(--neutral-825);
  --color-bg-inverse: var(--neutral-100);
  --color-text-primary: var(--neutral-100);
  --color-text-secondary: var(--neutral-500);
  --color-text-tertiary: var(--neutral-600);
  --color-text-inverse: var(--neutral-950);
  --color-border-default: var(--neutral-850);
  --color-border-strong: var(--neutral-100);

  --spacing-2xs: 4px;
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 48px;
  --spacing-2xl: 96px;
  --spacing-3xl: 140px;

  --layout-page-margin: 48px;
  --layout-grid-gap: 20px;

  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 14px;
  --radius-full: 999px;

  --font: "hn", "hn Fallback", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --header-h: 88px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (max-width: 900px) {
  :root { --layout-page-margin: 16px; --header-h: 64px; }
}

/* ---------- Reset / base -------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--color-bg-page); }
body {
  color: var(--color-text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 21px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { text-decoration: none; }
a, button { color: inherit; }
button { font: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
ul { list-style: none; }
.no-scroll { overflow: hidden; }
.u-underline { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link { transition: opacity .2s; }
.link:hover { opacity: .6; }

:focus-visible { outline: 1px solid var(--color-text-primary); outline-offset: 3px; border-radius: 2px; }

/* ---------- Type scale ---------------------------------------------------- */
.t-display-xl { font-size: 64px; line-height: 64px; letter-spacing: -2.2px; font-weight: 500; }
.t-display-l  { font-size: 60px; line-height: 60px; letter-spacing: -3px;   font-weight: 400; }
.t-h1         { font-size: 56px; line-height: 60px; letter-spacing: -2px;   font-weight: 400; }
.t-h2         { font-size: 34px; line-height: 38px; letter-spacing: -.8px;  font-weight: 400; }
.t-h3         { font-size: 25px; line-height: 28px; letter-spacing: -.5px;  font-weight: 400; }
.t-h4         { font-size: 26px; line-height: 30px; letter-spacing: -.6px;  font-weight: 500; }
.t-card       { font-size: 20px; line-height: 24px; letter-spacing: -.3px;  font-weight: 500; }
.t-body-l     { font-size: 20px; line-height: 26px; letter-spacing: -.2px; }
.t-body-m     { font-size: 16px; line-height: 21px; }
.t-body-s     { font-size: 15px; line-height: 19px; }
.t-body-xs    { font-size: 14px; line-height: 18px; }
.t-caption    { font-size: 13px; line-height: 17px; letter-spacing: .24px; }
.t-micro      { font-size: 11px; line-height: 14px; }
.c-2 { color: var(--color-text-secondary); }
.c-3 { color: var(--color-text-tertiary); }
@media (max-width: 900px) {
  .t-display-xl, .t-display-l, .t-h1 { font-size: 34px; line-height: 38px; letter-spacing: -.8px; }
}

/* ---------- Medium emulation ----------------------------------------------
   TeX Gyre Heros has no Medium (500), so Regular gets a hairline outline
   (0.02em) for the extra weight and +0.015em letter-spacing.
   Keep any new weight-500 style in this list.
--------------------------------------------------------------------------- */
.t-display-xl, .t-h4, .t-card, .intro p b {
  -webkit-text-stroke: .02em currentColor;
}
.t-display-xl { letter-spacing: calc(-2.2px + .015em); }
.t-h4 { letter-spacing: calc(-.6px + .015em); }
.t-card { letter-spacing: calc(-.3px + .015em); }
@media (max-width: 900px) {
  .t-display-xl { letter-spacing: calc(-.8px + .015em); }
}

/* ---------- Layout primitives -------------------------------------------- */
.wrap { padding-left: var(--layout-page-margin); padding-right: var(--layout-page-margin); }
.line-top { border-top: 1px solid var(--color-border-default); }

/* Media placeholder */
.ph {
  background: var(--color-bg-placeholder);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-tertiary);
  font-size: 13px;
  overflow: hidden;
  position: relative;
}
.ph--light { background: var(--color-bg-placeholder-light); color: var(--neutral-500); }
.ph img, .ph video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px 8px 14px;
  border-radius: var(--radius-full);
  font-size: 13px; line-height: 17px; letter-spacing: .1px;
  background: var(--color-bg-control);
  color: var(--color-text-primary);
  transition: background .2s;
}
.btn:hover, .btn[aria-expanded="true"] { background: var(--color-bg-control-active); }
.btn--primary { background: var(--color-bg-inverse); color: var(--color-text-inverse); font-size: 14px; }
.btn--primary:hover { background: #fff; }
.btn svg { flex: none; transition: transform .25s var(--ease); }
.btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
/* Contacts: plain text like the nav, no pill */
#contacts-btn, #contacts-btn:hover, #contacts-btn[aria-expanded="true"] { background: none; }
#contacts-btn { padding: 0; font-size: 16px; line-height: 21px; letter-spacing: normal; }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-bg-control);
  transition: background .2s;
}
.icon-btn:hover { background: var(--color-bg-control-active); }

/* ---------- Header -------------------------------------------------------- */
.header {
  position: relative; z-index: 30;
  height: var(--header-h);
  display: grid; grid-template-columns: 1fr 1fr; align-items: center;
}
.header__right { display: flex; align-items: center; justify-content: space-between; }
.header__nav a { transition: opacity .2s; }
.header__nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.header__nav a:not([aria-current="page"]) { opacity: .55; }
.header__nav a:not([aria-current="page"]):hover { opacity: 1; }

.header__lang {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto; margin-right: 16px;
  font-size: 13px; line-height: 17px;
}
.header__lang span { opacity: .4; }
.header__lang button { opacity: .55; padding: 4px 2px; transition: opacity .2s; }
.header__lang button:hover { opacity: 1; }
.header__lang button[aria-pressed="true"] { opacity: 1; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.header__contacts { position: relative; }
.header__menu-btn { display: none; }

@media (max-width: 900px) {
  .header { grid-template-columns: 1fr auto; }
  .header__nav, .header__contacts { display: none; }
  .header__menu-btn {
    display: inline-flex;
    padding: 10px 14px 10px 12px;
    font-size: 14px;
    background: var(--color-bg-placeholder);
  }
}

/* Contacts popover */
.popover {
  position: absolute; right: 0; top: calc(100% + 12px);
  width: 248px;
  background: var(--color-bg-popover);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 36px;
  transform-origin: top right;
  animation: pop .22s var(--ease);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.popover[hidden] { display: none; }
@keyframes pop { 0% { opacity: 0; transform: translateY(-6px) scale(.98); } }
.popover__group { display: flex; flex-direction: column; gap: 8px; }
.popover__links { display: flex; flex-direction: column; gap: 20px; }

/* Mobile menu */
.mmenu {
  position: fixed; inset: 0; z-index: 60;
  background: var(--color-bg-page);
  display: flex; flex-direction: column;
  overflow-y: auto;
  animation: fade .2s ease-out;
}
.mmenu[hidden] { display: none; }
@keyframes fade { 0% { opacity: 0; } }
.mmenu__body { display: flex; flex-direction: column; gap: 56px; padding: 56px var(--layout-page-margin) 48px; }
.mmenu__group { display: flex; flex-direction: column; gap: 12px; }
.mmenu .header__right { justify-content: flex-end; }

/* ---------- Intro --------------------------------------------------------- */
.intro {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 64px;
  align-items: end;
  padding-top: 96px;
  padding-bottom: 112px;
}
.intro h1 { max-width: 900px; }
.intro p b { color: var(--color-text-primary); font-weight: 500; }
@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; gap: 24px; padding-top: 48px; padding-bottom: 64px; }
}

/* ---------- Section head + category filter ------------------------------- */
.secthead {
  display: grid; grid-template-columns: 1fr 1fr;
  padding-top: 16px; padding-bottom: 96px;
}
.secthead__right { display: grid; grid-template-columns: 1fr 200px; }
.secthead__label { margin-bottom: 24px; }
.secthead__title { margin-top: 4px; }

.cats { display: flex; gap: 48px; }
.cats ul { display: flex; flex-direction: column; gap: 4px; }
.cat {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 25px; line-height: 28px; letter-spacing: -.5px;
  color: var(--color-text-primary);
  opacity: .4;
  transition: opacity .2s;
}
.cat:hover { opacity: .75; }
.cat[aria-pressed="true"] { opacity: 1; }
.cat__dot { width: 18px; height: 18px; border-radius: 50%; background: currentColor; display: none; }
.cat[aria-pressed="true"] .cat__dot { display: inline-block; }

@media (max-width: 900px) {
  .secthead { gap: 32px; padding-bottom: 48px; }
  .secthead, .secthead__right { grid-template-columns: 1fr; }
  .secthead__count { display: none; }
  .secthead__label { margin-bottom: 12px; }
  .cats { gap: 40px; }
}

/* ---------- Works grid ---------------------------------------------------- */
.grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 56px 24px;
  padding-bottom: 128px;
}
.card { position: relative; display: flex; flex-direction: column; gap: 16px; text-align: left; width: 100%; }
.card__img { aspect-ratio: 660 / 420; border-radius: var(--radius-md); transition: transform .5s var(--ease); }
.card:hover .card__img { transform: scale(.985); }
.card__meta { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.card__desc { margin-top: 4px; }
.card__lock {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.card.is-entering { animation: cardIn .45s var(--ease) both; }
@keyframes cardIn { 0% { opacity: 0; transform: translateY(12px); } }
.card:focus-visible { outline-offset: 6px; border-radius: var(--radius-md); }
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; gap: 40px; padding-bottom: 96px; }
  .card__img { aspect-ratio: 342 / 256; }
}


/* ==========================================================================
   About page
   ========================================================================== */
.header--overlay { position: absolute; top: 0; left: 0; right: 0; }

/* 3D ring of work thumbnails (drag to spin) */
.ring-wrap {
  position: relative;
  height: 640px;
  overflow: hidden;
  --persp: 2600px;
  --ring-r: 620px;
}
.ring-wrap .header { transform: translateZ(0); }
.ring-wrap::before, .ring-wrap::after {
  content: ""; position: absolute; left: 0; right: 0; z-index: 6; pointer-events: none;
}
.ring-wrap::before { top: 0; height: 130px; background: linear-gradient(to bottom, var(--color-bg-page) 20%, rgba(13,13,13,0)); }
.ring-wrap::after { bottom: 0; height: 90px; background: linear-gradient(to bottom, rgba(13,13,13,0), var(--color-bg-page)); }
.ring-stage, .ring-hit { position: absolute; inset: 0; }
.ring-stage {
  z-index: 0; isolation: isolate; overflow: hidden; contain: paint;
  perspective: var(--persp);
  perspective-origin: 50% 10%;
}
.ring {
  position: absolute; left: 50%; top: 46%;
  width: 0; height: 0;
  transform-style: preserve-3d;
  will-change: transform;
}
.ring-hit { z-index: 5; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.is-grabbing .ring-hit { cursor: grabbing; }
.ring__card {
  position: absolute;
  width: 220px; height: 140px;
  left: -110px; top: -70px;
  border-radius: 3px;
  background: var(--color-bg-placeholder);
  backface-visibility: visible;
  overflow: hidden;
  background-size: cover;
  background-position: 50%;
}
.ring__card:nth-child(4n+2) { background-color: #232322; }
.ring__card:nth-child(4n+3) { background-color: #191918; }
.ring__card:nth-child(4n)   { background-color: #262625; }
@media (max-width: 900px) {
  .ring-wrap { height: 320px; --persp: 1100px; --ring-r: 250px; --ring-scale: .45; }
  .ring__card { width: 104px; height: 66px; left: -52px; top: -33px; }
}

/* Intro text + services */
.about-top { display: grid; grid-template-columns: 1fr 1fr; padding-top: 24px; padding-bottom: 160px; }
.about-top__title { font-weight: inherit; }
.about-top__text { display: flex; flex-direction: column; gap: 28px; max-width: 560px; }
.about-top__services { display: flex; flex-direction: column; gap: 32px; }
.about-top__services ul { display: flex; flex-direction: column; gap: 3px; }

/* Clients: hover a name, its image wipes in from the bottom */
.clients { display: grid; grid-template-columns: 1fr 1fr; padding-bottom: 160px; }
.clients__col { padding-right: 20px; }
.clients__stack { position: relative; width: 354px; height: 411px; margin-left: auto; }
.clients__base, .clients__ph { position: absolute; inset: 0; background: #2a2a2a; }
.clients__ph { display: flex; align-items: center; justify-content: center; color: var(--color-text-tertiary); font-size: 13px; }
.clients__frame { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0); }
.clients__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clients__frame--default { z-index: 2; }
.clients__frame--enter { z-index: 2; animation: clientIn .45s cubic-bezier(.22,1,.36,1) forwards; }
.clients__frame--exit  { z-index: 1; animation: clientOut .45s cubic-bezier(.22,1,.36,1) forwards; }
@keyframes clientIn  { 0% { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
@keyframes clientOut { 0% { clip-path: inset(0); } to { clip-path: inset(0 0 100% 0); } }
.clients__list { display: flex; flex-direction: column; gap: 30px; }
.clients__list ul { display: flex; flex-direction: column; gap: 2px; }
.clients__list button {
  font-size: 34px; line-height: 39px; letter-spacing: -.8px;
  text-align: left; cursor: default; padding: 0; width: fit-content;
}
.clients__list button.is-active { text-decoration: underline; text-underline-offset: .16em; text-decoration-thickness: 1px; }

/* Experience / education */
.exp { display: grid; grid-template-columns: 1fr 1fr; padding-bottom: 140px; }
.exp__inner { display: flex; flex-direction: column; gap: 32px; }
.exp__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 48px; }
.exp__item { font-size: 15px; line-height: 19px; display: flex; flex-direction: column; gap: 1px; }
.cv-disabled { color: var(--color-text-tertiary); cursor: default; user-select: none; }

/* Photo marquee */
.strip { overflow: hidden; padding-bottom: 0; }
.strip__track { display: flex; gap: 0; width: max-content; animation: marquee 60s linear infinite; }
.strip__track:hover { animation-play-state: paused; }
.strip__track .ph { margin-right: 16px; width: 320px; height: 320px; flex: none; }
.strip__track .ph:nth-child(2n) { background: #191918; }
.strip__track .ph img { object-fit: contain; }
@keyframes marquee { to { transform: translateX(-50%); } }

@media (max-width: 900px) {
  .about-top, .clients, .exp { grid-template-columns: 1fr; padding-bottom: 64px; gap: 64px; }
  .about-top__text .t-h2 { font-size: 25px; line-height: 28px; letter-spacing: -.5px; }
  .clients { grid-template-columns: 1fr minmax(0, 42%); gap: 16px; align-items: end; }
  .clients__col { display: block; order: 2; padding-right: 0; }
  .clients__list { order: 1; }
  .clients__stack { width: 100%; height: auto; aspect-ratio: 354 / 411; margin-left: 0; }
  .clients__list button { font-size: 25px; line-height: 28px; cursor: pointer; }
  .exp > div:first-child { display: none; }
  .exp__cols { grid-template-columns: 1fr; gap: 20px; }
  .strip__track .ph { width: 220px; height: 220px; }
}

/* ==========================================================================
   Case study page
   ========================================================================== */
/* Hero: full-width cover under the overlay header, title starts at the 50% column */
.case-hero { position: relative; padding-top: var(--header-h); }
.case-hero__img { position: relative; width: 100%; aspect-ratio: 1758 / 1119; }
.case-hero__img > img, .case-hero__img > video { position: relative; width: 100%; height: auto; display: block; }
.case-hero__img:has(> img, > video) { aspect-ratio: auto; }
.case-hero__title { padding-left: 50%; margin-top: 32px; }

.case-info { display: grid; grid-template-columns: 1fr 1fr 2fr; padding-top: 28px; padding-bottom: 140px; }
.case-info__col { display: flex; flex-direction: column; gap: 48px; }
.meta { display: flex; flex-direction: column; gap: 18px; }
.meta ul { display: flex; flex-direction: column; gap: 2px; }
.case-desc { display: flex; flex-direction: column; gap: 20px; max-width: 600px; }
.case-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); padding-top: 24px; padding-bottom: 120px; }
.stat { display: flex; flex-direction: column; gap: 6px; }

.gallery { display: flex; flex-direction: column; gap: var(--layout-grid-gap); padding-bottom: 160px; }
.gallery__row { display: grid; gap: var(--layout-grid-gap); }
.gallery__row--two { grid-template-columns: 1fr 1fr; }
.gallery__row--two .ph { aspect-ratio: 662 / 580; }
.gallery__row--three { grid-template-columns: 1fr 1fr 1fr; }
.gallery__row--three .ph { aspect-ratio: 434 / 540; }
.gallery__row--full .ph { aspect-ratio: 1344 / 760; }

.nextp { display: grid; grid-template-columns: 1fr 1fr; padding-top: 20px; padding-bottom: 120px; }
.nextp__title { margin: 22px 0 10px; display: block; }


.nf { min-height: calc(100vh - var(--header-h) - 160px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 24px; padding-top: 96px; padding-bottom: 96px; }

@media (max-width: 900px) {
  .case-hero__title { padding: 0 var(--layout-page-margin); margin-top: 20px; }
  .case-info { grid-template-columns: 1fr 1fr; gap: 32px 24px; padding-bottom: 48px; }
  .case-desc { grid-column: 1 / -1; }
  .case-info__col { gap: 32px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 24px; padding-bottom: 56px; }
  .gallery { gap: 12px; padding-bottom: 80px; }
  .gallery__row { gap: 12px; }
  .gallery__row--two, .gallery__row--three { grid-template-columns: 1fr; }
  .nextp { grid-template-columns: 1fr; padding-bottom: 64px; }
  .nextp > div:first-child { display: none; }
}

/* ---------- Footer -------------------------------------------------------- */
.cta { padding-top: 140px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 20px; }
.cta a { width: fit-content; }
.foot { display: grid; grid-template-columns: 2fr 1fr 1fr; padding-top: 20px; padding-bottom: 24px; }
.foot__col { display: flex; flex-direction: column; gap: 40px; }
.foot__block { display: flex; flex-direction: column; gap: 14px; }
.foot__block ul { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 17px; }
.copy { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; padding-top: 56px; padding-bottom: 20px; color: var(--color-text-secondary); }
.copy__legal { display: flex; flex-wrap: wrap; gap: 20px; }
@media (max-width: 900px) {
  .cta { padding-top: 48px; padding-bottom: 48px; }
  .cta .t-display-xl { font-size: 26px; line-height: 30px; letter-spacing: calc(-.6px + .015em); word-break: break-all; }
  .foot { grid-template-columns: 1fr 1fr; gap: 40px 24px; }
  .foot__name { grid-column: 1 / -1; }
}

/* Larger tap targets on touch */
@media (pointer: coarse) {
  .cat, .copy__legal a, .foot__block a, .header > a, .header__lang button { position: relative; }
  .cat::after, .copy__legal a::after, .foot__block a::after, .header > a::after, .header__lang button::after {
    content: ""; position: absolute; inset: -10px -6px;
  }
}

/* ---------- Reduced motion ----------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* header name + nickname */
.brand__aka { margin-left: .35em; }
@media (max-width: 480px) { .brand__aka { display: none; } }
