/* ==========================================================================
   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): 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.

   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;
}

/* ---------- tokens ------------------------------------------------------- */
:root {
  --font: "Helvetica Neue", "Inter", Helvetica, Arial, sans-serif;
  --ink: #080808;          /* big black words                     */
  --accent: #080808;       /* overwritten on every project page   */
  --pink: #ec80a9;         /* political satire                    */
  --cyan: #00a5c9;         /* move on                             */
  --navy: #262f63;         /* van gogh                            */

  --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; }
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; }

.big {                                               /* zielińska / about / contact / works */
  font-weight: 700;
  font-size: calc(var(--fs, 190) * var(--u));
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}
.title {                                             /* big coloured project title */
  font-weight: 700;
  font-size: calc(128 * var(--u));
  line-height: calc(135 * var(--u));
  color: var(--accent);
}

/* 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(--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(70 * 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%; translate: 0 -50%; right: calc(var(--side) * var(--u)); }
.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 – carousel of works */
.carousel-item {
  --cx: 193; --cy: 0; --cw: 248; --ch: 228;
  position: absolute;
  left: calc(var(--cx) * var(--u));
  top: calc(var(--cy) * var(--u));
  width: calc(var(--cw) * var(--u));
  height: calc(var(--ch) * var(--u));
  overflow: hidden;
  transition: left .6s var(--ease), top .6s var(--ease), width .6s var(--ease), height .6s var(--ease), opacity .4s ease;
}
.carousel-item img { width: 100%; height: 100%; object-fit: cover; }
.carousel-item[data-pos="center"] { z-index: 2; }
.carousel-item[data-pos="left"] { --cx: 0; --cy: 34; --cw: 173; --ch: 159; cursor: w-resize; }
.carousel-item[data-pos="right"] { --cx: 461; --cy: 34; --cw: 173; --ch: 159; cursor: e-resize; }
.carousel-item[data-pos="far-left"] { --cx: -153; --cy: 54; --cw: 133; --ch: 122; opacity: 0; pointer-events: none; }
.carousel-item[data-pos="far-right"] { --cx: 654; --cy: 54; --cw: 133; --ch: 122; opacity: 0; pointer-events: none; }

/* works – grid of thumbnails */
.grid {
  display: grid;
  grid-template-columns: repeat(5, calc(248 * var(--u)));
  grid-auto-rows: calc(228 * var(--u));
  column-gap: calc(20 * var(--u));
  row-gap: calc(19 * var(--u));
}
.tile { position: relative; overflow: hidden; background: #f2f2f2; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: scale .6s var(--ease); }
.tile-label {
  position: absolute; left: 0; bottom: 0;
  padding: .35em .6em;
  background: #fff;
  font-size: max(12px, calc(14 * var(--u)));
  text-transform: uppercase;
  opacity: 0; translate: 0 100%;
  transition: opacity .3s ease, translate .4s var(--ease);
}
a.tile:hover img, a.tile:focus-visible img { scale: 1.04; }
a.tile:hover .tile-label, a.tile:focus-visible .tile-label { opacity: 1; translate: 0 0; }

/* contact */
.email { font-size: max(20px, calc(40 * var(--u))); line-height: 1.2; white-space: nowrap; text-align: left; }
.email span { display: inline-block; width: calc(168 * var(--u)); }

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

.meta { display: grid; gap: 1.2em; }
.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; }

/* 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; }

/* ---------- 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].is-visible { opacity: 1; translate: 0 0; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; translate: none; transition: none; }
  .carousel-item, .tile img, .tile-label { transition: none; }
}

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

  /* 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; }
  .hero .meta { gap: 1em; }

  .bar { height: 52px; }
  .bar-inner { width: auto; }
  .bar .menu { right: var(--pad); gap: 22px; 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 .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;
  }

  .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 > .big { font-size: calc(var(--fs, 190) * (100cqw - 2 * var(--pad)) / 800); }
  .screen > .carousel { --u: calc((100cqw - 2 * var(--pad)) / var(--w)); width: 100%; height: calc(var(--h) * var(--u)); }
  .page-home .screen > .carousel { margin-block: auto; }

  .grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: auto; gap: 12px; }
  .grid > .tile { aspect-ratio: 248 / 228; }
  .tile-label { opacity: 1; translate: none; font-size: 11px; }

  .about-photo { width: 60% !important; aspect-ratio: 247 / 226; }
  .email { white-space: normal; font-size: 20px; }
  .email span { width: auto; margin-right: .5em; }
  .gif { width: 110px !important; aspect-ratio: 1; }
}
