/*
 * Storefront redesign: content pages, single posts and the post list
 * (inc/itm-content.php). Built from the shared tokens (itm-layout.css) and
 * the redesign patterns: the account page title, the product card.
 */

body.itm-content-page #content {
  padding-bottom: 96px;
}

/* One reading column: title, meta, content. */
body.itm-content-page .itm-content {
  max-width: 760px;
  margin: 0 auto;
  padding-top: 40px;
}

body.itm-content-page .itm-content__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

body.itm-content-page h1.itm-content__title {
  margin: 0;
  font-family: var(--itm-font);
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--itm-ink);
}

/* Date · category */
body.itm-content-page .itm-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
}

body.itm-content-page .itm-post-meta a {
  color: var(--itm-muted-2);
}

body.itm-content-page .itm-post-meta a:hover {
  color: var(--itm-ink);
}

/* Content typography */
body.itm-content-page .itm-prose {
  font-family: var(--itm-font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--itm-ink-2);
}

body.itm-content-page .itm-prose > :first-child {
  margin-top: 0;
}

body.itm-content-page .itm-prose p {
  margin: 0 0 1.1em;
}

body.itm-content-page .itm-prose :is(h2, h3, h4, h5, h6) {
  margin: 2em 0 0.6em;
  font-family: var(--itm-font);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--itm-ink);
}

body.itm-content-page .itm-prose h2 {
  font-size: 26px;
}

body.itm-content-page .itm-prose h3 {
  font-size: 21px;
}

body.itm-content-page .itm-prose :is(h4, h5, h6) {
  font-size: 18px;
}

body.itm-content-page .itm-prose a {
  color: var(--itm-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

body.itm-content-page .itm-prose a:hover {
  color: var(--itm-ink-2);
}

body.itm-content-page .itm-prose strong {
  font-weight: 600;
  color: var(--itm-ink);
}

body.itm-content-page .itm-prose :is(ul, ol) {
  margin: 0 0 1.1em;
  padding-left: 1.4em;
}

body.itm-content-page .itm-prose ul {
  list-style: disc;
}

body.itm-content-page .itm-prose ol {
  list-style: decimal;
}

body.itm-content-page .itm-prose li {
  margin: 0 0 0.4em;
  padding-left: 0.2em;
}

body.itm-content-page .itm-prose li::marker {
  font-family: var(--itm-font);
  color: var(--itm-muted-2);
}

body.itm-content-page .itm-prose li > :is(ul, ol) {
  margin: 0.4em 0 0;
}

body.itm-content-page .itm-prose blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--itm-ink);
  font-family: var(--itm-font);
  font-size: 19px;
  font-style: normal;
  line-height: 1.55;
  color: var(--itm-ink);
}

body.itm-content-page .itm-prose blockquote p:last-child {
  margin-bottom: 0;
}

body.itm-content-page .itm-prose hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--itm-line);
}

body.itm-content-page .itm-prose :is(img, video, iframe) {
  max-width: 100%;
  height: auto;
}

body.itm-content-page .itm-prose img {
  border-radius: var(--itm-radius-card);
}

body.itm-content-page .itm-prose figure {
  margin: 1.6em 0;
}

body.itm-content-page .itm-prose figcaption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--itm-muted-2);
}

body.itm-content-page .itm-prose :is(code, kbd) {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--itm-soft);
  font-family: var(--itm-font-mono);
  font-size: 0.88em;
}

/* Tables: a white box with thin lines, scrolled sideways on phones. */
body.itm-content-page .itm-prose table {
  width: 100%;
  margin: 0 0 1.6em;
  border: 1px solid var(--itm-line);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 14px;
  background: var(--itm-white);
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;
}

body.itm-content-page .itm-prose :is(th, td) {
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--itm-line);
  vertical-align: top;
  text-align: left;
}

body.itm-content-page .itm-prose :is(th, td) + :is(th, td) {
  border-left: 1px solid var(--itm-line);
}

body.itm-content-page .itm-prose tr:last-child > :is(th, td) {
  border-bottom: 0;
}

body.itm-content-page .itm-prose th {
  background: var(--itm-paper);
  font-weight: 600;
  color: var(--itm-ink);
}

body.itm-content-page .itm-prose .wp-block-table {
  margin: 0 0 1.6em;
  overflow-x: auto;
}

body.itm-content-page .itm-prose .wp-block-table table {
  margin: 0;
}

/* Wide blocks leave the reading column. A page whose content is the
   bilingual terms (.itm-terms, two columns EN / RO) gets a wide column, title
   included. */
body.itm-content-page .itm-prose > .alignwide {
  width: min(1100px, calc(100vw - 48px));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

body.itm-content-page .itm-content:has(.itm-prose > :is(.itm-terms, .wp-block-columns)) {
  max-width: 1100px;
}

/* Column blocks (e.g. the bilingual privacy policy, RO | EN): side by side,
   one under the other on phones; each section separated by a line. */
body.itm-content-page .itm-prose > .wp-block-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 48px;
  margin: 0;
  padding: 28px 0;
  border-top: 1px solid var(--itm-line);
}

body.itm-content-page .itm-prose > .wp-block-columns:first-child {
  padding-top: 0;
  border-top: 0;
}

body.itm-content-page .itm-prose .wp-block-column {
  min-width: 0;
}

body.itm-content-page .itm-prose .wp-block-column > :first-child {
  margin-top: 0;
}

body.itm-content-page .itm-prose .wp-block-column .wp-block-table {
  margin: 0 0 1.2em;
}

body.itm-content-page .itm-prose .wp-block-column table {
  font-size: 14px;
}

body.itm-content-page .itm-prose .wp-block-column :is(th, td) {
  padding: 10px 12px;
  hyphens: auto;
}

body.itm-content-page .itm-prose > .itm-terms {
  max-width: none;
}

body.itm-content-page .itm-prose .page-links {
  margin-top: 2em;
  font-size: 15px;
}

/* Single post */
body.itm-content-page .itm-post__image {
  margin: 0 0 32px;
}

body.itm-content-page .itm-post__image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--itm-radius-box);
}

body.itm-content-page .itm-post-nav {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--itm-line);
}

body.itm-content-page .itm-post-nav .nav-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

body.itm-content-page .itm-post-nav .nav-next {
  grid-column: 2;
  text-align: right;
}

body.itm-content-page .itm-post-nav a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--itm-ink);
}

body.itm-content-page .itm-post-nav__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

body.itm-content-page .itm-post-nav a:hover .itm-post-nav__title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Post list */
body.itm-content-page .itm-blog {
  padding-top: 40px;
}

body.itm-content-page .itm-blog__head {
  max-width: 760px;
}

body.itm-content-page .itm-blog__lead {
  font-size: 17px;
  line-height: 1.6;
  color: var(--itm-muted);
}

body.itm-content-page .itm-blog__lead p {
  margin: 0;
}

body.itm-content-page .itm-blog__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 20px;
}

body.itm-content-page .itm-post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--itm-line);
  border-radius: var(--itm-radius-card);
  background: var(--itm-white);
  overflow: hidden;
  transition: border-color 0.15s;
}

body.itm-content-page .itm-post-card:hover {
  border-color: #cfc7bb;
}

body.itm-content-page .itm-post-card__media {
  aspect-ratio: 16 / 9;
  background: var(--itm-soft);
}

body.itm-content-page .itm-post-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.itm-content-page .itm-post-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
}

body.itm-content-page h2.itm-post-card__title {
  margin: 0;
  font-family: var(--itm-font);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-transform: none;
}

body.itm-content-page .itm-post-card__title a {
  color: var(--itm-ink);
}

/* The title link covers the card; the category link stays on top. */
body.itm-content-page .itm-post-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

body.itm-content-page .itm-post-card .itm-post-meta a {
  position: relative;
  z-index: 1;
}

body.itm-content-page .itm-post-card__excerpt {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--itm-muted);
}

body.itm-content-page .itm-blog__empty {
  margin: 0;
  padding: 40px;
  border: 1px solid var(--itm-line);
  border-radius: var(--itm-radius-card);
  background: var(--itm-white);
  font-size: 16px;
  color: var(--itm-muted);
  text-align: center;
}

/* Pagination: pills */
body.itm-content-page .itm-blog__pagination {
  margin-top: 40px;
}

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

body.itm-content-page .itm-blog__pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--itm-line);
  border-radius: var(--itm-radius-pill);
  background: var(--itm-white);
  font-size: 15px;
  font-weight: 500;
  color: var(--itm-ink);
}

body.itm-content-page .itm-blog__pagination .page-numbers.current {
  border-color: var(--itm-ink);
  background: var(--itm-ink);
  color: var(--itm-white);
}

body.itm-content-page .itm-blog__pagination .page-numbers.dots {
  border: 0;
  background: none;
}

@media (max-width: 1100px) {
  body.itm-content-page .itm-blog__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body.itm-content-page #content {
    padding-bottom: 64px;
  }

  body.itm-content-page :is(.itm-content, .itm-blog) {
    padding-top: 28px;
  }

  body.itm-content-page .itm-content__head {
    margin-bottom: 24px;
  }

  body.itm-content-page .itm-prose {
    font-size: 16px;
  }

  body.itm-content-page .itm-prose h2 {
    font-size: 22px;
  }

  body.itm-content-page .itm-prose h3 {
    font-size: 19px;
  }

  body.itm-content-page .itm-prose > .wp-block-columns {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  body.itm-content-page .itm-prose .wp-block-column .wp-block-table {
    overflow-x: auto;
  }

  body.itm-content-page .itm-prose > .alignwide {
    width: auto;
    margin-left: 0;
    transform: none;
  }

  body.itm-content-page .itm-blog__grid {
    grid-template-columns: 1fr;
  }

  body.itm-content-page .itm-post-nav .nav-links {
    grid-template-columns: 1fr;
  }

  body.itm-content-page .itm-post-nav .nav-next {
    grid-column: auto;
    text-align: left;
  }
}
