/* =====================================================================
   Perry Carsley — responsive design system
   Single stylesheet. No framework. Modern CSS: grid, flex, clamp, :has.
   ===================================================================== */

:root {
  /* Palette — warm neutral + single accent */
  --ink: #1e1a18;
  --ink-muted: #5a524d;
  --bg: #f7f3ec;
  --bg-elevated: #ffffff;
  --border: #e8e0d3;
  --accent: #b75d2b;        /* warm umber */
  --accent-strong: #8a4416;
  --nav-bg: #1e1a18;
  --nav-ink: #f5f1ea;

  /* Typography scale — fluid between mobile and desktop */
  --fs-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.85rem);
  --fs-sm: clamp(0.875rem, 0.8rem + 0.3vw, 1rem);
  --fs-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --fs-lg: clamp(1.125rem, 1rem + 0.4vw, 1.25rem);
  --fs-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --fs-2xl: clamp(2rem, 1.5rem + 2.5vw, 3.25rem);
  --fs-3xl: clamp(2.5rem, 1.8rem + 3.5vw, 4.5rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  --nav-h: 60px;
  --content-max: 1200px;
  --prose-max: 68ch;
  --radius: 4px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, picture, video { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { max-width: var(--prose-max); font-size: var(--fs-base); }

/* =====================================================================
   Site shell — nav + footer
   ===================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  color: var(--nav-ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}
.site-nav__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.site-nav__brand {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--nav-ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.site-nav__brand:hover { text-decoration: none; color: var(--nav-ink); opacity: 0.85; }

.site-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0;
}
.site-nav__links a {
  color: var(--nav-ink);
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  transition: color 0.2s ease, background 0.2s ease;
}
.site-nav__links a:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}
.site-nav__links a.is-active {
  color: var(--accent);
}

/* Mobile menu — hamburger toggle via :checked state, no JS */
.site-nav__toggle { display: none; }
.site-nav__burger {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--nav-ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.site-nav__burger svg { width: 24px; height: 24px; }

@media (max-width: 800px) {
  .site-nav__burger { display: inline-flex; }
  /* Hide the link list entirely when the toggle isn't checked — display:none
     is the only reliable way to fully collapse it (max-height: 0 left
     fractional-pixel bleed of the first link). Show as a full-width panel
     below the bar when toggled. */
  .site-nav__links { display: none; }
  .site-nav:has(.site-nav__toggle:checked) .site-nav__links {
    display: flex;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--nav-bg);
    padding: var(--space-2) var(--space-4) var(--space-4);
    gap: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  }
  .site-nav__links a {
    padding: var(--space-3) var(--space-2);
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }
  .site-nav__links a:first-child { border-top: 0; }
}

/* Footer */
.site-footer {
  background: var(--nav-bg);
  color: var(--nav-ink);
  padding: var(--space-16) var(--space-4) var(--space-12);
  margin-top: var(--space-20);
  text-align: center;
}
.site-footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
}
.site-footer__name {
  font-family: "Playfair Display", Georgia, serif;
  font-size: var(--fs-xl);
  margin-bottom: var(--space-2);
}
.site-footer a {
  color: var(--nav-ink);
  font-size: var(--fs-sm);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.site-footer a:hover {
  color: #e8b88c;
  border-bottom-color: #e8b88c;
  text-decoration: none;
}
.site-footer__contact {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  justify-content: center;
  font-size: var(--fs-sm);
}

/* =====================================================================
   Page layouts
   ===================================================================== */

main { min-height: 60vh; }

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}
.page--prose {
  max-width: var(--prose-max);
  padding-block: var(--space-16);
}
.page--prose p { margin-block: var(--space-4); }
.page--prose h2 { margin-block: var(--space-12) var(--space-4); }
.page--prose h3 { margin-block: var(--space-8) var(--space-3); }
.page--prose img {
  margin-block: var(--space-8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* Hero — used on landing + top of most pages */
.hero {
  position: relative;
  width: 100%;
  min-height: min(72vh, 640px);
  display: grid;
  place-items: center;
  padding: var(--space-16) var(--space-4);
  overflow: hidden;
  background: var(--ink);
}
.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  z-index: 0;
}
/* Landing variant: rich textured gradient, no artwork background */
.hero--landing {
  background:
    radial-gradient(ellipse at 30% 30%, #4a3f38 0%, transparent 50%),
    radial-gradient(ellipse at 70% 70%, #2e2621 0%, transparent 55%),
    linear-gradient(135deg, #1e1a18 0%, #3a302a 100%);
}
.hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(0, 0, 0, 0.15) 0%,
    rgba(0, 0, 0, 0.05) 40%,
    rgba(0, 0, 0, 0.45) 100%);
  z-index: 1;
}
.hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  max-width: 720px;
}
.hero__title {
  font-size: var(--fs-3xl);
  color: #fff;
  font-style: italic;
  font-weight: 400;
  margin-bottom: var(--space-4);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}
.hero__subtitle {
  font-size: var(--fs-xl);
  color: #fff;
  font-weight: 300;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
}
.hero__lede {
  margin-top: var(--space-6);
  font-size: var(--fs-lg);
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

/* Page intro — small heading above main content */
.page-header {
  padding: var(--space-16) var(--space-4) var(--space-8);
  text-align: center;
  max-width: var(--content-max);
  margin: 0 auto;
}
.page-header__eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-2);
}
.page-header__title {
  font-size: var(--fs-2xl);
  color: var(--ink);
}
.page-header__lede {
  max-width: var(--prose-max);
  margin: var(--space-6) auto 0;
  color: var(--ink-muted);
  font-size: var(--fs-lg);
}

/* =====================================================================
   Gallery grid — responsive columns via auto-fit
   ===================================================================== */

/* CSS columns give masonry-style layout where each item renders at its
   natural aspect (no crop) and columns flow independently. Breaks
   cleanly to fewer columns on narrower viewports. */
.gallery {
  column-count: 3;
  column-gap: var(--space-6);
  padding: var(--space-8) var(--space-4);
  max-width: var(--content-max);
  margin: 0 auto;
}
@media (max-width: 900px) { .gallery { column-count: 2; } }
@media (max-width: 560px) { .gallery { column-count: 1; } }
.gallery__item {
  display: block;
  break-inside: avoid;
  margin-bottom: var(--space-6);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: zoom-in;
}
.gallery__item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
/* No crop — display each image at its natural aspect. Tile heights vary
   to match image aspects (masonry-ish). Letterbox with bg color on the
   minority axis so it still looks intentional. */
.gallery__item img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--border);
}
.gallery__caption {
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-style: italic;
}

/* Gallery section (multiple groups on one page) */
.gallery-section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-12) var(--space-4);
}
.gallery-section__title {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-2);
  text-align: center;
}
.gallery-section__lede {
  text-align: center;
  color: var(--ink-muted);
  max-width: var(--prose-max);
  margin: 0 auto var(--space-8);
}

/* =====================================================================
   Lightbox (vanilla JS — see site.js)
   ===================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.95);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lightbox.is-open { display: flex; opacity: 1; }
.lightbox__img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.lightbox__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 500 28px/1 "Playfair Display", serif;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s ease, transform 0.2s ease;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, 0.22); transform: translateY(-50%) scale(1.08); }
.lightbox__btn--prev { left: var(--space-4); }
.lightbox__btn--next { right: var(--space-4); }
.lightbox__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.24); }
@media (max-width: 600px) {
  .lightbox__btn--prev { left: var(--space-2); }
  .lightbox__btn--next { right: var(--space-2); }
}

/* =====================================================================
   Contact page
   ===================================================================== */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-12);
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-12) var(--space-4);
}
@media (min-width: 800px) {
  .contact-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}
.contact-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}
.contact-card h3 { margin-bottom: var(--space-3); }
.contact-card__row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--fs-base);
}
.contact-card__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-muted);
  min-width: 60px;
}

/* =====================================================================
   Service/feature tiles (landing page "Other Services")
   ===================================================================== */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-6);
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}
.tile {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.tile img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--border);
}
.tile__body {
  padding: var(--space-4);
  text-align: center;
}
.tile__title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: var(--fs-lg);
  color: var(--ink);
  letter-spacing: 0.01em;
}

/* Services grid (used by studio site) */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: var(--space-6);
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}
.service-card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.service-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.service-card img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--border);
}
.service-card__body { padding: var(--space-6) var(--space-4); }
.service-card__body h3 { margin-bottom: var(--space-2); }

/* Blog post list + inline embeds (used by ME site) */
.blog-post {
  max-width: var(--prose-max);
  margin: 0 auto var(--space-16);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--border);
}
.blog-post__header { margin-bottom: var(--space-6); }
.blog-post__title { font-size: var(--fs-2xl); color: var(--ink); }
.blog-post__date {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
}
.blog-post__body img {
  margin-block: var(--space-6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.inline-image { margin-block: var(--space-8); }
.inline-image img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  width: 100%;
}
.inline-image figcaption {
  margin-top: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-style: italic;
  text-align: center;
}
.video-figure {
  margin-block: var(--space-8);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.video-figure video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
}
.pdf-figure {
  margin-block: var(--space-8);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.pdf-figure .pdf-viewer {
  width: 100%;
  height: 600px;
  border: 0;
  display: block;
  background: var(--bg);
}
.pdf-figure .pdf-fallback {
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  text-align: center;
}
@media (max-width: 600px) {
  .pdf-figure .pdf-viewer { height: 400px; }
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.muted { color: var(--ink-muted); }
