/* =========================================================================
   Josh MacDonald
   Plain gallery-white system. The photographs are the design.
   One sans typeface, black on white, quiet text links, metadata captions.
   No accent colour, no ornament, no copy.
   ========================================================================= */

:root {
  --bg:     #ffffff;
  --ink:    #111110;
  --muted:  #7c7a74;
  --line:   rgba(0, 0, 0, 0.12);
  --sans:   "Helvetica Neue", Helvetica, Arial, -apple-system, system-ui, sans-serif;
  --gutter: clamp(1.15rem, 5vw, 4.5rem);
  --head:   58px;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
}

img { display: block; max-width: 100%; height: auto; }
a   { color: inherit; text-decoration: none; }
::selection { background: var(--ink); color: var(--bg); }

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

/* caption — the only text near the work */
.cap {
  display: flex; gap: 1.2rem; justify-content: space-between; flex-wrap: wrap;
  font-size: 0.78rem; letter-spacing: 0.01em; color: var(--muted);
  padding-top: 0.7rem;
}
.cap .t { color: var(--ink); }

/* =========================================================================
   Header — name left, three disciplines, About/Contact quiet at the side
   ========================================================================= */

.site-head {
  position: sticky; top: 0; z-index: 50;
  height: var(--head);
  display: flex; align-items: center; gap: 1.2rem 2rem;
  padding: 0 var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-size: 0.95rem; font-weight: 500; letter-spacing: 0.01em; margin-right: auto; }

.nav-main { display: flex; gap: clamp(1rem, 3vw, 2.2rem); }
.nav-main a {
  font-size: 0.95rem; color: var(--ink);
  padding-bottom: 2px; border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav-main a:hover, .nav-main a[aria-current="page"] { border-color: var(--ink); }

.nav-aux { display: flex; gap: 1rem; padding-left: 1.4rem; border-left: 1px solid var(--line); }
.nav-aux a { font-size: 0.8rem; color: var(--muted); transition: color .2s; }
.nav-aux a:hover, .nav-aux a[aria-current="page"] { color: var(--ink); }

@media (max-width: 680px) {
  .site-head { height: auto; flex-wrap: wrap; padding: 0.8rem var(--gutter); }
  .nav-main { order: 3; width: 100%; gap: 1.1rem; font-size: 0.9rem; }
  .nav-aux { border-left: 0; padding-left: 0; margin-left: auto; }
}

/* =========================================================================
   Home — three entrances, nothing else
   ========================================================================= */

.home {
  min-height: calc(100svh - var(--head));
  display: grid; place-items: center;
  padding: clamp(2rem, 5vw, 4rem) var(--gutter);
}
.entries {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  width: 100%;
  max-width: 1040px;
}
@media (max-width: 760px) { .entries { grid-template-columns: 1fr; max-width: 420px; } }

.entry-card figure { margin: 0; }
.entry-card .shot {
  aspect-ratio: 4 / 5; overflow: hidden; background: #f0efec;
}
.entry-card .shot img {
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity .4s;
}
.entry-card:hover .shot img { opacity: 0.82; }
.entry-card figcaption {
  padding-top: 0.8rem;
  display: flex; justify-content: center; text-align: center;
}
.entry-card .name { font-size: 1.05rem; }

/* =========================================================================
   Page scaffolding
   ========================================================================= */

.page { padding: clamp(2rem, 5vw, 4rem) var(--gutter) clamp(3rem, 6vw, 5rem); }
.page > h1 {
  font-size: 1.05rem; font-weight: 500; margin: 0 0 2.5rem; letter-spacing: 0.01em;
}
.sub-label {
  font-size: 0.8rem; color: var(--muted); margin: clamp(2.5rem,6vw,4rem) 0 1.2rem;
  padding-bottom: 0.7rem; border-bottom: 1px solid var(--line);
}
.sub-label:first-of-type { margin-top: 0; }

/* =========================================================================
   Motion — sub-tabs (Cinematography / Aerials) + gapless wall
   ========================================================================= */

.subnav {
  position: sticky; top: var(--head); z-index: 40;
  display: flex; gap: 1.8rem; align-items: center;
  padding: 0.9rem var(--gutter);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.subnav button {
  font-family: var(--sans); font-size: 0.95rem; color: var(--muted);
  background: none; border: 0; padding: 0 0 3px; cursor: pointer;
  border-bottom: 1px solid transparent; transition: color .2s, border-color .2s;
}
.subnav button:hover { color: var(--ink); }
.subnav button.active { color: var(--ink); border-color: var(--ink); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* embedded reel (YouTube), 16:9, sized to fit on screen and centred */
.reel {
  width: 100%;
  /* cap width from the available height so the 16:9 box never exceeds the viewport */
  max-width: calc((100svh - var(--head) - 8rem) * 16 / 9);
  margin: clamp(1rem, 3vw, 2rem) auto 0;
  padding: 0 var(--gutter);
  background: transparent;
}
.reel { margin-bottom: clamp(1.5rem, 4vw, 3rem); }
.reel .frame16 { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.reel iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.reel .frame16 > img,
.reel .frame16 > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reel-play {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2.4rem; opacity: 0.9; pointer-events: none;
}
.reel figcaption {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-top: 0.7rem; font-size: 0.78rem; color: var(--muted);
}
.reel figcaption .t { color: var(--ink); }

/* =========================================================================
   Motion — gapless thumbnail wall (Sesler); video on hover
   ========================================================================= */

.wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
@media (max-width: 900px) { .wall { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .wall { grid-template-columns: 1fr; } }

.wall-tile {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: #ececea; cursor: pointer; border: 0; padding: 0;
}
.wall-tile img, .wall-tile video, .wall-tile iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: opacity .4s;
}
.wall-tile iframe { border: 0; }
/* youtube previews are wider than the frame — scale up to hide letterbox/UI */
.wall-tile iframe { width: 300%; height: 300%; left: -100%; top: -100%; pointer-events: none; }
.wall-tile video { opacity: 0; }
.wall-tile.playing video { opacity: 1; }
.wall-tile .meta {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 0.8rem 0.9rem; text-align: left;
  display: flex; justify-content: space-between; gap: 1rem;
  color: #fff; font-size: 0.76rem;
  background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
  opacity: 0; transition: opacity .3s;
}
.wall-tile:hover .meta, .wall-tile:focus-visible .meta { opacity: 1; }
.wall-tile .meta .m { color: rgba(255,255,255,0.75); }

/* =========================================================================
   Stills — one image at a time. Snap carousel; neighbours off-screen until
   you scroll. Left project index hides on scroll, returns at the left edge.
   ========================================================================= */

.stills { position: relative; height: calc(100svh - var(--head)); overflow: hidden; }

.track {
  display: flex; height: 100%;
  overflow: hidden;                 /* no native scroll — movement is JS-driven */
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%; height: 100%;
  scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.9rem; margin: 0;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(2.5rem, 12vw, 12rem);
}
.slide img { max-height: 78%; max-width: 100%; width: auto; object-fit: contain; }
.slide .cap { padding-top: 0; justify-content: center; }

/* prev / next click zones in the side whitespace */
.edge {
  position: absolute; top: 0; bottom: 0; width: clamp(56px, 12vw, 180px);
  border: 0; background: transparent; cursor: pointer; z-index: 5;
  display: flex; align-items: center;
  color: var(--muted); font-size: 1.5rem; line-height: 1;
  opacity: 0; transition: opacity .25s, color .2s;
}
.edge.prev { left: 0; justify-content: flex-start; padding-left: 1.4rem; }
.edge.next { right: 0; justify-content: flex-end; padding-right: 1.4rem; }
.stills:hover .edge { opacity: 1; }
.edge:hover { color: var(--ink); }
@media (hover: none) { .edge { opacity: 1; } }

/* left project index */
.stills-index {
  position: absolute; left: var(--gutter); top: clamp(1.5rem, 4vw, 2.5rem);
  z-index: 8; transition: opacity .3s, transform .3s;
}
.stills-index.hidden { opacity: 0; transform: translateX(-8px); pointer-events: none; }
.stills-index ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.stills-index a { font-size: 0.82rem; color: var(--muted); transition: color .2s; }
.stills-index a:hover, .stills-index a.active { color: var(--ink); }

@media (max-width: 760px) {
  /* on small screens fall back to a simple vertical scroll of images */
  .stills { height: auto; overflow: visible; }
  .track { flex-direction: column; overflow: visible; height: auto; }
  .slide { height: auto; padding: 1.5rem var(--gutter); }
  .slide img { max-height: none; width: 100%; }
  .edge { display: none; }
  .stills-index { position: static; margin: 0 0 1.5rem; }
  .stills-index.hidden { opacity: 1; transform: none; pointer-events: auto; }
}

/* =========================================================================
   Art & Installation — plain vertical sequence of works
   ========================================================================= */

.stack { max-width: 1200px; margin: 0 auto; }
.work { margin-bottom: clamp(3rem, 8vw, 6rem); }
.work img { width: 100%; }
.work .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
@media (max-width: 620px) { .work .row { grid-template-columns: 1fr; } }

/* =========================================================================
   About — minimal facts
   ========================================================================= */

.about { max-width: 46rem; }
.about p { margin: 0 0 1.1rem; }
.cv { list-style: none; margin: 2rem 0 0; padding: 0; }
.cv li {
  display: grid; grid-template-columns: 7rem 1fr; gap: 1.2rem;
  padding: 0.7rem 0; border-top: 1px solid var(--line); font-size: 0.95rem;
}
.cv li .yr { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 480px) { .cv li { grid-template-columns: 1fr; gap: 0.2rem; } }

/* =========================================================================
   Contact — form only
   ========================================================================= */

.contact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem 2rem;
  max-width: 640px; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field.full { grid-column: 1 / -1; }
@media (max-width: 540px) { .contact-form { grid-template-columns: 1fr; } }
.field label { font-size: 0.78rem; color: var(--muted); }
.field input, .field select, .field textarea {
  font-family: var(--sans); font-size: 1rem; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  padding: 0.5rem 0; border-radius: 0; appearance: none;
}
.field textarea { resize: vertical; min-height: 5rem; line-height: 1.5; }
.field :focus { outline: none; border-color: var(--ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.submit {
  grid-column: 1 / -1; justify-self: start;
  font-size: 0.9rem; color: var(--bg); background: var(--ink);
  border: 1px solid var(--ink); cursor: pointer; padding: 0.75em 1.6em;
  transition: background .2s, color .2s;
}
.submit:hover { background: var(--bg); color: var(--ink); }

/* =========================================================================
   Footer — links only
   ========================================================================= */

.foot {
  border-top: 1px solid var(--line); margin-top: clamp(3rem, 8vw, 6rem);
  padding: 1.6rem var(--gutter);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.8rem 2rem;
  font-size: 0.78rem; color: var(--muted);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 0.8rem 1.5rem; }
.foot a { color: var(--muted); transition: color .2s; }
.foot a:hover { color: var(--ink); }
