:root {
  --ink: #12202b;
  --ink-soft: #3a4d5c;
  --paper: #f3efe6;
  --paper-2: #e7f0f2;
  --accent: #0f7a6c;
  --accent-2: #c45c26;
  --line: color-mix(in srgb, var(--ink) 12%, transparent);
  --shadow: 0 18px 50px color-mix(in srgb, var(--ink) 18%, transparent);
  --radius: 18px;
  --font-display: "Bricolage Grotesque", Georgia, serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 12% -10%, #d9ece8 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #f0dcc8 0%, transparent 50%),
    linear-gradient(160deg, #f7f3ea 0%, #e8f1f3 48%, #f3ebe2 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  pointer-events: none;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 3vw, 2rem);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #7ebfb4 55%, var(--accent-2));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.brand-name,
.brand-hero {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-name {
  font-size: 1.15rem;
}

.top-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

main {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.intro {
  margin: 0.5rem 0 1.75rem;
  animation: rise 0.7s ease both;
}

.brand-hero {
  margin: 0;
  font-size: clamp(2.8rem, 8vw, 5rem);
  line-height: 0.95;
}

.lede {
  margin: 0.75rem 0 0;
  max-width: 28rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: calc(var(--radius) - 4px);
  text-decoration: none;
  color: inherit;
  background: color-mix(in srgb, white 55%, transparent);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  animation: tile-in 0.55s ease forwards;
  animation-delay: var(--delay, 0ms);
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.tile:hover img,
.tile:focus-visible img {
  transform: scale(1.06);
}

.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.tile-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.6rem 0.7rem 0.55rem;
  font-size: 0.78rem;
  color: #fff;
  background: linear-gradient(transparent, color-mix(in srgb, var(--ink) 75%, transparent));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tile:hover .tile-caption,
.tile:focus-visible .tile-caption {
  opacity: 1;
}

.pager {
  display: flex;
  justify-content: center;
  margin-top: 1.75rem;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--ink);
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--ink) 88%, var(--accent));
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: color-mix(in srgb, white 70%, transparent);
}

.empty {
  margin: 3rem auto;
  max-width: 28rem;
  text-align: center;
  color: var(--ink-soft);
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.view-viewer {
  animation: fade 0.35s ease both;
}

.viewer-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.viewer-name {
  margin: 0;
  text-align: center;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-actions {
  display: flex;
  gap: 0.4rem;
}

.stage {
  margin: 0;
  min-height: min(70vh, 760px);
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, white 55%, transparent), color-mix(in srgb, white 20%, transparent));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stage img {
  max-width: 100%;
  max-height: min(78vh, 860px);
  width: auto;
  height: auto;
  display: block;
  animation: zoom-in 0.4s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tile-in {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes zoom-in {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 720px) {
  .viewer-nav {
    grid-template-columns: 1fr;
  }

  .viewer-actions {
    justify-content: space-between;
  }

  .viewer-name {
    order: -1;
    text-align: left;
  }
}
