/* ==========================================================================
   Ken Altmann Photography

   Direction: a dark gallery wall. The interface is deliberately achromatic —
   every colour on the page comes from the photographs themselves. Type does
   the talking: exhibition-scale grotesque for names, a reading serif for
   Ken's own words, mono for the small factual bits a photographer's archive
   is full of.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Cool near-blacks, pulled from the blue hour in the night frames. */
  --ink:        #0a0d11;
  --ink-raised: #10151b;
  --rule:       #1c232b;
  --rule-lit:   #313b46;

  --paper:  #edeff2;
  --mute:   #939ca7;
  --faint:  #626b76;

  --display: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --text:    "Newsreader", Georgia, "Times New Roman", serif;
  --mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --pad-x:  clamp(20px, 5vw, 72px);
  --gutter: clamp(12px, 1.6vw, 24px);
  --row-gap: clamp(56px, 9vw, 132px);
  --bar-h:  62px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.65;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 1px solid var(--paper);
  outline-offset: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--paper);
  color: var(--ink);
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 12px;
}
.skip:focus { left: 12px; top: 12px; }

/* Repeated type roles ----------------------------------------------------- */

.mono {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.headline {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.88;
  margin: 0;
  text-wrap: balance;
}

.wrap { padding-inline: var(--pad-x); }

.rule-top {
  border-top: 1px solid var(--rule);
}

/* --------------------------------------------------------------------------
   3. Masthead
   -------------------------------------------------------------------------- */

.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding-inline: var(--pad-x);
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}

.masthead[data-solid="true"] {
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(14px) saturate(120%);
  border-bottom-color: var(--rule);
}

.wordmark {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.015em;
  white-space: nowrap;
  margin-right: auto;
}
.wordmark span { color: var(--mute); font-weight: 400; }

.nav {
  display: none;
  align-items: center;
  gap: 20px;
}

.nav a {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  padding-block: 6px;
  transition: color 0.25s var(--ease);
  white-space: nowrap;
}
.nav a:hover { color: var(--paper); }
.nav a[aria-current="page"] { color: var(--paper); }

.nav-divide {
  width: 1px;
  height: 14px;
  background: var(--rule-lit);
  flex: none;
}

.menu-toggle {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper);
}

@media (min-width: 1120px) {
  .nav { display: flex; }
  .menu-toggle { display: none; }
}

/* Full-screen menu -------------------------------------------------------- */

.menu {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--ink);
  padding: var(--bar-h) var(--pad-x) 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}
.menu[data-open="true"] { opacity: 1; visibility: visible; }

.menu-close {
  position: absolute;
  top: 0;
  right: var(--pad-x);
  height: var(--bar-h);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.menu-link {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-block: clamp(6px, 1.2vh, 12px);
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 8vw, 54px);
  letter-spacing: -0.035em;
  line-height: 1.02;
  color: var(--mute);
  transition: color 0.2s var(--ease);
}
.menu-link:hover,
.menu-link[aria-current="page"] { color: var(--paper); }
.menu-link em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--faint);
}

.menu-foot {
  display: flex;
  gap: 24px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.menu-foot a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

/* --------------------------------------------------------------------------
   4. Hero — one photograph, full bleed, developing up out of black
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  background: #05070a;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: develop 1900ms var(--ease) both;
}

@keyframes develop {
  from { opacity: 0; transform: scale(1.055); filter: brightness(0.28) contrast(1.55) saturate(0.35); }
  to   { opacity: 1; transform: scale(1);     filter: none; }
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(5,7,10,0.6) 0, transparent 24%),
    linear-gradient(to top,    rgba(5,7,10,0.9) 0, rgba(5,7,10,0.45) 26%, transparent 58%);
}

.hero-label {
  position: absolute;
  left: var(--pad-x);
  right: var(--pad-x);
  bottom: clamp(28px, 6vh, 62px);
  z-index: 2;
  animation: rise 1100ms var(--ease) 700ms both;
}

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

/* Everything sitting on the photograph gets lifted off it, so the small
   type stays readable wherever the picture happens to be bright. */
.hero-label .mono,
.scroll-cue { color: #c8ced6; text-shadow: 0 1px 14px rgba(0, 0, 0, 0.85); }

.hero-title {
  font-size: clamp(2.5rem, 7.6vw, 6.6rem);
  margin-block: 16px 16px;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.5);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
}
.hero-meta .dot { opacity: 0.5; }

.scroll-cue {
  position: absolute;
  right: var(--pad-x);
  bottom: clamp(28px, 6vh, 62px);
  z-index: 2;
  display: none;
  writing-mode: vertical-rl;
  letter-spacing: 0.22em;
  color: var(--mute);
  animation: rise 1100ms var(--ease) 900ms both;
}
@media (min-width: 900px) { .scroll-cue { display: block; } }

/* --------------------------------------------------------------------------
   5. Statement
   -------------------------------------------------------------------------- */

.statement {
  display: grid;
  gap: clamp(24px, 4vw, 64px);
  padding-block: clamp(72px, 12vw, 150px);
}

@media (min-width: 860px) {
  .statement { grid-template-columns: 200px minmax(0, 1fr); }
}

.statement-body {
  max-width: 40ch;
  font-size: clamp(1.2rem, 2.1vw, 1.55rem);
  line-height: 1.5;
  color: var(--paper);
  margin: 0;
}
.statement-body + .statement-body { margin-top: 1.1em; }
.statement-body em { font-style: italic; color: var(--mute); }

.statement-aside { display: flex; flex-direction: column; gap: 6px; }

/* --------------------------------------------------------------------------
   6. Collections index — the signature. Names at exhibition scale on the
      left; the photograph on the right changes as you move down the list.
   -------------------------------------------------------------------------- */

.index {
  border-top: 1px solid var(--rule);
  padding-block: clamp(48px, 7vw, 90px);
}

.index-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin-bottom: clamp(28px, 4vw, 52px);
}
.index-head h2 { font: inherit; margin: 0; color: var(--paper); }

/* A heading that sits directly above a hang, with no list beneath it. */
.index--tight { padding-bottom: 0; }
.index--tight .index-head { margin-bottom: clamp(24px, 3vw, 40px); }

.index-grid { display: grid; gap: 40px; }

@media (min-width: 940px) {
  .index-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
    gap: clamp(40px, 6vw, 90px);
    align-items: start;
  }
}

.index-list { display: flex; flex-direction: column; }

.index-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: clamp(14px, 2.2vw, 24px);
  border-top: 1px solid var(--rule);
  transition: border-color 0.3s var(--ease);
}
.index-row:last-child { border-bottom: 1px solid var(--rule); }
.index-row:hover { border-top-color: var(--rule-lit); }

/* Only ever seen below 940px, where the large preview is hidden and there is
   no hover to reveal anything — so these stay in full colour. */
.index-thumb {
  flex: none;
  width: 64px;
  height: 44px;
  object-fit: cover;
}

.index-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.75rem, 4.4vw, 3.15rem);
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--mute);
  margin-right: auto;
  transition: color 0.3s var(--ease), transform 0.4s var(--ease);
}
.index-row:hover .index-name,
.index-row:focus-visible .index-name {
  color: var(--paper);
  transform: translateX(8px);
}

.index-count { flex: none; }

.index-stage {
  display: none;
  position: sticky;
  top: calc(var(--bar-h) + 28px);
  aspect-ratio: 4 / 5;
  background: var(--ink-raised);
  overflow: hidden;
}
@media (min-width: 940px) { .index-stage { display: block; } }
@media (min-width: 940px) { .index-thumb { display: none; } }

.index-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0.6s var(--ease), transform 1.2s var(--ease);
}
.index-stage img[data-active="true"] { opacity: 1; transform: none; }

.index-stage-label {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 2;
  color: var(--paper);
  text-shadow: 0 1px 12px rgba(0,0,0,0.9);
}

/* --------------------------------------------------------------------------
   7. Collection header (gallery pages)
   -------------------------------------------------------------------------- */

.collection-head {
  padding-top: calc(var(--bar-h) + clamp(48px, 11vw, 130px));
  padding-bottom: clamp(38px, 6vw, 76px);
}

.collection-title {
  font-size: clamp(3rem, 12.5vw, 11rem);
  margin-bottom: clamp(16px, 2.4vw, 28px);
}

.collection-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 26px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.collection-blurb {
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  color: var(--mute);
  margin: 0;
  max-width: 46ch;
}

.collection-meta .mono { margin-left: auto; }

/* --------------------------------------------------------------------------
   8. The hang — justified rows. Each row's images share an exact height
      because flex-grow is set to each photograph's aspect ratio.
   -------------------------------------------------------------------------- */

.hang {
  display: flex;
  flex-direction: column;
  gap: var(--row-gap);
  padding-bottom: clamp(80px, 12vw, 160px);
}

.hang-row {
  display: flex;
  gap: var(--gutter);
  align-items: flex-start;
}

/* A photograph hung on its own gets margin on both sides, the way a single
   print gets more wall than a pair does. */
@media (min-width: 780px) {
  .hang-row[data-solo="true"] { padding-inline: 13%; }
}

.plate {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}

.plate-frame {
  display: block;
  position: relative;
  width: 100%;
  background: var(--ink-raised);
  cursor: zoom-in;
  overflow: hidden;
}

.plate-frame img {
  width: 100%;
  height: auto;
  transition: opacity 0.5s var(--ease), transform 0.9s var(--ease);
}
.plate-frame:hover img { transform: scale(1.014); }

/* Fade each photograph in as it arrives, once. */
.plate[data-seen="false"] .plate-frame img { opacity: 0; transform: translateY(12px); }
.plate[data-seen="true"]  .plate-frame img { opacity: 1; transform: none; }

.plate-label {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-top: 12px;
}

.plate-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: -0.012em;
  color: var(--paper);
}

.plate-index { margin-left: auto; }

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #05070a;
  display: grid;
  grid-template-rows: var(--bar-h) 1fr auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}
.lightbox[data-open="true"] { opacity: 1; visibility: visible; }

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-inline: var(--pad-x);
}

.lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: var(--pad-x);
  min-height: 0;
}

/* Size the photograph against the viewport rather than against its parent —
   a percentage max-height here depends on how the row happens to resolve,
   and quietly lets tall frames run underneath the caption. */
.lightbox-stage img {
  max-width: 100%;
  max-height: calc(100svh - var(--bar-h) - 132px);
  width: auto;
  height: auto;
  transition: opacity 0.25s var(--ease);
}

.lightbox-foot {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 18px var(--pad-x) clamp(20px, 4vh, 36px);
}

.lightbox-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.05rem, 2.4vw, 1.6rem);
  letter-spacing: -0.025em;
}

.lightbox-count { margin-left: auto; }

.lightbox-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  z-index: 2;
}
.lightbox-nav[data-dir="prev"] { left: 0; cursor: w-resize; }
.lightbox-nav[data-dir="next"] { right: 0; cursor: e-resize; }

/* --------------------------------------------------------------------------
   10. Editorial pages — about, contact
   -------------------------------------------------------------------------- */

.page-head {
  padding-top: calc(var(--bar-h) + clamp(48px, 11vw, 130px));
  padding-bottom: clamp(30px, 5vw, 60px);
}

.page-title {
  font-size: clamp(2.6rem, 9vw, 7rem);
}

.essay {
  display: grid;
  gap: clamp(32px, 5vw, 72px);
  padding-bottom: clamp(72px, 11vw, 150px);
  border-top: 1px solid var(--rule);
  padding-top: clamp(38px, 5vw, 70px);
}

/* Same left rail as the statement on the home page, so the two editorial
   pages sit on the site's existing rhythm rather than inventing a new one. */
@media (min-width: 900px) {
  .essay { grid-template-columns: 200px minmax(0, 1fr); }
}

.essay-body { max-width: 56ch; }
.essay-body p {
  font-size: clamp(1.12rem, 1.7vw, 1.3rem);
  line-height: 1.62;
  margin: 0 0 1.15em;
}
body[data-page="about"] .essay-body p:first-child::first-letter {
  font-family: var(--display);
  font-weight: 600;
  font-size: 3.1em;
  line-height: 0.78;
  float: left;
  padding: 0.06em 0.12em 0 0;
}

.facts { display: flex; flex-direction: column; gap: 22px; }

.fact { display: flex; flex-direction: column; gap: 5px; }
.fact a {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 500;
  border-bottom: 1px solid var(--rule-lit);
  padding-bottom: 2px;
  align-self: flex-start;
  transition: border-color 0.25s var(--ease);
}
.fact a:hover { border-bottom-color: var(--paper); }
.fact p { margin: 0; font-family: var(--display); font-size: 1.02rem; font-weight: 400; }

.portrait-plate {
  margin: 0 0 clamp(38px, 5vw, 70px);
}
.portrait-plate img { width: 100%; height: auto; }

/* The address is the whole point of the page, so it gets the full column
   rather than the reading measure the paragraph above it uses. */
body[data-page="contact"] .essay-body { max-width: none; }

.contact-intro { margin-bottom: 2em; max-width: 46ch; }

.contact-lead {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.5rem, 5vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
  word-break: break-word;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-lit);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.contact-lead:hover { border-bottom-color: var(--paper); }

/* --------------------------------------------------------------------------
   11. Next collection + footer
   -------------------------------------------------------------------------- */

.onward {
  border-top: 1px solid var(--rule);
  padding-block: clamp(38px, 6vw, 76px);
}

.onward a {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}

.onward-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 7vw, 4.6rem);
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--mute);
  transition: color 0.3s var(--ease), transform 0.4s var(--ease);
}
.onward a:hover .onward-name { color: var(--paper); transform: translateX(10px); }

.site-foot {
  border-top: 1px solid var(--rule);
  padding-block: 34px 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: baseline;
}
.site-foot a { color: var(--mute); transition: color 0.25s var(--ease); }
.site-foot a:hover { color: var(--paper); }
.site-foot .spacer { margin-left: auto; }

/* --------------------------------------------------------------------------
   12. Small screens & reduced motion
   -------------------------------------------------------------------------- */

@media (max-width: 779px) {
  .hang-row { flex-direction: column; gap: var(--row-gap); }
  .plate { width: 100%; }
  .lightbox-nav { width: 34%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
  .plate[data-seen="false"] .plate-frame img { opacity: 1; transform: none; }
  .plate-frame:hover img { transform: none; }
}
