/* ─── Inner pages: page head, journal cards, single post, pages, search,
   empty state, 404, pagination ───────────────────────────────────────── */

.page-head {
  padding: 32px 0 40px;

  @media (min-width: 992px) {
    padding: 56px 0 56px;
  }
}

.page-head__paper {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background-color: var(--card);
  background-image: repeating-linear-gradient(0deg, transparent 0 39px, var(--ruled) 39px 40px);

  @media (min-width: 768px) {
    padding: 48px 56px;
  }
}

.page-head__note {
  align-self: flex-start;
  font-size: 24px;
  color: var(--red);
  transform: rotate(-2deg);
}

.page-head__title {
  font-size: clamp(40px, 5.4vw, 68px);
  line-height: 1;
}

.page-head__text {
  max-width: 640px;
  color: var(--muted);
}

/* ─── Journal post cards ─────────────────────────────────────────────────── */

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 40px 28px;
}

.news-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.news-card__media {
  position: relative;
}

.news-card__photo {
  display: block;
  padding: 10px 10px 28px;
  background: var(--card-white);
  box-shadow: var(--shadow-photo);
  transform: rotate(-1deg);
  transition: transform var(--hover-duration) var(--timing);
}

.news-card:nth-child(even) .news-card__photo {
  transform: rotate(1deg);
}

.news-card:hover .news-card__photo {
  transform: rotate(0deg) translateY(-3px);
}

.news-card__image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.news-card__tag {
  position: absolute;
  top: -10px;
  right: 8px;
  z-index: 1;
  padding: 6px 12px;
  border: 2px double var(--red);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--red);
  font: 700 11px/1.2 var(--text-font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transform: rotate(4deg);

  &:hover {
    background: var(--red);
    color: var(--paper);
  }
}

.news-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-card__title {
  font-size: 28px;
  line-height: 1.08;

  a {
    color: var(--ink);
    text-decoration: none;

    &:hover {
      color: var(--red);
    }
  }
}

.news-card__excerpt {
  color: var(--muted);
  line-height: 1.55;
}

.news-card__meta {
  font-size: 13px;
  color: var(--muted);
}

/* ─── Pagination ─────────────────────────────────────────────────────────── */

.ymr-pagination {
  margin-top: 56px;

  .nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--line-strong);
    background: var(--card);
    color: var(--ink);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;

    &:hover {
      border-color: var(--ink);
    }

    &.current {
      background: var(--ink);
      border-color: var(--ink);
      color: var(--paper);
    }

    &.dots {
      border-color: transparent;
      background: none;
    }
  }
}

/* ─── Single post ────────────────────────────────────────────────────────── */

.post-single__head {
  padding: 32px 0 40px;

  @media (min-width: 992px) {
    padding: 48px 0 56px;
  }
}

.post-single__head-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 860px;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);

  a {
    text-decoration: none;
  }
}

.post-single__title {
  font-size: clamp(40px, 5.6vw, 72px);
  line-height: 1;
}

.post-single__meta {
  font-size: 14px;
  color: var(--muted);
}

.post-single__photo {
  max-width: 1000px;
  margin: 0 auto 56px;
  transform: rotate(-0.6deg);

  .polaroid__img {
    aspect-ratio: 16 / 9;
  }
}

.post-single__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 720px;
  margin: 40px auto 0;
}

.post-single {
  padding-bottom: var(--section-pad);
}

/* ─── Prose (post & page content) ────────────────────────────────────────── */

.prose {
  max-width: 720px;
  margin: 0 auto;
  font-size: 18px;
  line-height: 1.75;

  > * + * {
    margin-top: 1.1em;
  }

  h2,
  h3,
  h4 {
    margin-top: 1.6em;
  }

  h2 { font-size: clamp(30px, 3.2vw, 40px); }
  h3 { font-size: clamp(24px, 2.6vw, 30px); }
  h4 { font: 700 18px/1.3 var(--text-font); }

  ul,
  ol {
    padding-left: 1.3em;
  }

  ul { list-style: disc; }
  ol { list-style: decimal; }

  li + li {
    margin-top: 0.4em;
  }

  li::marker {
    color: var(--saffron);
  }

  blockquote {
    padding: 8px 0 8px 24px;
    border-left: 3px double var(--red);
    font-family: var(--hand-font);
    font-size: 28px;
    line-height: 1.25;
  }

  img {
    border-radius: var(--radius-sm);
  }

  figcaption {
    margin-top: 8px;
    font-family: var(--hand-font);
    font-size: 20px;
    color: var(--muted);
  }

  hr {
    border: 0;
    border-top: 1px dashed var(--line-dash);
  }

  a {
    text-underline-offset: 3px;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
  }

  th,
  td {
    padding: 10px;
    border-bottom: 1px dashed var(--line-dash);
    text-align: left;
  }
}

.prose--paper {
  max-width: 820px;
  padding: 32px 24px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--line);

  @media (min-width: 768px) {
    padding: 48px 56px;
  }
}

/* ─── Search ─────────────────────────────────────────────────────────────── */

.ymr-search {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  max-width: 560px;

  .field {
    flex: 1 1 240px;
  }
}

.search-bar {
  margin-bottom: 40px;
}

/* ─── Empty state & 404 ──────────────────────────────────────────────────── */

.empty-state,
.not-found__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;

  .ymr-search {
    justify-content: center;
  }
}

.empty-state {
  padding: 48px 0;
}

.empty-state__stamp {
  --size: 120px;
  transform: rotate(-10deg);
}

.empty-state__title {
  font-size: clamp(32px, 3.6vw, 44px);
}

.empty-state__text,
.not-found__text {
  max-width: 480px;
  color: var(--muted);
}

.not-found__stamp {
  --size: 168px;
  font-size: 32px;
  letter-spacing: 0.08em;
  transform: rotate(-12deg);

  .stamp__small {
    font-size: 10px;
  }
}

.not-found__note {
  font-size: 26px;
  color: var(--red);
}

.not-found__title {
  font-size: clamp(40px, 5vw, 64px);
}

/* ─── Related posts ──────────────────────────────────────────────────────── */

.related .section-head {
  margin-bottom: 40px;
}
