/* Portfolio wall. No external resources (fonts, CDNs, analytics). */

:root {
  --wall: #c9ccc7;      /* neutral concrete wall, shows in the gutters */
  --paper: #f7f7f4;     /* identity label, captions, panels */
  --ink: #1e2427;
  --pencil: #5a6266;
  --cobalt: #2b45c8;    /* focus, active filter edge, contact edge */
  --night: #121517;     /* viewer backdrop */
  --gap: 6px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --zoom: 1.06;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t: 240ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--wall); -webkit-text-size-adjust: 100%; }
html.viewer-open { overflow: hidden; }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 400 1rem/1.5 var(--sans); }

/* ---------- Masonry wall ---------- */
.wall {
  columns: 2;
  column-gap: var(--gap);
  padding: var(--gap);
  padding-bottom: calc(var(--gap) + 5.5rem); /* the floating contact control never covers the last works */
}
@media (min-width: 40rem) { .wall { columns: auto; column-width: 17rem; } }
.wall > * { break-inside: avoid; margin: 0 0 var(--gap); }

/* ---------- Identity label (first tile) ---------- */
.wall-label {
  display: inline-block;
  width: 100%;
  background: var(--paper);
  padding: 1.4rem 1.3rem 1.3rem;
}
.wall-label__name { margin: 0; font: 600 clamp(1.6rem, 1.15rem + 1.5vw, 2.2rem)/1.06 var(--serif); letter-spacing: -0.012em; }
.wall-label__business { margin: 0.3rem 0 0; font-size: 0.95rem; font-weight: 500; }
.wall-label__tagline { margin: 0.6rem 0 0; font: italic 400 1.05rem/1.35 var(--serif); }
.wall-label__preview {
  margin: 1rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid rgb(30 36 39 / 0.18);
  color: var(--pencil);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 1rem; }
.no-js .filters { display: none; }
.filter {
  min-height: 2.25rem;
  padding: 0 0.7rem;
  border: 1px solid rgb(30 36 39 / 0.28);
  background: transparent;
  color: var(--ink);
  font: 400 0.875rem/1 var(--sans);
  cursor: pointer;
}
.filter__n { color: var(--pencil); margin-left: 0.15rem; }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter[aria-pressed="true"] .filter__n { color: rgb(247 247 244 / 0.7); }
.filter:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }

/* ---------- Works ---------- */
.tile { position: relative; display: block; overflow: hidden; background: var(--paper); }
.tile[hidden] { display: none; }
.tile__open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.tile__open:focus-visible { outline: 3px solid var(--cobalt); outline-offset: -3px; }
.tile picture, .tile img { display: block; width: 100%; height: auto; }
.tile img { transform-origin: 50% 50%; transition: transform var(--t) var(--ease); }

.tile__flag,
.tile__badge {
  position: absolute;
  top: 0.5rem;
  padding: 0.2rem 0.45rem;
  font: 500 0.75rem/1.2 var(--sans);
  pointer-events: none;
}
.tile__flag { right: 0.5rem; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); }
.tile__badge { left: 0.5rem; background: var(--ink); color: var(--paper); }

.tile__label {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  max-width: calc(100% - 1.2rem);
  margin: 0;
  padding: 0.45rem 0.65rem 0.5rem;
  background: var(--paper);
  color: var(--ink);
  font: 400 0.8125rem/1.35 var(--sans);
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
  pointer-events: none;
}
.tile__title { display: block; font: italic 400 0.95rem/1.25 var(--serif); }
.tile__meta { display: block; color: var(--pencil); }
.tile__desc { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Desktop hover enlargement (real pointers only), and the same on keyboard focus. */
@media (hover: hover) and (pointer: fine) {
  .tile:hover img { transform: scale(var(--zoom)); }
  .tile:hover .tile__label { opacity: 1; transform: none; }
}
.tile:has(.tile__open:focus-visible) img { transform: scale(var(--zoom)); }
.tile:has(.tile__open:focus-visible) .tile__label { opacity: 1; transform: none; }

@media (max-width: 39.99rem) {
  .tile__flag, .tile__badge { top: 0.35rem; font-size: 0.6875rem; padding: 0.15rem 0.35rem; }
  .tile__flag { right: 0.35rem; }
  .tile__badge { left: 0.35rem; }
}

/* ---------- Viewer (tap/click to open, tap/close/Escape to close) ---------- */
.viewer {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(18 21 23 / 0.97);
  color: var(--paper);
}
.viewer::backdrop { background: rgb(18 21 23 / 0.6); }
.viewer[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
/* The stage is a fixed box between the close button and the caption; the work is
   fitted inside it whatever its shape, so tall portrait pieces never overflow. */
.viewer__stage {
  position: relative;
  min-height: 0;
  margin: max(3.75rem, env(safe-area-inset-top)) 1rem 0.5rem;
  cursor: zoom-out;
}
.viewer__stage picture { display: contents; }
.viewer__stage img,
.viewer__stage video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.viewer__stage video { cursor: auto; }
.viewer__caption {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0.6rem 1.25rem max(1.1rem, env(safe-area-inset-bottom));
  text-align: center;
}
.viewer__title { margin: 0; font: italic 400 1.1rem/1.3 var(--serif); }
.viewer__meta { margin: 0.1rem 0 0; color: rgb(247 247 244 / 0.7); font-size: 0.875rem; }
.viewer__desc { margin: 0.35rem 0 0; font-size: 0.9375rem; color: rgb(247 247 244 / 0.88); }
.viewer__close {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid rgb(247 247 244 / 0.5);
  background: rgb(18 21 23 / 0.6);
  color: var(--paper);
  font: 500 0.95rem/1 var(--sans);
  cursor: pointer;
}
.viewer__close:focus-visible { outline: 3px solid #8fa2ff; outline-offset: 2px; }

/* ---------- Floating contact control ---------- */
.contact {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}
.contact__toggle,
.contact__panel {
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-left: 4px solid var(--cobalt);
  box-shadow: 0 1px 2px rgb(30 36 39 / 0.18), 0 6px 18px rgb(30 36 39 / 0.16); /* lifts it off busy work */
}
.contact__toggle { min-height: 2.75rem; padding: 0 1.1rem; font: 500 0.95rem/1 var(--sans); cursor: pointer; }
.contact__toggle[aria-expanded="true"] { background: var(--ink); color: var(--paper); }
.contact__panel { width: min(21rem, calc(100vw - 2rem)); padding: 1.1rem 1.2rem 1rem; }
.contact__heading { margin: 0 0 0.35rem; font: 600 1.2rem/1.2 var(--serif); }
.contact__note { margin: 0; color: var(--pencil); font-size: 0.9rem; }
.contact__email { margin: 0.75rem 0 0; font-size: 1rem; overflow-wrap: anywhere; }
.contact__email a { color: var(--cobalt); text-underline-offset: 0.18em; }
.contact__pending { margin: 0.75rem 0 0; padding: 0.55rem 0.7rem; background: #ebece8; font-size: 0.875rem; }
.contact__close {
  margin-top: 0.85rem;
  min-height: 2.25rem;
  padding: 0 0.8rem;
  border: 1px solid rgb(30 36 39 / 0.25);
  background: transparent;
  color: var(--ink);
  font: 400 0.875rem/1 var(--sans);
  cursor: pointer;
}
.contact__toggle:focus-visible,
.contact__close:focus-visible,
.contact__email a:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.js .contact__panel:not(.is-open) { display: none; }
.no-js .contact__toggle, .no-js .contact__close { display: none; }

/* ---------- Reduced motion: state changes stay, movement goes ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --t: 0ms; --zoom: 1; }
}

/* Video without a poster image: a plain titled panel */
.tile__noposter {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  padding: 1rem;
  background: var(--ink);
  color: var(--paper);
  font: italic 400 1rem/1.3 var(--serif);
  text-align: center;
}
