/* ============ Gappy's File ============ */

/* Шрифт Ivory: поклади файл у assets/fonts/Ivory-Light.woff2 — і він підхопиться сам.
   Поки файла немає, показується схожий Newsreader. */
@font-face {
  font-family: "Ivory";
  src: url("../assets/fonts/Ivory-Light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #8a8a8a;
  --line: #ececec;          /* вертикальні лінії сітки */
  --accent: #0d99ff;        /* синій «як у Figma» — колір виділення */
  --placeholder: #f3f3f3;
  --btn-border: #d6d6d6;

  --margin: 20px;           /* поля сторінки */
  --gap: 10px;              /* відстань між колонками */
  --cols: 6;

  --sans: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --serif: "Ivory", "Newsreader", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* чорне тло видно лише коли «тягнеш» сторінку за край (overscroll) */
html { -webkit-text-size-adjust: 100%; background: #111; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* «Projects» у меню прокручує до робіт; запас зверху, щоб підпис проєкту не ховався під меню */
#work { scroll-margin-top: 110px; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.3;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; height: auto; }

/* ---------- вертикальні лінії, як колонки у Figma ---------- */
.grid-lines {
  position: fixed; inset: 0 var(--margin);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  column-gap: var(--gap);
  pointer-events: none;
  z-index: 0;
}
.grid-lines span { border-left: 1px solid var(--line); margin-left: -5px; }
.grid-lines span:last-child { border-right: 1px solid var(--line); margin-right: -5px; }

/* ---------- спільна сітка 6 колонок ---------- */
.row {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  column-gap: var(--gap);
  padding: 0 var(--margin);
  position: relative;
  z-index: 1;
}

/* ---------- шапка ----------
   Без підкладки: текст білий + mix-blend-mode: difference,
   тому на білому він чорний, а на картинках інвертується. */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  padding-top: 20px; padding-bottom: 20px;
  align-items: start;
  z-index: 20;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
}
.header a { pointer-events: auto; display: inline-block; justify-self: start; padding-bottom: 4px; transition: opacity .2s; }
.header .brand { grid-column: 1; }
.header .nav-projects { grid-column: 3; }
.header .nav-about { grid-column: 4; }
.header .nav-contact { grid-column: 5; }
.header a[aria-current="page"] { border-bottom: 1px solid currentColor; }
.header a:hover { opacity: .55; }

/* годинник окремо, бо в нього своя чорна плашка без difference */
.clock {
  position: fixed; top: 20px; right: var(--margin);
  z-index: 21;
  background: #111; color: #fff;
  padding: 4px 10px; font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
main { padding-top: 60px; }

/* ---------- головна: hero ---------- */
/* 220 px від меню до блоку з грифоном (60 px уже дає відступ main) і 220 px під ним */
.hero { padding-top: 205px; padding-bottom: 220px; align-items: center; }
.hero .creature { grid-column: 3; position: relative; margin: 0; }
.hero .creature img { display: block; }
/* ховер на грифона: рамка виділення, як у Figma, і підпис під ним */
.hero .creature .selection { inset: -6px; opacity: 0; transition: opacity .15s; }
.hero .creature figcaption {
  position: absolute; top: calc(100% + 16px); left: 0; right: 0;
  font-size: 13px; line-height: 1.45; color: var(--muted);
  opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s;
}
.hero .creature:hover .selection,
.hero .creature:hover figcaption { opacity: 1; transform: none; }
.hero .intro {
  grid-column: 4;
  font-family: var(--serif);
  font-weight: 300;
  font-optical-sizing: auto;
  font-size: 22px; line-height: 1.12;
}

/* ---------- головна: сітка робіт ---------- */
.works {
  row-gap: 120px;
  padding-bottom: 160px;
  align-items: start;
}
.tile {
  position: relative;
  cursor: none;
}
.tile .label {
  position: absolute; bottom: 100%; left: 0;
  padding-bottom: 8px;
  font-size: 13px; color: var(--muted);
  white-space: nowrap;
}
.tile .media { background: var(--placeholder); position: relative; overflow: hidden; }
.tile .media img, .tile .media video,
.project .gallery .media img, .project .gallery .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .media .missing {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 10px; color: #b5b5b5;
}

/* стан ховеру проєкту */
.works.is-hovering .tile.is-active .label { color: var(--accent); }

/* синя рамка виділення — малюється JS-ом навколо рядків проєкту */
.selection {
  position: absolute;
  border: 1px solid var(--accent);
  pointer-events: none;
  z-index: 5;
}
.selection i {
  position: absolute; width: 7px; height: 7px;
  background: #fff; border: 1px solid var(--accent);
}
.selection i:nth-child(1) { top: -4px; left: -4px; }
.selection i:nth-child(2) { top: -4px; right: -4px; }
.selection i:nth-child(3) { bottom: -4px; left: -4px; }
.selection i:nth-child(4) { bottom: -4px; right: -4px; }

/* плашка «See project», що їде за курсором */
.cursor-tag {
  position: fixed; left: 0; top: 0;
  background: var(--ink); color: #fff;
  font-size: 12px; padding: 7px 13px;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity .15s;
  white-space: nowrap;
}
.cursor-tag.on { opacity: 1; }

/* ---------- сторінка проєкту ---------- */
.project { padding-top: 50px; padding-bottom: 160px; align-items: start; }
.project .info {
  grid-column: 1 / span 2;
  /* ліва колонка стоїть на місці, поки картинки скроляться;
     верх — врівень з першою картинкою, навігація притиснута донизу екрана */
  position: sticky; top: 110px;
  height: calc(100vh - 130px);
  display: flex; flex-direction: column; gap: 18px;
  padding-right: 20px;
}
.project .info .pnav {
  margin-top: auto;
  display: flex; justify-content: space-between;
  font-size: 13px;
}
.project .info .pnav a:hover { color: var(--accent); }
.project-nav { display: none; }
.project .info dt { font-size: 13px; color: var(--muted); }
.project .info dd { font-size: 13px; }
.project .info .desc { font-size: 13px; max-width: 420px; padding-top: 18px; }
.btn {
  display: inline-block; align-self: flex-start;
  border: 1px solid var(--btn-border); background: transparent;
  padding: 7px 13px; font-size: 12px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.is-off, .btn.is-off:hover { color: var(--muted); border-color: var(--btn-border); opacity: .7; cursor: default; }
.project .gallery {
  grid-column: 3 / span 4;
  display: flex; flex-direction: column; gap: 10px;
}
.project .gallery .media { background: var(--placeholder); position: relative; }
.project .gallery .media { overflow: hidden; }
.project .gallery .media .missing {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11px; color: #b5b5b5;
}
.project-nav { grid-column: 3 / span 4; justify-content: space-between; padding-top: 40px; font-size: 13px; }
.project-nav a:hover { color: var(--accent); }

/* ---------- About ---------- */
/* сцена з обличчям масштабується так, щоб обличчя повністю влазило у висоту екрана,
   і трохи піднята вгору (порожній верх композиції ховається під меню) */
.about-stage {
  --sw: min(100%, 1440px, calc((100svh - 80px) * 2));
  position: relative; z-index: 1;
  margin: calc(var(--sw) * -0.07) auto 0;
  width: var(--sw);
  aspect-ratio: 1440 / 900;
}
.about-stage > * { position: absolute; }
.about-stage .face { left: 33.9%; top: 16.1%; width: 31.1%; }
.about-stage svg.leaders { inset: 0; width: 100%; height: 100%; }
.about-stage svg.leaders line { stroke: var(--ink); stroke-width: 1; }
.about-stage .note dt { font-family: var(--sans); font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.about-stage .note dd { font-weight: 300; font-family: var(--serif); font-size: 18px; line-height: 1.05; }
.about-stage .btn { font-size: 14px; }
.about-stage .btn:hover ~ * {}
.illustrations { padding-bottom: 120px; }
.illustrations .box { grid-column: 1 / span 2; }
.illustrations .label { font-size: 13px; color: var(--muted); padding-bottom: 8px; }
.illustrations .soon {
  background: #f6f6f6; aspect-ratio: 458 / 256;
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--serif); font-size: 64px; color: #c9c9c9;
}
.illustrations .soon span { transform: rotate(-20deg); white-space: nowrap; }

/* ---------- футер ---------- */
.footer { padding-bottom: 20px; font-size: 11px; color: var(--muted); }
.footer p { grid-column: 1 / span 3; }

/* ---------- планшет / телефон ---------- */
@media (max-width: 900px) {
  :root { --cols: 2; --margin: 12px; }
  .header { grid-template-columns: repeat(4, auto); justify-content: space-between; }
  .header .brand, .header .nav-projects, .header .nav-about, .header .nav-contact { grid-column: auto; }
  .clock { display: none; }
  .hero { padding-top: 80px; padding-bottom: 160px; }
  .hero .creature { grid-column: 1; }
  .hero .intro { grid-column: 2; font-size: 18px; }
  .works { row-gap: 60px; }
  .works .skip { display: none; }
  .tile { cursor: pointer; }
  .cursor-tag { display: none; }
  .project .info { grid-column: 1 / -1; position: static; height: auto; padding-bottom: 30px; }
  .project .info .pnav { display: none; }
  .project-nav { display: flex; }
  .project .gallery, .project-nav { grid-column: 1 / -1; }
  .about-stage {
    aspect-ratio: auto; display: flex; flex-wrap: wrap; gap: 16px;
    padding: 20px var(--margin) 80px; align-items: flex-start;
  }
  .about-stage > * { position: static !important; }
  .about-stage .face { width: 70% !important; margin: 0 auto 20px; flex-basis: 100%; max-width: 320px; }
  .about-stage .note { flex-basis: 100%; }
  .about-stage svg.leaders { display: none; }
  .about-stage .note dd { font-size: 18px; }
  .about-stage .btn { font-size: 12px; padding: 5px 9px; }
  .illustrations .box { grid-column: 1 / -1; }
  .illustrations .soon { font-size: 44px; }
}

/* ---------- ефект появи при скролі ----------
   Картинка «випадає» зверху вниз: маска відкривається донизу,
   а картинка всередині з'їжджає згори і зменшується з 1.15 до 1. */
.reveal .media {
  clip-path: inset(0 0 100% 0);
  transition: clip-path .55s cubic-bezier(.77, 0, .18, 1) var(--delay, 0s);
}
.reveal .media > img, .reveal .media > video {
  transform: scale(1.15) translateY(-6%);
  transition: transform .7s cubic-bezier(.22, 1, .36, 1) var(--delay, 0s);
}
.reveal .label { opacity: 0; transform: translateY(-6px); transition: opacity .3s var(--delay, 0s), transform .3s var(--delay, 0s), color .2s; }
.reveal.is-in .media { clip-path: inset(0 0 0 0); }
.reveal.is-in .media > img, .reveal.is-in .media > video { transform: none; }
.reveal.is-in .label { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal .media, .reveal .media > img, .reveal .media > video, .reveal .label, .reveal.media {
    clip-path: none; transform: none; opacity: 1; transition: none;
  }
}

.studio-link { border-bottom: 1px solid currentColor; }
.studio-link:hover { color: var(--accent); }

.about-stage svg.face { height: auto; display: block; }

/* Arena: на десктопі на About, на телефоні — на Contact */
.mobile-only { display: none !important; }

@media (max-width: 900px) {
  .mobile-only { display: inline-block !important; }
  .desktop-only { display: none !important; }
  body[data-page="contact"] .about-stage { justify-content: center; }
  .about-stage .note-experience { padding-right: 25%; }
  .project { padding-top: 200px; }
}

/* телефон: шрифт із засічками трохи щільніший, щоб не здавався блідим */
@media (max-width: 900px) {
  .hero .intro, .about-stage .note dd { font-weight: 350; }
}

/* темна сторінка проєкту (колір задається полем bg у projects.js) */
body.theme-dark {
  --ink: #f2f2f2;
  --muted: #8f8f8f;
  --line: #343434;
  --placeholder: #2c2c2c;
  --btn-border: #555;
}
