/* Rafal Hyps photography: site styles.
   Colours, type and spacing are the variables just below; change them to restyle everything. */
:root {
  --bg: #f6f5f2;          /* warm off-white page */
  --ink: #161616;
  --soft: #4f4d49;
  --muted: #6e6c68;
  --line: #e2e0db;
  --placeholder: #e9e7e2;
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --pad: clamp(16px, 4vw, 48px);   /* page margin */
  --header: 92px;         /* height of the top bar */
  --gap: 10px;            /* space between photos */
  --row: 300px;           /* target height of a row of thumbnails */
  --bar: 64px;            /* height of the caption line under the big photo */
  --gutter: 64px;         /* side columns that hold the Prev / Next arrows */
}
@media (max-width: 899px) { :root { --gap: 6px; --row: 200px; --header: 64px; } }
@media (min-width: 1600px) { :root { --row: 340px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 300 15px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img, video, iframe { max-width: 100%; }
button { font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--ink); color: #fff; padding: 8px 14px; }
.skip:focus { left: 8px; }

/* small uppercase labels used throughout */
.nav-links a, .social a, .bar, .filters, .page-head h1, .story-meta, .credits dt, .post-meta,
.read, .pager span, .pager-all, .section-title, .details dt, .contact-form label, .about-cta, .text-link {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
}

/* ================================================================ top bar */
.site-header {
  position: relative; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px 32px;
  min-height: var(--header);
  padding: 0 var(--pad);
}
.brand { position: relative; z-index: 2; display: flex; align-items: baseline; gap: 14px; }
.brand-name { font-size: 15px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; }
.brand-tag { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
/* desktop: the signature replaces the typed name (which stays for screen readers); phones keep the typed name */
.brand-sig { display: none; }
@media (min-width: 900px) {
  .brand { align-items: center; }
  .site-header { padding-top: 18px; }
  .brand-sig { display: block; height: 54px; width: auto; mix-blend-mode: multiply; }
  .brand-name, .brand-tag { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.nav { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 6px 26px; }
.nav-links a { display: block; padding: 4px 0; color: var(--muted); border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.nav .social { display: none; }
.social { display: flex; gap: 18px; }
.social a { color: var(--muted); transition: color .2s; }
.social a:hover { color: var(--ink); }
.menu-toggle { display: none; }

main { min-width: 0; padding: 0 var(--pad); }

@media (max-width: 899px) {
  /* phones: the bar slides away while you scroll down through the photos and comes back as soon as you scroll up */
  .site-header { position: sticky; top: 0; background: var(--bg); transition: transform .3s ease; }
  .site-header.tucked { transform: translateY(-100%); }
  .brand { flex-direction: column; gap: 0; }
  .brand-name { font-size: 14px; font-weight: 600; }
  .brand-tag { font-size: 10px; letter-spacing: .26em; }
  html:not(.js) .site-header { flex-wrap: wrap; position: static; padding-block: 14px; }
  .js .menu-toggle {
    display: block; position: relative; z-index: 2; border: 0; background: none; padding: 10px 0 10px 12px;
    font-size: 12px; letter-spacing: .14em; text-transform: uppercase; cursor: pointer;
  }
  .menu-open .menu-toggle span { visibility: hidden; }
  .menu-open .menu-toggle::after { content: "Close"; position: absolute; right: 0; top: 10px; }
  .js .nav {
    position: fixed; inset: 0; z-index: 1;
    flex-direction: column; align-items: flex-start; justify-content: space-between;
    padding: 110px var(--pad) 40px; background: var(--bg);
    opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
  }
  .menu-open .nav { opacity: 1; visibility: visible; }
  .menu-open, .menu-open body { overflow: hidden; }
  .js .nav-links { flex-direction: column; }
  .js .nav-links a { font-size: 26px; letter-spacing: .06em; padding: 6px 0; color: var(--ink); border: 0; }
  .js .nav-links a[aria-current="page"] { font-style: italic; }
  .js .nav .social { display: flex; }
}

.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px;
  margin-top: 120px; padding: 22px 0 30px; border-top: 1px solid var(--line);
  font-size: 11px; letter-spacing: .04em; color: var(--muted);
}
.page-portfolio .site-footer { margin-top: 72px; }

/* ================================================================ page headings */
.page-head { max-width: 640px; margin: 24px 0 40px; }
.page-head h1 { margin: 0; font-weight: 400; color: var(--ink); }
.page-head p { margin: 14px 0 0; color: var(--soft); font-size: 17px; line-height: 1.6; }

/* ================================================================ portfolio: big photo view */
.viewer .slides { display: none; }
.js .viewer[data-view="slides"] .slides { display: block; }
.js .viewer[data-view="slides"] .thumbs { display: none; }
html:not(.js) .filters { display: none; }

/* The arrows live in fixed side columns, so they never move when a photo changes shape.
   The whole left half of the viewing area means "previous", the right half "next". */
.stage {
  position: relative;
  height: calc(100vh - var(--header) - var(--bar) - 24px);
  height: calc(100svh - var(--header) - var(--bar) - 24px);
  min-height: 320px;
  padding: 0 var(--gutter);
  touch-action: pan-y;
}
.stage-img {
  height: 100%;
  container-type: size;
  display: flex; align-items: center; justify-content: center;
}
.frame {
  position: relative; margin: 0;
  width: min(100cqw, 100cqh * var(--ar));
  aspect-ratio: var(--ar);
}
.frame img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  transition: opacity .3s ease;
  -webkit-user-drag: none; user-select: none;
}
.frame.is-fading img { opacity: 0; }

.hit {
  position: absolute; top: 0; bottom: 0; z-index: 2; width: 50%;
  display: flex; align-items: center;
  border: 0; padding: 0; background: none; color: var(--muted); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hit-prev { left: 0; justify-content: flex-start; }
.hit-next { right: 0; justify-content: flex-end; }
.hit svg {
  width: var(--gutter); height: 44px; padding: 0 14px;
  fill: none; stroke: currentColor; stroke-width: 1;
  opacity: .5; transition: opacity .2s, color .2s;
}
.stage:hover .hit svg { opacity: .8; }
.hit:hover svg, .hit:focus-visible svg { opacity: 1; color: var(--ink); }
.hit:focus-visible { outline: none; }
.hit:focus-visible svg { outline: 1px solid var(--ink); outline-offset: -2px; }

.bar {
  height: var(--bar);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 32px;
  padding: 18px var(--gutter) 0; color: var(--muted);
}
.caption, .controls { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.c-title { color: var(--ink); }
.c-project { color: var(--ink); border-bottom: 1px solid var(--line); transition: border-color .2s; }
.c-project:hover { border-color: var(--ink); }
.controls { flex-wrap: nowrap; white-space: nowrap; gap: 10px; }
.controls button, .filter {
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); transition: color .2s;
}
.controls button:hover, .filter:hover { color: var(--ink); }
.controls .count { margin: 0 14px; font-variant-numeric: tabular-nums; }
.controls .sep { color: var(--line); }
.controls .to-thumbs { color: var(--ink); }

@media (max-width: 899px) {
  .stage { height: auto; min-height: 0; padding: 0; }
  .stage-img { height: auto; container-type: normal; }
  .frame { width: min(100%, 70svh * var(--ar)); }
  .hit svg { display: none; }               /* phones: swipe, or Prev / Next below */
  .bar { height: auto; flex-direction: column; padding: 16px 0 0; }
  .controls { width: 100%; justify-content: space-between; }
  .controls .count { margin: 0 auto; }
  .controls .long { display: none; }
}

/* ================================================================ portfolio: thumbnails */
.filters { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 8px 0 26px; }
.filter { padding: 4px 0; border-bottom: 1px solid transparent; }
.filter[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.filter sup { font-size: 9px; letter-spacing: 0; margin-left: 1px; color: var(--muted); }

.grid { display: flex; flex-wrap: wrap; gap: var(--gap); transition: opacity .2s; }
.grid.is-changing { opacity: 0; }
.grid::after { content: ""; flex-grow: 999; }   /* stops the last row from stretching */
.tile {
  flex-grow: var(--ar); flex-basis: calc(var(--ar) * var(--row));
  background: var(--placeholder); overflow: hidden; cursor: pointer;
}
.tile[hidden] { display: none; }
.tile img { display: block; width: 100%; height: auto; aspect-ratio: var(--ar); transition: opacity .3s; }
.tile:hover img { opacity: .86; }
/* the photo you just came from fades up softly once, instead of carrying a frame */
.tile.is-current img { animation: tile-return 1.4s ease-out; }
@keyframes tile-return { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tile.is-current img { animation: none; } }
@media (max-width: 560px) { .tile { flex-basis: 100%; } }

/* ================================================================ cards (projects, journal) */
.card-img { display: block; overflow: hidden; background: var(--placeholder); }
.card-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
a:hover .card-img img { transform: scale(1.025); }

.project-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
.project-card { display: block; position: relative; }
.project-card .card-img { aspect-ratio: 4 / 3; }
.project-card .card-info {
  position: absolute; inset: 0; padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; color: #fff; background: rgba(16, 16, 16, .5);
  opacity: 0; transition: opacity .35s;
}
.project-card:hover .card-info, .project-card:focus-visible .card-info { opacity: 1; }
.card-title { font-size: 13px; font-weight: 400; letter-spacing: .22em; text-transform: uppercase; }
.card-year { font-size: 12px; letter-spacing: .16em; opacity: .9; }
@media (hover: none) {
  .project-card .card-info {
    position: static; opacity: 1; background: none; color: var(--ink);
    align-items: flex-start; text-align: left; padding: 12px 0 22px;
  }
  .card-year { color: var(--muted); }
}

.journal-list { display: grid; gap: 72px 40px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.post-card a { display: block; }
.post-card .card-img { aspect-ratio: 3 / 2; }
.post-meta { display: block; margin-top: 20px; color: var(--muted); }
.post-card h2 { margin: 6px 0 10px; font-size: 26px; font-weight: 300; line-height: 1.25; }
.post-card p { margin: 0; color: var(--soft); max-width: 540px; }
.read { display: inline-block; margin-top: 16px; padding-bottom: 2px; border-bottom: 1px solid var(--line); transition: border-color .2s; }
.post-card a:hover .read { border-color: var(--ink); }

/* ================================================================ project & journal pages */
.story-head { max-width: 780px; margin: 32px 0 56px; }
.story-head h1 { margin: 0; font-size: clamp(30px, 3.6vw, 48px); font-weight: 300; line-height: 1.12; letter-spacing: -.005em; }
.page-project .story-meta { margin: 14px 0 0; color: var(--muted); }
.page-post .story-meta { margin: 0 0 14px; color: var(--muted); }
.lede { margin: 22px 0 0; font-size: clamp(19px, 1.8vw, 23px); line-height: 1.5; color: var(--soft); max-width: 680px; }
.credits { display: flex; flex-wrap: wrap; gap: 16px 44px; margin: 30px 0 0; }
.credits dt { color: var(--muted); }
.credits dd { margin: 3px 0 0; font-size: 15px; }

.story-body > * + * { margin-top: 56px; }
.prose { max-width: 660px; font-size: 17px; line-height: 1.75; color: #2b2a28; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; }
.prose p:last-child { margin-bottom: 0; }
.prose h2, .prose h3, .prose h4 { margin: 2.2em 0 .8em; font-size: 12px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; }
.prose a { border-bottom: 1px solid #c9c6bf; transition: border-color .2s; }
.prose a:hover { border-color: var(--ink); }
.prose blockquote { margin: 1.6em 0; padding-left: 24px; border-left: 1px solid var(--ink); font-size: 21px; line-height: 1.5; color: var(--ink); }
.prose ul { padding-left: 1.1em; }

.media-row { display: flex; gap: var(--gap); align-items: flex-start; }
.media { margin: 0; flex: var(--ar) 1 0; min-width: 0; }
.media img { display: block; width: 100%; height: auto; background: var(--placeholder); }
.media-row.n1 .media img { width: auto; max-width: 100%; max-height: 90vh; max-height: 90svh; }
.media figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); }
.media.video video, .media.video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; background: #000; }
@media (max-width: 600px) {
  .media-row { flex-direction: column; }
  .media { width: 100%; }
  .media:has(figcaption) + .media { margin-top: 26px; }   /* a caption stays with its own photo */
  .story-body > * + * { margin-top: 36px; }
}

.pager {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 24px;
  margin-top: 110px; padding-top: 26px; border-top: 1px solid var(--line); font-size: 15px;
}
.pager span { display: block; margin-bottom: 4px; color: var(--muted); }
.pager-next { text-align: right; }
.pager-all { color: var(--muted); transition: color .2s; }
.pager a:hover, .pager-all:hover { color: var(--ink); }
@media (max-width: 600px) {
  .pager { grid-template-columns: 1fr 1fr; }
  .pager-all { grid-column: 1 / -1; grid-row: 2; text-align: center; }
}

/* ================================================================ about */
.about { display: grid; gap: 48px; }
@media (min-width: 1000px) {
  .about:has(.portrait) { grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 64px; align-items: start; }
}
.portrait { margin: 0; }
.portrait img { display: block; width: 100%; height: auto; }
.bio .lede { margin: 0 0 30px; color: var(--ink); }

.accomplishments { margin-top: 110px; max-width: 980px; }
.section-title { margin: 0 0 8px; font-weight: 400; color: var(--muted); }
.accomplishments .prose { max-width: none; }
.accomplishments .prose h2, .accomplishments .prose h3 { margin: 56px 0 14px; }
.accomplishments .media-row { margin-top: 56px; }   /* room under each caption */
.bio .media-row { margin: 36px 0 44px; }   /* a photo in the biography, set apart from the text */
@media (min-width: 601px) { .bio .media-row.n1 .media { flex: 0 1 460px; } }   /* kept modest beside the text */
ul.dated { list-style: none; padding: 0; margin: 0; }
ul.dated li {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 20px;
  padding: 14px 0; border-top: 1px solid var(--line); font-size: 16px; line-height: 1.55;
}
ul.dated li:last-child { border-bottom: 1px solid var(--line); }
.when { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { ul.dated li { grid-template-columns: 1fr; gap: 2px; } }
.about-cta { margin-top: 80px; }
.about-cta a, .text-link { border-bottom: 1px solid var(--ink); padding-bottom: 2px; }

/* ================================================================ contact */
.contact { display: grid; gap: 64px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); max-width: 1040px; }
.details { margin: 0; display: grid; gap: 26px; align-content: start; }
.details dt { color: var(--muted); }
.details dd { margin: 4px 0 0; font-size: clamp(18px, 1.9vw, 23px); }
.details a { border-bottom: 1px solid var(--line); transition: border-color .2s; }
.details a:hover { border-color: var(--ink); }
.contact-form { display: grid; gap: 22px; }
.contact-form label { display: grid; gap: 6px; color: var(--muted); }
.contact-form input, .contact-form textarea {
  font: 300 16px/1.5 var(--font); color: var(--ink); letter-spacing: 0; text-transform: none;
  border: 0; border-bottom: 1px solid #c9c6bf; padding: 8px 0; background: none; border-radius: 0;
}
.contact-form textarea { resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--ink); }
.contact-form button {
  justify-self: start; border: 1px solid var(--ink); background: none; padding: 12px 28px; cursor: pointer;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; transition: background .2s, color .2s;
}
.contact-form button:hover { background: var(--ink); color: var(--bg); }
.empty { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ================================================================ project page: text below the slideshow */
.project-info { margin-top: 96px; padding-top: 40px; border-top: 1px solid var(--line); }
.project-info .story-head { margin-top: 0; }
.project-info .story-head h2 { margin: 0; font-size: clamp(24px, 2.6vw, 34px); font-weight: 300; line-height: 1.2; }
.project-info .story-meta { margin: 12px 0 0; color: var(--muted); }
.page-project .pager { margin-top: 72px; }

/* the arrow on "All projects" / "All stories" */
.pager-all i { display: inline-block; margin-right: 6px; font-style: normal; transition: transform .2s; }
.pager-all:hover i { transform: translateX(-3px); }

/* Back-to-top arrow: appears after scrolling down a long page. It follows you down the page in the
   bottom-right corner, then comes to rest just above the footer, so it never covers the footer links.
   The negative margin keeps it from adding space to the page. */
.to-top {
  position: sticky; bottom: 24px; z-index: 40; margin: 0 0 -42px auto;
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: rgba(246, 245, 242, .92);
  color: var(--ink); font-size: 17px; line-height: 1; cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .3s, transform .3s, visibility 0s .3s, border-color .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; transition: opacity .3s, transform .3s, border-color .2s; }
.to-top:hover { border-color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .to-top, .to-top.show, .site-header { transition: none; } .to-top, .to-top.show { transform: none; } }

