/* =========================================================
   davidname.com — foundational styles
   Calm, minimal, intentional
   ========================================================= */

:root {
  --text: #111111;
  --muted: #555555;
  --border: rgba(0,0,0,0.1);
  --max-width: 1120px;
  --radius: 14px;
  --shadow: 0 12px 28px rgba(0,0,0,0.08);

  /* Header “moods” */
  --logo-hero: 50px;       /* ~39% bigger than 36px */
  --logo-compact: 40px;    /* ~11% bigger than 36px */
  --header-pad-hero: 18px;
  --header-pad-compact: 14px;

  /* Project page shared width (hero + text + gallery + quote)
     Match site container width so the project page is NOT narrower. */
  --project-width: var(--max-width);

  /* Masonry tuning */
  --gallery-gap: 22px;
  --masonry-row: 10px; /* smaller = smoother masonry, slightly more JS work */
}

/* Reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  color: var(--text);
  background: #ffffff;
  line-height: 1.6;
}

/* =========================================================
   Background experiment — FIRST PRINCIPLES (STATIC)
   - background visible and recognisable (apples read as apples)
   - static (quiet fans)
   - veil ~0.50
   - content panel stays readable
   ========================================================= */

body.page-has-bg {
  background: #f6f4f0; /* calm base */
}

/* Background image layer (static, no filters, no animation) */
body.page-has-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;

  background-image: url("assets/images/synthography-hero-synthographic-artwork-by-davidname.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;

  /* Keep it crisp + recognisable */
  transform: none;

  /* Critical: never intercept clicks / taps */
  pointer-events: none;
}

/* 50% veil (the “soften without hiding” layer) */
body.page-has-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;

  /* ~50% opacity feel */
  background: rgba(246, 244, 240, 0.50);

  pointer-events: none;
}

/* Content panel: readable and clean */
body.page-has-bg .project-page .project-wrap {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 22px 70px rgba(0,0,0,0.14);
  border-radius: calc(var(--radius) + 6px);

  padding: 26px;
  margin-top: 10px;

  /* Prevent this panel from ever floating above menus */
  position: relative;
  z-index: 0;
}

/* Slightly stronger separators when on background */
body.page-has-bg .site-header {
  background: rgba(255,255,255,0.92);
}

body.page-has-bg .site-footer {
  background: rgba(255,255,255,0.88);
}

/* Disabled hero arrow polish (Synthography is newest) */
.hero-arrow.is-disabled {
  opacity: 0.35;
  filter: grayscale(0.2);
  box-shadow: none;
}

/* Scroll lock polish (lightbox) */
body.no-scroll {
  overflow: hidden;
}

/* Layout */
.container {
  width: min(var(--max-width), 92%);
  margin: 0 auto;
}

/* =========================================================
   Typography hierarchy (visual sanity across devices)
   ========================================================= */

h1 {
  /* Cap the desktop size to match your pre-responsive look (~34px) */
  font-size: clamp(2rem, 2.4vw, 2.125rem);
  line-height: 1.15;
  margin: 0 0 14px;
  font-weight: 600;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.25;
  margin: 0 0 18px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

h3 {
  font-size: 1.02rem;
  line-height: 1.3;
  margin: 14px 0 10px;
  font-weight: 600;
}

p {
  margin: 0 0 14px;
}

/* =========================================================
   Header (sticky + shrinking)
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid var(--border);

  /* IMPORTANT: keep header + dropdown above the page content panel */
  z-index: 1000;

  backdrop-filter: blur(6px);

  /* Stabilise stacking behaviour across browsers */
  isolation: isolate;

  /* Smooth mood shift */
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--header-pad-hero) 0; /* HERO state padding by default */
  gap: 18px;
  transition: padding 0.2s ease;

  /* Anchor absolute-positioned mobile menu */
  position: relative;
}

/* Logo default: HERO state */
.brand {
  flex: 0 0 auto;
}

.brand img {
  height: var(--logo-hero);
  width: auto;
  display: block;
  transition: height 0.2s ease;
}

/* Compact state when scrolled */
.site-header.scrolled .header-inner {
  padding: var(--header-pad-compact) 0;
}

.site-header.scrolled .brand img {
  height: var(--logo-compact);
}

/* =========================================================
   Navigation (desktop)
   ========================================================= */

.site-nav {
  position: relative;
  margin-left: auto;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 18px;
  padding: 0;
  margin: 0;
  white-space: nowrap;
}

.nav-list a {
  text-decoration: none;
  color: var(--muted);
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 10px;
  display: inline-block;
}

.nav-list a:hover,
.nav-list a[aria-current="page"] {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

/* =========================================================
   Mobile nav toggle (hamburger, no JS)
   ========================================================= */

.nav-toggle {
  position: absolute;
  left: -9999px;
}

.nav-toggle-label {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.02);
  align-items: center;
  justify-content: center;
  cursor: pointer;

  /* FIX: stack the three bars vertically (classic hamburger) */
  flex-direction: column;
  gap: 6px;
}

.nav-toggle-label span {
  display: block;
  width: 24px;      /* clearer “burger” */
  height: 3px;      /* thicker lines */
  background: var(--text);
  border-radius: 3px;

  /* FIX: spacing handled by .nav-toggle-label gap */
  margin: 0;
}

/* =========================================================
   Sections (tightened vertical rhythm)
   ========================================================= */

.section {
  padding: 34px 0;
}

/* =========================================================
   Intro
   ========================================================= */

.intro-inner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr; /* image left, text right */
  gap: 48px;
  align-items: start;
}

.intro-media img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}

.kicker {
  color: var(--muted);
  margin-bottom: 24px;
}

.contact a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =========================================================
   Latest project (feature)
   Make hero full container width and keep text same width
   ========================================================= */

.project-feature .project-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.latest .project-image img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}

.latest .project-text {
  width: 100%;
  max-width: none;
}

/* =========================================================
   Project grids (index pages / homepage grids)
   ========================================================= */

.project-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.project-grid.small {
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

/* Cards */
.project-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.project-card img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 12px;
  display: block;
}

.project-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

/* Hover */
.project-card img,
.latest .project-image img {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card a:hover img,
.project-feature a:hover img {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* =========================================================
   Project page
   ========================================================= */

.project-page .project-header {
  margin-bottom: 14px;
}

/* Shared width wrapper so hero/text/gallery/quote align perfectly */
.project-wrap {
  max-width: var(--project-width);
  margin: 0 auto;
}

.project-hero {
  position: relative;
  margin: 0 0 18px;
}

.project-hero-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.project-hero img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
}

/* Arrows: calm, not blue, sized properly */
.hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  box-shadow: 0 16px 46px rgba(0,0,0,0.10);
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.hero-arrow span {
  font-size: 26px;
  line-height: 1;
  font-weight: 500;
  margin-top: -2px;
}

.hero-arrow-left {
  left: 12px;
}

.hero-arrow-right {
  right: 12px;
}

.hero-arrow:hover {
  transform: translateY(-50%) translateY(-1px);
  box-shadow: 0 18px 56px rgba(0,0,0,0.14);
  background: rgba(255,255,255,0.98);
}

/* Project text: same width as hero/gallery via .project-wrap */
.project-body {
  width: 100%;
  margin: 0 0 26px;
}

.project-text {
  overflow: visible;
  max-height: none;
}

/* =========================================================
   Gallery — true masonry (no holes, no cropping, keeps order)
   Requires script.js masonry pass
   ========================================================= */

.project-gallery {
  margin-top: 18px;
}

/* Masonry grid: the JS will set grid-row-end spans per item */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gallery-gap);
  margin-top: 14px;

  /* Masonry mechanics */
  grid-auto-rows: var(--masonry-row);

  /* Important: don't let items stretch */
  align-items: start;
}

.gallery-item {
  display: block;
  text-decoration: none;
  color: inherit;

  /* This stops any “mystery” extra height */
  align-self: start;
}

.gallery-item img {
  width: 100%;
  height: auto;                 /* preserves portrait/landscape identity */
  display: block;
  border-radius: var(--radius);
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  /* Avoid baseline gaps */
  vertical-align: top;
}

.gallery-item:hover img {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Quote: bigger, after gallery, centred */
.project-quote {
  margin: 30px auto 0;
  padding: 0;
  border: none;
  text-align: center;
}

.project-quote p {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2.2vw, 2.05rem);
  line-height: 1.2;
  font-weight: 500;
  color: var(--text);
}

/* =========================================================
   Lightbox (GoDaddy-like: blurred/cropped active image backdrop)
   ========================================================= */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
}

.lightbox.is-open {
  display: block;
}

/* This layer will become the blurred “echo” of the active image.
   JS updates its background-image on every render(). */
.lightbox-backdrop {
  position: absolute;
  inset: 0;

  /* Use the active image as the background */
  background-color: #000;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;

  /* The blur + slight zoom gives that lush GoDaddy feel */
  filter: blur(22px);
  transform: scale(1.08);

  /* Helps reduce “edges” and banding on some screens */
  will-change: transform, filter;
}

/* Dark veil over the blurred image so the main artwork pops */
.lightbox-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.62);
}

/* UI (sharp image + controls) sits above the backdrop */
.lightbox-ui {
  position: absolute;
  inset: 0;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.lightbox-figure {
  margin: 0;
  display: grid;
  gap: 12px;
  justify-items: center;
  align-content: center;
}

.lightbox-img {
  display: block;
  margin: 0 auto;
  max-width: min(92vw, 1120px);
  max-height: 86vh;
  width: auto;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  object-fit: contain;
  background: rgba(255,255,255,0.03);
}

.lightbox-caption {
  max-width: min(92vw, 1120px);
  color: rgba(255,255,255,0.86);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

/* Buttons */
.lightbox-btn {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.10);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 18px 60px rgba(0,0,0,0.35);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-btn span {
  font-size: 30px;
  line-height: 1;
  margin-top: -2px;
}

/* Hover/Focus lift for buttons that are NOT vertically centred with translateY(-50%) */
.lightbox-btn:hover,
.lightbox-btn:focus-visible {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.16);
  box-shadow: 0 22px 72px rgba(0,0,0,0.42);
}

/* Active press: tiny “down” feedback (no layout jump) */
.lightbox-btn:active {
  transform: translateY(0px);
  background: rgba(255,255,255,0.18);
}

/* Prev/Next are centred using translateY(-50%) — preserve that transform on hover/active */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-prev:hover,
.lightbox-prev:focus-visible {
  transform: translateY(-50%) translateY(-1px);
}

.lightbox-prev:active {
  transform: translateY(-50%) translateY(0px);
}

.lightbox-next:hover,
.lightbox-next:focus-visible {
  transform: translateY(-50%) translateY(-1px);
}

.lightbox-next:active {
  transform: translateY(-50%) translateY(0px);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  z-index: 2;
}

.lightbox-close span {
  font-size: 34px;
  margin-top: -3px;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .lightbox-ui {
    padding: 14px;
  }

  .lightbox-btn {
    width: 48px;
    height: 48px;
  }

  .lightbox-btn span {
    font-size: 28px;
  }

  .lightbox-img {
    max-height: 82vh;
  }

  .lightbox-prev { left: 12px; }
  .lightbox-next { right: 12px; }

  .lightbox-close {
    top: 12px;
    right: 12px;
  }
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  font-size: 14px;
  color: var(--muted);
}

.footer-inner {
  text-align: center;
}

.footer-inner p {
  margin: 0;
  line-height: 1.6;
}

/* =========================================================
   Responsive behaviour
   ========================================================= */

/* Tablet */
@media (max-width: 900px) {
  .intro-inner {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .project-grid,
  .project-grid.small {
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .project-wrap {
    max-width: 100%;
  }

  body.page-has-bg .project-page .project-wrap {
    padding: 22px;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .header-inner {
    align-items: center;
  }

  h1 {
    font-size: 1.9rem;
    line-height: 1.18;
  }

  .nav-toggle-label {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: min(320px, 92vw);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
    padding: 10px;
    display: none;

    /* IMPORTANT: keep the dropdown above the content panel */
    z-index: 1100;
  }

  .nav-list {
    flex-direction: column;
    gap: 6px;
    white-space: normal;
  }

  .nav-list a {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .nav-toggle:checked ~ .site-nav {
    display: block;
  }

  .intro-inner {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .project-grid,
  .project-grid.small {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .section {
    padding: 26px 0;
  }

  .hero-arrow {
    width: 42px;
    height: 42px;
  }

  .hero-arrow span {
    font-size: 24px;
  }

  .project-card a:hover img,
  .project-feature a:hover img,
  .gallery-item:hover img {
    transform: none;
    box-shadow: none;
  }

  body.page-has-bg .project-page .project-wrap {
    padding: 18px;
    border-radius: calc(var(--radius) + 4px);
  }
}
