/* ============================================================
   MAXIM SHESTERIKOV — PHOTOGRAPHY PORTFOLIO
   "The Monolithic Gallery" — editorial dark, zero-radius
   ============================================================ */

:root {
  /* Tonal palette */
  --bg: #131313;
  --bg-surface: #131313;
  --bg-elevated: #1B1B1B;
  --surface-container-low: #1B1B1B;
  --surface: #353535;
  --surface-container-highest: #353535;
  --primary: #FFFFFF;
  --secondary: #FFB4A8;
  --on-surface-variant: #C4C7C8;
  --text: #FFFFFF;
  --text-muted: #C4C7C8;
  --text-dim: rgba(255, 255, 255, 0.22);
  --danger: #c0392b;

  /* Zero-radius rule */
  --radius: 0px;

  /* Typography */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-label: 'Space Grotesk', sans-serif;

  /* Layout */
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 7.5rem;
  /* ~120px whitespace mandate */
}

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;
  }
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

::selection {
  background: var(--primary);
  color: var(--bg);
}

/* ============================================================
   HEADER — Glassmorphism
   ============================================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 clamp(1.5rem, 4vw, 3rem);
  background-color: rgba(19, 19, 19, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background-color 0.4s var(--ease);
}

.site-header.scrolled {
  background-color: rgba(19, 19, 19, 0.95);
}

.site-logo {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
  transition: opacity 0.3s var(--ease);
}

.site-logo:hover {
  opacity: 0.7;
}

.logo-title {
  font-family: var(--font-label);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo-sub {
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 400;
  font-family: var(--font-label);
}

.site-nav {
  display: flex;
  gap: 2.5rem;
}

/* Nav links — opacity + weight shift, no underline rule */
.nav-link {
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.25s var(--ease), font-weight 0.1s;
}

.nav-link:hover {
  color: var(--text);
  font-weight: 500;
}

.nav-link.active {
  color: var(--text);
  font-weight: 500;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 110;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--text);
  transition: all 0.3s var(--ease);
  transform-origin: center;
}

.nav-toggle.open span:first-child {
  transform: rotate(45deg) translateY(4.5px);
}

.nav-toggle.open span:last-child {
  transform: rotate(-45deg) translateY(-4.5px);
}

@media (max-width: 680px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(19, 19, 19, 0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
    z-index: 105;
  }

  .site-nav.open {
    opacity: 1;
    pointer-events: all;
  }

  .site-nav .nav-link {
    font-size: 1.4rem;
    letter-spacing: 0.15em;
  }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
  padding-top: var(--header-h);
  min-height: 100vh;
}

.page-intro {
  padding: var(--space-3xl) clamp(1.5rem, 4vw, 3rem) 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 680px;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.7;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.empty-state a {
  color: var(--secondary);
}

/* ============================================================
   GALLERY — Asymmetric CSS Grid
   ============================================================ */

/* Whitespace mandate: ~120px breathing room from header to first grid */
.gallery-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 2rem clamp(1rem, 3vw, 2rem) 1rem;
  flex-wrap: wrap;
}

/* No-line rule: tonal shifts only, no borders */
.gallery-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4rem 1rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.gallery-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.gallery-tab.active {
  background: #1B1B1B;
  color: var(--text);
}

.gallery-section {}

.gallery-folder-title {
  font-family: var(--font-label);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-3xl) clamp(1rem, 3vw, 2rem) 1.5rem;
}

/* Uniform grid — all cells same size, images cropped to fit */
.gallery {
  padding: 0 clamp(1rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

@media (min-width: 480px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 700px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 900px) {
  .gallery {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 1100px) {
  .gallery {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (min-width: 1400px) {
  .gallery {
    grid-template-columns: repeat(7, 1fr);
  }
}

@media (min-width: 1800px) {
  .gallery {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* Portrait sub-grid — fewer columns, taller cells, no top padding (landscape grid above provides it) */
.gallery-portrait {
  padding-top: 4px;
}

.gallery-portrait .gallery-item {
  aspect-ratio: 2 / 3;
}

@media (min-width: 480px) {
  .gallery-portrait {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 700px) {
  .gallery-portrait {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 900px) {
  .gallery-portrait {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (min-width: 1100px) {
  .gallery-portrait {
    grid-template-columns: repeat(7, 1fr);
  }
}

@media (min-width: 1400px) {
  .gallery-portrait {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (min-width: 1800px) {
  .gallery-portrait {
    grid-template-columns: repeat(10, 1fr);
  }
}

/* First gallery section — just enough room below the fixed header */
.gallery-section:first-of-type .gallery,
.gallery-section:only-of-type .gallery {
  padding-top: 2rem;
}

/* When tabs are present they already provide top spacing */
#gallery-tabs~.gallery-section:first-of-type .gallery,
#gallery-tabs~.gallery-section:only-of-type .gallery {
  padding-top: 0;
}

.gallery-item {
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 3 / 2;
  /* IO-driven fade-in */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}

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

.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
  filter: brightness(0.88) contrast(1.04);
}

.gallery-item:hover img {
  transform: scale(1.03);
  filter: brightness(1) contrast(1.04);
}

/* EXIF hover overlay */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0.6rem 0.75rem;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.overlay-name,
.overlay-camera,
.overlay-date {
  font-family: var(--font-label);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
  line-height: 1.3;
}

.overlay-name {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

/* ============================================================
   LIGHTBOX — Darkroom glass
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(19, 19, 19, 0.88);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lb-content {
  max-width: 92vw;
  max-height: 86vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lb-content img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.lb-content img.loaded {
  opacity: 1;
}

.lb-spinner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: lbSpin 0.7s linear infinite;
}

.lb-spinner.hidden {
  display: none;
}

@keyframes lbSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Brutalist geometric arrows — no soft shadows */
.lb-close,
.lb-prev,
.lb-next {
  position: absolute;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 1rem;
  transition: color 0.2s;
  z-index: 10;
  font-family: var(--font-label);
  font-weight: 300;
  line-height: 1;
}

.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
  color: var(--text);
}

.lb-close {
  top: 0.5rem;
  right: 0.5rem;
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: -0.05em;
}

.lb-prev {
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  font-weight: 200;
}

.lb-next {
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  font-weight: 200;
}

.lb-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.lb-caption {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lb-caption-name {
  font-family: var(--font-label);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.3;
}

.lb-caption-desc {
  font-family: var(--font-label);
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
}

.lb-caption-camera,
.lb-caption-date {
  font-family: var(--font-label);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* Space Grotesk for technical counting UI */
.lb-counter {
  font-family: var(--font-label);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

@media (max-width: 680px) {

  .lb-prev,
  .lb-next {
    display: none;
  }
}

/* ============================================================
   HERO HOME PAGE
   ============================================================ */

.hero {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
  animation: heroZoom 10s var(--ease) forwards;
}

@keyframes heroZoom {
  from {
    transform: scale(1.08);
  }

  to {
    transform: scale(1);
  }
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
      rgba(19, 19, 19, 0.2) 0%,
      rgba(19, 19, 19, 0.45) 40%,
      rgba(19, 19, 19, 0.88) 80%,
      var(--bg) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.hero-title {
  font-family: var(--font-label);
  font-size: clamp(3rem, 8vw, 8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--text);
  animation: heroSlideUp 1s var(--ease) both;
  animation-delay: 0.15s;
}

.hero-subtitle {
  font-family: var(--font-label);
  font-size: clamp(0.6rem, 1.1vw, 0.75rem);
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 400;
  animation: heroSlideUp 1s var(--ease) both;
  animation-delay: 0.35s;
}

.hero-cta {
  display: inline-block;
  margin-top: var(--space-lg);
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 3px;
  transition: color 0.3s var(--ease);
  animation: heroSlideUp 1s var(--ease) both;
  animation-delay: 0.55s;
}

.hero-cta:hover {
  color: var(--text);
}

@keyframes heroSlideUp {
  from {
    opacity: 0;
    transform: translateY(32px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.hero-scroll-indicator span {
  display: block;
  width: 14px;
  height: 14px;
  border-right: 1.5px solid rgba(255, 255, 255, 0.3);
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.3);
  transform: rotate(45deg);
  animation: scrollBounce 1.6s ease-in-out infinite;
  margin: 0 auto;
}

@keyframes scrollBounce {

  0%,
  100% {
    transform: rotate(45deg) translateY(0) translateX(0);
  }

  50% {
    transform: rotate(45deg) translateY(6px) translateX(6px);
  }
}

/* ============================================================
   CONTACT SUCCESS STATE
   ============================================================ */

.contact-success {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 0;
  animation: heroSlideUp 0.6s var(--ease) both;
}

.contact-success.visible {
  display: flex;
}

.success-check {
  font-size: 3rem;
  color: var(--secondary);
  line-height: 1;
}

.contact-success p {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ============================================================
   CONTACT PAGE
   ============================================================ */

.contact-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: calc(var(--header-h) + 3rem) clamp(1.5rem, 4vw, 3rem) 3rem;
}

.contact-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  max-width: 900px;
  width: 100%;
}

@media (max-width: 768px) {
  .contact-container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

.contact-info h1 {
  font-family: var(--font-label);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 1rem;
}

.contact-desc {
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.7;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-email {
  color: var(--secondary);
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  transition: opacity 0.3s;
}

.contact-email:hover {
  opacity: 0.7;
}

.contact-social {
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: color 0.3s;
}

.contact-social:hover {
  color: var(--text);
}

/* ============================================================
   CONTACT FORM — Underline-only inputs
   ============================================================ */

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

.form-group {
  position: relative;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 1.2rem 0 0.6rem;
  outline: none;
  transition: border-color 0.3s var(--ease);
  resize: vertical;
}

.form-group textarea {
  min-height: 100px;
}

.form-group input:focus,
.form-group textarea:focus {
  border-bottom-color: var(--primary);
}

.form-group label {
  position: absolute;
  left: 0;
  top: 1.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.3s var(--ease);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 400;
  font-family: var(--font-label);
}

.form-group input:focus+label,
.form-group input:not(:placeholder-shown)+label,
.form-group textarea:focus+label,
.form-group textarea:not(:placeholder-shown)+label {
  top: -0.2rem;
  font-size: 0.6rem;
  color: var(--primary);
}

/* ============================================================
   BUTTONS — Solid primary / Ghost border
   ============================================================ */

/* Primary submit — solid white, dark text, vertical gradient on hover */
.btn-submit {
  align-self: flex-start;
  background: var(--primary);
  border: none;
  color: #2F3131;
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  padding: 0.9rem 2.5rem;
  cursor: pointer;
  transition: background 0.25s var(--ease);
  text-transform: uppercase;
}

.btn-submit:hover {
  background: linear-gradient(to bottom, #FFFFFF, #E2E2E2);
}

.btn-submit:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.form-status {
  font-size: 0.85rem;
  min-height: 1.5em;
}

.form-status.success {
  color: #6fcf97;
}

.form-status.error {
  color: var(--danger);
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem clamp(1.5rem, 4vw, 3rem);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 2rem;
}

.footer-ig {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  transition: color 0.3s;
}

.footer-ig:hover {
  color: var(--text-muted);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================================
   PAGE LOAD ANIMATION
   ============================================================ */

body {
  animation: bodyFadeIn 0.45s var(--ease);
}

@keyframes bodyFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}