/* Faulk Photography - flat dark theme, CSS-column masonry, dialog lightbox. */

:root {
  --bg: #0a0a0a;
  --fg: #e6e4e1;
  --muted: #7d7873;
  --accent: #6db6e5;
  --gap: 14px;
  --edge: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  border: 0;
}

a {
  color: var(--fg);
  text-decoration-color: color-mix(in srgb, var(--fg) 40%, transparent);
  text-underline-offset: 3px;
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 12px 18px;
  background: var(--fg);
  color: var(--bg);
}

.skip-link:focus {
  left: 0;
}

/* ---------- masthead ---------- */

.masthead {
  padding: clamp(36px, 7vw, 88px) var(--edge) clamp(28px, 5vw, 56px);
  text-align: center;
}

.masthead .mark {
  width: clamp(150px, 26vw, 250px);
  height: auto;
  opacity: 0.85;
}

.masthead h1 {
  margin: 14px 0 0;
  font-size: clamp(15px, 2.4vw, 20px);
  font-weight: 300;
  letter-spacing: 0.34em;
  text-indent: 0.34em; /* balances the trailing letter-space */
  text-transform: uppercase;
  color: var(--fg);
}

/* ---------- masonry grid ---------- */

/* CSS columns keep every photo at its natural aspect ratio with no cropping and
   no layout JavaScript. Photos flow down each column, then across. */
.grid {
  padding: 0 var(--edge);
  column-count: 1;
  column-gap: var(--gap);
}

@media (min-width: 560px) {
  .grid {
    column-count: 2;
  }
}

@media (min-width: 900px) {
  .grid {
    column-count: 3;
  }
}

@media (min-width: 1400px) {
  .grid {
    column-count: 4;
  }
}

@media (min-width: 1900px) {
  .grid {
    column-count: 5;
  }
}

.tile {
  display: block;
  width: 100%;
  margin: 0 0 var(--gap);
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

.tile picture {
  display: block;
}

.tile img {
  display: block;
  width: 100%;
  height: auto;
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease);
}

.tile:hover img,
.tile:focus-visible img {
  opacity: 0.72;
  transform: scale(1.012);
}

/* ---------- colophon ---------- */

.colophon {
  padding: clamp(40px, 7vw, 80px) var(--edge) clamp(32px, 5vw, 56px);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.05em;
}

.colophon p {
  margin: 0;
}

.colophon a {
  color: var(--muted);
}

/* ---------- lightbox ---------- */

html:has(.lightbox[open]) {
  overflow: hidden;
}

.lightbox {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 97%, transparent);
  color: var(--fg);
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.94);
}

.lightbox:not([open]) {
  display: none;
}

.lb-track {
  display: flex;
  height: 100%;
  transform: translate3d(calc(var(--offset, 0px) - var(--index, 0) * 100%), 0, 0);
  transition: transform 0.4s var(--ease);
  will-change: transform;
}

.lb-track.is-dragging {
  transition: none;
}

.lb-slide {
  display: flex;
  flex: 0 0 100%;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: clamp(12px, 3vw, 44px);
  padding-bottom: clamp(52px, 7vw, 76px); /* clear of the counter */
}

/* picture is inline by default, which would shrink-wrap the photo and make
   the percentage sizing below resolve to its natural size. */
.lb-slide picture {
  display: block;
  width: 100%;
  height: 100%;
}

/* Scaling to fill the stage keeps older, smaller exports from floating in the
   middle of a large screen, the way the original site sized every photo to a
   fixed height. object-fit preserves the aspect ratio at any size. */
.lb-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Navigation controls */

.lb-nav,
.lb-close {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s var(--ease);
}

.lb-nav:hover,
.lb-close:hover,
.lb-nav:focus-visible,
.lb-close:focus-visible {
  opacity: 1;
}

.lb-nav[disabled] {
  opacity: 0.12;
  cursor: default;
}

.lb-nav {
  top: 0;
  bottom: 0;
  width: clamp(52px, 10vw, 110px);
}

.lb-prev {
  left: 0;
}

.lb-next {
  right: 0;
}

/* Chevrons and the close cross are drawn in CSS, so the lightbox needs no icon
   assets and stays crisp at any size. */
.lb-nav::before {
  content: "";
  width: 17px;
  height: 17px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.lb-prev::before {
  transform: rotate(-135deg);
  margin-left: 6px;
}

.lb-next::before {
  transform: rotate(45deg);
  margin-right: 6px;
}

.lb-close {
  top: clamp(8px, 2vw, 20px);
  right: clamp(8px, 2vw, 20px);
  width: 48px;
  height: 48px;
}

.lb-close::before,
.lb-close::after {
  content: "";
  position: absolute;
  width: 21px;
  height: 2px;
  background: currentColor;
}

.lb-close::before {
  transform: rotate(45deg);
}

.lb-close::after {
  transform: rotate(-45deg);
}

.lb-count {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: clamp(14px, 2.5vw, 26px);
  margin: 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--muted);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .tile img,
  .lb-track,
  .lb-nav,
  .lb-close {
    transition: none;
  }

  .tile:hover img,
  .tile:focus-visible img {
    transform: none;
  }
}
