/* ============================================================
   BOARDSHORT PHOTOGRAPHY — style.css
   ============================================================

   QUICK REFERENCE — things you'll want to tweak:

   COLOURS         → :root variables at the top
   FONTS           → :root --font-serif and --font-mono
   THUMBNAIL SIZE  → edit THUMB_H / THUMB_H_SM in site.js
   THUMBNAIL RATIO → currently 4:3 — change (4/3) in initGrid() in site.js
   THUMB GAP       → edit THUMB_GAP in site.js (px between thumbnails/rows)
   HERO HEIGHT     → .hero img / .hero video → height: clamp(...)
   SPACING         → header/timeline/footer padding values
   CC LICENSE      → footer in index.html
   WATERMARK TEXT  → .thumb-watermark in makeThumb() in site.js
   ============================================================ */


/* ── RESET & BASE ─────────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  min-height: 100vh;
  overflow-x: hidden;
}


/* ── DESIGN TOKENS ────────────────────────────────────────── */

:root {
  /* Colours */
  --bg:         #f7f5f0;   /* warm off-white page background  */
  --ink:        #1a1814;   /* near-black body text            */
  --ink-light:  #7a7570;   /* secondary / date text           */
  --ink-faint:  #c8c4bc;   /* borders, dividers               */
  --accent:     #c8834a;   /* sunrise/sunset tag colour       */

  /* Typography */
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-mono:  'Geist Mono', 'Courier New', monospace;

  /* Grid — set by JS at runtime based on screen size */
  --thumb-w:   107px;  /* 4:3 ratio of --thumb-h (80px) — updated by JS */
  --thumb-h:   80px;   /* fixed row height — updated by JS              */
  --thumb-gap: 2px;    /* gap between thumbnails within a row            */
  --row-gap:   4px;    /* gap between rows                               */
}


/* ── HEADER ───────────────────────────────────────────────── */

header {
  padding: 52px 48px 36px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink-faint);
}

.site-title {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.site-subtitle {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-light);
  letter-spacing: 0.08em;
}


/* ── HERO IMAGE ───────────────────────────────────────────── */

.hero {
  padding: 0;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  height: clamp(320px, 52vh, 640px);
}

/* Two layers sit on top of each other — one fades in as the other fades out */
.hero-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
}

.hero-layer.active  { opacity: 1; }
.hero-layer.preload { opacity: 0; } /* loading next image silently */

.hero-layer img,
.hero-layer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero:hover .hero-layer.active img,
.hero:hover .hero-layer.active video {
  /* subtle brightness lift on hover */
  filter: brightness(1.04);
  transition: filter 0.4s;
}

.hero-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 48px 20px;
  background: linear-gradient(transparent, rgba(26,24,20,0.75));
  color: #f7f5f0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  z-index: 10;
  pointer-events: none;
}
.hero-meta-click {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}


.hero-caption {
  font-size: clamp(1rem, 2.2vw, 1.5rem);
  font-style: italic;
  font-weight: 300;
  max-width: 60%;
  line-height: 1.35;
}

.hero-data {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  text-align: left;
  line-height: 1.9;
  opacity: 0.85;
}

.hero-tag {
  position: absolute;
  top: 48px;
  right: 48px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  padding: 3px 8px;
  z-index: 10;
  transition: background 0.8s ease;
}

/* Sunrise — tag + copy both left */
.hero.is-sunrise .hero-tag    { left: 48px; right: auto; }

/* Sunset — tag + copy both right */
.hero.is-sunset .hero-tag     { right: 48px; left: auto; }
.hero.is-sunset .hero-meta    { align-items: flex-end; }
.hero.is-sunset .hero-caption { text-align: right; }
.hero.is-sunset .hero-data    { text-align: right; }


/* ── TIMELINE ─────────────────────────────────────────────── */

.timeline {
  padding: 0 48px 80px;
}

/* Week block — groups 1–7 days under one header */
.week-block {
  margin-top: 32px;
}

.week-block:nth-child(1) { animation: fadeUp 0.4s ease both 0.05s; }
.week-block:nth-child(2) { animation: fadeUp 0.4s ease both 0.15s; }
.week-block:nth-child(3) { animation: fadeUp 0.4s ease both 0.25s; }

/* Week header — sits above the first row of the week */
.week-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 28px 0 10px;
  border-top: 1px solid var(--ink-faint);
}

.week-date {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--ink-light);
}


/* ── CONTACT STRIP ────────────────────────────────────────── */
/*
  One row per day. Sunrise thumbnails fill from the LEFT.
  Sunset thumbnails fill from the RIGHT.
  The gap between them is pure white space.
*/

.contact-strip {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: var(--thumb-h);
  margin-bottom: 4px;
  overflow-x: hidden;
  overflow-y: hidden;
  flex-wrap: nowrap;
  gap: var(--thumb-gap);
}

.cluster-sunrise,
.cluster-sunset {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  flex-wrap: nowrap;
  gap: var(--thumb-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.cluster-sunrise::-webkit-scrollbar,
.cluster-sunset::-webkit-scrollbar  { display: none; }

.gap-zone {
  flex-grow: 0;
  flex-shrink: 0;
  min-width: var(--thumb-w);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 8px;
}

/* Inner wrapper — column by default (1 slot: all stacked) */
.gz-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.gz-date {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Counts row — horizontal by default (2+ slots) */
.gz-counts {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.gz-pill {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* 1 slot: stack the counts too */
[data-slots="1"] .gz-counts {
  flex-direction: column;
  gap: var(--thumb-gap);
}

/* 3+ slots: date and counts on the same line */
[data-slots="3"] .gz-inner {
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}
[data-slots="3"] .gz-date::after {
  content: ' ·';
  opacity: 0.5;
}


/* ── THUMBNAILS ───────────────────────────────────────────── */
/*
  Fixed 4:3 ratio (--thumb-w × --thumb-h).
  object-fit: cover fills the frame regardless of original crop.
*/

.thumb-wrap {
  position: relative;
  width: var(--thumb-w);
  min-width: var(--thumb-w);
  max-width: var(--thumb-w);
  height: var(--thumb-h);
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
  background: #1a1814;
}

.thumb-wrap img,
.thumb-wrap video,
.thumb-wrap .video-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: opacity 0.22s, transform 0.28s;
  transform-origin: bottom center;
}

.thumb-wrap:hover img,
.thumb-wrap:hover video {
  opacity: 0.82;
  transform: scaleY(1.03);
}

.video-placeholder { background: #1a1814; }

/* Suppress iOS native video play button overlay */
.thumb-wrap video::-webkit-media-controls,
.thumb-wrap video::-webkit-media-controls-overlay-play-button,
.thumb-wrap video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
  appearance: none;
}

/* Video play badge — CSS border triangle, identical on all platforms */
.thumb-wrap.is-video::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-38%, -50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent rgba(255,255,255,0.88);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.55));
  pointer-events: none;
  z-index: 1;
}

/* Wraps lb-img and lb-video — watermark is positioned inside image bounds */
#lb-media-wrap {
  position: relative;
  line-height: 0;
}

/* Lightbox watermark — horizontally centered, 15px from bottom of image */
.lb-watermark {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}



/* Sunrise / sunset tag — appears on hover */
.thumb-tag {
  position: absolute;
  top: 3px;
  left: 3px;
  font-family: var(--font-mono);
  font-size: 0.42rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.thumb-wrap:hover .thumb-tag { opacity: 1; }
.thumb-tag.sunrise { background: rgba(248,210,140,0.92); color: #5a3a00; }
.thumb-tag.sunset  { background: rgba(200,100,60,0.88);  color: #fff; left: auto; right: 3px; }


/* ── LIGHTBOX ─────────────────────────────────────────────── */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20,18,14,0.97);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox.open { display: flex; }

.lb-media {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  display: block;
}

#lb-video {
  width: min(92vw, calc(78vh * 16 / 9));
  aspect-ratio: 16 / 9;
}

.lb-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 24px;
  pointer-events: none;
}

.lb-arrow {
  pointer-events: all;
  background: none;
  border: 1px solid rgba(247,245,240,0.2);
  color: rgba(247,245,240,0.7);
  font-family: var(--font-mono);
  font-size: 1rem;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.lb-arrow:hover {
  border-color: rgba(247,245,240,0.6);
  color: #f7f5f0;
  background: rgba(247,245,240,0.06);
}

.lb-arrow:disabled { opacity: 0.15; cursor: default; }

.lb-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: rgba(247,245,240,0.5);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  padding: 6px 10px;
  transition: color 0.2s;
}

.lb-close:hover { color: #f7f5f0; }

.lb-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 48px 32px;
  background: linear-gradient(transparent, rgba(20,18,14,0.9));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.lb-caption {
  color: #f7f5f0;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-style: italic;
  font-weight: 300;
  max-width: 55%;
  line-height: 1.4;
}

.lb-meta {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: rgba(247,245,240,0.7);
  text-align: right;
  line-height: 2;
}

.tag-pill {
  display: inline-block;
  padding: 2px 7px;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.tag-pill.sunrise { background: rgba(248,210,140,0.8); color: #5a3a00; }
.tag-pill.sunset  { background: rgba(200,100,60,0.8);  color: #fff;    }

.lb-counter {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: rgba(247,245,240,0.35);
  letter-spacing: 0.1em;
}


/* ── LOADING / EMPTY STATE ────────────────────────────────── */

.loading-state {
  padding: 80px 48px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
}


/* ── FOOTER ───────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--ink-faint);
  padding: 24px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
}

.cc-link {
  color: var(--ink-faint);
  text-decoration: none;
  letter-spacing: 0.1em;
  transition: color 0.2s;
}
.cc-link:hover { color: var(--ink-light); }

/* ── ORDER PRINT BADGE ────────────────────────────────────── */

.lb-print {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247,245,240,0.45);
  text-decoration: none;
  border: 1px solid rgba(247,245,240,0.2);
  padding: 5px 12px;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.lb-print:hover {
  color: rgba(247,245,240,0.9);
  border-color: rgba(247,245,240,0.5);
}

/* ── ABOUT OVERLAY ────────────────────────────────────────── */

.about-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,18,14,0.85);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.about-overlay.open { display: flex; }

.about-box {
  position: relative;
  max-width: 560px;
  width: 100%;
  background: #1a1814;
  border: 1px solid rgba(247,245,240,0.1);
  padding: 52px 48px 40px;
  color: rgba(247,245,240,0.8);
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  font-weight: 300;
  line-height: 1.75;
}
.about-box p { margin: 0 0 1.2em; }
.about-box p:last-child { margin-bottom: 0; }

.about-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: rgba(247,245,240,0.4);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}
.about-close:hover { color: rgba(247,245,240,0.9); }


/* ── RESPONSIVE ───────────────────────────────────────────── */
/*
  --slot-w and --thumb-h are computed by JS at load and on resize.
  These breakpoints only adjust padding and chrome, not the grid.
*/

/* iPad portrait and smaller */
@media (max-width: 1023px) {
  header                          { padding: 32px 24px 24px; }
  .timeline, footer               { padding-left: 24px; padding-right: 24px; }
  .hero-meta                      { padding-left: 24px; padding-right: 24px; }
  .hero-tag                       { top: 24px; right: 24px; }
  .hero.is-sunrise .hero-tag      { left: 24px; right: auto; }
  /* contact-strip scroll already set in base styles */
}

/* iPhone */
@media (max-width: 599px) {
  .hero                           { height: 75vw; }
  header                          { padding: 22px 16px 16px; flex-direction: column; gap: 4px; }
  .timeline, footer               { padding-left: 16px; padding-right: 16px; }
  .hero-meta                      { padding-left: 16px; padding-right: 16px; }
  .hero-tag                       { top: 16px; right: 16px; }
  .hero-caption                   { max-width: 100%; font-size: 1rem; }
  .hero.is-sunrise .hero-tag      { left: 16px; right: auto; }
  .hero.is-sunset .hero-tag       { right: 16px; left: auto; }
  .lb-info                        { flex-direction: column; align-items: flex-start; padding: 16px 16px 24px; }
  .lb-caption                     { max-width: 100%; margin-bottom: 8px; font-size: 1rem; }
  .lb-meta                        { text-align: left; }
  .lb-controls                    { padding: 0 8px; }
  .lb-arrow                       { width: 38px; height: 38px; }
  .gz-date, .gz-pill              { font-size: 0.42rem; }
}


/* ── ANIMATIONS ───────────────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
