:root {
  --main-olive: #7a7f55;
  --accent-blush: #c9b0aa;
  --neutral-warm-gray: #bab5b5;
  --foundational-terracotta: #b97553;
  --bg-light: #dedddf;
  --text-dark: #1e1d20;
  --surface: #efedee;
  --card-shadow: 0 14px 26px rgba(30, 29, 32, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Alegreya Sans", "Helvetica Neue", sans-serif;
  color: var(--text-dark);
  background: var(--neutral-warm-gray);
  min-height: 100vh;
}

.viewer-page {
  overflow: hidden;
}

.backdrop {
  display: none;
}

.page {
  width: min(1240px, 100% - 2.5rem);
  margin: 0 auto;
  padding: 3rem 0 4rem;
  position: relative;
}

.hero {
  margin-bottom: 2.5rem;
  background: var(--main-olive);
  border: 1px solid rgba(30, 29, 32, 0.2);
  border-radius: 16px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: fade-in 500ms ease-out both;
}

.hero-copy {
  text-align: center;
  padding: 0.55rem 0.4rem 0;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.hero-copy .lang-switch {
  margin-top: 0.55rem;
  margin-bottom: 0;
}

.lang-btn {
  border: 1px solid rgba(30, 29, 32, 0.28);
  border-radius: 999px;
  background: rgba(239, 237, 238, 0.5);
  color: var(--text-dark);
  padding: 0.2rem 0.55rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}

.lang-btn.is-active {
  background: rgba(30, 29, 32, 0.17);
  border-color: rgba(30, 29, 32, 0.4);
  font-weight: 700;
}

.lang-btn:focus-visible {
  outline: 2px solid rgba(30, 29, 32, 0.5);
  outline-offset: 2px;
}

.hero-photo {
  width: 100%;
  height: clamp(220px, 38vw, 440px);
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 12px;
  background: rgba(239, 237, 238, 0.35);
}

h1 {
  font-family: "Cormorant Garamond", Georgia, serif;
  line-height: 1.1;
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  color: var(--text-dark);
}

.hero-subtitle {
  margin: 0.45rem auto 0;
  max-width: 60ch;
  font-size: 1rem;
  color: rgba(30, 29, 32, 0.86);
}

.albums {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 260px));
  justify-content: center;
  gap: 1rem;
}

.album-extra {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
}

.album-extra .album-card {
  width: min(260px, 100%);
}

.album-card {
  background: var(--accent-blush);
  border: 1px solid rgba(30, 29, 32, 0.2);
  border-radius: 16px;
  aspect-ratio: 1 / 1;
  padding: 0.95rem;
  min-height: 0;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  animation: fade-in 500ms ease-out both;
}

.album-photo,
.album-photo-slot {
  width: min(78%, 190px);
  aspect-ratio: 4 / 3;
  margin: auto auto 0;
  display: block;
  object-fit: cover;
  border-radius: 10px;
}

.album-photo {
  border: 1px solid rgba(30, 29, 32, 0.28);
  background: var(--surface);
}

.album-photo-slot {
  border: 1px dashed rgba(30, 29, 32, 0.35);
  background: rgba(239, 237, 238, 0.72);
}

.album-card-link {
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.album-card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(30, 29, 32, 0.2);
}

.album-card-link:focus-visible {
  outline: 2px solid rgba(30, 29, 32, 0.55);
  outline-offset: 2px;
}

.album-card:nth-child(3n + 2) {
  animation-delay: 90ms;
}

.album-card:nth-child(3n) {
  animation-delay: 180ms;
}

h2 {
  font-family: "Alegreya Sans", "Helvetica Neue", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
}

.album-card p {
  margin: 0;
  color: rgba(30, 29, 32, 0.86);
  font-size: 0.9rem;
  line-height: 1.35;
}

.album-link {
  margin-top: auto;
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  color: var(--text-dark);
  font-weight: 600;
}

.album-link:hover,
.album-link:focus-visible {
  color: rgba(30, 29, 32, 0.85);
}

.viewer {
  width: 100%;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0.75rem;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.75rem;
}

.viewer-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--accent-blush);
  border: 1px solid rgba(30, 29, 32, 0.2);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
}

.viewer-lang-switch {
  margin-bottom: 0;
  margin-left: auto;
}

.back-link {
  width: fit-content;
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 600;
  border-bottom: 1px solid rgba(30, 29, 32, 0.45);
}

.back-link:hover,
.back-link:focus-visible {
  border-bottom-color: rgba(30, 29, 32, 0.85);
}

.viewer-title {
  font-size: clamp(1.35rem, 3.2vw, 2.1rem);
  margin-right: auto;
}

.viewer-frame-wrap {
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(30, 29, 32, 0.2);
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

#viewer-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.viewer-open {
  display: inline-block;
  width: fit-content;
  text-align: left;
  margin-top: 0;
  white-space: nowrap;
}

.page-footer {
  margin-top: 1.25rem;
  padding: 0.65rem 0.25rem 0;
  border-top: 1px solid rgba(30, 29, 32, 0.18);
  text-align: center;
  font-size: 0.92rem;
  color: rgba(30, 29, 32, 0.72);
}

.page-footer p {
  margin: 0;
}

.footer-contact {
  display: inline-block;
  margin-top: 0.25rem;
  color: rgba(30, 29, 32, 0.78);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.footer-contact:hover,
.footer-contact:focus-visible {
  color: rgba(30, 29, 32, 0.9);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .page {
    width: min(1240px, 100% - 1.5rem);
    padding-top: 1.8rem;
  }

  .hero {
    margin-bottom: 1.5rem;
    padding: 0.65rem;
  }

  .albums {
    grid-template-columns: 1fr;
    justify-content: center;
  }

  .album-extra .album-card {
    width: 100%;
  }

  .album-card {
    padding: 0.9rem;
    min-height: 0;
    border-radius: 14px;
  }

  .viewer {
    padding: 0.45rem;
    gap: 0.5rem;
  }

  .viewer-head {
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
  }

  .viewer-lang-switch {
    margin-left: 0;
  }

  .viewer-title {
    font-size: 1.2rem;
  }

  .viewer-open {
    font-size: 0.88rem;
  }

  .viewer-frame-wrap {
    border-radius: 12px;
  }
}

@media (max-width: 980px) and (min-width: 641px) {
  .albums {
    grid-template-columns: repeat(2, minmax(0, 260px));
    justify-content: center;
  }
}
