@font-face {
  font-family: 'Alegreya';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/alegreya-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Alegreya';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/alegreya-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin-inline: auto;
}

body > .container {
  flex: 1;
}

/* ---------- Link page ---------- */

.links-page {
  font-family: 'Alegreya', Georgia, serif;
  color: #f2edda;
  background: #141a0e;
}

/* The scenery stays fixed while the gallery scrolls over it. */
.links-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  background:
    url('/assets/img/bg-candle.webp') top right / 340px no-repeat,
    linear-gradient(rgba(10, 14, 6, 0.45), rgba(8, 11, 5, 0.7)),
    url('/assets/img/bg.webp') 60% center / cover no-repeat;
}

@media (max-width: 768px) {
  .links-page::before {
    background-position: top right, center, 20% center;
    background-size: 220px, auto, cover;
  }
}

/* The page snaps between two screens: links and gallery. The gallery scrolls on its own,
   so a swipe inside it can't carry on into the links; that takes a new scroll from its top.
   Only the gallery shows a scrollbar. */
:root:has(.gallery) {
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.links-main,
.gallery {
  scroll-snap-align: start;
}

.links-main {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 48px 20px;
}

.links-main:has(.scroll-cue) {
  padding-bottom: 72px;
}

.links-card {
  width: 100%;
  max-width: 490px;
  padding: 36px 30px;
  text-align: center;
  background: rgba(14, 18, 8, 0.55);
  border: 1px solid rgba(242, 237, 218, 0.12);
  border-radius: 22px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

.links-logo {
  width: min(440px, 100%);
  height: auto;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
}

.links-bio {
  margin: 14px 0 26px;
  font-size: 1.1rem;
  color: #ddd8c2;
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.link-button {
  --accent: #e6f37a;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 18px;
  border-radius: 14px;
  background: rgba(242, 237, 218, 0.06);
  border: 1px solid rgba(242, 237, 218, 0.14);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.link-button:hover,
.link-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 22px color-mix(in srgb, var(--accent) 30%, transparent);
}

.link-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.link-button--discord { --accent: #7289da; }
.link-button--x { --accent: #e7e9ea; }
.link-button--twitch { --accent: #a970ff; }
.link-button--youtube { --accent: #ff0033; }
.link-button--spotify { --accent: #1ed760; }

.link-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  opacity: 0.9;
  transition: color 0.15s ease;
}

.link-button:hover .link-icon,
.link-button:focus-visible .link-icon {
  color: var(--accent);
}

.link-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.link-label {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
}

.link-platform {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(242, 237, 218, 0.55);
}

/* Phones: fit links and the gallery cue on one screen, even with the browser bars shown. */
@media (max-width: 600px) {
  .links-main {
    gap: 12px;
    padding: 20px 16px;
  }

  .links-main:has(.scroll-cue) {
    padding-bottom: 64px;
  }

  .links-card {
    padding: 20px 16px;
    border-radius: 18px;
  }

  .links-logo {
    width: min(260px, 100%);
  }

  .links-bio {
    margin: 8px 0 16px;
    font-size: 1rem;
  }

  .links-list {
    gap: 8px;
  }

  .link-button {
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
  }

  .link-icon {
    width: 22px;
    height: 22px;
  }

  .link-text {
    flex: 1;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
  }

  .link-label {
    font-size: 1rem;
  }

  .link-platform {
    font-size: 0.72rem;
  }
}

.scroll-cue {
  position: absolute;
  bottom: 16px;
  left: 50%;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(242, 237, 218, 0.7);
  text-decoration: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  transition: color 0.15s ease;
}

.scroll-cue:hover,
.scroll-cue:focus-visible {
  color: #e6f37a;
}

.scroll-cue:focus-visible {
  outline: 2px solid #e6f37a;
  outline-offset: 4px;
  border-radius: 6px;
}

.scroll-cue-icon {
  width: 24px;
  height: 24px;
  animation: cue-bob 2.4s ease-in-out infinite;
}

@keyframes cue-bob {
  50% { transform: translateY(5px); }
}

/* ---------- Gallery ---------- */

.gallery {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  padding: 64px 20px 32px;
  background: linear-gradient(rgba(10, 13, 7, 0.82), rgba(7, 9, 5, 0.94));
  box-shadow: 0 -30px 60px rgba(0, 0, 0, 0.4);
  scrollbar-color: rgba(242, 237, 218, 0.3) transparent;
}

.gallery-header {
  margin-bottom: 40px;
  text-align: center;
}

.gallery-title {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

.gallery-title::after {
  content: '';
  display: block;
  width: 160px;
  height: 1px;
  margin: 16px auto 0;
  background: linear-gradient(90deg, transparent, rgba(230, 243, 122, 0.7), transparent);
}

.gallery-intro {
  margin: 14px 0 0;
  font-size: 1.1rem;
  color: #ddd8c2;
}

.gallery-wall {
  --gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  columns: 4 260px;
  column-gap: var(--gap);
}

@media (max-width: 600px) {
  .gallery {
    padding-inline: 12px;
  }

  .gallery-wall {
    --gap: 10px;
    columns: 2;
  }
}

.art {
  margin-bottom: var(--gap);
  break-inside: avoid;
}

.art-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(242, 237, 218, 0.14);
  border-radius: 14px;
  background: rgba(242, 237, 218, 0.05);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.art-frame:hover,
.art-frame:focus-within {
  transform: translateY(-3px);
  border-color: rgba(230, 243, 122, 0.6);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), 0 0 28px rgba(230, 243, 122, 0.18);
}

.art-frame:has(.art-open:focus-visible) {
  outline: 2px solid #e6f37a;
  outline-offset: 3px;
}

.art-open {
  display: block;
  outline: none;
}

.art-open img,
.art-open video {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.art-frame:hover .art-open > * {
  transform: scale(1.04);
}

.art-credit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.3;
}

.art-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.art-artist {
  font-size: 0.9rem;
  color: rgba(242, 237, 218, 0.75);
}

.art-artist a {
  font-weight: 700;
  color: #e6f37a;
  text-decoration: none;
}

.art-artist a:hover,
.art-artist a:focus-visible {
  text-decoration: underline;
}

.art-link-icon {
  width: 0.9em;
  height: 0.9em;
  margin-left: 2px;
  vertical-align: -0.05em;
}

/* Touch screens show the credit below the artwork … */
.art-frame .art-credit {
  padding: 8px 12px 10px;
}

/* … with a pointer it overlays the artwork and appears on hover. */
@media (hover: hover) {
  .art-frame .art-credit {
    position: absolute;
    inset: auto 0 0;
    padding: 48px 14px 12px;
    background: linear-gradient(transparent, rgba(8, 11, 5, 0.92));
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .art-frame .art-credit a {
    pointer-events: auto;
  }

  .art-frame:hover .art-credit,
  .art-frame:focus-within .art-credit {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 600px) {
  .art-frame .art-title {
    font-size: 0.92rem;
  }

  .art-frame .art-artist {
    font-size: 0.8rem;
  }
}

.gallery-note {
  margin: 40px 0 0;
  font-size: 0.85rem;
  text-align: center;
  color: rgba(242, 237, 218, 0.5);
}

/* ---------- Lightbox ---------- */

.lightbox {
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: visible;
  border: 0;
  background: none;
  color: inherit;
}

.lightbox::backdrop {
  background: rgba(5, 7, 3, 0.9);
}

.lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0;
}

/* Sized from the artwork's ratio, so swapping thumbnail for full size doesn't jump. */
.lightbox-media {
  display: block;
  width: min(92vw, 1600px, (100vh - 140px) * var(--ratio, 1));
  width: min(92vw, 1600px, (100svh - 140px) * var(--ratio, 1));
  height: auto;
  aspect-ratio: var(--ratio, auto);
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  cursor: zoom-out;
}

.lightbox-media[hidden] {
  display: none;
}

.lightbox-video[controls] {
  cursor: auto;
}

.lightbox-credit {
  align-items: center;
  text-align: center;
}

.lightbox-credit:empty {
  display: none;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(242, 237, 218, 0.2);
  border-radius: 50%;
  background: rgba(14, 18, 8, 0.6);
  color: inherit;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  border-color: #e6f37a;
  color: #e6f37a;
}

.lightbox-close svg {
  width: 22px;
  height: 22px;
}

.lightbox[open]::backdrop {
  animation: fade-in 0.3s ease;
}

.lightbox[open] .lightbox-figure {
  animation: lightbox-in 0.3s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes lightbox-in {
  from { opacity: 0; transform: scale(0.96); }
}

/* ---------- Scroll-driven effects (where supported) ---------- */

@media (prefers-reduced-motion: no-preference) {
  :root:has(.gallery) {
    scroll-behavior: smooth;
  }

  @supports (animation-timeline: view()) {
    /* Blur and dim the scenery on the way to the gallery. */
    .links-page:has(.gallery)::before {
      animation: scenery-dim linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }

    .links-card {
      animation: card-leave linear both;
      animation-timeline: view();
      animation-range: exit;
    }

    .art {
      animation: art-enter linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 80%;
    }
  }
}

@keyframes scenery-dim {
  to { filter: blur(6px) brightness(0.6); transform: scale(1.06); }
}

@keyframes card-leave {
  to { opacity: 0; transform: translateY(-40px) scale(0.96); }
}

@keyframes art-enter {
  from { opacity: 0; transform: translateY(48px) scale(0.97); }
}

@media (prefers-reduced-motion: reduce) {
  .link-button,
  .link-icon,
  .scroll-cue,
  .art-frame,
  .art-open > *,
  .art-frame .art-credit,
  .lightbox-close {
    transition: none;
  }

  .link-button:hover,
  .link-button:focus-visible,
  .art-frame:hover,
  .art-frame:focus-within,
  .art-frame:hover .art-open > * {
    transform: none;
  }

  .scroll-cue-icon,
  .lightbox[open]::backdrop,
  .lightbox[open] .lightbox-figure {
    animation: none;
  }
}
