/* ============================================================
   Spencer Portfolio — custom styles (complements Tailwind CDN)
   ============================================================ */

:root {
  --ink: #141210;
  --mist: #f7f5f2;
  --stone: #8a847c;
  --line: #e4e0d9;
  --accent: #3d4a3c;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  background-color: var(--mist);
  background-image:
    radial-gradient(ellipse 90% 55% at 12% -10%, rgba(61, 74, 60, 0.07), transparent 55%),
    radial-gradient(ellipse 70% 45% at 92% 8%, rgba(138, 132, 124, 0.12), transparent 50%),
    linear-gradient(180deg, #f9f7f4 0%, var(--mist) 40%, #f3f0eb 100%);
  background-attachment: fixed;
}

/* Hero atmosphere — soft, typography-first (no heavy photo wash) */
.hero-atmosphere {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 40% at 70% 60%, rgba(61, 74, 60, 0.05), transparent 70%),
    linear-gradient(to bottom, transparent 60%, var(--mist) 100%);
}

.hero-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* Entrance */
@keyframes enter-up {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-enter {
  animation: enter-up 0.9s var(--ease-out) forwards;
}

/* Hero circular portrait */
.hero-portrait {
  position: relative;
}

.hero-portrait-ring {
  width: clamp(11rem, 28vw, 17.5rem);
  height: clamp(11rem, 28vw, 17.5rem);
  border-radius: 50%;
  padding: 0.35rem;
  background: linear-gradient(
    145deg,
    rgba(61, 74, 60, 0.35),
    rgba(228, 224, 217, 0.9) 45%,
    rgba(138, 132, 124, 0.45)
  );
  box-shadow:
    0 18px 40px rgba(20, 18, 16, 0.08),
    0 0 0 1px rgba(20, 18, 16, 0.04);
}

.hero-portrait-ring img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  background: #ddd8cf;
}

@media (max-width: 767px) {
  .hero-portrait-ring {
    width: clamp(9.5rem, 42vw, 13rem);
    height: clamp(9.5rem, 42vw, 13rem);
  }
}

/* Sticky header border once scrolled */
#site-header.is-scrolled {
  border-color: var(--line);
}

/* Filter buttons */
.filter-btn {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
  border-radius: 999px;
  transition:
    color 0.25s var(--ease-soft),
    background-color 0.25s var(--ease-soft);
}

.filter-btn:hover {
  color: var(--ink);
}

.filter-btn.is-active {
  color: var(--mist);
  background-color: var(--ink);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Gallery cards */
.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition:
    opacity 0.45s var(--ease-out),
    transform 0.45s var(--ease-out);
}

.gallery-item.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.gallery-item.is-exiting {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
}

.gallery-item.is-hidden {
  display: none;
}

.gallery-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #ddd8cf;
}

.gallery-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s var(--ease-out), filter 0.5s var(--ease-soft);
  will-change: transform;
}

.gallery-item:hover .gallery-media img,
.gallery-item:focus-visible .gallery-media img {
  transform: scale(1.04);
  filter: brightness(0.92);
}

.gallery-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.gallery-meta {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.gallery-title {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.gallery-niche {
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone);
}

/* Play overlay — minimal */
.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.play-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  border: 1px solid rgba(247, 245, 242, 0.85);
  background: rgba(20, 18, 16, 0.28);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.35s var(--ease-out),
    background-color 0.35s var(--ease-soft),
    border-color 0.35s var(--ease-soft);
}

.play-icon svg {
  margin-left: 2px;
}

.gallery-item:hover .play-icon,
.gallery-item:focus-visible .play-icon {
  transform: scale(1.06);
  background: rgba(20, 18, 16, 0.45);
  border-color: rgba(247, 245, 242, 1);
}

/* Lightboxes / modals */
.lightbox {
  opacity: 0;
  transition: opacity 0.35s var(--ease-soft);
}

.lightbox.is-open {
  display: flex !important;
  opacity: 1;
}

.lightbox-backdrop {
  cursor: pointer;
}

body.modal-open {
  overflow: hidden;
}

#lightbox-image.is-ready {
  opacity: 1;
}

/* Header contact button */
.contact-nav-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--ink);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  transition:
    background-color 0.25s var(--ease-soft),
    opacity 0.25s var(--ease-soft);
}

.contact-nav-btn:hover {
  background-color: var(--accent);
}

.contact-nav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Contact form modal */
.contact-panel {
  max-height: min(92vh, 720px);
  overflow-y: auto;
  border: 1px solid var(--line);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.contact-field span {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
}

.contact-field input,
.contact-field select,
.contact-field textarea {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  padding: 0.7rem 0.85rem;
  border-radius: 2px;
  transition:
    border-color 0.2s var(--ease-soft),
    box-shadow 0.2s var(--ease-soft);
}

.contact-field textarea {
  resize: vertical;
  min-height: 6rem;
}

.contact-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238a847c' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
}

.contact-field input::placeholder,
.contact-field textarea::placeholder {
  color: rgba(20, 18, 16, 0.35);
}

.contact-field input:focus,
.contact-field select:focus,
.contact-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 74, 60, 0.12);
}

.contact-field input.is-invalid,
.contact-field select.is-invalid,
.contact-field textarea.is-invalid {
  border-color: #a34a3a;
}

.contact-submit {
  appearance: none;
  border: none;
  cursor: pointer;
  margin-top: 0.35rem;
  width: 100%;
  background: var(--ink);
  color: var(--mist);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.9rem 1.25rem;
  border-radius: 2px;
  transition: background-color 0.25s var(--ease-soft);
}

.contact-submit:hover {
  background-color: var(--accent);
}

.contact-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.contact-submit:disabled {
  opacity: 0.55;
  cursor: progress;
}

/* Filter bar horizontal scroll fade on small screens */
#filter-bar .overflow-x-auto {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#filter-bar .overflow-x-auto::-webkit-scrollbar {
  display: none;
}

/* Selection */
::selection {
  background: rgba(61, 74, 60, 0.22);
  color: var(--ink);
}
