/* ==========================================================================
   letscalebrate · Photography
   1. Fonts  2. Tokens  3. Base  4. Masthead  5. Page header  6. Filters
   7. Hero + grid  8. Footer  9. Lightbox  10. Motion preferences
   ========================================================================== */

/* 1. Fonts ------------------------------------------------------------------
   Self-hosted, so there are no third-party requests. These match the
   letscalebrate.com portfolio: Inter (variable, SIL Open Font License) for
   body and UI, Borna (commercial, Medium) for the page title, and Basier
   Square (commercial atipo font, 400 and 500) for other headings. Commercial
   fonts are used under their webfont licences. */

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Borna';
  src: url('../fonts/borna-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Basier Square';
  src: url('../fonts/basier-square-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Basier Square';
  src: url('../fonts/basier-square-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* 2. Tokens ----------------------------------------------------------------- */

:root {
  /* Palette taken from letscalebrate.com */
  --paper: #f2f5fa;
  --ink: #0a0a0b;
  --ink-soft: #333333;
  --ink-muted: #666666; /* the portfolio's #797979 is ~4:1 on paper; this keeps AA */
  --accent: #2c2c54; /* portfolio navy: headings, links, active states */
  --rule: rgb(44 44 84 / 0.18);
  --placeholder: #e1e7f1;

  --font-sans: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-title: 'Borna', 'Basier Square', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-display: 'Basier Square', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --gap: 18px;
  --radius: 2px;
  --shadow: 0 1px 2px rgb(44 44 84 / 0.05), 0 6px 16px rgb(44 44 84 / 0.07);
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

/* 3. Base ------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.arrow {
  font-size: 0.85em;
  color: var(--ink-muted);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  transform: translateY(-120%);
}

.skip-link:focus {
  transform: none;
}

/* 4. Masthead --------------------------------------------------------------- */

.masthead {
  border-bottom: 0.5px solid var(--rule);
}

.masthead-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.125rem var(--gutter);
}

/* Wordmark copied from the letscalebrate.com nav: Inter 14px, "lets" and "rate"
   in grey 400, "caleb" in near-black 500, no letter-spacing. The grey is the
   portfolio's own (#797979); as a logo it is exempt from text contrast rules. */
.masthead-title {
  display: flex;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.4286;
  letter-spacing: normal;
  text-decoration: none;
}

.wordmark-dim {
  color: #797979;
  font-weight: 400;
}

.wordmark-strong {
  color: var(--ink);
  font-weight: 500;
}

.masthead-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.97rem;
}

.masthead-nav a {
  padding-block: 0.25rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.masthead-nav a:hover,
.masthead-nav a[aria-current='page'] {
  color: var(--accent);
  border-bottom-color: currentColor;
}

/* 5. Page header ------------------------------------------------------------ */

.page {
  padding: 1.875rem var(--gutter) 2.5rem;
}

.page-header {
  max-width: 720px;
  padding-bottom: 1.125rem;
  border-bottom: 0.5px solid var(--rule);
}

h1 {
  margin: 0 0 0.625rem;
  color: var(--accent);
  font-family: var(--font-title);
  font-size: clamp(1.875rem, 1.4rem + 2vw, 2.5rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.dek {
  max-width: 600px;
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.cta {
  max-width: 600px;
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.cta a {
  color: var(--accent);
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
}

.cta a:hover {
  text-decoration-color: currentColor;
}

/* 6. Filters ---------------------------------------------------------------- */

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem 1.25rem;
  margin-top: 3rem;
  padding-bottom: 1.125rem;
  border-bottom: 0.5px solid var(--rule);
}

.filter-btn {
  padding: 0.25rem 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--ink-muted);
  font: 600 0.75rem / 1.4 var(--font-sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}

.filter-btn:hover {
  color: var(--accent);
}

.filter-btn[aria-pressed='true'] {
  color: var(--accent);
  border-bottom-color: currentColor;
}

/* 7. Hero + grid ------------------------------------------------------------ */

.gallery-hero,
.gallery-item {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--placeholder);
  border-radius: var(--radius);
}

.gallery-hero {
  margin-top: 1.25rem;
  border-radius: 3px;
  box-shadow: var(--shadow);
}

.gallery-hero img {
  width: 100%;
  /* Desktop crops the hero to a wide band; small screens show it whole. */
  max-height: min(72vh, 660px);
  object-fit: cover;
}

/* CSS columns give a masonry layout with no JavaScript. Photos flow down the
   first column, then the next: the same order a keyboard or screen reader follows. */
.gallery-grid {
  columns: 1;
  column-gap: var(--gap);
  margin-top: var(--gap);
}

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

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

.gallery-item {
  margin-bottom: var(--gap);
  break-inside: avoid;
}

.gallery-item img {
  width: 100%;
}

.gallery-hero img,
.gallery-item img {
  transition: transform 0.5s var(--ease);
}

.gallery-label {
  position: absolute;
  inset: auto 0 0;
  padding: 2.5rem 0.875rem 0.75rem;
  background: linear-gradient(transparent, rgb(10 10 11 / 0.65));
  color: #fff;
  font: 600 0.72rem / 1.4 var(--font-sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.25s;
}

@media (hover: hover) {
  .gallery-hero:hover img,
  .gallery-item:hover img {
    transform: scale(1.02);
  }

  .gallery-hero:hover .gallery-label,
  .gallery-item:hover .gallery-label {
    opacity: 1;
  }
}

.gallery-hero:focus-visible .gallery-label,
.gallery-item:focus-visible .gallery-label {
  opacity: 1;
}

.gallery-empty {
  margin: 3rem 0;
  color: var(--ink-muted);
  font-style: italic;
}

/* 8. Footer ----------------------------------------------------------------- */

.site-footer {
  padding: 3rem var(--gutter) 4rem;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.site-footer p {
  margin: 0;
}

/* 9. Lightbox --------------------------------------------------------------- */

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

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}

.lightbox::backdrop {
  background: var(--paper);
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox-figure {
  --chrome: 13rem; /* top bar + caption + (on small screens) the buttons below */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
  max-width: 100%;
  margin: 0;
  padding: 3.25rem 1rem 4rem;
}

@media (min-width: 720px) {
  .lightbox-figure {
    --chrome: 10.5rem;
    padding: 3.25rem 4.5rem 1.25rem;
  }
}

.lightbox-img {
  width: auto;
  max-width: 100%;
  max-height: calc(100dvh - var(--chrome));
  background: var(--placeholder);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  touch-action: pan-y pinch-zoom;
}

.lightbox-caption {
  min-height: 3.75rem;
  max-width: 60ch;
  text-align: center;
}

.lightbox-caption p {
  margin: 0;
}

.lightbox-caption p:empty {
  display: none;
}

.lightbox-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
}

.lightbox-text {
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.lightbox-meta,
.lightbox-count {
  color: var(--ink-muted);
  font: 500 0.8125rem / 1.6 var(--font-sans);
  letter-spacing: 0.04em;
}

.lightbox-meta {
  margin-top: 0.25rem;
}

.lightbox-count {
  position: absolute;
  top: 1.1rem;
  left: 1.25rem;
  margin: 0;
}

.lightbox-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(242 245 250 / 0.88);
  color: var(--ink);
  cursor: pointer;
}

.lightbox-btn:hover {
  background: rgb(44 44 84 / 0.1);
}

.lightbox-btn svg {
  width: 1.375rem;
  height: 1.375rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox-close {
  top: 0.375rem;
  right: 0.5rem;
}

.lightbox-prev,
.lightbox-next {
  bottom: 0.75rem;
}

.lightbox-prev {
  left: calc(50% - 3.25rem);
}

.lightbox-next {
  right: calc(50% - 3.25rem);
}

@media (min-width: 720px) {
  .lightbox-prev,
  .lightbox-next {
    top: calc(50% - 3rem);
    bottom: auto;
  }

  .lightbox-prev {
    left: 1rem;
  }

  .lightbox-next {
    right: 1rem;
  }
}

/* 10. Motion preferences ---------------------------------------------------- */

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

  .gallery-hero:hover img,
  .gallery-item:hover img {
    transform: none;
  }
}
