/* ==========================================================================
   nzielinska.com — style
   --------------------------------------------------------------------------
   Units: `--u` = "one Figma pixel". The design is 1440 px wide; on a 1440 px
   screen 1u = 1px, on wider screens a bit more, on smaller ones a bit less.

   The most important knobs (change them here, they apply everywhere):
     --side   page margin left/right            (Figma px)
     --gap    space between pictures/texts       (Figma px)
     --bar    height of the coloured menu bar   (Figma px)

   One-screen pages (home, about, contact, works) and the top of every project:
   every element is placed with Figma coordinates:  style="--x:60; --y:270; --w:556".
   Project pages: a 12-column grid. A block says which columns it spans:
   style="--c: 3 / 11"  = from the start of column 3 to the start of column 11
   (so it covers columns 3–10). Collages (tubes, phones, mockups) are
   "groups" that keep the Figma composition inside them.
   A block that must start at an exact Figma x:  class="at" style="--gx:181",
   and have an exact Figma width:  class="fw" style="--fw:824".

   Below 760 px (phones) everything becomes one column.
   ========================================================================== */

/* ---------- fonts ---------------------------------------------------------
   Design font: Helvetica Neue (installed on every Mac/iPhone).
   Everyone else gets Inter (free, OFL licence, files in /assets/fonts).   */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  size-adjust: 94%;          /* Inter is a bit bigger than Helvetica Neue – this keeps the same line breaks */
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  size-adjust: 94%;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* serif used on the "Porozmawiajmy o śmierci przy kolacji" page (Source Serif 4, OFL licence) */
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin-ext-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- tokens ------------------------------------------------------- */
:root {
  --font: "Helvetica Neue", "Inter", Helvetica, Arial, sans-serif;
  --accent: #000;          /* overwritten on every project page   */
  --pink: #ec80a9;         /* political satire                    */
  --cyan: #00a5c9;         /* move on                             */
  --navy: #262f63;         /* van gogh                            */
  --blue: #0201d2;         /* porozmawiajmy o śmierci przy kolacji */
  --orange: #fd8006;       /* (same book)                         */

  --side: 60;              /* page margin, Figma px               */
  --gap: 80;               /* space between blocks, Figma px      */
  --bar: 83;               /* menu bar height, Figma px           */
  --hover-weight: 500;     /* menu / links get this thick on hover */

  --pad: 20px;             /* side margin on phones               */
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 300;
  color: #000;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p, h1, h2, dl, dd, figure { margin: 0; }
h1, h2 { font-weight: inherit; font-size: inherit; }

.site {
  container-type: inline-size;
  overflow-x: clip;                                   /* pictures may stick out of the page, like in Figma */
  --U: calc(min(100cqw, 1920px) / 1440);              /* 1 Figma px (capped at 1920 px screens) */
  --u: var(--U);
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- text styles -------------------------------------------------- */
.t20 { font-size: max(14px, calc(20 * var(--u))); line-height: 1.2; }
.t16 { font-size: max(13px, calc(16 * var(--u))); line-height: 1.2; }
.t15 { font-size: max(12px, calc(15 * var(--u))); line-height: 1.2; }
p { text-align: justify; }                          /* all running text: aligned to both margins */
.center p, p.center { text-align: center; }
.stack > * + * { margin-top: 1.2em; }               /* empty line between paragraphs, like in Figma */
.medium { font-weight: 500; }
.regular { font-weight: 400; }

/* the handwritten "zielińska" at the top of every page — a link to the home page */
.logo { display: block; }
.logo a { display: block; height: 100%; }
.logo img { width: 100%; height: 100%; }

.title { font-size: max(20px, calc(30 * var(--u))); line-height: 1.2; }   /* project name */
.year { font-size: max(12px, calc(15 * var(--u))); line-height: 1.2; text-align: left; }
.year--big { font-size: max(18px, calc(24 * var(--u))); }               /* the ∞ of the archive */

/* links that get thicker on hover — the hidden copy keeps the width,
   so neighbouring words don't jump. Needs data-text="SAME TEXT". */
.hb { display: inline-grid; }
.hb::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  font-weight: var(--hover-weight);
  height: 0; overflow: hidden; visibility: hidden;
  pointer-events: none; user-select: none;
}
.hb:hover, .hb:focus-visible, .hb[aria-current="page"] { font-weight: var(--hover-weight); }

/* ---------- Figma coordinates (one-screen pages, hero, collages) --------- */
.band {
  position: relative;
  width: calc(1440 * var(--u));
  height: calc(var(--bh) * var(--u));
  margin-inline: auto;
}
.el {
  --x: 0; --y: 0; --w: initial; --h: initial;          /* not inherited from parents */
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
}
.el > img:not(.el) { width: 100%; height: 100%; object-fit: cover; }   /* picture filling its box */
img.el { object-fit: cover; }                                          /* picture that is itself the box */
picture.el > img { width: 100%; height: 100%; object-fit: cover; }
.round-3 > img, img.round-3 { border-radius: calc(3 * var(--u)); }
.r24 { border-radius: calc(24 * var(--u)); }

/* rotated picture: .el is the bounding box from Figma, the image inside is rotated */
.tilt { display: grid; place-items: center; }
.el.tilt > img, .el.tilt > .swap {
  width: calc(var(--iw) * var(--u));
  height: calc(var(--ih) * var(--u));
  max-width: none;
  rotate: var(--r, 0deg);
}
.el.tilt > img { object-fit: cover; }
.flip { rotate: 180deg; }

/* collage = a piece of the Figma frame kept as it was, scaled by --k */
.group {
  --u: calc(var(--U) * var(--k, 1));
  position: relative;
  width: calc(var(--gw) * var(--u));
  height: calc(var(--gh) * var(--u));
}

/* ---------- coloured panels --------------------------------------------- */
.panel { background: var(--bg, var(--accent)); color: #fff; min-height: calc(var(--ph, 0) * var(--u)); }
.panel-pad {
  padding: calc(var(--pt, 0) * var(--u)) calc(var(--pr, 0) * var(--u)) calc(var(--pb, 0) * var(--u)) calc(var(--pl, 0) * var(--u));
}
.panel-row { display: flex; align-items: center; padding-left: calc(var(--pl, 0) * var(--u)); }
.center { display: grid; place-items: center; text-align: center; }
.inner { width: calc(var(--tw) * var(--u)); }

/* ---------- navigation --------------------------------------------------- */
.menu {
  display: flex;
  gap: calc(400 * var(--u));
  font-size: max(14px, calc(20 * var(--u)));
  line-height: 1.2;
  white-space: nowrap;
}

/* menu bar fixed to the bottom of the window, on every page: coloured on projects,
   white (.bar--light) on home/about/contact/works — the page scrolls under it.
   It sits outside .site, so it computes its own unit. */
.bar {
  --u: calc(min(100vw, 1920px) / 1440);
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  height: calc(var(--bar) * var(--u));
  background: var(--accent);
  color: #fff;
}
.bar-inner { position: relative; height: 100%; width: calc(1440 * var(--u)); margin-inline: auto; }
.bar .menu { position: absolute; top: 50%; left: 50%; translate: -50% -50%; }   /* in the middle */
.page-project .site { padding-bottom: calc(var(--bar) * var(--U)); }   /* the end of the page stays above the bar */
.bar--light { background: #fff; color: #000; }
.page-screen .bar { --u: min(calc(min(100vw, 1920px) / 1440), calc(100svh / 820)); }  /* same scale as the page */

/* ---------- one-screen pages (home, about, contact, works) --------------- */
.page-screen .site {
  /* the whole 1440×820 frame fits in the window */
  --U: min(calc(min(100cqw, 1920px) / 1440), calc(100svh / 820));
}
.screen {
  position: relative;
  width: calc(1440 * var(--u));
  height: max(100svh, calc(820 * var(--u)));
  margin-inline: auto;
}

/* home – "still gallery": the works glide between fixed places, the one in the
   middle gets its name and year underneath. The places (Figma coordinates) are
   listed in js/main.js; JavaScript writes them into --sx --sy --sw --sh --sz. */
.gallery { --gfw: 1440; --gfh: 741; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.gallery-item, .gallery-caption {
  position: absolute;
  left: calc(var(--sx, 0) / var(--gfw) * 100%);
  top: calc(var(--sy, 0) / var(--gfh) * 100%);
  width: calc(var(--sw, 0) / var(--gfw) * 100%);
}
.gallery-item {
  display: block;
  height: calc(var(--sh, 0) / var(--gfh) * 100%);
  z-index: var(--sz, 1);
  overflow: hidden;
  cursor: pointer;
  transition:
    left var(--glide) var(--glide-ease), top var(--glide) var(--glide-ease),
    width var(--glide) var(--glide-ease), height var(--glide) var(--glide-ease),
    opacity .45s ease;
  --glide: .9s;                                   /* how long one move takes */
  --glide-ease: cubic-bezier(.76, 0, .2, 1);      /* slow – fast – slow       */
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; pointer-events: none; }
.gallery-item.is-out { opacity: 0; transition: opacity .25s ease; }  /* a work jumping from one end to the other */
.gallery-item.no-glide { transition: opacity .45s ease; }
.gallery-caption {
  display: flex; justify-content: space-between; gap: 1em;
  font-size: max(12px, calc(16 * var(--u))); line-height: 1.2;
  transition: opacity .3s ease, translate .5s var(--ease);
}
.gallery-caption p { text-align: left; }
.gallery-caption.is-out { opacity: 0; translate: 0 calc(6 * var(--u)); transition: opacity .2s ease; }

/* works – grid of thumbnails; on hover the tile turns black with the name in white */
.grid {
  display: grid;
  grid-template-columns: repeat(4, calc(329 * var(--u)));
  grid-auto-rows: calc(303 * var(--u));
  column-gap: calc(15 * var(--u));
  row-gap: calc(17 * var(--u));
}
.tile { position: relative; overflow: hidden; background: #f2f2f2; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile-label {
  position: absolute; inset: 0;
  padding: calc(125 * var(--u)) calc(23 * var(--u)) 0;
  background: #000; color: #fff;
  font-size: max(13px, calc(16 * var(--u))); line-height: 1.2;
  opacity: 0;
  transition: opacity .25s ease;
}
a.tile:hover .tile-label, a.tile:focus-visible .tile-label { opacity: 1; }

/* contact */
.email { font-size: max(20px, calc(40 * var(--u))); line-height: 1.2; white-space: nowrap; text-align: left; }
.gif { animation: appear .4s ease 1s both; }     /* the cat shows up 1 second after the page opens */
@keyframes appear { from { opacity: 0; } }

/* ---------- project pages ------------------------------------------------ */
.page-satir { --accent: var(--pink); }
.page-move-on { --accent: var(--cyan); }
.page-van-gogh { --accent: var(--navy); }
.page-ksiazka { --accent: var(--blue); }
.page-archive { --accent: #000; }

/* Role / Project Type / Tools … in one row, spread over the width of the description */
.meta {
  display: flex; justify-content: space-between; gap: calc(24 * var(--u));
  font-size: max(12px, calc(15 * var(--u))); line-height: 1.2;
}
.meta dd { margin: 0; }

/* the 12-column page */
.p-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: calc(20 * var(--u));
  row-gap: calc(var(--gap) * var(--u));
  align-items: start;
  width: calc(1440 * var(--u));
  margin-inline: auto;
  padding: calc(var(--gap) * var(--u)) calc(var(--side) * var(--u)) calc(var(--gap) * 1.5 * var(--u));
}
.p-grid > * { grid-column: var(--c, 1 / -1); min-width: 0; }
.row { display: grid; grid-template-columns: subgrid; align-items: center; }
.row > * { grid-row: 1; grid-column: var(--c, auto); min-width: 0; }
.p-grid > figure > img, .p-grid > img, .row > figure > img, .row > img, .panel > img { width: 100%; height: auto; }

/* placement helpers */
.p-grid > .group, .row > .group { justify-self: start; margin-left: calc((100% - var(--gw) * var(--u)) / 2); }  /* centred */
.p-grid > .group.to-end, .row > .group.to-end { margin-left: 0; justify-self: end; }
.to-end { justify-self: end; }
.self-end { align-self: end; }
.pull { margin-top: calc(var(--pull) * -1 * var(--u)); }            /* overlaps the block above */
.bleed-l { margin-left: calc(var(--side) * -1 * var(--u)); }       /* reaches the left edge of the window */
.bleed-r { margin-right: calc(var(--side) * -1 * var(--u)); }      /* reaches the right edge of the window */
.z1 { z-index: 1; } .z2 { z-index: 2; } .z3 { z-index: 3; } .z4 { z-index: 4; }
.p-grid > .at { grid-column: 1 / -1; justify-self: start; margin-left: calc((var(--gx) - var(--side)) * var(--U)); }
.fw { width: calc(var(--fw) * var(--U)); max-width: none; }
.fw > img { width: 100%; height: auto; }
.p-grid figcaption { margin-top: calc(24 * var(--u)); font-size: max(14px, calc(20 * var(--u))); line-height: 1.2; }

/* white square with a thin grey border, the posters change inside it */
.frame { background: #fff; border: 1px solid #807d7d; }
.el.frame > .swap { position: absolute; left: 9.84%; top: 8.51%; width: 78.69%; height: 82.97%; }

/* typeface specimen written in the font itself */
.type-specimen { display: grid; justify-items: center; text-align: center; color: var(--accent); }
.type-specimen p { text-align: center; }
.serif { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; }
.type-aa { font-size: calc(170 * var(--u)); line-height: 1.15; }
.type-name { font-size: max(14px, calc(20 * var(--u))); line-height: 2; }
.type-abc { width: calc(296 * var(--u)); font-size: max(18px, calc(32 * var(--u))); line-height: 1.25; margin-top: calc(26 * var(--u)); overflow-wrap: anywhere; }

/* colour swatches */
.swatches { display: flex; gap: calc(9 * var(--u)); }
.swatch {
  flex: 1; aspect-ratio: 164 / 163; border-radius: 2px;
  padding: calc(78 * var(--u)) 0 0 calc(26 * var(--u));
  font-weight: 400; font-size: max(13px, calc(20 * var(--u))); line-height: 1.2; text-align: left;
}

/* PREVIOUS / NEXT: together in the middle (desktop), at the right edge under the thumb (phones) */
.pager { display: flex; justify-content: center; gap: calc(140 * var(--u)); }
.pager a {
  font-size: max(24px, calc(48 * var(--u)));
  line-height: 1.2;
  color: var(--accent);
}

/* pictures that change (satire mockups, van gogh pairs) — instant switch, no fade */
.swap:not(.el) { position: relative; }
.swap > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  visibility: hidden;
}
.swap > img.is-active { visibility: visible; }
.swap.contain > img { object-fit: contain; }
.frame > .swap > img { object-fit: contain; }

/* ---------- scroll animations -------------------------------------------- */
/* elements with data-reveal appear when scrolled into view (see js/main.js) */
.js [data-reveal] {
  opacity: 0;
  transition: opacity .8s ease, translate .9s var(--ease);
}
.js [data-reveal="up"] { translate: 0 calc(90 * var(--u)); }
.js [data-reveal="from-right"] { translate: calc(260 * var(--u)) 0; }
.js [data-reveal="fade"] { translate: none; }
.js [data-reveal="pop"] {                         /* pops up (book covers) */
  translate: 0 calc(120 * var(--u)); scale: .86;
  transition: opacity .6s ease, translate 1s var(--ease), scale 1s var(--ease);
}
.js [data-reveal].is-visible { opacity: 1; translate: 0 0; scale: 1; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; translate: none; scale: none; transition: none; }
  .gallery-item, .gallery-caption, .tile-label { transition: none; }
  .gif { animation-duration: 1ms; }
}

/* ==========================================================================
   Phones (≤ 760 px): single column
   ========================================================================== */
@media (max-width: 760px) {
  .t20 { font-size: 16px; }
  .t16 { font-size: 15px; }
  p { hyphens: auto; }
  .title { font-size: 24px; }

  /* project header re-flows */
  .flow {
    width: auto;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 48px var(--pad) 40px;
  }
  .flow > .el { position: relative; left: auto; top: auto; width: auto; height: auto; }
  .flow > .el.logo, .screen > .el.logo { width: 150px; align-self: center; margin-bottom: 12px; }
  .logo img { height: auto; }
  .hero .meta { justify-content: flex-start; flex-wrap: wrap; gap: 16px 32px; font-size: 13px; }
  .flow > .year { margin-top: -20px; }

  .bar { height: 52px; }
  .bar-inner { width: auto; }
  .bar .menu { left: 0; right: 0; translate: 0 -50%; justify-content: space-around; gap: 0; font-size: 14px; }
  .page-project .site { padding-bottom: 52px; }

  /* the 12-column page becomes one column */
  .p-grid {
    display: flex;
    flex-direction: column;
    gap: 36px;
    width: auto;
    padding: 36px var(--pad) 56px;
  }
  .p-grid .row { display: flex; flex-direction: column; align-items: stretch; gap: 28px; }
  .p-grid .pull { margin-top: 0; }
  .p-grid .bleed-l { margin-left: calc(-1 * var(--pad)); }
  .p-grid .bleed-r { margin-right: calc(-1 * var(--pad)); }
  .p-grid > .at { margin-left: 0; }
  .p-grid .fw { width: auto; align-self: stretch; }
  .p-grid .wide { margin-inline: calc(-1 * var(--pad)); }
  .p-grid .panel { padding: 32px var(--pad); margin-inline: calc(-1 * var(--pad)); min-height: 0; }
  .p-grid .panel.center { padding-block: 72px; }
  .inner { width: auto; }

  /* collages keep their composition, edge to edge, scaled to the phone width
     (--mw / --mx = which part of a very wide collage is shown) */
  .p-grid .group, .p-grid .group.to-end {
    --u: calc(100cqw / var(--mw, var(--gw)));
    margin-left: calc(-1 * var(--pad) - var(--mx, 0) * var(--u));
    align-self: flex-start;
  }

  /* "collage" groups don't shrink on phones: their pieces go one under another
     (m-half = half width, side by side; m-hide = not shown on phones) */
  .p-grid .group.collage {
    --u: var(--U);
    display: flex; flex-wrap: wrap; gap: 20px 12px;
    width: auto; height: auto; margin-left: 0; margin-top: 0; align-self: stretch;
  }
  .p-grid .collage > .el { position: relative; left: auto; top: auto; width: 100%; height: auto; aspect-ratio: var(--w) / var(--h); }
  .p-grid .collage > .m-half { width: calc(50% - 6px); }
  .p-grid .collage > .m-hide { display: none; }
  .p-grid .collage > .panel { width: calc(100% + 2 * var(--pad)); aspect-ratio: auto; }
  .p-grid .collage > .tilt { --u: calc((100cqw - 2 * var(--pad)) / var(--w)); }
  .type-aa { font-size: 96px; }
  .type-abc { width: 240px; font-size: 22px; }
  .swatch { padding: 40% 0 0 12px; font-size: 13px; }

  .specimen { width: min(240px, 65%) !important; height: auto; }
  .panel .specimen { margin-inline: auto; }

  .p-grid .pager { align-self: stretch; justify-content: flex-end; gap: 32px; }

  /* one-screen pages */
  .page-screen .site { padding-bottom: 52px; }        /* room for the white menu bar */
  .screen {
    width: auto;
    height: auto;
    min-height: calc(100svh - 52px);
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 24px var(--pad) 32px;
  }
  .screen > .el {
    position: relative;
    left: auto; right: auto; top: auto; bottom: auto;
    width: auto; height: auto;
  }
  .screen > .gallery {
    --gfw: 390; --gfh: 470; --u: calc(100cqw / 390);
    width: auto; height: auto; aspect-ratio: 390 / 470;
    margin: auto calc(-1 * var(--pad));
  }
  .gallery-caption { font-size: 13px; }

  .grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: auto; gap: 18px 12px; }
  .tile { overflow: visible; background: none; }
  .tile img { aspect-ratio: 329 / 303; height: auto; background: #f2f2f2; }
  .tile-label { position: static; opacity: 1; background: none; color: #000; padding: 6px 0 0; font-size: 12px; }

  .about-photo { width: 60% !important; aspect-ratio: 247 / 226; }
  .email { white-space: normal; font-size: 18px; overflow-wrap: anywhere; }
  .gif { width: 110px !important; aspect-ratio: 1; }
}
