.stories-page {
  min-height: 100vh;
  padding: 120px clamp(18px, 5vw, 72px) 64px;
  background: var(--paper);
}

.stories-wrap {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.stories-heading {
  display: grid;
  gap: 14px;
  margin-bottom: 30px;
}

.stories-heading h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(52px, 7vw, 92px);
  line-height: 0.9;
  color: rgba(67, 103, 122, 0.92);
}

.stories-heading p {
  max-width: 680px;
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
  color: rgba(47, 50, 50, 0.72);
}

.stories-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin: 26px 0 34px;
}

.stories-filters input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid rgba(47, 50, 50, 0.14);
  border-radius: 8px;
  background: #fffefd;
  color: var(--ink);
  font: inherit;
}

.stories-filters button,
.story-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 11px 18px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: linear-gradient(180deg, rgba(168, 207, 229, 0.98), rgba(114, 173, 204, 0.96));
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.active-filter {
  margin: -18px 0 28px;
  color: rgba(47, 50, 50, 0.68);
}

.active-filter a,
.story-tags a {
  color: #4f85a4;
  font-weight: 700;
}

.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.story-card {
  overflow: hidden;
  border: 1px solid rgba(47, 50, 50, 0.12);
  border-radius: 8px;
  background: #fffefd;
  box-shadow: 0 16px 38px rgba(58, 68, 73, 0.09);
}

.story-card-media {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  background: rgba(159, 196, 219, 0.18);
  color: rgba(47, 50, 50, 0.58);
  font-weight: 700;
}

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

.story-card-body {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.story-card h2 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 32px;
  line-height: 1.05;
  color: rgba(47, 50, 50, 0.88);
}

.story-card p,
.story-content p,
.wojtek-note p {
  margin: 0;
  line-height: 1.65;
  color: rgba(47, 50, 50, 0.76);
}

.story-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.story-tags a,
.story-tags span {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(108, 155, 183, 0.13);
  font-size: 14px;
}

.empty-state {
  padding: 26px;
  border: 1px solid rgba(47, 50, 50, 0.12);
  border-radius: 8px;
  background: #fffefd;
}

.story-article {
  display: grid;
  gap: 28px;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(28px, 4.5vw, 52px);
  border: 1px solid rgba(67, 103, 122, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 254, 253, 0.92), rgba(255, 250, 243, 0.98)),
    #fffefd;
  box-shadow: 0 22px 58px rgba(58, 68, 73, 0.08);
}

.story-article h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(42px, 5.8vw, 64px);
  line-height: 1.04;
  font-weight: 700;
  color: rgba(67, 103, 122, 0.88);
  text-align: center;
}

.story-hero-image {
  overflow: hidden;
  border-radius: 8px;
  background: rgba(159, 196, 219, 0.18);
  box-shadow: 0 16px 34px rgba(58, 68, 73, 0.09);
}

.story-hero-image img {
  display: block;
  width: 100%;
  height: min(420px, 56vw);
  object-fit: cover;
}

.story-intro {
  margin: 0;
  padding: 18px 22px;
  border-left: 3px solid rgba(108, 155, 183, 0.38);
  border-radius: 8px;
  background: rgba(159, 196, 219, 0.1);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(23px, 3vw, 30px);
  line-height: 1.35;
  color: rgba(47, 50, 50, 0.78);
}

.story-content {
  display: grid;
  gap: 18px;
  font-size: 18.5px;
  line-height: 1.9;
  overflow: hidden;
}

.story-content h2,
.story-content h3 {
  margin: 12px 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  line-height: 1.1;
  color: rgba(47, 50, 50, 0.86);
}

.story-content h2 {
  font-size: 36px;
}

.story-content h3 {
  font-size: 28px;
}

.story-content ul,
.story-content ol {
  margin: 0;
  padding-left: 26px;
  line-height: 1.85;
  color: rgba(47, 50, 50, 0.76);
}

.story-content blockquote {
  margin: 4px 0;
  padding: 14px 18px;
  border-left: 3px solid rgba(108, 155, 183, 0.58);
  background: rgba(255, 254, 253, 0.72);
  color: rgba(47, 50, 50, 0.72);
}

.story-content a {
  color: #4f85a4;
  font-weight: 700;
}

.story-content figure {
  max-width: 560px;
  margin: 28px auto;
}

.story-content figure img,
.story-content > img,
.story-content p > img {
  display: block;
  width: auto;
  max-width: min(100%, 560px);
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

.story-content figcaption {
  margin-top: 8px;
  color: rgba(47, 50, 50, 0.62);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}

.story-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.story-gallery figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(47, 50, 50, 0.12);
  border-radius: 8px;
  background: #fffefd;
  box-shadow: 0 12px 28px rgba(58, 68, 73, 0.07);
}

.story-gallery img {
  display: block;
  width: 100%;
  height: auto;
}

.story-gallery figcaption {
  padding: 12px 14px;
  color: rgba(47, 50, 50, 0.68);
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
}

.story-tags-bottom {
  justify-content: center;
  padding-top: 4px;
}

.wojtek-note,
.youtube-box {
  padding: 22px 24px;
  border: 1px solid rgba(47, 50, 50, 0.12);
  border-radius: 8px;
  background: rgba(255, 254, 253, 0.78);
}

.wojtek-note h2,
.youtube-box h2 {
  margin: 0 0 10px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 32px;
}

.wojtek-note {
  border-color: rgba(108, 155, 183, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 254, 253, 0.72), rgba(159, 196, 219, 0.12));
}

.wojtek-note-legacy {
  display: none;
}

.youtube-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
}

.youtube-box {
  display: flex;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.youtube-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(180deg, rgba(168, 207, 229, 0.98), rgba(114, 173, 204, 0.96));
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(67, 119, 148, 0.18);
}

.back-link {
  color: #4f85a4;
  font-weight: 700;
  justify-self: start;
}

@media (max-width: 700px) {
  .stories-page {
    padding: 96px 14px 38px;
  }

  .stories-filters {
    grid-template-columns: 1fr;
  }

  .story-page .story-article {
    gap: 20px;
    padding: 20px 16px;
    border: 0;
    box-shadow: none;
  }

  .story-page .story-article h1 {
    font-size: clamp(38px, 12vw, 52px);
    text-align: left;
  }

  .story-page .story-hero-image img {
    height: min(280px, 68vw);
  }

  .story-page .story-intro {
    padding: 15px 16px;
  }

  .story-page .story-content {
    font-size: 17px;
    line-height: 1.78;
  }

  .story-page .wojtek-note {
    padding: 18px;
  }
}

/* Book-like story index */
.stories-wrap {
  width: min(900px, 100%);
}

.stories-heading {
  margin-bottom: 26px;
}

.stories-heading h1 {
  font-size: clamp(48px, 6vw, 76px);
}

.stories-heading p {
  max-width: 650px;
}

.stories-filters {
  max-width: 720px;
}

.active-filter {
  margin-bottom: 20px;
}

.stories-grid {
  display: grid;
  gap: 0;
  border-top: 1px solid rgba(47, 50, 50, 0.1);
}

.story-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  overflow: visible;
  padding: 24px 0;
  border: 0;
  border-bottom: 1px solid rgba(47, 50, 50, 0.1);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.story-card-media {
  width: 120px;
  height: 120px;
  overflow: hidden;
  border-radius: 8px;
  aspect-ratio: auto;
  background: rgba(159, 196, 219, 0.18);
  color: rgba(47, 50, 50, 0.58);
  font-size: 13px;
  text-align: center;
}

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

.story-card-body {
  gap: 10px;
  padding: 0;
}

.story-card h2 {
  font-size: clamp(30px, 4vw, 38px);
  line-height: 1.08;
}

.story-card p {
  max-width: 680px;
}

.story-card .story-tags {
  margin-top: 2px;
}

.story-card .story-tags a,
.story-card .story-tags span {
  background: rgba(108, 155, 183, 0.11);
}

.story-card .story-link {
  justify-self: start;
  min-height: 40px;
  margin-top: 4px;
  padding: 9px 16px;
  border-radius: 999px;
}

@media (max-width: 700px) {
  .story-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 24px 0;
  }

  .story-card-media {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
  }
}
