/* =========================================================
   Stanislaw Bekkel — shared styles for every page
   ========================================================= */

:root {
  --bg: #ffffff;
  --text: #000000;
  --muted: #4d4d4d;
  --faint: #8a8a8a;
  --chip: rgba(0, 0, 0, .04);
  --chip-hover: rgba(0, 0, 0, .08);
  --line: rgba(0, 0, 0, .08);
  --radius: 12px;
  --col: 460px;
  --label: 120px;          /* left column in two-column rows */
  --font: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --fs: 14px;              /* one type size for the whole site */
  --lh: 20px;
  --fs-small: 12px;
  --lh-small: 16px;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 72px;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; font-size: inherit; line-height: inherit; }
::selection { background: #000; color: #fff; }

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

/* ---------- Layout ---------- */
.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: 220px 24px 160px;
  min-height: 100vh;
}
.column {
  width: 100%;
  max-width: var(--col);
  display: flex;
  flex-direction: column;
}

/* ---------- Text roles ---------- */
.strong { font-weight: 500; }
.muted  { color: var(--muted); }
.faint  { color: var(--faint); }
.stack  { display: flex; flex-direction: column; gap: var(--space-2); }

/* Underline that draws in on hover — used for every text link */
.link { position: relative; color: var(--muted); font-weight: 500; transition: color .25s ease; }
.link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .35s ease;
}
.link:hover { color: var(--text); }
.link:hover::after { transform: scaleX(1); transform-origin: left; }

.links { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- Header row (name + i button / breadcrumb) ---------- */
.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
}

.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  background: none;
  color: var(--text);
  line-height: 0;
  transition: color .25s ease;
}
.info-btn svg { display: block; width: 14px; height: 14px; }
button.info-btn { position: relative; padding: 0; border: 0; font: inherit; cursor: pointer; }

.head-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

/* "Link copied" note under the share button */
.toast {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  white-space: nowrap;
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--faint);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.show-toast .toast { opacity: 1; }
.info-btn:hover { color: var(--muted); }

.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.crumbs a.link { color: var(--text); }   /* underline draws in on hover, like other links */

/* ---------- Section with a small heading ---------- */
.section { display: flex; flex-direction: column; gap: var(--space-2); }
.section-title { font-weight: 500; }

/* Two-column rows: label on the left, content on the right */
.rows { display: flex; flex-direction: column; gap: var(--space-2); }
.row { display: flex; gap: var(--space-3); align-items: flex-start; }
.row .label { flex: 0 0 var(--label); color: var(--muted); }
.row .body  { flex: 1 1 auto; min-width: 0; }
.row .body span { display: block; color: var(--muted); }
/* Company logo before the company name in «Опыт» */
.co-logo { display: inline-block; width: auto; height: 16px; margin-right: 6px; vertical-align: -3px; }
.co-logo-app { border-radius: 4px; }

/* ---------- Project cards ---------- */
.cards { display: flex; flex-direction: column; gap: var(--space-3); }
.card { display: flex; flex-direction: column; gap: var(--space-1); }
.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1.84;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(160deg, #ececec 0%, #d4d4d4 55%, #b9b9b9 100%);
}
.card-media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--muted);
  transition: color .25s ease;
}
.card:hover .card-meta { color: var(--text); }

/* ---------- Project page ---------- */
.gallery { display: flex; flex-direction: column; gap: var(--space-3); }
.gallery .pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.shot {
  position: relative;
  width: 100%;
  aspect-ratio: 1.84;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(160deg, #ececec 0%, #d4d4d4 55%, #b9b9b9 100%);
}
.shot.square { aspect-ratio: 1; }
.shot.tall   { aspect-ratio: 4 / 5; }
.shot img, .shot video { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Case page: title, text blocks and full-width images, like the reference */
.case-title { display: flex; flex-direction: column; }
.case-section { display: flex; flex-direction: column; gap: var(--space-3); }
.case-section .stack { gap: var(--space-2); }
.case-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: var(--chip);
}

/* Video that just plays: no player UI, no clicks */
.case-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--chip);
}
.case-video video,
.case-video iframe {
  position: absolute;
  inset: -2px;                 /* trim 2px on every edge: hides screen-capture borders */
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  border: 0;
  object-fit: cover;
  pointer-events: none;
}

.next {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-2);
}
.next .muted { flex: 0 0 auto; }

/* ---------- Footer with the loader flower ---------- */
.footer {
  margin-top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.flower {
  width: 40px;
  height: auto;
  color: var(--text);
  overflow: visible;
}
.flower .petals {
  transform-box: view-box;
  transform-origin: 48px 48px;
  animation: petals 1.4s linear infinite;
  will-change: transform;
}
@keyframes petals { to { transform: rotate(360deg); } }

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  padding-top: var(--space-2);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--faint);
}

/* ---------- Progressive blur bars at the viewport edges ---------- */
.blur-bar {
  position: fixed;
  left: 0;
  right: 0;
  height: 100px;
  pointer-events: none;
  z-index: 50;
}
.blur-bar.top { top: 0; }
.blur-bar.bottom { bottom: 0; }
.blur-bar .layer { position: absolute; inset: 0; -webkit-mask-image: var(--m); mask-image: var(--m); }

/* Strongest blur on the screen edge, fading toward the content. */
.blur-bar.bottom .layer { --m: linear-gradient(to bottom, #0000 var(--a), #000 var(--b), #000 var(--c), #0000 var(--d)); }
.blur-bar.top .layer    { --m: linear-gradient(to top,    #0000 var(--a), #000 var(--b), #000 var(--c), #0000 var(--d)); }

.blur-bar .layer:nth-child(1) { -webkit-backdrop-filter: blur(.2px);   backdrop-filter: blur(.2px);   --a: 0%;    --b: 12.5%; --c: 25%;   --d: 37.5%; }
.blur-bar .layer:nth-child(2) { -webkit-backdrop-filter: blur(.4px);   backdrop-filter: blur(.4px);   --a: 12.5%; --b: 25%;   --c: 37.5%; --d: 50%; }
.blur-bar .layer:nth-child(3) { -webkit-backdrop-filter: blur(.8px);   backdrop-filter: blur(.8px);   --a: 25%;   --b: 37.5%; --c: 50%;   --d: 62.5%; }
.blur-bar .layer:nth-child(4) { -webkit-backdrop-filter: blur(1.6px);  backdrop-filter: blur(1.6px);  --a: 37.5%; --b: 50%;   --c: 62.5%; --d: 75%; }
.blur-bar .layer:nth-child(5) { -webkit-backdrop-filter: blur(3.1px);  backdrop-filter: blur(3.1px);  --a: 50%;   --b: 62.5%; --c: 75%;   --d: 87.5%; }
.blur-bar .layer:nth-child(6) { -webkit-backdrop-filter: blur(6.3px);  backdrop-filter: blur(6.3px);  --a: 62.5%; --b: 75%;   --c: 87.5%; --d: 100%; }
.blur-bar .layer:nth-child(7) { -webkit-backdrop-filter: blur(12.5px); backdrop-filter: blur(12.5px); --a: 75%;   --b: 87.5%; --c: 100%;  --d: 112.5%; }
.blur-bar .layer:nth-child(8) { -webkit-backdrop-filter: blur(25px);   backdrop-filter: blur(25px);   --a: 87.5%; --b: 100%;  --c: 112.5%; --d: 125%; }

/* ---------- Small screens ---------- */
@media (max-width: 612.98px) {
  :root { --fs: 13px; --label: 96px; }
  .page { padding: 160px 16px 140px; gap: 32px; }
  .row { gap: var(--space-2); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card-media img, .link::after { transition: none; }
  .flower .petals { animation: none; }
}

/* ---------- Glass "Посмотреть" cursor over the case cards ---------- */
.has-view-cursor, .has-view-cursor * { cursor: none; }
.view-cursor {                       /* follows the pointer */
  position: fixed;
  left: 0;
  top: 0;
  z-index: 80;                       /* above the zoomed image */
  pointer-events: none;
  transform: translate3d(var(--x, 0), var(--y, 0), 0);
}
.view-cursor span {                  /* the glass pill: appears, shrinks on press */
  display: block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text);
  white-space: nowrap;
  background: rgba(255, 255, 255, .28);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  backdrop-filter: blur(14px) saturate(180%);
  transform: translate(-50%, -50%) scale(.6);
  opacity: 0;
  transition: opacity .2s ease, transform .25s var(--ease);
}
.view-cursor.is-visible span { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.view-cursor.is-visible.is-pressed span {
  transform: translate(-50%, -50%) scale(.88);
  transition: opacity .2s ease, transform .12s ease;
}

/* ---------- Back-to-top arrow (appears after a third of the page) ---------- */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 61;                       /* above the blur bars */
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(0, 0, 0, .05);       /* faint tint so it reads on white too */
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  backdrop-filter: blur(14px) saturate(180%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s var(--ease), visibility 0s linear .25s;
}
.to-top svg { display: block; width: 16px; height: 16px; }
.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .25s ease, transform .25s var(--ease), visibility 0s;
}
.to-top:active { transform: scale(.88); transition-duration: .12s; }
@media (max-width: 612.98px) { .to-top { right: 16px; bottom: 16px; } }

/* ---------- Full-screen image view on case pages ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  cursor: zoom-out;                  /* replaced by the glass cursor on mouse devices */
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity .25s ease, visibility 0s; }
.lightbox img {
  display: block;
  max-width: min(80vw, 960px);       /* zoomed, but not wall-to-wall */
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: var(--radius);
}
.lightbox:focus { outline: none; }
/* Zoomed video: 16:9, as large as fits the screen */
.lightbox .lightbox-video {
  width: min(80vw, 960px, calc(80vh * 16 / 9));
  max-width: 100%;
  background-color: #fff;            /* the page must not show through while Vimeo loads */
}
.lightbox .lightbox-video.is-loading { background-color: #efefef; }   /* keep the skeleton visible */
@media (max-width: 612.98px) {       /* phones: use the full width */
  .lightbox img { max-width: 100%; }
  .lightbox .lightbox-video { width: 100%; }
}
.lightbox.has-view-cursor, .lightbox.has-view-cursor * { cursor: none; }
.no-scroll, .no-scroll body { overflow: hidden; }

/* ---------- Skeleton while images and videos load ---------- */
/* The gradient is 3× wider than the block; only its middle third holds the highlight.
   Sliding from one end to the other, the highlight enters fully from the left edge,
   leaves fully past the right edge, and the loop restarts on a plain frame — no jump. */
.is-loading {
  background-color: #efefef;
  background-image: linear-gradient(90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0) 40%,
    rgba(255,255,255,.7) 50%,
    rgba(255,255,255,0) 60%,
    rgba(255,255,255,0) 100%);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  background-position: 100% 0;
  animation: skeleton 1.8s linear infinite;
}
@keyframes skeleton { to { background-position: 0% 0; } }

/* Hide the media itself until it is ready, so only the skeleton shows */
img.is-loading { color: transparent; }                 /* no alt text flash */
.card-media.is-loading img,
.case-video.is-loading iframe,
.case-video.is-loading video { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .is-loading { animation: none; background-image: none; }
}

/* ---------- Draggable footer flower ---------- */
.flower.is-grabbable {
  position: relative;
  z-index: 55;                       /* drag it over the blur bars */
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: 37% 24%;         /* the flower head: the stem swings below it */
}
.flower.is-dragging { cursor: grabbing; }
.flower .petals rect { transition: opacity .5s ease; }
.flower .petals rect.is-gone { opacity: 0; transition-duration: 0s; }

/* Flying petals after a hard shake */
.seed {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 90;
  border-radius: 999px;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Case images get their real size only once loaded; until then the skeleton
   keeps a sensible landscape shape so the page does not collapse. */
.case-img.is-loading { aspect-ratio: 16 / 10; }

/* ---------- Portrait on the About page, top right ---------- */
.about-photo {
  flex: 0 0 auto;
  display: block;
  width: 96px;
  height: 96px;
  border-radius: var(--radius);      /* same rounding as the case images */
  object-fit: cover;
  background: var(--chip);
}

/* ---------- "Open to work" line on the home page ---------- */
.status { display: flex; align-items: center; gap: 8px; color: var(--text); }
.status-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34c759;
}
