/* ================================================================== *
 *  FIELD NOTES — a dark expedition-journal gallery
 *  Shared styles for home / categories / detail
 * ================================================================== */

:root {
  /* ink + bone + a sign-post oxblood pulled from the trail markers */
  --ink:        #0c0d0f;
  --ink-2:      #131418;
  --ink-3:      #1c1e23;
  --bone:       #ece7da;
  --bone-dim:   #9b978c;
  --bone-faint: #5d5b55;
  --line:       rgba(236, 231, 218, 0.12);
  --line-soft:  rgba(236, 231, 218, 0.07);
  --clay:       #c0512c;   /* oxblood / trail-sign accent */
  --clay-soft:  rgba(192, 81, 44, 0.16);

  --gap: 10px;

  --serif: "Fraunces", Georgia, serif;
  --sans:  "Archivo", system-ui, sans-serif;
  --mono:  "Space Mono", ui-monospace, monospace;

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

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* faint film grain over everything, fixed so the photos sit on texture */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

::selection { background: var(--clay); color: var(--bone); }

/* slim custom scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: #2c2f36; }

/* ------------------------------------------------------------------ *
 *  HEADER  — whisper-thin, blurs in on scroll
 * ------------------------------------------------------------------ */
.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding: 18px clamp(16px, 4vw, 40px) 0;
  transition: padding 0.4s var(--ease);
}
.masthead::before {
  content: "";
  position: absolute;
  inset: 0 0 -40px 0;
  background: linear-gradient(to bottom, rgba(8,9,10,0.85), rgba(8,9,10,0));
  opacity: 1;
  pointer-events: none;
}

.masthead__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.wordmark { display: flex; align-items: baseline; gap: 12px; line-height: 1; }
.wordmark__name {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(20px, 2.4vw, 27px);
  letter-spacing: -0.01em;
}
.wordmark__kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--clay);
}

.nav { display: flex; align-items: center; gap: clamp(16px, 2.5vw, 30px); }
.nav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone-dim);
  position: relative;
  padding-bottom: 4px;
  transition: color 0.25s var(--ease);
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--clay);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav a:hover { color: var(--bone); }
.nav a:hover::after,
.nav a.is-active::after { transform: scaleX(1); }
.nav a.is-active { color: var(--bone); }

/* category links live in the masthead nav (.nav a) — styled above.
   On phones the nav scrolls sideways instead of wrapping. */
@media (max-width: 760px) {
  .masthead__bar { gap: 14px; }
  .wordmark__kicker { display: none; }
  .nav {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
    gap: 16px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { font-size: 10px; }
}

/* ------------------------------------------------------------------ *
 *  HOME — full-screen horizontal filmstrip (the "inverted" gallery)
 * ------------------------------------------------------------------ */
.strip {
  display: flex;
  align-items: stretch;
  height: 100dvh;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
}
.strip::-webkit-scrollbar { display: none; }
.strip:active { cursor: grabbing; }

.slide {
  position: relative;
  height: 100dvh;
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--ink-2);
  /* desktop width is set inline by JS = 100dvh * (w / h) */
}
.slide img {
  display: block;
  height: 100%;
  width: 100%;
  object-fit: cover;
  filter: saturate(0.97);
  transition: transform 1.1s var(--ease), filter 0.6s var(--ease);
  -webkit-user-drag: none;
  user-select: none;
}
.slide:hover img { transform: scale(1.03); filter: saturate(1.07); }

.slide__cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 80px clamp(20px, 3vw, 42px) clamp(24px, 3.5vh, 40px);
  background: linear-gradient(to top, rgba(8,9,10,0.8), transparent);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  pointer-events: none;
}
.slide:hover .slide__cap { opacity: 1; transform: none; }
.slide__place {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--clay);
  margin-bottom: 9px;
}
.slide__title {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(21px, 2.4vw, 31px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.slide__view {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone);
  display: flex; align-items: center; gap: 7px;
}
.slide__view::after { content: "↗"; color: var(--clay); }

/* counter + progress, fixed bottom-right */
.counter {
  position: fixed;
  right: clamp(16px, 4vw, 40px);
  bottom: 22px;
  z-index: 90;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  display: flex;
  align-items: center;
  gap: 13px;
  pointer-events: none;
}
.counter__now { color: var(--bone); }
.counter__tot { color: var(--bone-faint); }
.counter__bar {
  width: 92px; height: 1px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.counter__bar i {
  position: absolute; inset: 0 auto 0 0;
  background: var(--clay);
  width: 10%;
  transition: width 0.3s var(--ease);
}

/* a quiet scroll hint, fades after first interaction */
.hint {
  position: fixed;
  left: clamp(16px, 4vw, 40px);
  bottom: 21px;
  z-index: 90;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-dim);
  display: flex; align-items: center; gap: 11px;
  transition: opacity 0.6s var(--ease);
}
.hint.gone { opacity: 0; pointer-events: none; }
.hint::after { content: "→"; color: var(--clay); animation: nudge 1.8s var(--ease) infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }

/* touch / phones: full height + pan the width (same as desktop).
   Landscapes overflow the screen and you scroll sideways through them;
   a gentle proximity snap settles on each photo's leading edge. */
@media (hover: none) {
  .slide__cap { opacity: 1; transform: none; }
}
@media (max-width: 640px) {
  .strip { scroll-snap-type: x proximity; cursor: default; }
  .slide { scroll-snap-align: start; }
  .slide__cap { opacity: 1; transform: none; }
  .hint { display: none; }
}

/* ------------------------------------------------------------------ *
 *  CATEGORIES — album covers
 * ------------------------------------------------------------------ */
.albums {
  padding: 150px clamp(16px, 4vw, 40px) clamp(40px, 8vw, 90px);
  max-width: 1500px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: clamp(14px, 1.6vw, 24px);
}
.album {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  isolation: isolate;
}
.album img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -2;
  transition: transform 1s var(--ease), filter 0.6s var(--ease);
  filter: saturate(0.9) brightness(0.82);
}
.album::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(8,9,10,0.92) 4%, rgba(8,9,10,0.1) 55%, rgba(8,9,10,0.35));
  transition: background 0.5s var(--ease);
}
.album:hover img { transform: scale(1.06); filter: saturate(1.05) brightness(0.9); }
.album__body { padding: clamp(18px, 2vw, 28px); }
.album__idx {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--clay);
  text-transform: uppercase;
}
.album__name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.05;
  margin: 6px 0 8px;
  letter-spacing: -0.01em;
}
.album__blurb {
  font-size: 13.5px;
  color: var(--bone-dim);
  max-width: 34ch;
  line-height: 1.5;
}
.album__count {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--bone);
}
.album__count::before {
  content: "";
  width: 22px; height: 1px; background: var(--clay);
}

/* ------------------------------------------------------------------ *
 *  PAGE HEADING (used on categories)
 * ------------------------------------------------------------------ */
.pagehead {
  padding: 132px clamp(16px, 4vw, 40px) 0;
  max-width: 1500px;
  margin: 0 auto;
}
.pagehead__eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--clay);
}
.pagehead__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.025em;
  margin-top: 10px;
}
.pagehead__title em { font-style: italic; }

/* ------------------------------------------------------------------ *
 *  DETAIL PAGE
 * ------------------------------------------------------------------ */
.viewer {
  display: grid;
  grid-template-columns: 1fr clamp(300px, 27vw, 380px);
  min-height: 100vh;
}
.viewer__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(56px, 7vw, 90px) clamp(24px, 5vw, 70px);
  background:
    radial-gradient(120% 90% at 50% 30%, var(--ink-2), var(--ink) 70%);
}
.viewer__img {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,0.8);
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.viewer__img.in { opacity: 1; transform: none; }

/* stage arrows */
.stage-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(12,13,15,0.4);
  backdrop-filter: blur(6px);
  color: var(--bone);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  z-index: 5;
}
.stage-nav:hover { background: var(--clay); border-color: var(--clay); }
.stage-nav--prev { left: clamp(14px, 2vw, 26px); }
.stage-nav--next { right: clamp(14px, 2vw, 26px); }

/* meta panel */
.panel {
  border-left: 1px solid var(--line);
  padding: clamp(78px, 9vh, 110px) clamp(24px, 2.2vw, 38px) 40px;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  position: relative;
}
.panel__idx {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--clay);
}
.panel__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 12px 0 18px;
}
.panel__desc {
  font-size: 15px;
  line-height: 1.7;
  color: #c9c4b8;
  margin-bottom: 30px;
}
.spec {
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.spec__row {
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.spec__row--full { grid-column: 1 / -1; }
.spec__k {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-faint);
  margin-bottom: 4px;
}
.spec__v {
  font-size: 14px;
  color: var(--bone);
}
.spec__v.mono { font-family: var(--mono); font-size: 12.5px; }

.tagrow { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 22px; }
.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--bone-dim);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 5px 12px;
  transition: all 0.2s var(--ease);
}
.tag:hover { color: var(--bone); border-color: var(--clay); }
.tag::before { content: "#"; color: var(--clay); }

.panel__back {
  margin-top: auto;
  padding-top: 30px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: color 0.2s var(--ease);
}
.panel__back:hover { color: var(--bone); }
.panel__back::before { content: "←"; color: var(--clay); }

@media (max-width: 860px) {
  .viewer { grid-template-columns: 1fr; }
  .viewer__stage { padding: 80px 16px 20px; }
  .viewer__img { max-height: 70vh; }
  .panel { border-left: none; border-top: 1px solid var(--line); padding-top: 34px; }
}

/* shared close button (detail) */
.closer {
  position: fixed;
  top: 16px; right: clamp(16px, 4vw, 40px);
  z-index: 200;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-dim);
  display: flex; align-items: center; gap: 8px;
  transition: color 0.2s var(--ease);
}
.closer:hover { color: var(--bone); }
.closer span { font-size: 18px; line-height: 1; }
/* in the modal the closer must sit above the overlay */
.modal .closer { z-index: 320; }

/* ------------------------------------------------------------------ *
 *  MODAL (photo opened over the filmstrip)
 * ------------------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(8, 9, 10, 0.97);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.modal[hidden] { display: none; }
.modal.open { opacity: 1; }
.modal .viewer { min-height: 100dvh; }
body.modal-open { overflow: hidden; }

.fragment-error {
  display: grid;
  place-items: center;
  min-height: 60vh;
  font-family: var(--mono);
  color: var(--bone-dim);
}

/* full /photo/<slug> page sits under the floating masthead */
.photo-page .viewer { min-height: 100dvh; }

.strip__empty {
  display: grid;
  place-items: center;
  width: 100vw;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  color: var(--bone-dim);
}

/* ------------------------------------------------------------------ *
 *  404
 * ------------------------------------------------------------------ */
.notfound {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.notfound__code {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.4em;
  color: var(--clay);
}
.notfound__title {
  font-family: var(--serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(40px, 8vw, 92px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 14px 0 10px;
}
.notfound__lead { color: var(--bone-dim); margin-bottom: 28px; }
.notfound__back {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone);
  border-bottom: 1px solid var(--clay);
  padding-bottom: 4px;
}

/* ------------------------------------------------------------------ *
 *  OVERVIEW TOGGLE (masthead)
 * ------------------------------------------------------------------ */
.masthead__right { display: flex; align-items: center; gap: clamp(14px, 2vw, 26px); }

.viewtoggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--bone-dim);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
  flex-shrink: 0;
}
.viewtoggle:hover { color: var(--bone); border-color: var(--line); }
.viewtoggle svg { width: 16px; height: 16px; fill: currentColor; grid-area: 1 / 1; }
/* show the "grid" icon while in strip mode (what a click gives you),
   the "strip" icon while in overview mode */
.viewtoggle__strip { display: none; }
body.overview-open .viewtoggle { color: var(--clay); border-color: var(--clay); }
body.overview-open .viewtoggle__grid { display: none; }
body.overview-open .viewtoggle__strip { display: block; }

/* ------------------------------------------------------------------ *
 *  OVERVIEW (contact sheet) — masonry of thumbnails
 * ------------------------------------------------------------------ */
.overview {
  display: none;
  columns: clamp(150px, 22vw, 230px);
  column-gap: 10px;
  padding: 100px clamp(12px, 3vw, 32px) 60px;
  max-width: 1700px;
  margin: 0 auto;
}
body.overview-open .overview { display: block; }
body.overview-open .strip,
body.overview-open .hint,
body.overview-open .counter { display: none; }

.thumb {
  position: relative;
  display: block;
  margin: 0 0 10px;
  break-inside: avoid;
  overflow: hidden;
  background: var(--ink-2);
  cursor: pointer;
}
.thumb img {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.95);
  transition: transform 0.6s var(--ease), filter 0.4s var(--ease);
}
.thumb:hover img { transform: scale(1.04); filter: saturate(1.08); }
.thumb__no {
  position: absolute;
  top: 8px; left: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--bone);
  background: rgba(8, 9, 10, 0.5);
  padding: 2px 7px;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.thumb:hover .thumb__no { opacity: 1; }

/* ------------------------------------------------------------------ *
 *  THUMBNAIL RAIL (in the detail modal / page)
 * ------------------------------------------------------------------ */
.railstrip {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 330;
  background: linear-gradient(to top, rgba(8, 9, 10, 0.94), rgba(8, 9, 10, 0.35));
  padding: 11px 0 13px;
  overflow-x: auto;
  scrollbar-width: none;
}
.railstrip::-webkit-scrollbar { display: none; }
.railstrip__track {
  display: flex;
  gap: 6px;
  padding: 0 clamp(12px, 3vw, 28px);
  width: max-content;
}
.railitem {
  flex: 0 0 auto;
  height: 58px;
  overflow: hidden;
  opacity: 0.5;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: opacity 0.2s var(--ease), outline-color 0.2s var(--ease);
}
.railitem img { display: block; height: 58px; width: auto; object-fit: cover; }
.railitem:hover { opacity: 0.85; }
.railitem.is-current { opacity: 1; outline-color: var(--clay); }

/* keep the rail from covering the image / "back" link */
.viewer__stage { padding-bottom: 104px; }
@media (max-width: 860px) {
  .panel { padding-bottom: 104px; }
}
