/* ==========================================================================
   Piotr Wyżlic · Portfolio
   Tokens → base → background guides → intro → bar → hero → about
   → sections/projects/gallery → footer → lightbox → responsive
   ========================================================================== */

@font-face { font-family: "TeX Gyre Heros"; src: url("../assets/fonts/texgyreheros-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "TeX Gyre Heros"; src: url("../assets/fonts/texgyreheros-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "TeX Gyre Heros"; src: url("../assets/fonts/texgyreheros-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "TeX Gyre Heros"; src: url("../assets/fonts/texgyreheros-bolditalic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  /* palette (brief) */
  --ink: #191718;
  --paper: #E0E5E9;
  --signal: #F3D849;
  /* derived */
  --paper-soft: rgba(224, 229, 233, 0.62);
  --rule: rgba(224, 229, 233, 0.16);
  --guide: rgba(224, 229, 233, 0.05);
  --arc: rgba(224, 229, 233, 0.065);
  --tile: rgba(224, 229, 233, 0.035);

  --font: "TeX Gyre Heros", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* grid: 12 columns, gutters proportional so the background guides and
     the arcs drawn on them scale with the layout */
  --cols: 12;
  --gap: 1.6%;
  --side: clamp(16px, 4vw, 56px);
  --max: 1320px;
  --mod: clamp(1.25rem, 2.6vw, 2.75rem); /* vertical module for gallery shifts */
  --bar-h: 60px;

  --ease: cubic-bezier(0.77, 0, 0.18, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 24px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 16px/1.55 var(--font);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
html.with-intro:not(.is-ready) body { overflow: hidden; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--side); }
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gap); }

.label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--paper-soft);
}

.skip {
  position: fixed; top: 8px; left: 8px; z-index: 200;
  padding: 10px 14px; background: var(--signal); color: var(--ink); font-weight: 700;
  transform: translateY(-160%);
}
.skip:focus { transform: none; }

/* --------------------------------------------------------------------------
   Background guides: column guides (pairs of lines, as in InDesign) and arcs
   whose centres and radii sit on those guides. Drawn by js (drawArcs).
   -------------------------------------------------------------------------- */
.guides { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.guides__cols { height: 100%; }
.guides__cols > span { border-inline: 1px solid var(--guide); }
.guides__arcs { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.guides__arcs path, .guides__arcs line {
  fill: none; stroke: var(--arc); stroke-width: 1; vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: 0;
}
html.with-intro .guides__arcs path, html.with-intro .guides__arcs line { stroke-dashoffset: 1; }
html.with-intro.is-ready .guides__arcs path, html.with-intro.is-ready .guides__arcs line {
  stroke-dashoffset: 0; transition: stroke-dashoffset 2.6s var(--ease) calc(var(--i, 0) * 90ms + 200ms);
}

header, main, footer { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   Intro
   -------------------------------------------------------------------------- */
.intro { display: none; }
html.with-intro .intro {
  display: grid; place-items: center;
  position: fixed; inset: 0; z-index: 100;
  background: var(--ink);
  cursor: pointer;
}
html.with-intro.is-ready .intro { pointer-events: none; }
html.with-intro.is-done .intro { display: none; }

.intro__word {
  position: relative;
  font-weight: 700;
  font-size: clamp(56px, 15.5vw, 230px);
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--paper);
  white-space: nowrap;
}
.ch { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.ch > i { display: inline-block; font-style: normal; transform: translateY(105%); }
.intro.is-on .ch > i { transform: none; transition: transform 0.75s var(--ease-out) calc(var(--i) * 55ms); }

/* large thumbnails flick through behind the word */
.intro__word { z-index: 1; }
/* letters invert over the photos so the word stays readable on light images */
.intro.is-flick .intro__word { mix-blend-mode: difference; }
.intro__stack {
  position: fixed; left: 50%; top: 50%; z-index: 0;
  width: clamp(200px, 30vw, 460px); aspect-ratio: 4 / 5;
  transform: translate(-50%, -50%);
}
.intro__stack img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: rotate(var(--r)) scale(0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}
.intro__stack img.is-on { opacity: 1; transform: rotate(var(--r)) scale(1); transition: transform 0.3s var(--ease-out); }
.intro__stack.is-off img { opacity: 0; transform: rotate(0) scale(0.85); transition: opacity 0.3s, transform 0.35s var(--ease); }

.intro__curtain {
  position: fixed; inset: 0; background: var(--paper);
  transform: translateY(100%);
}
.intro.is-cover .intro__curtain { transform: translateY(0); transition: transform 0.6s var(--ease); }
.intro.is-lift { background: transparent; }
.intro.is-lift .intro__word { visibility: hidden; }
.intro.is-lift .intro__curtain { transform: translateY(-100%); transition: transform 0.75s var(--ease); }

/* --------------------------------------------------------------------------
   Bar (sticky navigation)
   -------------------------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(25, 23, 24, 0.86);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.bar.is-scrolled { border-bottom-color: var(--rule); }
html.with-intro:not(.is-ready) .bar { opacity: 0; }
html.with-intro.is-ready .bar { opacity: 1; transition: opacity 0.6s 0.5s; }

.bar__inner { display: flex; align-items: center; gap: 24px; height: var(--bar-h); font-size: 14px; }
.bar__name { font-weight: 700; white-space: nowrap; margin-right: auto; transition: color 0.2s; }
.bar__name:hover { color: var(--signal); }
.bar__nav { display: flex; gap: clamp(14px, 2.2vw, 32px); }
.bar__nav a { position: relative; padding: 6px 0; color: var(--paper-soft); transition: color 0.2s; white-space: nowrap; }
.bar__nav a:hover { color: var(--paper); }
.bar__nav a[aria-current="true"] { color: var(--paper); }
.bar__nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--signal); transform: scaleX(0); transform-origin: left; transition: transform 0.4s var(--ease);
}
.bar__nav a[aria-current="true"]::after { transform: scaleX(1); }

.bar__lang { display: flex; align-items: center; gap: 6px; margin-left: clamp(8px, 2vw, 32px); font-weight: 700; font-size: 13px; }
.bar__lang span { color: var(--rule); }
.bar__lang button { padding: 6px 2px; color: var(--paper-soft); transition: color 0.2s; }
.bar__lang button:hover { color: var(--paper); }
.bar__lang button[aria-pressed="true"] { color: var(--signal); }

.bar__toggle { display: none; font-weight: 700; font-size: 13px; padding: 8px 0; }

/* --------------------------------------------------------------------------
   Hero: PORTFOLIO fitted to the 12 columns, cut through the bowls of the O's
   so their tops read as arches
   -------------------------------------------------------------------------- */
.hero {
  --fs: 18vw; /* set by js (fitHero) */
  position: relative;
  margin-top: clamp(28px, 5vw, 72px);
  font-weight: 700;
  line-height: 1;
  color: var(--signal);
}
.hero__word { display: inline-block; font-size: var(--fs); letter-spacing: -0.045em; white-space: nowrap; transform: translateX(-0.035em); }
.hero .ch > i { transform: none; }
html.with-intro .hero .ch > i { transform: translateY(105%); }
/* the hero only rises once the curtain has left the screen */
html.with-intro.hero-in .hero .ch > i { transform: none; transition: transform 0.9s var(--ease-out) calc(var(--i) * 40ms); }

/* --------------------------------------------------------------------------
   About + contact
   -------------------------------------------------------------------------- */
.about { padding-block: clamp(36px, 6vw, 96px) clamp(64px, 10vw, 160px); row-gap: 40px; }
.about__label { grid-column: 1 / span 2; padding-top: 0.6em; }
.about__name {
  grid-column: 3 / span 9;
  margin-bottom: -16px;
  font-size: clamp(26px, 3.4vw, 50px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--signal);
}
.about__statement {
  grid-column: 3 / span 9;
  font-size: clamp(26px, 3.4vw, 50px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 400;
  text-wrap: balance;
}
.about__bio { grid-column: 3 / span 6; margin-top: -8px; font-size: 18px; line-height: 1.6; color: var(--paper-soft); }
.about__statement em { font-style: normal; color: var(--signal); }
.about__facts { grid-column: 3 / -1; display: grid; grid-template-columns: subgrid; row-gap: 32px; padding-top: 32px; border-top: 1px solid var(--rule); }
.fact { grid-column: span 3; display: grid; align-content: start; gap: 10px; }
.fact--wide { grid-column: span 4; }
.fact.fact--contact { grid-column: 1 / -1; padding-top: 28px; border-top: 1px solid var(--rule); }
.fact.fact--contact ul { display: flex; flex-wrap: wrap; gap: 10px 48px; font-size: clamp(18px, 1.6vw, 22px); }
.fact ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fact a { border-bottom: 1px solid var(--rule); transition: border-color 0.2s, color 0.2s; }
.fact a:hover { color: var(--signal); border-color: var(--signal); }
.copy { margin-left: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper-soft); }
.copy:hover { color: var(--signal); }

/* --------------------------------------------------------------------------
   Sections, projects, gallery
   -------------------------------------------------------------------------- */
.section { padding-bottom: clamp(80px, 12vw, 200px); }
.section__head { row-gap: 20px; align-items: end; padding-top: 18px; border-top: 1px solid var(--rule); margin-bottom: clamp(48px, 7vw, 112px); }
.section__name {
  grid-column: 1 / span 9;
  font-size: clamp(44px, 8.4vw, 124px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.04em;
}
.section__meta { grid-column: 10 / -1; display: grid; gap: 10px; padding-bottom: 0.5em; }
.section__intro { color: var(--paper-soft); font-size: 15px; }

.project + .project { margin-top: clamp(80px, 11vw, 176px); }
.project__head { row-gap: 18px; margin-bottom: clamp(28px, 4vw, 56px); }
.project__title { grid-column: 1 / span 5; font-size: clamp(22px, 2.3vw, 34px); font-weight: 700; line-height: 1.12; letter-spacing: -0.015em; }
.project__title .alt { display: block; font-weight: 400; color: var(--paper-soft); }
.project__body { grid-column: 7 / -1; display: grid; gap: 18px; }
.project__text { max-width: 58ch; }
.project__facts { display: flex; flex-wrap: wrap; gap: 8px 32px; font-size: 14px; }
.project__facts dt { margin-bottom: 4px; }
.project__facts dd { margin: 0; }

.gallery { row-gap: var(--mod); align-items: start; }
.shot {
  grid-column: var(--col);
  margin-top: calc(var(--shift, 0) * var(--mod));
  cursor: zoom-in;
  text-align: left;
}
.shot__frame { position: relative; display: block; overflow: hidden; background: var(--tile); aspect-ratio: var(--ar); }
.shot__frame img { width: 100%; height: 100%; object-fit: cover; }
.shot--small .shot__frame { max-width: var(--native); }

/* reveal: masks open from left to right */
html.js .shot__frame { clip-path: inset(0 100% 0 0); transition: clip-path 1.25s var(--ease) var(--delay, 0ms); }
html.js .shot__frame img { transform: scale(1.08) translateX(-2.5%); transition: transform 1.7s var(--ease-out) var(--delay, 0ms); }
html.js .shot.is-in .shot__frame { clip-path: inset(0 0 0 0); }
html.js .shot.is-in .shot__frame img { transform: none; }
.shot:hover .shot__frame img { transform: scale(1.015); transition-duration: 0.8s; transition-delay: 0ms; }
@media (prefers-reduced-motion: reduce) {
  html.js .shot__frame { clip-path: none; transition: none; }
  html.js .shot__frame img { transform: none; transition: none; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.foot { padding-block: clamp(56px, 8vw, 112px) 32px; row-gap: 40px;
  background: linear-gradient(var(--signal), var(--signal)) 50% 0 / calc(100% - 2 * var(--side)) 1px no-repeat; }
.foot__line { grid-column: 1 / span 6; color: var(--paper-soft); }
.foot__mail {
  grid-column: 1 / -1;
  font-size: clamp(30px, 6.4vw, 96px); font-weight: 700; letter-spacing: -0.04em; line-height: 1;
  overflow-wrap: anywhere;
}
.foot__mail a { transition: color 0.2s; }
.foot__mail a:hover { color: var(--signal); }
.foot__row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px 40px; align-items: baseline; padding-top: 24px; border-top: 1px solid var(--rule); font-size: 14px; }
.foot__row a:hover { color: var(--signal); }
.foot__row .top { margin-left: auto; }

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(25, 23, 24, 0.97); color: var(--paper);
}
.lightbox::backdrop { background: transparent; }
.lightbox[open] { display: grid; place-items: center; animation: fade 0.3s ease; }
.lightbox__figure { display: grid; gap: 14px; justify-items: center; padding: 64px 72px 32px; }
.lightbox__figure img { max-width: min(92vw, 1800px); max-height: calc(100dvh - 150px); width: auto; height: auto; object-fit: contain; }
.lightbox__figure figcaption { font-size: 13px; color: var(--paper-soft); text-align: center; }
.lightbox__btn { position: fixed; width: 48px; height: 48px; display: grid; place-items: center; font-size: 22px; color: var(--paper-soft); transition: color 0.2s; }
.lightbox__btn:hover { color: var(--signal); }
.lightbox__close { top: 8px; right: 8px; font-size: 30px; }
.lightbox__prev { left: 8px; top: 50%; translate: 0 -50%; }
.lightbox__next { right: 8px; top: 50%; translate: 0 -50%; }
.lightbox.is-single .lightbox__prev, .lightbox.is-single .lightbox__next { display: none; }
@keyframes fade { from { opacity: 0; } }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .bar__inner { font-size: 13px; gap: 16px; }
  .bar__nav { gap: 16px; }
}

@media (max-width: 860px) {
  .bar__nav {
    position: absolute; top: var(--bar-h); left: 0; right: 0;
    display: grid; gap: 0; padding: 8px var(--side) 24px;
    background: var(--ink); border-bottom: 1px solid var(--rule);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s, visibility 0s 0.25s;
  }
  .bar__nav.is-open { visibility: visible; opacity: 1; transform: none; transition: opacity 0.25s, transform 0.25s; }
  .bar__nav a { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; padding: 10px 0; border-bottom: 1px solid var(--rule); }
  .bar__nav a::after { display: none; }
  .bar__nav a[aria-current="true"] { color: var(--signal); }
  .bar__toggle { display: block; }
  .bar__lang { margin-left: 0; order: 2; }
  .bar__toggle { order: 3; }
}

@media (max-width: 760px) {
  :root { --cols: 4; --gap: 4%; }
  .about__label { grid-column: 1 / -1; padding: 0; }
  .about__name, .about__statement, .about__bio { grid-column: 1 / -1; }
  .about__facts { grid-column: 1 / -1; }
  .fact, .fact--wide { grid-column: 1 / -1; }
  .section__name, .section__meta, .project__title, .project__body { grid-column: 1 / -1; }
  .foot__line { grid-column: 1 / -1; }
  .shot { grid-column: 1 / -1; margin-top: 0; }
  .shot--half { grid-column: span 2; }
  .gallery { row-gap: 16px; }
  .lightbox__figure { padding: 56px 12px 24px; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 8px; translate: none; }
}
