/* ============================================================
   synapticjunctions.com — Michael Ray Photography
   Warm-parchment masonry edition
   ============================================================ */

/* ---- Tokens ---- */
:root {
  --font-display: "Barlow Condensed", "Helvetica Neue", sans-serif;
  --font-body: "Libre Baskerville", Georgia, serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;

  --transition: 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);

  --maxw: 1680px;
  --gutter: clamp(16px, 4vw, 56px);
  --grid-gap: 12px;
}

[data-theme="light"] {
  --bg: #edeae4;
  --bg-raised: #e4e0d8;
  --bg-sunken: #e7e3dc;
  --border: #d2cdc3;
  --border-strong: #c2bcaf;
  --text: #1a1714;
  --text-muted: #5c564e;
  --text-faint: #908a80;
  --accent: oklch(0.55 0.09 56);
  --lightbox-bg: #0a0908;
  --scrim: rgba(26, 23, 20, 0.06);
}

[data-theme="dark"] {
  --bg: #151210;
  --bg-raised: #1d1916;
  --bg-sunken: #100d0b;
  --border: #2e2a25;
  --border-strong: #413b34;
  --text: #f2ede6;
  --text-muted: #aaa298;
  --text-faint: #6f685f;
  --accent: oklch(0.72 0.09 56);
  --lightbox-bg: #0a0908;
  --scrim: rgba(242, 237, 230, 0.05);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--text); color: var(--bg); }

/* ---- Header ---- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}
.site-header.scrolled { border-bottom-color: var(--border); }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.brand svg { width: 54px; height: auto; display: block; }
.brand .wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand .wordmark .name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand .wordmark .sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 3px;
  padding-left: 1px;
  white-space: nowrap;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition), transform var(--transition);
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); transform: rotate(-12deg); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- Hero ---- */
.hero {
  position: relative;
  height: 56vh;
  min-height: 380px;
  margin-top: 0;
  overflow: hidden;
  background: var(--bg-sunken);
}
.hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.1s ease, transform 7s ease-out;
}
.hero img.loaded { opacity: 1; transform: scale(1); }
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    rgba(0,0,0,0.18) 0%,
    rgba(0,0,0,0) 28%,
    rgba(0,0,0,0) 64%,
    color-mix(in srgb, var(--bg) 92%, transparent) 100%);
  pointer-events: none;
}
.hero-caption {
  position: absolute;
  left: var(--gutter);
  bottom: 30px;
  z-index: 2;
  color: #f4f0ea;
  max-width: 60ch;
  text-shadow: 0 1px 18px rgba(0,0,0,0.45);
}
.hero-caption h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(34px, 6vw, 78px);
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.hero-caption p {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.9;
}

/* ---- Genre nav ---- */
.genre-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--border);
  transition: transform 360ms var(--ease-out);
}
.genre-nav.hidden { transform: translateY(-110%); }
.genre-nav-inner {
  display: flex;
  align-items: stretch;
  gap: clamp(16px, 2.6vw, 36px);
  padding: 0 var(--gutter);
  max-width: var(--maxw);
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.genre-nav-inner::-webkit-scrollbar { display: none; }
.genre-tab {
  position: relative;
  padding: 17px 2px 15px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(15px, 1.5vw, 19px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  transition: color var(--transition);
}
.genre-tab:hover { color: var(--text-muted); }
.genre-tab.active { color: var(--text); }
.genre-tab::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms var(--ease-out);
}
.genre-tab.active::after { transform: scaleX(1); }
.genre-tab .count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  vertical-align: super;
  margin-left: 4px;
  color: var(--text-faint);
  letter-spacing: 0;
}

/* ---- Panels ---- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 3.5vw, 40px) var(--gutter) 120px;
}
.panel { display: none; }
.panel.active { display: block; animation: panelIn 460ms var(--ease-out); }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(18px, 2.5vw, 30px);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 0.9;
  letter-spacing: -0.005em;
  text-transform: uppercase;
}
.panel-head .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ---- Masonry grid ---- */
.masonry {
  column-count: 3;
  column-gap: var(--grid-gap);
}
@media (max-width: 1080px) { .masonry { column-count: 2; } }
@media (max-width: 620px) { .masonry { column-count: 1; } }

.tile {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  text-align: left;
  break-inside: avoid;
  margin-bottom: var(--grid-gap);
  background: var(--bg-sunken);
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
}
.tile.in { animation: tileIn 620ms var(--ease-out) forwards; }
@keyframes tileIn {
  to { opacity: 1; transform: translateY(0); }
}
.tile img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 620ms var(--ease-out), filter var(--transition);
  background: var(--bg-sunken);
}
.tile:hover img { transform: scale(1.045); }
.tile-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px 16px;
  background: linear-gradient(to top, rgba(10,9,8,0.62) 0%, rgba(10,9,8,0) 52%);
  opacity: 0;
  transition: opacity var(--transition);
}
.tile:hover .tile-overlay { opacity: 1; }
.tile-overlay .t-title {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
  color: #f4f0ea;
  line-height: 1.3;
}
.tile-overlay .t-expand {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(244,240,234,0.78);
  margin-top: 6px;
}

/* shimmer placeholder for grid tiles before image arrives */
.tile.skeleton { aspect-ratio: 3/4; }
.tile.skeleton::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, var(--bg-sunken) 30%, var(--bg-raised) 50%, var(--bg-sunken) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---- About ---- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  max-width: 1180px;
}
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }
.about-photo {
  position: relative;
  aspect-ratio: 4/5;
  background: var(--bg-sunken);
  overflow: hidden;
  order: 2;
}
@media (max-width: 860px) { .about-photo { order: -1; aspect-ratio: 3/2; } }
.about-photo img { width: 100%; height: 100%; object-fit: cover; }
.placeholder {
  position: absolute; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(45deg,
      var(--bg-sunken), var(--bg-sunken) 11px,
      var(--bg-raised) 11px, var(--bg-raised) 22px);
}
.placeholder span {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg);
  padding: 6px 12px;
  border: 1px solid var(--border);
}
.about-text { order: 1; padding-top: 4px; }
.about-text .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 22px;
}
.about-text p {
  font-family: var(--font-body);
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.72;
  font-style: italic;
  color: var(--text);
  margin: 0 0 1.2em;
  max-width: 38ch;
  text-wrap: pretty;
}
.about-text .signoff {
  font-style: normal;
  font-size: 16px;
  color: var(--text-muted);
}
.about-meta {
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 30px 48px;
}
.about-meta .item .k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 7px;
}
.about-meta .item .v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.about-meta .item .v a { transition: color var(--transition); border-bottom: 1px solid var(--border-strong); padding-bottom: 2px; }
.about-meta .item .v a:hover { color: var(--accent); }

/* ---- Projects ---- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--grid-gap);
}
.project-card {
  position: relative;
  aspect-ratio: 4/3;
  background: var(--bg-sunken);
  overflow: hidden;
  cursor: pointer;
}
.project-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease-out);
}
.project-card:hover img { transform: scale(1.05); }
.project-card .pc-overlay {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px 24px;
  background: linear-gradient(to top, rgba(10,9,8,0.7) 0%, rgba(10,9,8,0.05) 60%);
}
.project-card .pc-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 25px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #f4f0ea;
  line-height: 1;
}
.project-card .pc-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(244,240,234,0.78);
  margin-top: 9px;
}
.project-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 22px;
  transition: color var(--transition), gap var(--transition);
}
.project-back:hover { color: var(--text); gap: 13px; }
.project-detail-head { margin-bottom: clamp(18px, 2.5vw, 28px); }
.project-detail-title {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.project-detail-title .pdt-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 0.9;
  letter-spacing: -0.005em;
  text-transform: uppercase;
}
.project-detail-title .pdt-count {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ---- Empty / status states ---- */
.status {
  padding: clamp(60px, 12vw, 140px) 20px;
  text-align: center;
}
.status .glyph {
  display: inline-flex;
  color: var(--text-faint);
  margin-bottom: 22px;
}
.status .glyph svg { width: 52px; height: auto; }
.status h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--text-muted);
}
.status p {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--lightbox-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 320ms ease, visibility 320ms ease;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lb-stage {
  position: relative;
  width: min(2048px, 92vw);
  height: 86vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 420ms ease;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.lb-stage img.loaded { opacity: 1; }
.lb-spinner {
  position: absolute;
  width: 34px; height: 34px;
  border: 2px solid rgba(244,240,234,0.18);
  border-top-color: rgba(244,240,234,0.85);
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}
.lb-spinner.hide { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.lb-close {
  position: absolute;
  top: 20px; right: 22px;
  z-index: 3;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(244,240,234,0.7);
  border-radius: 50%;
  transition: color var(--transition), background var(--transition);
}
.lb-close:hover { color: #fff; background: rgba(244,240,234,0.08); }
.lb-close svg { width: 22px; height: 22px; }

.lb-nav {
  position: absolute;
  top: 0; bottom: 0;
  width: clamp(70px, 12vw, 150px);
  z-index: 2;
  display: flex;
  align-items: center;
  color: rgba(244,240,234,0.55);
  transition: color var(--transition), background var(--transition);
}
.lb-nav:hover { color: #fff; background: rgba(244,240,234,0.03); }
.lb-nav svg { width: 30px; height: 30px; }
.lb-prev { left: 0; justify-content: flex-start; padding-left: clamp(16px, 3vw, 40px); }
.lb-next { right: 0; justify-content: flex-end; padding-right: clamp(16px, 3vw, 40px); }

.lb-footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 24px 26px;
  pointer-events: none;
}
.lb-caption {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
  color: rgba(244,240,234,0.82);
  text-align: center;
}
.lb-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(244,240,234,0.5);
  border: 1px solid rgba(244,240,234,0.22);
  padding: 3px 8px;
  white-space: nowrap;
}
.lb-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(244,240,234,0.5);
  white-space: nowrap;
}
.lb-hint {
  position: absolute;
  top: 22px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244,240,234,0.55);
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
}
.lb-hint.show { opacity: 1; }

@media (max-width: 620px) {
  .lb-footer { flex-direction: column; gap: 6px; padding-bottom: 18px; }
  .lb-stage { height: 78vh; }
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 34px var(--gutter) 44px;
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.site-footer .copy {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.site-footer .links {
  display: flex;
  gap: 24px;
}
.site-footer .links a {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--transition);
}
.site-footer .links a:hover { color: var(--text); }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .tile { opacity: 1; transform: none; }
}
