/* ===========================================================
   August Photography — stylesheet
   Dark, quiet and minimal: the photos are the only colour.
   =========================================================== */

/* Manrope, served from this site (SIL Open Font License, see assets/fonts) */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 300; font-display: swap; src: url("../assets/fonts/manrope-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/manrope-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/manrope-latin-500-normal.woff2") format("woff2"); }

:root {
  color-scheme: dark;                     /* dark scrollbars and form controls */
  --bg: #0e0e10;
  --surface: #1a1a1e;
  --surface-2: #232329;
  --text: #f1f1ef;
  --text-muted: #96969e;
  --border: #242428;
  --accent: #d8c3a5;
  --accent-hover: #efe1cb;
  --danger: #d98b7a;
  --maxw: none;                            /* pages and galleries use the whole window width */
  --gutter: clamp(1rem, 3vw, 2.5rem);   /* side margin of the page */
  --tile-gap: 6px;                        /* between photos and tiles */
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1em; }

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

a { color: var(--accent); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

button { font: inherit; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14, 14, 16, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 1rem;
}

.brand {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand small { color: var(--text-muted); font-weight: 400; margin-left: 0.5rem; }

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }

/* Menu button: only shown on phones, and only when js/site.js has run */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -0.6rem;        /* icon lines up with the page edge */
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle svg { width: 1.5rem; height: 1.5rem; }
.nav-toggle .icon-close,
.nav.is-open .nav-toggle .icon-open { display: none; }
.nav.is-open .nav-toggle .icon-close { display: block; }
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Home: full-width photo with the name over it ---------- */
.hero {
  position: relative;
  height: clamp(420px, 72vh, 760px);
  height: clamp(420px, 72svh, 760px);
  overflow: hidden;
  background: var(--surface);
}
.hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-text {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0 0 clamp(1.5rem, 5vh, 3.5rem);
  background: linear-gradient(to top, rgba(14, 14, 16, 0.85) 0%, rgba(14, 14, 16, 0.3) 55%, transparent 100%);
  padding-top: 8rem;            /* the gradient needs room to fade out */
}
.hero-text h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  color: #fff;
}
.hero-text p {
  margin: 0.5rem 0 0;
  max-width: 44ch;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.05rem;
}
.hero-text .hero-link { font-size: 0.9rem; }
.hero-text .hero-link:empty { display: none; }

/* ---------- Sections ---------- */
.section { padding: var(--tile-gap) 0 3rem; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0 1rem;
}
.section-head h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); }
.section-head .more { font-size: 0.875rem; white-space: nowrap; }

/* ---------- Tiles: shoots and subjects (name always visible) ---------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem var(--tile-gap);
}
@media (min-width: 1100px) {
  .tile-grid-6 { grid-template-columns: repeat(6, 1fr); }   /* the six subjects in one row */
}
.tile-grid:empty::after {
  content: attr(data-empty);
  color: var(--text-muted);
}
.tile { display: block; color: var(--text); }
.tile:hover { color: var(--text); }
.tile-media {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--surface);
}
.tile-media img { width: 100%; height: 100%; object-fit: cover; }
.tile-media.is-empty::after {
  content: "No photos yet";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.3); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.tile-caption { padding: 0.6rem 0.1rem 0; }
.tile-title { display: block; font-size: 1rem; }
.tile-meta { display: block; color: var(--text-muted); font-size: 0.8rem; }
.tile:hover .tile-title { color: var(--accent-hover); }

.year-heading {
  font-size: 1.1rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  padding: 2rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.year-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.875rem; margin: 0 0 0.5rem; }

/* ---------- Page title (shoot, subject, about, 404) ---------- */
.page-title { padding: 2.25rem 0 1.5rem; }
.page-title h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.page-title p {
  margin: 0.35rem 0 0;
  max-width: 60ch;
  color: var(--text-muted);
}
.page-title .crumb { margin: 0 0 0.5rem; font-size: 0.85rem; }
.page-title .summary { color: var(--text); white-space: pre-line; margin-top: 0.75rem; }
.page-title .summary:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.9rem !important; }
.chips:empty { display: none; }
.chip {
  display: inline-block;
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.chip:hover { color: var(--text); border-color: var(--text-muted); }
.chip-auto { border-style: dashed; }     /* subject present only by automatic (experimental) sorting */

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  padding: 0 0 1rem;
  font-size: 0.875rem;
}
.subnav a { color: var(--text-muted); }
.subnav a:hover, .subnav a.active { color: var(--text); }

/* ---------- Gallery: justified rows laid out by js/gallery.js ----------
   Each row is a flex line of photos with the same height; widths are set
   inline so every row fills the container exactly, without cropping. */
.gallery { display: block; }
.gallery .row { display: flex; gap: var(--tile-gap); margin-bottom: var(--tile-gap); }
.gallery .photo {
  display: block;
  flex: none;
  position: relative;
  overflow: hidden;
  background: var(--surface);
}
.gallery .photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;            /* the box already has the photo's shape; hides sub-pixel rounding */
}
.gallery a.photo:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sentinel { height: 1px; }
.gallery-status {
  padding: 1rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
.gallery-status:empty { display: none; }

/* ---------- Notices, buttons, pager ---------- */
.notice {
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.notice p { margin: 0 0 0.75rem; }
.notice p:last-child { margin: 0; }
.notice strong { color: var(--text); font-weight: 500; }

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn:hover { background: rgba(216, 195, 165, 0.1); color: var(--accent-hover); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-quiet { border-color: var(--border); color: var(--text-muted); }
.btn-quiet:hover { color: var(--text); background: var(--surface); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(217, 139, 122, 0.1); color: var(--danger); }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--gutter) 2rem;
  font-size: 0.9rem;
}
.pager:empty { display: none; }
.pager span { color: var(--text-muted); display: block; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.pager .next { text-align: right; margin-left: auto; }

/* Placeholder tiles (About page, home page before any photo exists) */
.ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ph-1 { background: linear-gradient(135deg, #2b3a4a, #4a5a6a); }
.ph-2 { background: linear-gradient(135deg, #4a3b2f, #7a5c46); }

/* ---------- About / Contact ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 3rem;
  align-items: start;
  padding-bottom: 1rem;
}
.about-photo { aspect-ratio: 4 / 5; width: 100%; object-fit: cover; }
.about-text { max-width: 60ch; }
.about-text p { color: var(--text); }
.contact-line {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

/* ---------- Contact form ---------- */
.contact-form { max-width: 40rem; padding-bottom: 2rem; }
.contact-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.contact-form input,
.contact-form textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.6rem 0.75rem;
  width: 100%;
}
.contact-form textarea { resize: vertical; min-height: 8rem; }
.contact-form input:focus-visible,
.contact-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.contact-form .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { min-height: 1.5em; color: var(--text-muted); font-size: 0.9rem; }
.form-status.is-error { color: var(--danger); }
.form-status.is-ok { color: var(--text); }

/* ---------- 404 / empty states ---------- */
.not-found { padding-top: 2rem; padding-bottom: 6rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
  margin-top: 1rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.footer-inner a { color: var(--text-muted); }
.footer-inner a:hover { color: var(--text); }

/* ---------- Full-screen photo viewer (js/lightbox.js) ---------- */
html.lightbox-open { overflow: hidden; }   /* stops the page scrolling behind the viewer */

.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10, 10, 11, 0.97);
  color: var(--text);
  overflow: hidden;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }

.lightbox-img {
  width: calc(100vw - 8rem);    /* leaves room for the previous/next buttons */
  height: calc(100vh - 8rem);
  height: calc(100dvh - 8rem);
  max-width: none;
  object-fit: contain;          /* whole photo visible, never cropped */
  -webkit-user-select: none;
  user-select: none;
}
.lightbox-img.is-loading { visibility: hidden; }

.lightbox-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s var(--ease);
}
.lightbox-btn[hidden] { display: none; }
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.18); }
.lightbox-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lightbox-btn svg { width: 1.25rem; height: 1.25rem; }
.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev,
.lightbox-next { top: 50%; transform: translateY(-50%); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-foot {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.lightbox-caption { margin: 0; min-width: 0; }
.lightbox-caption .cap-alt { color: var(--text); }
.lightbox-caption .cap-settings { display: block; font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.01em; }
.lightbox-caption .cap-note { display: block; font-size: 0.78rem; }
.lightbox-caption a { color: var(--accent); }
.lightbox-count { margin: 0; letter-spacing: 0.12em; white-space: nowrap; }
@keyframes lightbox-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox[open] { animation: lightbox-in 0.2s var(--ease); }

/* ---------- Motion: off for people who asked for less of it ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  /* Without JavaScript: the full menu, stacked under the brand name */
  .nav { flex-direction: column; align-items: flex-start; padding-top: 0.8rem; padding-bottom: 0.8rem; }

  /* With JavaScript: one row (brand + ☰ button); the menu drops down when open */
  html.js .nav { flex-direction: row; flex-wrap: wrap; align-items: center; padding-top: 0; padding-bottom: 0; }
  html.js .nav-toggle { display: inline-flex; }
  html.js .nav > nav { display: none; flex-basis: 100%; }
  html.js .nav.is-open > nav { display: block; }
  html.js .nav.is-open .nav-links { flex-direction: column; gap: 0; padding-bottom: 0.5rem; }
  html.js .nav.is-open .nav-links li { border-top: 1px solid var(--border); }
  html.js .nav.is-open .nav-links a { display: block; padding: 0.9rem 0; font-size: 1rem; }
  html.js .nav.is-open .nav-links a.active { color: var(--accent); }

  .hero { height: clamp(360px, 60vh, 560px); height: clamp(360px, 60svh, 560px); }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 560px) {
  .tile-grid { grid-template-columns: 1fr; }
  .lightbox-img { width: 100vw; height: calc(100vh - 9rem); height: calc(100dvh - 9rem); }
  .lightbox-prev,
  .lightbox-next { top: auto; bottom: 0.75rem; transform: none; }  /* keep the photo clear */
  .lightbox-foot { bottom: 3.75rem; padding-bottom: 0.25rem; flex-direction: column; gap: 0.25rem; text-align: center; align-items: center; }
}
