/* ============================================================
   BS. minimal light-gallery portfolio
   ============================================================ */

:root {
  --bg: #faf9f6;
  --bg-2: #efece5;
  --ink: #1c1b17;
  --ink-2: #56524a;
  --ink-3: #9a958a;
  --line: #e4e0d6;
  --scrim: rgba(18, 17, 14, 0.96);
  --maxw: 1500px;
  --gut: clamp(18px, 4vw, 56px);
  --radius: 2px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "General Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

/* --- Masthead ----------------------------------------------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--gut);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease);
}

.masthead.is-scrolled {
  border-bottom-color: var(--line);
}

.mark {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}

.mark span {
  color: var(--ink-3);
}

.masthead__nav a {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-2);
  position: relative;
  transition: color 0.25s var(--ease);
}

.masthead__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.masthead__nav a:hover {
  color: var(--ink);
}

.masthead__nav a:hover::after {
  transform: scaleX(1);
}

/* --- Intro -------------------------------------------------- */
.intro {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(48px, 11vw, 132px) var(--gut) clamp(36px, 6vw, 64px);
}

.intro__title {
  margin: 0;
  font-size: clamp(2.1rem, 5.4vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.02;
  max-width: 18ch;
}

.intro__sub {
  margin: clamp(18px, 2.4vw, 28px) 0 0;
  max-width: 46ch;
  font-size: clamp(0.98rem, 1.4vw, 1.1rem);
  color: var(--ink-2);
  line-height: 1.55;
}

/* --- Filters ------------------------------------------------ */
.filters {
  position: sticky;
  top: 64px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 2.4vw, 30px);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px var(--gut);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}

.filter {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-3);
  position: relative;
  transition: color 0.25s var(--ease);
}

.filter:hover {
  color: var(--ink-2);
}

.filter.is-active {
  color: var(--ink);
}

.filter .filter__n {
  font-size: 0.6rem;
  vertical-align: super;
  margin-left: 3px;
  letter-spacing: 0;
  color: var(--ink-3);
}

.filter.is-active .filter__n {
  color: var(--ink-2);
}

/* --- Grid (masonry via columns) ----------------------------- */
.grid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px var(--gut) clamp(80px, 12vw, 140px);
  column-gap: clamp(12px, 1.6vw, 22px);
  columns: 4;
}

@media (max-width: 1240px) {
  .grid { columns: 3; }
}
@media (max-width: 860px) {
  .grid { columns: 2; }
}
@media (max-width: 540px) {
  .grid { columns: 1; }
}

.tile {
  display: block;
  width: 100%;
  break-inside: avoid;
  margin: 0 0 clamp(12px, 1.6vw, 22px);
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  position: relative;
  text-align: left;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  opacity: 1;
  transform: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

/* hidden state applied by JS only when a reveal observer is active,
   so the grid is always visible if scripting/IO is unavailable */
.tile.is-pre {
  opacity: 0;
  transform: translateY(16px);
}

.tile__media {
  display: block;
  width: 100%;
  overflow: hidden;
  background: var(--bg-2);
  border-radius: var(--radius);
  position: relative;
}

.tile__media img,
.tile__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.85s var(--ease), filter 0.6s var(--ease);
  will-change: transform;
}

.tile:hover .tile__media img,
.tile:hover .tile__media video {
  transform: scale(1.035);
}

.tile:focus-visible {
  outline: none;
}

.tile:focus-visible .tile__media {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* hover caption */
.tile__tag {
  position: absolute;
  left: 12px;
  bottom: 11px;
  z-index: 2;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fff;
  padding: 4px 9px;
  background: rgba(20, 19, 16, 0.55);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  pointer-events: none;
}

.tile:hover .tile__tag {
  opacity: 1;
  transform: none;
}

/* film marker */
.tile__film {
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fff;
  padding: 4px 8px 4px 7px;
  background: rgba(20, 19, 16, 0.5);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  pointer-events: none;
}

.tile__film svg {
  width: 8px;
  height: 8px;
  fill: #fff;
}

/* --- Footer ------------------------------------------------- */
.footer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 34px var(--gut) 48px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink-2);
}

.footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer__note {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink-3);
  max-width: 64ch;
}

.footer__mark {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.footer__mark span {
  color: var(--ink-3);
}

.footer__email {
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.3s var(--ease);
}

.footer__email:hover {
  border-color: var(--ink);
}

.footer__year {
  color: var(--ink-3);
}

/* --- Lightbox ----------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--scrim);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lb__stage {
  max-width: min(92vw, 1500px);
  max-height: 84vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.985);
  transition: transform 0.4s var(--ease);
}

.lightbox.is-open .lb__stage {
  transform: none;
}

.lb__stage img,
.lb__stage video {
  max-width: min(92vw, 1500px);
  max-height: 84vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.lb__btn {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.72);
  transition: color 0.25s var(--ease), transform 0.25s var(--ease),
    opacity 0.25s var(--ease);
}

.lb__btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lb__btn:hover {
  color: #fff;
}

.lb__close {
  top: clamp(14px, 2.4vw, 26px);
  right: clamp(14px, 2.4vw, 26px);
  width: 44px;
  height: 44px;
}

.lb__close svg {
  width: 22px;
  height: 22px;
}

.lb__prev,
.lb__next {
  top: 50%;
  width: 56px;
  height: 56px;
  margin-top: -28px;
}

.lb__prev svg,
.lb__next svg {
  width: 30px;
  height: 30px;
}

.lb__prev {
  left: clamp(6px, 2vw, 28px);
}

.lb__next {
  right: clamp(6px, 2vw, 28px);
}

.lb__prev:hover {
  transform: translateX(-3px);
}

.lb__next:hover {
  transform: translateX(3px);
}

.lb__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(16px, 3vw, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
}

.lb__caption {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.8);
}

.lb__count {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
}

/* --- Motion preferences ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .tile.is-pre {
    opacity: 1;
    transform: none;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (max-width: 540px) {
  .lb__prev,
  .lb__next {
    width: 44px;
    height: 44px;
    margin-top: -22px;
  }
  .filters {
    top: 60px;
  }
}
