:root {
  --bg: #f4eee4;
  --surface: rgba(255, 248, 240, 0.72);
  --surface-strong: rgba(255, 248, 240, 0.9);
  --ink: #211711;
  --muted: #5e4f45;
  --line: rgba(66, 38, 17, 0.16);
  --accent: #b14d1f;
  --accent-deep: #6b1f16;
  --winter: #28344e;
  --spring: #7fb1c9;
  --summer: #c74b3f;
  --autumn: #8a6447;
  --shadow: 0 24px 80px rgba(44, 25, 12, 0.16);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --content-width: min(1180px, calc(100vw - 2rem));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(199, 75, 63, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(127, 177, 201, 0.2), transparent 30%),
    linear-gradient(180deg, #f7f1e7 0%, #f1e6d6 38%, #eee4d6 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  position: relative;
  overflow: clip;
}

.page-shell::before,
.page-shell::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  filter: blur(24px);
}

.page-shell::before {
  top: 4rem;
  left: -4rem;
  width: 14rem;
  height: 14rem;
  background: rgba(177, 77, 31, 0.16);
}

.page-shell::after {
  right: -5rem;
  bottom: 10rem;
  width: 18rem;
  height: 18rem;
  background: rgba(72, 119, 142, 0.16);
}

.hero,
main > section {
  width: var(--content-width);
  margin: 0 auto;
}

.hero {
  padding: 1rem 0 2rem;
}

.hero-nav a,
.button {
  transition: transform 180ms ease, opacity 180ms ease, background-color 180ms ease;
}

.hero-nav a:hover,
.button:hover {
  transform: translateY(-1px);
}

.hero-panel {
  --spotlight-x: 82%;
  --spotlight-y: 14%;
  position: relative;
  display: grid;
  gap: 1.5rem;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  margin-top: 1.25rem;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(140deg, rgba(27, 17, 11, 0.82), rgba(78, 47, 28, 0.66)),
    url("./gallery/hero-cover.webp") center/cover no-repeat;
  box-shadow: var(--shadow);
  color: #fef8ee;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--spotlight-x) var(--spotlight-y), rgba(248, 221, 175, 0.2), transparent 32%);
  opacity: 0.95;
  pointer-events: none;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 8, 6, 0.22) 100%);
  pointer-events: none;
}

.hero-copy,
.hero-card {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.hero-head {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  align-self: start;
  pointer-events: auto;
}

.hero-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  margin-left: auto;
  gap: 1.1rem;
  color: rgba(255, 244, 227, 0.88);
  font-size: 1rem;
  text-align: right;
}

.hero-nav a {
  position: relative;
}

.hero-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.25rem;
  width: 100%;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.4);
  transform-origin: left;
  transition: opacity 180ms ease, transform 180ms ease;
}

.hero-nav a:hover::after,
.hero-nav a:focus-visible::after {
  opacity: 0.7;
  transform: scaleX(1);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgba(255, 248, 240, 0.4);
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.08);
  color: #fff7ef;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 1.1rem;
  height: 1px;
  margin: 0.16rem 0;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

.eyebrow,
.section-kicker,
.hero-card-label {
  margin: 0 0 0.8rem;
  color: rgba(255, 244, 227, 0.78);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-head .eyebrow {
  margin-bottom: 0;
  align-self: center;
}

.hero h1,
.section-grid h2,
.contact h2 {
  margin: 0;
  font-family: Iowan Old Style, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  line-height: 0.95;
}

.hero h1 {
  max-width: 9ch;
  font-size: clamp(3.6rem, 12vw, 6.8rem);
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
}

.hero-lead {
  max-width: 40rem;
  margin: 1rem 0 0;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  color: rgba(255, 244, 227, 0.92);
  overflow-wrap: anywhere;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.4rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 3rem;
  padding: 0.75rem 1.2rem;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  max-width: 100%;
  text-align: center;
}

.button-primary {
  background: #f8ddaf;
  color: #29170d;
}

.button-secondary {
  border-color: rgba(255, 248, 240, 0.45);
  background: rgba(255, 248, 240, 0.08);
  color: #fff7ef;
}

.hero-card {
  align-self: end;
  max-width: 24rem;
  padding: 1.15rem 1.2rem;
  border: 1px solid rgba(255, 246, 232, 0.18);
  border-radius: var(--radius-lg);
  background: rgba(255, 248, 240, 0.12);
  backdrop-filter: blur(12px);
}

.hero-card-title {
  margin: 0;
  font-family: Iowan Old Style, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 2rem;
  line-height: 1;
}

.hero-card-text {
  margin: 0.8rem 0 0;
  color: rgba(255, 244, 227, 0.88);
}

main {
  padding: 1rem 0 4rem;
}

main > section {
  margin-top: clamp(3rem, 8vw, 6rem);
}

.reveal-section {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.reveal-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.section-grid {
  display: grid;
  gap: 1.5rem;
}

.section-grid > * {
  min-width: 0;
}

.section-kicker {
  color: var(--accent);
}

.section-grid h2,
.contact h2 {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
}

.section-copy,
.manifesto-panel,
.collection-note,
.contact-lead,
.contact-list,
.form-hint,
.form-status {
  color: var(--muted);
}

.section-copy p,
.manifesto-panel p,
.collection-note,
.contact-copy p,
.contact-list li,
.poem-description p {
  margin: 0;
}

.section-copy,
.manifesto-panel,
.author-copy,
.contact-form,
.poem-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 36px rgba(46, 27, 13, 0.08);
}

.section-copy,
.manifesto-panel,
.contact-form,
.author-copy {
  padding: clamp(1.2rem, 3vw, 2rem);
}

.intro .section-copy,
.manifesto-panel,
.author-copy .section-copy {
  display: grid;
  gap: 1rem;
}

.collection-head {
  align-items: end;
}

.season-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
  margin-top: 1.5rem;
  color: var(--muted);
}

.season-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
}

.legend-dot.winter {
  background: var(--winter);
}

.legend-dot.spring {
  background: var(--spring);
}

.legend-dot.summer {
  background: var(--summer);
}

.legend-dot.autumn {
  background: var(--autumn);
}

.poems-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.poems-grid[data-state="loading"] {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.poems-grid[data-state="loading"] .poem-skeleton {
  min-height: 25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(110deg, rgba(255, 248, 240, 0.8) 8%, rgba(255, 255, 255, 0.96) 18%, rgba(255, 248, 240, 0.8) 33%),
    rgba(255, 248, 240, 0.72);
  background-size: 200% 100%;
  box-shadow: 0 12px 36px rgba(46, 27, 13, 0.08);
  animation: skeleton-shimmer 1.4s linear infinite;
}

.poems-grid[data-state="loading"] .poem-skeleton::before,
.poems-grid[data-state="loading"] .poem-skeleton::after {
  content: "";
  display: block;
  margin: 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
}

.poems-grid[data-state="loading"] .poem-skeleton::before {
  height: 14rem;
  margin-bottom: 1.25rem;
}

.poems-grid[data-state="loading"] .poem-skeleton::after {
  height: 5.5rem;
}

.poems-grid[data-state="error"]::before {
  content: "Не удалось загрузить галерею. Обновите страницу.";
  display: inline-block;
  color: var(--accent-deep);
  padding: 0.75rem 0;
}

.poem-card {
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 480ms ease, transform 480ms ease, border-color 240ms ease, box-shadow 240ms ease;
}

.poem-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: inherit;
}

.poem-open:focus-visible {
  outline: 2px solid rgba(177, 77, 31, 0.38);
  outline-offset: -2px;
}

.poem-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.poem-card:hover {
  border-color: rgba(84, 48, 22, 0.34);
  box-shadow: 0 18px 44px rgba(46, 27, 13, 0.14);
}

.poem-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 34%, transparent 70%, rgba(177, 77, 31, 0.1));
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}

.poem-card:hover::after {
  opacity: 1;
}

.poem-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.poem-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.001);
  transition: transform 700ms cubic-bezier(0.2, 0.7, 0.2, 1), filter 320ms ease;
}

.poem-card:hover .poem-image img {
  transform: scale(1.05);
  filter: saturate(1.05) contrast(1.02);
}

.poem-content {
  padding: 1rem;
  transition: transform 240ms ease;
}

.poem-card:hover .poem-content {
  transform: translateY(-2px);
}

.poem-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
}

.poem-month {
  margin: 0;
  font-family: Iowan Old Style, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 2rem;
  line-height: 1;
}

.poem-season {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.poem-proverb {
  margin: 0.9rem 0 0;
  color: var(--accent-deep);
  font-style: italic;
}

.poem-description {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.poem-card[data-season="winter"] {
  border-top: 4px solid var(--winter);
}

.poem-card[data-season="spring"] {
  border-top: 4px solid var(--spring);
}

.poem-card[data-season="summer"] {
  border-top: 4px solid var(--summer);
}

.poem-card[data-season="autumn"] {
  border-top: 4px solid var(--autumn);
}

.author {
  align-items: start;
}

.author-media {
  overflow: hidden;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.author-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-copy {
  display: grid;
  gap: 1.2rem;
}

.author-signature {
  margin: -0.2rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-style: italic;
}

.author-quote {
  margin: 0;
  padding-left: 1rem;
  border-left: 3px solid rgba(177, 77, 31, 0.34);
  color: var(--accent-deep);
  font-family: Iowan Old Style, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 1.6rem;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.contact-grid {
  align-items: start;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 14, 10, 0.8);
  backdrop-filter: blur(16px);
}

.lightbox-dialog {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 100dvh;
  padding: clamp(1rem, 4vw, 2rem);
}

.lightbox-stage {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}

.lightbox-figure {
  margin: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: rgba(255, 248, 240, 0.08);
  box-shadow: 0 24px 80px rgba(8, 6, 5, 0.34);
  touch-action: pan-y pinch-zoom;
  cursor: pointer;
}

.lightbox-figure img {
  width: 100%;
  max-height: min(72dvh, 920px);
  object-fit: contain;
  background: rgba(0, 0, 0, 0.12);
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-caption {
  display: grid;
  gap: 0.4rem;
  padding: 1rem 1.1rem 1.2rem;
  background: rgba(28, 18, 12, 0.86);
  color: #f8efe4;
}

.lightbox-caption h3,
.lightbox-count,
.lightbox-proverb {
  margin: 0;
}

.lightbox-count {
  color: rgba(248, 239, 228, 0.72);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lightbox-proverb {
  color: rgba(248, 239, 228, 0.88);
  font-style: italic;
}

.lightbox-close,
.lightbox-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 248, 240, 0.22);
  background: rgba(28, 18, 12, 0.7);
  color: #fff7ef;
  backdrop-filter: blur(16px);
}

.lightbox-close {
  position: absolute;
  top: clamp(0.8rem, 3vw, 1.4rem);
  right: clamp(0.8rem, 3vw, 1.4rem);
  z-index: 2;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
}

.lightbox-close span {
  position: absolute;
  width: 1.15rem;
  height: 1px;
  background: currentColor;
}

.lightbox-close span:first-child {
  transform: rotate(45deg);
}

.lightbox-close span:last-child {
  transform: rotate(-45deg);
}

.lightbox-nav {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
}

.lightbox-nav span {
  font-size: 2rem;
  line-height: 1;
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
  outline: 2px solid rgba(255, 248, 240, 0.54);
  outline-offset: 2px;
}

.contact-list {
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.8rem;
  margin: 1.5rem 0 0;
}

.contact-list strong {
  color: var(--ink);
}

.contact-form {
  display: grid;
  gap: 1rem;
}

.contact-form label {
  display: grid;
  gap: 0.45rem;
}

.contact-form span {
  font-size: 0.92rem;
  font-weight: 700;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(72, 42, 22, 0.16);
  border-radius: 16px;
  background: rgba(255, 251, 246, 0.92);
  color: var(--ink);
}

.captcha-row {
  display: grid;
  gap: 0.6rem;
}

.captcha-question {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(109, 74, 48, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid rgba(177, 77, 31, 0.18);
  border-color: rgba(177, 77, 31, 0.45);
}

.form-status {
  min-height: 1.5rem;
}

.form-status.is-error {
  color: #9f2f2f;
}

.form-status.is-success {
  color: #266843;
}

@media (min-width: 720px) {
  .hero-panel {
    grid-template-columns: minmax(0, 1.45fr) minmax(18rem, 0.8fr);
    grid-template-areas:
      "head head"
      "copy card";
    align-items: end;
    min-height: 76svh;
  }

  .hero-head {
    grid-area: head;
    margin-bottom: 0.25rem;
  }

  .hero-copy {
    grid-area: copy;
  }

  .hero-card {
    grid-area: card;
  }

  .section-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

  .poems-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .poems-grid[data-state="loading"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-grid {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  }
}

@media (min-width: 1080px) {
  .poems-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .poems-grid[data-state="loading"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .poem-card:nth-child(4n + 1) {
    transform: translateY(18px);
  }

  .poem-card.is-visible:nth-child(4n + 1) {
    transform: translateY(0);
  }
}

@media (max-width: 719px) {
  .reveal-section,
  .poem-card {
    opacity: 1;
    transform: none;
  }

  .hero {
    padding-top: 0.75rem;
  }

  .hero-panel {
    padding: 1rem;
    overflow: hidden;
  }

  .hero-head {
    position: relative;
    align-items: flex-start;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(2.3rem, 12.8vw, 3.8rem);
    line-height: 0.92;
  }

  .hero-lead {
    font-size: 0.95rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .button {
    width: 100%;
  }

  .hero-card {
    max-width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 20px;
  }

  .hero-card-title,
  .section-grid h2,
  .contact h2 {
    overflow-wrap: anywhere;
  }

  .hero-card-title {
    font-size: clamp(1.6rem, 9.6vw, 2.25rem);
    line-height: 0.96;
  }

  .author-signature {
    font-size: 0.92rem;
  }

  .hero-card-text {
    font-size: 0.95rem;
  }

  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
    flex-shrink: 0;
  }

  .hero-nav {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: min(18rem, 100%);
    display: none;
    grid-auto-flow: row;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid rgba(255, 248, 240, 0.18);
    border-radius: 22px;
    background: rgba(29, 18, 12, 0.88);
    backdrop-filter: blur(14px);
    box-shadow: 0 16px 48px rgba(14, 10, 8, 0.26);
  }

  .hero-nav.is-open {
    display: grid;
  }

  .lightbox-dialog {
    padding: 0.75rem;
  }

  .lightbox-stage {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .lightbox-figure img {
    max-height: 62dvh;
  }

  .lightbox-nav {
    position: absolute;
    top: calc(50% - 2.4rem);
    z-index: 2;
    width: 3rem;
    height: 3rem;
  }

  .lightbox-prev {
    left: 0.5rem;
  }

  .lightbox-next {
    right: 0.5rem;
  }

}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .poem-card {
    opacity: 1;
    transform: none;
  }

  .poem-image img,
  .poem-content,
  .poem-card::after,
  .poem-skeleton {
    transition: none;
  }

  .poem-skeleton {
    animation: none;
  }

  .reveal-section {
    opacity: 1;
    transform: none;
  }
}
