/* Finn Murray Photography. Same system as the main site (v3): white paper, black type,
   Schibsted Grotesk plus Geist Mono, a 12-column grid and hairline rules. The photos do the talking:
   a masonry grid in natural aspect ratios and a plain white viewer. Light mode only. */

:root {
  --paper: #ffffff;
  --ink: #0b0b0b;
  --graphite: #6a6a6a;
  --rule: #e7e7e7;
  --mist: #f4f4f4;

  --sans: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: max(16px, 3vw);
  --gap: clamp(10px, 1.4vw, 20px);
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);

  color-scheme: light only;
}

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

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

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

h1,
p {
  margin: 0;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
}

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

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

.wrap {
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

/* ---------- Header: name on the left, page links on the right, as on the main site ---------- */

.top {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 16px;
  padding-top: max(20px, env(safe-area-inset-top, 0px));
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
}

.top-name {
  grid-column: 1 / 4;
  align-self: start;
  font-weight: 700;
  text-decoration: none;
}

.top-nav {
  grid-column: 10 / 13;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.top-nav a {
  text-decoration: none;
  color: var(--graphite);
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: var(--ink);
}

/* text links: the underline draws in from the left, and stays under the page you're on */
.top-name,
.top-nav a,
.foot a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.35s var(--ease), color 0.2s ease;
}

.top-name:hover,
.top-nav a:hover,
.top-nav a[aria-current="page"],
.foot a:hover,
.top-name:focus-visible,
.top-nav a:focus-visible,
.foot a:focus-visible {
  background-size: 100% 1px;
}

/* ---------- Compact bar: slides down once the header scrolls away, as on the main site ---------- */

.mini {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding-top: env(safe-area-inset-top, 0px);
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--rule);
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform 0.45s var(--ease), visibility 0s linear 0.45s;
}

.mini.on {
  transform: none;
  visibility: visible;
  transition: transform 0.45s var(--ease);
}

.mini-name {
  font-weight: 700;
  text-decoration: none;
}

.mini-nav {
  display: flex;
  gap: 22px;
}

.mini-nav a {
  position: relative;
  text-decoration: none;
  color: var(--graphite);
  transition: color 0.2s ease;
}

.mini-nav a:hover,
.mini-nav a[aria-current="page"] {
  color: var(--ink);
}

/* the underline sits under the page you're on */
.mini-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1.5px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s var(--ease);
}

.mini-nav a[aria-current="page"]::after,
.mini-nav a:hover::after {
  transform: scaleX(1);
}

/* ---------- Intro ---------- */

.intro {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 16px;
  align-items: end;
  padding-top: clamp(56px, 8vw, 128px);
  padding-bottom: clamp(32px, 4vw, 56px);
}

.intro-lede {
  grid-column: 1 / 6;
  max-width: 36ch;
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.42;
  font-weight: 500;
  letter-spacing: -0.01em;
  animation: fade 0.9s var(--ease) 0.3s both;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Work: masonry grid ---------- */

.grid {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
}

.col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.grid-note {
  color: var(--graphite);
}

.ph {
  display: block;
  text-decoration: none;
  cursor: zoom-in;
}

/* scroll reveal; site.js sets .reveal on the page and .in on each photo as it comes into view */
.reveal .ph {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.9s var(--ease), transform 1.1s var(--ease);
  transition-delay: var(--d, 0ms);
}

.reveal .ph.in {
  opacity: 1;
  transform: none;
}

.ph-frame {
  display: block;
  overflow: hidden;
  background: var(--mist);
}

.ph img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.6s var(--ease), transform 0.8s var(--ease);
}

.ph img.ok {
  opacity: 1;
}

.ph:hover img {
  transform: scale(1.02);
}

.ph-cap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--graphite);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
}

.ph-cap b {
  font-weight: 500;
  color: var(--ink);
}


.ph:hover .ph-cap,
.ph:focus-visible .ph-cap {
  opacity: 1;
  transform: none;
}

/* touch screens have no hover, so captions stay on */
@media (hover: none) {
  .ph-cap {
    opacity: 1;
    transform: none;
  }
}

/* ---------- About: a photo beside the statement, like a page in a photo book ---------- */

.about {
  padding-top: clamp(56px, 8vw, 128px);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 32px;
  align-items: start;
}

/* a tall portrait, so it takes five columns and the text sits beside it */
.about-photo {
  grid-column: 1 / 6;
  margin: 0;
  background: var(--mist);
}

.about-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.about-body {
  grid-column: 7 / 12;
  animation: fade 0.9s var(--ease) 0.35s both;
}

.about-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--graphite);
}

.about-text {
  margin-top: 14px;
  max-width: 42ch;
  font-size: clamp(16px, 1.25vw, 18px);
  line-height: 1.55;
  text-wrap: pretty;
}

/* ---------- Footer ---------- */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(96px, 12vw, 180px);
  padding-top: 16px;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  font-size: 12px;
  font-weight: 500;
  color: var(--graphite);
}

.foot a {
  color: var(--ink);
  text-decoration: none;
}

/* ---------- Viewer: the photo on white, caption and controls along the bottom ---------- */

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

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

.viewer[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  animation: fade 0.35s var(--ease);
}

.viewer-stage {
  min-height: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  overflow: hidden;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)) 0
    max(var(--gutter), env(safe-area-inset-left, 0px));
  cursor: zoom-out;
}

/* the image box fills the stage; contain fits the photo inside it, whatever its shape */
.viewer-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer-bar {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 16px;
  align-items: baseline;
  padding-top: 14px;
  padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
  font-size: 12px;
  font-weight: 500;
}

.viewer-cap {
  grid-column: 1 / 7;
}

.viewer-cap .meta {
  color: var(--graphite);
}

/* photo numbers, place and date, and the viewer's counter: the mono used for dates on the main site */
.num,
.ph-cap > span,
.viewer-count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--graphite);
}

.viewer-count {
  grid-column: 7 / 9;
}

.viewer-btns {
  grid-column: 9 / 13;
  display: flex;
  justify-content: flex-end;
  gap: 20px;
}

.viewer-btns button {
  padding: 4px 0;
  border: 0;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-size 0.35s var(--ease);
}

.viewer-btns button:hover,
.viewer-btns button:focus-visible {
  background-size: 100% 1px;
}

/* ---------- Tablet ---------- */

@media (max-width: 960px) {
  .intro-lede {
    grid-column: 1 / 10;
  }
  .about-photo,
  .about-body {
    grid-column: 1 / 13;
  }
}

/* ---------- Phone ---------- */

@media (max-width: 640px) {
  .top {
    grid-template-columns: 1fr auto;
  }
  .top-name {
    grid-column: 1;
  }
  .top-nav {
    grid-column: 2;
    align-items: flex-end;
  }
  .intro-lede {
    grid-column: 1 / 13;
  }
  .viewer-cap {
    grid-column: 1 / 10;
  }
  .viewer-count {
    grid-column: 10 / 13;
    text-align: right;
  }
  .viewer-btns {
    grid-column: 1 / 13;
    justify-content: space-between;
    margin-top: 10px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .intro-lede,
  .about-body,
  .viewer[open] {
    animation: none;
  }
  .ph img,
  .ph-cap {
    transition: none;
  }
  .ph:hover img {
    transform: none;
  }
  .mini,
  .mini.on,
  .mini-nav a::after {
    transition: none;
  }
}
