* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #050505;
  --text: #f3f3f0;
  --muted: rgba(243, 243, 240, 0.72);
  --header-h: 64px;
}

html {
  scroll-behavior: auto;
}

html.smooth-scroll-active {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* #app-content removed view-transition-name to prevent the "scroll-up" animation
   when switching tabs from a scrolled position. The root transition will handle
    the cross-fade instead. */

.hero, main, .about-page, footer {
  opacity: 1;
  transition: opacity 500ms ease;
}

main {
  position: relative;
  z-index: 5;
  background: var(--bg);
}

body.preload .hero, 
body.preload main, 
body.preload .about-page, 
body.preload footer {
  opacity: 0;
}

body.preload * {
  transition: none !important;
}

body.lightbox-open {
  overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 20;
  background: rgba(5, 5, 5, 0.15);
  backdrop-filter: blur(10px);
  transition: opacity 260ms ease, transform 260ms ease, background 260ms ease;
  view-transition-name: site-header;
}

/* Ensure the header stays on top and steady during native page transitions */
::view-transition-group(site-header) {
  z-index: 10000;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 200ms;
}

::view-transition-old(site-header),
::view-transition-new(site-header) {
  animation: none;
  mix-blend-mode: normal;
}


.hidden-header {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

header.scrolled {
  background: rgba(5, 5, 5, 0.5);
}

body.lightbox-open header {
  opacity: 0;
  pointer-events: none;
}

header h1 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

nav {
  display: flex;
  gap: 18px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 180ms ease;
}

nav a:hover { color: var(--text); }
nav a.active { color: var(--text); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 100svh;
  min-height: 700px;
  overflow: hidden;
  background: #000;
}

.hero-media {
  position: absolute;
  inset: 0;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1600ms ease-in-out;
}

.hero-slide.active {
  opacity: 1;
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  filter: brightness(0.96);
  transition: filter 600ms ease;
}

.hero-slide img.loading {
  filter: brightness(0.96) blur(20px);
}

@media (max-width: 768px) {
  .hero-slide img {
    object-position: var(--mobile-focal-point, center);
  }
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5,5,5,0.78) 0%, rgba(5,5,5,0.2) 32%, rgba(5,5,5,0.15) 100%);
}

.hero-overlay {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: flex-start;
  padding: 0 22px 34px;
  max-width: 760px;
}

.hero-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(243, 243, 240, 0.72);
  margin-bottom: 14px;
}

.hero-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(243, 243, 240, 0.4);
  padding-bottom: 4px;
}

/* ── Gallery ────────────────────────────────────────────────────────────────── */
.gallery {
  display: grid;
  grid-auto-rows: 10px;
  gap: 0;
  overflow: hidden; /* Contain sub-pixel overflows */
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  opacity: 0;
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
  /* Removed blur as it can cause a 'pop' effect on clear */
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  min-height: 0;
}

.gallery img.fill-gap {
  /* No extra styles needed; base img now handles fill/cover */
}

.gallery img.loaded {
  opacity: 1;
  filter: blur(0);
}

.gallery img:hover {
  opacity: 1;
  transform: scale(1.008) translateZ(0);
  z-index: 10;
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 80ms ease;
}

#lightbox:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

#lightbox.hidden {
  display: none;
}

#lightbox::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 110;
  background: none;
  border: none;
  color: rgba(243, 243, 240, 0.7);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 150ms ease;
}
.lightbox-close:hover { color: var(--text); }

#lightbox-slider {
  display: flex;
  height: 100%;
  width: 100%;
  transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1);
  will-change: transform;
}

.lightbox-slide {
  flex: 0 0 100vw;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-slide img {
  max-width: 94vw;
  max-height: 92vh;
  object-fit: contain;
  display: block;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  will-change: transform;
  touch-action: none;
}

.lightbox-slide img.ready {
  opacity: 1;
  visibility: visible;
}

.lightbox-slide img.is-thumb {
  filter: none;
}

/* Clone that animates from thumbnail position to centre — uses CSS transitions */
.lightbox-clone {
  position: fixed;
  margin: 0;
  object-fit: cover;
  z-index: 101;
  pointer-events: none;
  will-change: top, left, width, height;
  transition:
    top    420ms cubic-bezier(0.22, 1, 0.36, 1),
    left   420ms cubic-bezier(0.22, 1, 0.36, 1),
    width  420ms cubic-bezier(0.22, 1, 0.36, 1),
    height 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── About page ───────────────────────────────────────────────────────────── */
.about-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.about-content {
  flex: 1;
  padding: calc(var(--header-h) + 60px) 22px 80px;
  max-width: 640px;
}

.about-profile-img {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  filter: brightness(0.94);
}

.about-header {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 36px;
}

.about-text-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.about-name {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 8px;
}

.about-text {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.72;
  margin-bottom: 36px;
  white-space: pre-wrap;
}

.about-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.about-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(243,243,240,0.25);
  padding-bottom: 3px;
  transition: color 180ms ease, border-color 180ms ease;
}

.about-links a:hover {
  color: var(--text);
  border-color: rgba(243,243,240,0.6);
}


/* ── Professional Animations ─────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: revealIn 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.page-fade-out .hero,
.page-fade-out main,
.page-fade-out .about-page,
.page-fade-out footer {
  opacity: 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  /* script.js handles col count */
}

@media (max-width: 700px) {
  header { padding: 0 14px; }
  .hero-overlay { padding: 0 14px 22px; }
  nav { gap: 12px; }
  .about-content { padding: calc(var(--header-h) + 32px) 14px 60px; }
}

/* ── Footer ───────────────────────────────────────────────────────────── */
footer {
  padding: 80px 22px 40px;
  border-top: 1px solid rgba(243, 243, 240, 0.05);
  margin-top: 60px;
}

.footer-content {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.footer-text {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

/* ── Contact Form ──────────────────────────────────────────────────────── */
.contact-form {
  margin-top: 60px;
  max-width: 480px;
}

.contact-form .field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.contact-form label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-form input,
.contact-form textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(243, 243, 240, 0.12);
  border-radius: 4px;
  color: var(--text);
  padding: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 200ms ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: rgba(243, 243, 240, 0.4);
}

.contact-form .btn-submit {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 200ms ease;
}

.contact-form .btn-submit:hover {
  opacity: 0.9;
}

.contact-form .btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#form-status {
  margin-top: 16px;
  font-size: 0.9rem;
}

#form-status.success { color: #4ade80; }
#form-status.error { color: #f87171; }