:root {
  --bg-cream: #fbf7ef;
  --bg-warm: #efe5d6;
  --bg-deep: #e6d8c3;
  --paper: #f6efe4;
  --ink-main: #4b3525;
  --ink-soft: #76543a;
  --wood-light: #d6a06a;
  --wood-mid: #9f6435;
  --wood-deep: #6c3b1a;
  --wood-shadow: rgba(70, 39, 18, 0.26);
  --line-soft: rgba(120, 87, 55, 0.18);
  --glow: rgba(255, 244, 227, 0.82);
  --ease-premium: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "Segoe UI Variable", "Trebuchet MS", "Segoe UI", sans-serif;
  --font-serif: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-main);
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at 50% -15%, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 15% 18%, rgba(227, 191, 136, 0.24) 0%, rgba(227, 191, 136, 0) 26%),
    radial-gradient(circle at 85% 14%, rgba(211, 177, 130, 0.18) 0%, rgba(211, 177, 130, 0) 24%),
    linear-gradient(180deg, var(--bg-cream) 0%, var(--bg-warm) 52%, var(--bg-deep) 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 36%),
    repeating-linear-gradient(
      135deg,
      rgba(131, 96, 59, 0.028) 0 2px,
      rgba(131, 96, 59, 0) 2px 12px
    );
  opacity: 0.72;
}

body::after {
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0) 56%, rgba(85, 57, 34, 0.06) 100%);
}

img {
  max-width: 100%;
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Layout */
.page-shell {
  position: relative;
  min-height: 100vh;
  padding: clamp(1.25rem, 3vw, 2.4rem) clamp(1rem, 4vw, 3.25rem) clamp(3rem, 6vw, 4.5rem);
}

.page-shell::before {
  content: "";
  position: absolute;
  inset: 1rem;
  border-radius: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.hero {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: clamp(0.25rem, 1vw, 0.8rem);
  padding-bottom: clamp(1.5rem, 4vw, 3rem);
}

.site-logo {
  width: clamp(8.5rem, 16vw, 13rem);
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 18px 30px rgba(96, 64, 34, 0.14))
    drop-shadow(0 4px 10px rgba(255, 255, 255, 0.6));
  opacity: 0;
  transform: translateY(-0.8rem) scale(0.97);
}

main {
  display: flex;
  justify-content: center;
}

.archive {
  width: min(100%, 88rem);
}

.archive-showcase {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 3vw, 2.8rem);
  border-radius: 2.2rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(247, 239, 227, 0.42)),
    linear-gradient(140deg, rgba(255, 252, 247, 0.72), rgba(234, 221, 202, 0.5));
  border: 1px solid rgba(137, 100, 61, 0.14);
  box-shadow:
    0 1.5rem 3.5rem rgba(104, 72, 40, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -1.2rem 2rem rgba(195, 167, 129, 0.08);
  backdrop-filter: blur(10px);
}

.archive-showcase::before,
.archive-showcase::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.archive-showcase::before {
  inset: 0.9rem;
  border-radius: 1.6rem;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 24%),
    repeating-linear-gradient(
      90deg,
      rgba(148, 104, 63, 0.03) 0 1px,
      rgba(148, 104, 63, 0) 1px 4.6rem
    );
}

.archive-showcase::after {
  left: 7%;
  right: 7%;
  bottom: 1rem;
  height: 1.8rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(86, 52, 25, 0.17), rgba(86, 52, 25, 0) 72%);
  filter: blur(0.7rem);
}

.showcase-glow {
  position: absolute;
  inset: -15% 12% auto;
  height: min(22rem, 38vw);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 249, 239, 0.88) 0%, rgba(255, 249, 239, 0.18) 44%, rgba(255, 249, 239, 0) 70%);
  filter: blur(0.6rem);
  pointer-events: none;
}

/* Magazine Showcase */
.magazine-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(1.25rem, 2vw, 2rem);
  align-items: end;
  list-style: none;
  padding: clamp(1rem, 2vw, 1.75rem) 0 0;
  margin: 0;
}

.magazine-stand {
  position: relative;
  display: grid;
  gap: 1rem;
  justify-items: center;
  align-items: end;
  padding: 0 0.45rem 2.65rem;
  opacity: 0;
  transform: translateY(1.6rem);
  isolation: isolate;
}

.magazine-stand::before,
.magazine-stand::after {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  pointer-events: none;
}

.magazine-stand::before {
  bottom: 0.85rem;
  height: 1.25rem;
  border-radius: 0.9rem 0.9rem 1.1rem 1.1rem;
  background:
    linear-gradient(180deg, rgba(255, 243, 225, 0.34), rgba(255, 243, 225, 0) 26%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.08) 0 8%,
      rgba(124, 73, 34, 0.05) 8% 15%,
      rgba(255, 255, 255, 0.03) 15% 21%
    ),
    linear-gradient(145deg, var(--wood-light) 0%, var(--wood-mid) 48%, var(--wood-deep) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 249, 240, 0.42),
    inset 0 -0.55rem 0.9rem rgba(78, 44, 20, 0.32),
    0 1rem 1.6rem rgba(66, 38, 18, 0.18);
}

.magazine-stand::after {
  left: 11%;
  right: 11%;
  bottom: 0.25rem;
  height: 0.9rem;
  border-radius: 0 0 1rem 1rem;
  background: linear-gradient(180deg, rgba(84, 47, 23, 0.86), rgba(48, 24, 10, 0.72));
  box-shadow: 0 0.8rem 1rem rgba(48, 24, 10, 0.16);
  transform: perspective(520px) rotateX(70deg);
  transform-origin: top;
}

.magazine-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 210 / 297;
  border-radius: 1.1rem;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(228, 214, 191, 0.9)),
    linear-gradient(140deg, #f4ece0, #dcc8a7);
  border: 1px solid rgba(128, 95, 62, 0.16);
  box-shadow:
    0 1.2rem 2rem rgba(74, 45, 21, 0.18),
    0 0.4rem 0.9rem rgba(74, 45, 21, 0.08);
  cursor: pointer;
  transform: rotateZ(var(--tilt));
  transform-origin: center bottom;
  transition:
    transform 0.55s var(--ease-premium),
    box-shadow 0.55s var(--ease-premium),
    border-color 0.35s ease;
}

.magazine-card::before,
.magazine-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.magazine-card::before {
  z-index: 2;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.08) 18%, rgba(255, 255, 255, 0) 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(63, 40, 20, 0.12) 100%);
}

.magazine-card::after {
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: inherit;
}

.magazine-edge {
  position: absolute;
  inset: 0 auto 0 0;
  width: 7.5%;
  z-index: 3;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.12) 24%, rgba(88, 56, 30, 0.22) 100%);
  box-shadow:
    inset -1px 0 0 rgba(255, 255, 255, 0.4),
    inset -10px 0 18px rgba(77, 45, 22, 0.12);
}

.magazine-placeholder {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  padding: 1.4rem;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 0.82rem;
  line-height: 1.6;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(96, 66, 37, 0.76);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0) 36%),
    repeating-linear-gradient(
      180deg,
      rgba(117, 85, 51, 0) 0 14px,
      rgba(117, 85, 51, 0.04) 14px 15px
    ),
    linear-gradient(145deg, rgba(245, 236, 222, 0.96), rgba(224, 208, 183, 0.96));
}

.magazine-card img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: linear-gradient(180deg, #f7f0e4, #e7d8c1);
}

.magazine-reflection {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 3%;
  z-index: 2;
  height: 14%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 72%);
  filter: blur(0.65rem);
  opacity: 0.55;
  transform: translateY(40%);
}

.magazine-label {
  position: relative;
  z-index: 1;
  font-family: var(--font-serif);
  font-size: clamp(0.88rem, 1vw + 0.45rem, 1.05rem);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  transition:
    transform 0.35s ease,
    color 0.35s ease;
}

.magazine-card:hover,
.magazine-card:focus-visible {
  transform: translateY(-0.9rem) scale(1.035) rotateZ(0deg);
  border-color: rgba(148, 106, 68, 0.3);
  box-shadow:
    0 2rem 3.2rem rgba(74, 45, 21, 0.24),
    0 0.8rem 1.2rem rgba(74, 45, 21, 0.14);
}

.magazine-card:focus-visible {
  outline: none;
  box-shadow:
    0 2rem 3.2rem rgba(74, 45, 21, 0.24),
    0 0.8rem 1.2rem rgba(74, 45, 21, 0.14),
    0 0 0 0.28rem rgba(183, 144, 97, 0.22);
}

.magazine-stand:hover .magazine-label,
.magazine-stand:focus-within .magazine-label {
  color: #563825;
  transform: translateY(-0.15rem);
}

.magazine-card.image-missing img {
  opacity: 0;
}

.magazine-grid .magazine-stand:nth-child(1) .magazine-card {
  --tilt: -2.2deg;
}

.magazine-grid .magazine-stand:nth-child(2) .magazine-card {
  --tilt: -1deg;
}

.magazine-grid .magazine-stand:nth-child(3) .magazine-card {
  --tilt: 0.45deg;
}

.magazine-grid .magazine-stand:nth-child(4) .magazine-card {
  --tilt: 1.15deg;
}

.magazine-grid .magazine-stand:nth-child(5) .magazine-card {
  --tilt: 2.2deg;
}

/* Entrance Motion */
body.is-ready .site-logo {
  animation: logo-fade 0.85s var(--ease-premium) forwards;
}

body.is-ready .magazine-stand {
  animation: shelf-reveal 0.85s var(--ease-premium) forwards;
}

body.is-ready .magazine-grid .magazine-stand:nth-child(1) {
  animation-delay: 0.1s;
}

body.is-ready .magazine-grid .magazine-stand:nth-child(2) {
  animation-delay: 0.18s;
}

body.is-ready .magazine-grid .magazine-stand:nth-child(3) {
  animation-delay: 0.26s;
}

body.is-ready .magazine-grid .magazine-stand:nth-child(4) {
  animation-delay: 0.34s;
}

body.is-ready .magazine-grid .magazine-stand:nth-child(5) {
  animation-delay: 0.42s;
}

@keyframes logo-fade {
  from {
    opacity: 0;
    transform: translateY(-0.8rem) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shelf-reveal {
  from {
    opacity: 0;
    transform: translateY(1.6rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 1100px) {
  .archive {
    width: min(100%, 70rem);
  }

  .magazine-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.8rem 1.4rem;
  }

  .magazine-grid .magazine-stand:nth-child(4),
  .magazine-grid .magazine-stand:nth-child(5) {
    max-width: min(100%, 16rem);
    justify-self: center;
  }
}

@media (max-width: 780px) {
  .page-shell {
    padding-inline: 0.9rem;
  }

  .archive-showcase {
    padding: 1.15rem 0.95rem 1.4rem;
    border-radius: 1.65rem;
  }

  .magazine-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.45rem 1.05rem;
  }

  .magazine-stand {
    padding-inline: 0.25rem;
  }

  .magazine-grid .magazine-stand:nth-child(5) {
    grid-column: 1 / -1;
    max-width: min(100%, 17rem);
    width: 100%;
  }
}

@media (max-width: 560px) {
  .hero {
    padding-bottom: 1.35rem;
  }

  .site-logo {
    width: clamp(7.2rem, 34vw, 9rem);
  }

  .archive {
    width: 100%;
  }

  .archive-showcase {
    padding: 0.9rem 0.7rem 1.2rem;
  }

  .archive-showcase::before {
    inset: 0.55rem;
  }

  .showcase-glow {
    inset: -10% 4% auto;
    height: 10rem;
  }

  .magazine-grid {
    grid-template-columns: 1fr;
    max-width: 18rem;
    margin-inline: auto;
    gap: 1.1rem;
  }

  .magazine-grid .magazine-stand:nth-child(4),
  .magazine-grid .magazine-stand:nth-child(5) {
    max-width: none;
  }

  .magazine-grid .magazine-stand:nth-child(5) {
    grid-column: auto;
  }

  .magazine-label {
    letter-spacing: 0.2em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .site-logo,
  .magazine-stand {
    opacity: 1;
    transform: none;
  }
}
