:root {
  --paper: #fbf0df;
  --paper-light: #fff8ec;
  --ink: #202120;
  --muted: #716760;
  --coral: #ee5e66;
  --coral-deep: #d94052;
  --coral-dark: #d94052;
  --teal: #43b4c3;
  --yellow: #f3ae2b;
  --line: rgb(61 45 34 / 18%);
  --shell: min(1450px, calc(100% - 56px));
  --max: 1460px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 9%, rgb(239 79 95 / 12%), transparent 26rem),
    radial-gradient(circle at 91% 19%, rgb(45 157 176 / 11%), transparent 28rem),
    radial-gradient(circle at 50% 0%, rgb(255 255 255 / 72%), transparent 34rem),
    var(--paper);
  font-family: Manrope, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: radial-gradient(rgb(23 21 22 / 8%) 0.7px, transparent 0.7px);
  background-size: 8px 8px;
  content: "";
  opacity: 0.35;
  pointer-events: none;
}

a {
  color: inherit;
}

.library-skip {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  font-weight: 800;
  transform: translateY(-160%);
}

.library-skip:focus {
  transform: none;
}

.site-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 260px 1fr 56px;
  gap: 28px;
  align-items: center;
  height: 78px;
  padding: 0 max(30px, calc((100vw - var(--max)) / 2));
  background: rgb(251 240 223 / 96%);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  width: max-content;
  color: var(--coral-deep);
  font: 800 34px/1 "Shantell Sans", cursive;
  letter-spacing: -3px;
  text-decoration: none;
  transform: rotate(-2deg);
  text-shadow: 1px 1px 0 rgb(255 255 255 / 70%);
}

.brand span {
  transform: translateY(-2px);
}

.brand b {
  font-weight: 800;
  transform: translateY(3px) rotate(2deg);
}

.site-header nav {
  display: flex;
  gap: clamp(22px, 4vw, 62px);
  align-items: center;
  justify-content: center;
  height: 100%;
}

.site-header nav a {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  font: 700 16px/1 Oswald, sans-serif;
  letter-spacing: 0.03em;
  text-decoration: none;
  white-space: nowrap;
}

.site-header nav a::after {
  position: absolute;
  right: 3px;
  bottom: 13px;
  left: 3px;
  height: 9px;
  background: url("../assets/hero-coral-chalk-line-v2.webp") center / 100% 100% no-repeat;
  content: "";
  mix-blend-mode: multiply;
  transform: scaleX(0) rotate(-2deg);
  transition: transform 200ms ease;
}

.site-header nav a:hover::after,
.site-header nav a.active::after {
  transform: scaleX(1) rotate(-2deg);
}

.header-telegram {
  display: grid;
  place-items: center;
  width: 50px;
  aspect-ratio: 1;
  color: #fff;
  background: var(--teal);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 3px 4px 0 rgb(32 33 32 / 20%);
  transform: rotate(-4deg);
  transition: transform 200ms ease;
}

.header-telegram svg {
  width: 29px;
  height: 29px;
  fill: currentColor;
  transform: translate(-1px, 1px);
}

.header-telegram:hover {
  transform: rotate(5deg) scale(1.07);
}

.site-header a:focus-visible,
.library-hero a:focus-visible,
.article-photo-card:focus-visible,
.library-cta a:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 5px;
}

.library-hero {
  position: relative;
  width: var(--shell);
  min-height: 0;
  margin: auto;
  padding: clamp(56px, 6vw, 90px) 2vw 18px;
}

.library-hero::before,
.library-hero::after {
  position: absolute;
  color: var(--coral);
  font: 700 70px/1 Neucha, cursive;
  content: "♡";
  opacity: 0.8;
  pointer-events: none;
}

.library-hero::before {
  top: 9%;
  right: 38%;
  transform: rotate(14deg);
}

.library-hero::after {
  right: 2%;
  bottom: 7%;
  color: var(--teal);
  content: "♫";
  transform: rotate(-11deg);
}

.library-hero-copy {
  position: relative;
  z-index: 2;
}

.library-hero h1 {
  margin: 0;
  font: 700 clamp(72px, 9.5vw, 154px)/0.82 Oswald, sans-serif;
  letter-spacing: -0.067em;
}

.library-hero h1 em {
  position: relative;
  display: inline-block;
  color: var(--coral);
  font-style: normal;
  transform: rotate(-1.5deg);
}

.library-hero h1 em::after {
  position: absolute;
  right: -2%;
  bottom: -14px;
  left: 2%;
  height: 11px;
  background: var(--coral);
  border-radius: 60% 40% 45% 55%;
  content: "";
  opacity: 0.86;
  transform: rotate(-1deg);
}

.library-hero-copy > p {
  max-width: 760px;
  margin: 34px 0 0;
  font-size: clamp(18px, 1.55vw, 23px);
  line-height: 1.55;
}

.doodle-heart,
.doodle-star {
  position: absolute;
  z-index: -1;
  color: var(--coral);
  font: 700 62px/1 Neucha, cursive;
  font-style: normal;
  opacity: 0.76;
}

.doodle-heart {
  right: 3%;
  bottom: -58px;
  transform: rotate(13deg);
}

.doodle-star {
  top: -26px;
  right: 16%;
  color: var(--yellow);
  transform: rotate(-16deg);
}

.article-collage {
  width: min(1420px, calc(100% - 64px));
  margin: -6px auto 0;
  padding: 18px 12px 154px;
  column-count: 4;
  column-gap: clamp(24px, 3vw, 46px);
}

.article-photo-card {
  position: relative;
  z-index: 1;
  display: inline-block;
  width: 100%;
  margin: var(--drop, 0) 0 -18px;
  break-inside: avoid;
  text-decoration: none;
  transform: translateX(var(--shift, 0)) rotate(var(--turn, 0deg));
  transform-origin: center;
  transition: z-index 0s, transform 180ms ease, filter 180ms ease;
}

.article-photo-card:nth-child(5n + 2) {
  width: 91%;
  margin-left: 7%;
}

.article-photo-card:nth-child(7n) {
  width: 106%;
  margin-left: -3%;
}

.article-photo-card:nth-child(9n + 3) {
  width: 96%;
}

.article-photo-card[hidden] {
  display: none;
}

.article-photo-card::after {
  position: absolute;
  z-index: 3;
  right: -13px;
  bottom: -22px;
  color: var(--coral);
  font: 700 42px/1 Neucha, cursive;
  content: attr(data-doodle);
  filter: drop-shadow(2px 2px 0 var(--paper));
  transform: rotate(calc(var(--turn, 0deg) * -1));
  pointer-events: none;
}

.article-photo-card figure {
  position: relative;
  margin: 0;
  padding: 9px 9px 17px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px 14px 9px 12px;
  box-shadow: 8px 10px 0 rgb(239 79 95 / 72%);
  transition: inherit;
}

.article-photo-card:nth-child(3n + 2) figure {
  box-shadow: 8px 10px 0 rgb(45 157 176 / 64%);
}

.article-photo-card:nth-child(4n) figure {
  box-shadow: 8px 10px 0 rgb(241 169 29 / 65%);
}

.article-photo-card figure::before {
  position: absolute;
  z-index: 2;
  top: -14px;
  left: 50%;
  width: 84px;
  height: 25px;
  background: rgb(225 199 161 / 82%);
  border: 1px solid rgb(132 102 70 / 18%);
  content: "";
  transform: translateX(-50%) rotate(-3deg);
}

.article-photo-card:nth-child(2n) figure::before {
  left: 20%;
  transform: rotate(5deg);
}

.article-photo-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #eadfd5;
  border: 1px solid rgb(23 21 22 / 42%);
}

.article-photo-card figcaption {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
  min-height: 92px;
  padding: 15px 7px 2px;
}

.article-photo-card h2 {
  margin: 0;
  font: 700 clamp(21px, 2vw, 29px)/1.01 Oswald, sans-serif;
  letter-spacing: -0.035em;
}

.article-photo-card figcaption span {
  color: var(--coral-dark);
  font: 700 11px/1 Oswald, sans-serif;
  letter-spacing: 0.055em;
  white-space: nowrap;
}

.article-photo-card:hover,
.article-photo-card:focus-visible {
  filter: saturate(1.05);
  transform: translateX(var(--shift, 0)) rotate(0deg) translateY(-9px) scale(1.025);
}

.library-cta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(24px, 4vw, 60px);
  align-items: center;
  width: min(1240px, calc(100% - 56px));
  margin: 0 auto 110px;
  padding: clamp(28px, 4vw, 54px);
  color: #fff;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 31px 21px 38px 25px;
  box-shadow: 10px 11px 0 var(--coral);
  transform: rotate(-0.4deg);
}

.library-cta > span {
  color: var(--coral);
  font-size: clamp(55px, 7vw, 96px);
}

.library-cta small {
  color: #ffb9c3;
  font: 700 12px/1 Oswald, sans-serif;
  letter-spacing: 0.07em;
}

.library-cta h2 {
  margin: 7px 0 0;
  font: 700 clamp(38px, 4.7vw, 69px)/0.93 Oswald, sans-serif;
  letter-spacing: -0.045em;
}

.library-cta a {
  padding: 17px 20px;
  color: var(--ink);
  background: #fff;
  border: 2px solid #fff;
  border-radius: 12px;
  box-shadow: 5px 5px 0 var(--coral);
  font: 700 14px/1 Oswald, sans-serif;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
}

.library-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px max(20px, calc((100vw - 1450px) / 2));
  border-top: 1px solid var(--line);
  font: 700 11px/1 Oswald, sans-serif;
  letter-spacing: 0.07em;
}

.library-footer p {
  margin: 0;
}

.library-footer a {
  text-decoration: none;
}

@media (max-width: 1100px) {
  .site-header {
    grid-template-columns: 210px 1fr 50px;
  }

  .site-header nav {
    gap: 22px;
  }

  .site-header nav a {
    font-size: 14px;
  }

  .article-collage {
    column-count: 3;
  }
}

@media (max-width: 780px) {
  .site-header {
    grid-template-columns: 1fr 48px;
    height: 68px;
    padding-inline: 16px;
  }

  .site-header .brand {
    font-size: 32px;
  }

  .site-header nav {
    display: none;
  }

  .header-telegram {
    width: 44px;
  }

  .library-hero {
    padding: 52px 0 12px;
  }

  .article-collage {
    width: calc(100% - 30px);
    padding-top: 14px;
    column-count: 2;
    column-gap: 22px;
  }

  .library-cta {
    grid-template-columns: auto 1fr;
  }

  .library-cta a {
    grid-column: 1 / -1;
    text-align: center;
  }
}

@media (max-width: 520px) {
  .library-hero {
    width: calc(100% - 28px);
  }

  .library-hero h1 {
    font-size: clamp(55px, 20vw, 88px);
  }

  .library-hero-copy > p {
    margin-top: 30px;
    font-size: 17px;
  }

  .article-collage {
    width: calc(100% - 34px);
    padding: 10px 0 104px;
    column-count: 1;
  }

  .article-photo-card,
  .article-photo-card:nth-child(5n + 2),
  .article-photo-card:nth-child(7n),
  .article-photo-card:nth-child(9n + 3) {
    width: 96%;
    margin: min(var(--drop, 0), 20px) 2% 18px;
    transform: rotate(calc(var(--turn, 0deg) * 0.55));
  }

  .article-photo-card:hover,
  .article-photo-card:focus-visible {
    transform: rotate(0deg) translateY(-5px) scale(1.01);
  }

  .article-photo-card figcaption {
    min-height: 84px;
  }

  .library-cta {
    display: block;
    width: calc(100% - 28px);
    margin-bottom: 72px;
  }

  .library-cta > span {
    display: none;
  }

  .library-cta a {
    display: block;
    margin-top: 24px;
  }

  .library-footer p {
    display: none;
  }
}

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

  .site-header *,
  .library-hero *,
  .article-photo-card,
  .library-cta * {
    transition: none !important;
  }
}

@media print {
  .site-header,
  .library-cta,
  .library-footer,
  .library-skip {
    display: none !important;
  }

  .article-collage {
    column-count: 2;
  }
}
