/* THE WALL — light theme, ported from the Lovable reference design. */

:root {
  --radius: 0.75rem;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --background: oklch(0.985 0.002 90);
  --foreground: oklch(0.17 0.005 270);
  --card: oklch(1 0 0);
  --secondary: oklch(0.95 0.003 90);
  --muted: oklch(0.95 0.003 90);
  --muted-foreground: oklch(0.5 0.01 270);
  --accent: oklch(0.62 0.17 45);
  --border: oklch(0.9 0.004 90);
  --ring: oklch(0.62 0.17 45);
  --backdrop: oklch(0.1 0.005 270 / 0.85);
  --shadow-card: 0 1px 2px oklch(0 0 0 / 0.06), 0 8px 24px -12px oklch(0 0 0 / 0.15);
  --shadow-card-hover: 0 2px 4px oklch(0 0 0 / 0.08), 0 24px 48px -16px oklch(0 0 0 / 0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

.page {
  max-width: 80rem;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 1.25rem;
}
@media (min-width: 640px) {
  .page { padding: 0 2rem; }
}

/* ---------- header ---------- */

.header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 4rem 0 2.5rem;
}
@media (min-width: 640px) {
  .header { padding-top: 6rem; }
}

.title {
  margin: 0;
  font-size: 3.75rem;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
}
@media (min-width: 640px) {
  .title { font-size: 6rem; }
}

.subrow {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.subtitle {
  margin: 0;
  font-size: 1.125rem;
  color: var(--muted-foreground);
}

.count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
}
.count .dot { color: var(--accent); }

/* ---------- masonry grid ---------- */

.wall {
  columns: 2;
  column-gap: 1.5rem;
}
@media (max-width: 480px) {
  .wall { columns: 1; }
}
@media (min-width: 1024px) {
  .wall { columns: 3; }
}
@media (min-width: 1280px) {
  .wall { columns: 4; }
}

.item {
  margin: 0 0 1.5rem;
  break-inside: avoid;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.item.in { opacity: 1; transform: none; }

.card {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: zoom-in;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s;
}
.card:hover {
  transform: translateY(-4px) scale(1.015);
  box-shadow: var(--shadow-card-hover);
}
.card:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

.card img {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(0.92);
  opacity: 0;
  transition: filter 0.5s, opacity 0.5s;
}
.card img.loaded { opacity: 1; }
.card:hover img { filter: brightness(1.08); }

figcaption {
  margin-top: 0.75rem;
  padding: 0 0.25rem;
}
.cap-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.cap-meta {
  margin: 0.125rem 0 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ---------- footer ---------- */

.footer {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { color: var(--foreground); }
.footer a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- lightbox ---------- */

.lightbox {
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: oklch(0.96 0.003 90);
  display: flex;
  flex-direction: column;
}
.lightbox:not([open]) { display: none; }
.lightbox::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: lb-fade 0.25s ease-out;
}
.lightbox[open] { animation: lb-fade 0.25s ease-out; }
@keyframes lb-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
}
.lb-count {
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: oklch(0.8 0.005 270);
}

.lb-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .lb-stage { padding: 0 5rem; }
}

.lb-imgwrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

#lb-img {
  max-width: 100%;
  max-height: calc(100vh - 11rem);
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-card-hover);
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.25s, transform 0.25s;
  user-select: none;
}
#lb-img.ready { opacity: 1; transform: none; }

.lb-spinner {
  position: absolute;
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid oklch(1 0 0 / 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lb-spin 0.8s linear infinite;
}
.lb-spinner.hidden { display: none; }
@keyframes lb-spin { to { transform: rotate(360deg); } }

.lb-caption {
  padding: 1.5rem;
  text-align: center;
}
.lb-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.lb-meta {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: oklch(0.8 0.005 270);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid oklch(1 0 0 / 0.2);
  border-radius: 9999px;
  background: oklch(1 0 0 / 0.08);
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.icon-btn:hover { background: oklch(1 0 0 / 0.18); }
.icon-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}
@media (min-width: 640px) {
  .lb-nav { display: flex; }
}
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  .item, .card, .card img, #lb-img, .lightbox[open] {
    transition: none;
    animation: none;
  }
  .item { opacity: 1; transform: none; }
}
