/* ─── Fonts ────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Stefan';
  src: url('/fonts/ABCStefan-Bubble.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Otto';
  src: url('/fonts/ABCOtto-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

/* ─── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
::selection { background: #d2dce9; }

:root {
  --bg: #f5f5f5;
  --fg: #111110;
  --muted: #b0aea9;
  --gap: 56px;
  --col: 4;
  --pad: 14px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --speed: 0.44s;
  --stefan: 'Stefan', Georgia, serif;
  --otto: 'Otto', system-ui, sans-serif;
}

html {
  -webkit-font-smoothing: antialiased;
  -webkit-overflow-scrolling: touch;
}

/* ─── Page fade-in ─────────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--otto);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.7s ease;
}

body.loaded { opacity: 1; }

a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; }

/* ─── Photo Grid ───────────────────────────────────────────────────── */
.photo-grid-wrap {
  flex: 1;
  padding: 40px var(--pad) 64px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(var(--col), 1fr);
  gap: var(--gap);
  align-items: center;
}

.photo-item {
  cursor: pointer;
  position: relative;
  will-change: opacity, filter;
  transition:
    opacity var(--speed) var(--ease),
    filter var(--speed) var(--ease);
  opacity: 0;
  animation: fadeIn 0.75s var(--ease) forwards;
}

.photo-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* Color overlay */
.photo-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--photo-color, transparent);
  opacity: 0;
  transition: opacity var(--speed) var(--ease);
  pointer-events: none;
}

/* Dim siblings */
.photo-grid:has(.photo-item:hover) .photo-item:not(:hover) {
  opacity: 0.5;
  filter: blur(0.5px);
}

/* Hover: color wash only, no movement */
.photo-item:hover::after { opacity: 0.60; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Lightbox ─────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s var(--ease);
  backdrop-filter: blur(6px);
}

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

.lightbox-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-stage {
  position: relative;
  width: calc(100% - 160px);
  height: calc(100% - 120px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* First open: fade in. Navigation: instant (no transition class added). */
.lightbox-img-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img-wrap.fade-in {
  animation: fadeIn 0.6s var(--ease) forwards;
}

.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}


.lightbox-close {
  position: fixed;
  top: 0;
  right: 0;
  padding: 7px 14px 2px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--otto);
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #fff;
  mix-blend-mode: difference;
  transition: opacity 0.2s;
  z-index: 10;
}
.lightbox-close:hover { opacity: 0.5; }

body.lb-open #gridPlus {
  opacity: 0;
  pointer-events: none;
}

.lightbox-counter {
  position: absolute;
  bottom: 0;
  padding: 2px 0 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-family: var(--otto);
}

.lightbox-caption {
  position: absolute;
  bottom: 0;
  padding: 2px 0 4px;
  right: 0;
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-family: var(--otto);
  text-align: right;
  max-width: 220px;
  line-height: 1.5;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.lightbox-caption.visible { opacity: 1; }

.lightbox-caption a {
  color: inherit;
  border-bottom: 1px solid rgba(176,174,169,0.5);
  transition: border-color 0.2s;
}

.lightbox-caption a:hover { border-color: var(--muted); }

.lb-peek {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 90px;
  height: auto;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 5;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.lb-peek-left  { left: 28px; }
.lb-peek-right { right: 28px; }
.lb-peek.show  { opacity: 1; }

/* ─── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2px 14px 4px;
  font-family: var(--otto);
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  z-index: 50;
  mix-blend-mode: difference;
}

.site-footer a,
.site-footer span {
  color: #fff;
  white-space: nowrap;
  transition: opacity 0.22s;
}

.site-footer a:hover { opacity: 0.5; }
.site-footer ::selection { background: transparent; }
.site-footer a.active { opacity: 1; }

/* Stefan font only for the brand name */
.site-footer .brand {
  font-family: var(--stefan);
  font-size: 0.85rem;
  letter-spacing: 0;
}

.footer-copy { text-align: right; }
.footer-sep { display: none; }

/* ─── Grid zoom controls ───────────────────────────────────────────── */
.grid-zoom {
  position: fixed;
  top: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  font-family: var(--otto);
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 14px 2px;
  z-index: 100;
  mix-blend-mode: difference;
  transition: opacity 0.2s;
}
.grid-zoom:hover { opacity: 0.5; }

#gridMinus { left: 0; }
#gridPlus  { right: 0; }

/* ─── Video Grid ───────────────────────────────────────────────────── */
.video-grid-wrap {
  flex: 1;
  padding: 80px var(--pad) 64px;
}

.video-grid {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
}

.video-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.video-item {
  position: relative;
  cursor: pointer;
  opacity: 0;
  animation: fadeIn 0.7s var(--ease) forwards;
}

.video-item iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
  pointer-events: none;
}

.video-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.video-item.active .video-overlay { pointer-events: none; }
.video-item.active iframe { pointer-events: auto; }

/* ─── Info / Other Pages ─────────────────────────────────────────── */
.info-layout {
  flex: 1;
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 80px var(--pad) 64px;
  gap: calc(var(--gap) * 2);
}

.info-polaroids-link {
  position: absolute;
  bottom: 48px;
  left: var(--pad);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--muted);
}

.info-layout .page-wrap {
  padding: 0;
  max-width: none;
  flex: 1;
}

.info-photo {
  width: 260px;
  flex-shrink: 0;
}

.info-photo img {
  width: 100%;
  height: auto;
  display: block;
}

.page-wrap {
  flex: 1;
  padding: 80px var(--pad) 64px;
  max-width: 580px;
}

.page-wrap h1 {
  font-size: 2rem;
  font-weight: 300;
  margin-bottom: 28px;
  font-family: var(--otto);
}

.page-wrap p {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--muted);
  margin-bottom: 16px;
  font-family: var(--otto);
}

.page-wrap p.dark { color: var(--fg); }

.page-wrap a {
  color: var(--fg);
  border-bottom: 1px solid rgba(0,0,0,0.15);
  transition: border-color 0.2s;
}
.page-wrap a:hover { border-color: var(--fg); }

/* ─── Polaroids Page ─────────────────────────────────────────────── */
.polaroids-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 10%;
}

.polaroid-grid {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 48px;
}

.polaroid-item {
  transform: translate(var(--tx, 0px), var(--ty, 0px)) rotate(var(--rot, 0deg));
  opacity: 0;
  animation: fadeIn 1.2s var(--ease) forwards;
  will-change: transform;
}

.polaroid-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* ─── Upload Page ─────────────────────────────────────────────────── */
.upload-zone {
  border: 1px dashed rgba(0,0,0,0.18);
  padding: 52px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
  margin-bottom: 20px;
}
.upload-zone.drag-over { border-color: var(--fg); background: rgba(0,0,0,0.01); }
.upload-zone p { color: var(--muted); font-size: 0.9rem; margin: 0; }

.upload-list { font-size: 0.85rem; color: var(--muted); }
.upload-list .item { padding: 5px 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
.upload-list .item.done { color: #5a7a5a; }
.upload-list .item.err  { color: #8a4a4a; }

.btn {
  font-family: var(--otto);
  font-size: 0.85rem;
  background: var(--fg);
  color: var(--bg);
  border: none;
  padding: 11px 28px;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 16px;
}
.btn:hover { opacity: 0.75; }
.btn:disabled { opacity: 0.35; cursor: default; }

.pw-input {
  font-family: var(--otto);
  font-size: 0.9rem;
  border: 1px solid rgba(0,0,0,0.12);
  padding: 10px 14px;
  width: 100%;
  margin-bottom: 16px;
  background: var(--bg);
  color: var(--fg);
  outline: none;
  transition: border-color 0.2s;
}
.pw-input:focus { border-color: var(--fg); }

/* ─── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --col: 3; }
}

@media (max-width: 768px) {
  :root { --col: 2; --gap: 28px; }
  .video-grid { grid-template-columns: repeat(2, 1fr); }
  .site-footer { flex-wrap: wrap; gap: 10px 20px; }
  .site-footer > a:nth-child(2) { display: none; }
  .polaroid-grid { grid-template-columns: repeat(2, 1fr); gap: 32px; }
  .polaroids-wrap { padding: 64px 8%; }
}

@media (max-width: 480px) {
  :root { --col: 2; --gap: 16px; }
  .polaroid-grid { gap: 20px; }
  .polaroids-wrap { padding: 56px var(--pad) 56px; }
  .video-grid { grid-template-columns: 1fr; }
  .lightbox-stage { width: calc(100% - 80px); }
  .lb-peek { display: none; }
  /* Footer: Brand left, "Photo, Video, Info, © All Rights Reserved" right */
  .site-footer { flex-wrap: nowrap; gap: 0; }
  .site-footer > a:nth-child(2) { display: inline; margin-left: auto; }
  .footer-sep { display: inline; }
  .info-polaroids-link { position: static; }
  /* Info page: text full-width top, photo bottom-right */
  .info-layout {
    flex-direction: column;
    padding: 56px var(--pad) 64px;
    gap: 0;
    align-items: flex-start;
  }
  .info-photo {
    width: 55%;
    align-self: flex-end;
    margin-top: auto;
    margin-bottom: 48px;
    padding-top: 32px;
  }
}
