/*
Theme Name: Show Me China Editorial
Theme URI: 
Author: Show Me China
Description: A quiet, photo-first block theme for short notes from everyday life in China.
Version: 1.0.5
Requires at least: 6.7
Requires PHP: 8.1
Text Domain: show-me-china-editorial
*/

:root {
  --editorial-canvas: #f5f5f7;
  --editorial-card: #ffffff;
  --editorial-ink: #1d1d1f;
  --editorial-muted: #6e6e73;
  --editorial-radius: 28px;
  --editorial-image-radius: 20px;
  --editorial-shadow: 0 18px 50px rgb(0 0 0 / 0.055);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--editorial-canvas);
  color: var(--editorial-ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 5px;
  border-radius: 5px;
}

.editorial-shell {
  width: min(100% - 40px, 1200px);
  margin-inline: auto;
}

.editorial-header {
  padding-block: clamp(68px, 10vw, 132px) clamp(58px, 9vw, 112px);
}

.editorial-title {
  margin: 0;
  max-width: 900px;
  font-size: clamp(2.625rem, 7vw, 4.5rem);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.editorial-title a {
  text-decoration: none;
}

.editorial-tagline {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--editorial-muted);
  font-size: clamp(1.125rem, 2.4vw, 1.32rem);
  line-height: 1.45;
  letter-spacing: -0.018em;
}

.editorial-posts {
  list-style: none;
  padding: 0;
  margin: 0;
}

.editorial-card {
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 clamp(28px, 5vw, 64px);
  padding: clamp(24px, 5vw, 64px);
  background: var(--editorial-card);
  border-radius: var(--editorial-radius);
  box-shadow: var(--editorial-shadow);
  overflow: clip;
}

.editorial-card.is-pending-reveal {
  opacity: 0;
  transform: translateY(18px);
}

.editorial-card.is-revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 420ms ease, transform 420ms ease;
}

.editorial-meta {
  margin: 0 0 16px;
  color: var(--editorial-muted);
  font-size: clamp(0.82rem, 1.4vw, 0.94rem);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.editorial-post-title {
  max-width: 900px;
  margin: 0 0 clamp(30px, 5vw, 50px);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.editorial-post-title a {
  text-decoration: none;
}

.editorial-content {
  font-size: clamp(1.125rem, 2vw, 1.3125rem);
  line-height: 1.55;
  letter-spacing: -0.014em;
  overflow-wrap: anywhere;
}

.editorial-content > :where(p, h2, h3, h4, ul, ol, blockquote) {
  max-width: 680px;
  margin-inline: auto;
}

.editorial-content > :first-child {
  margin-top: 0;
}

.editorial-content > :last-child {
  margin-bottom: 0;
}

.editorial-content :where(img, video) {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--editorial-image-radius);
}

.editorial-content .wp-block-image,
.editorial-content .wp-block-gallery {
  margin-block: clamp(30px, 5vw, 52px);
}

.editorial-content .wp-block-image img,
.editorial-content .wp-block-gallery figure img {
  transition: transform 240ms ease;
}

.editorial-content .wp-block-image a:hover img,
.editorial-content .wp-block-gallery figure a:hover img {
  transform: scale(1.015);
}

.editorial-content .wp-block-gallery.has-nested-images {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 22px) !important;
  align-items: start;
}

.editorial-content .wp-block-gallery.has-nested-images > figure.wp-block-image {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
}

.editorial-content .wp-block-gallery.has-nested-images > figure.wp-block-image > a {
  display: block;
  width: 100%;
}

.editorial-content .wp-block-gallery.has-nested-images > figure:only-child,
.editorial-content .wp-block-gallery.has-nested-images:has(figure:nth-child(3)) > figure:first-child {
  grid-column: 1 / -1;
}

.editorial-content .wp-block-gallery.has-nested-images figure img {
  width: 100%;
  height: auto !important;
  aspect-ratio: auto !important;
}

.editorial-single {
  padding-bottom: clamp(52px, 9vw, 112px);
}

.editorial-single .editorial-card {
  margin-bottom: 0;
}

.editorial-back {
  width: min(100% - 40px, 680px);
  margin: clamp(32px, 5vw, 58px) auto 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.editorial-footer {
  padding-block: 24px 54px;
  color: var(--editorial-muted);
  font-size: 0.84rem;
}

@media (max-width: 700px) {
  .editorial-shell {
    width: min(100% - 24px, 1200px);
  }

  .editorial-card {
    border-radius: 22px;
  }

  .editorial-content .wp-block-gallery.has-nested-images {
    grid-template-columns: 1fr;
  }

  .editorial-content .wp-block-gallery.has-nested-images > figure.wp-block-image {
    grid-column: 1;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --editorial-canvas: #000000;
    --editorial-card: #1d1d1f;
    --editorial-ink: #f5f5f7;
    --editorial-muted: #a1a1a6;
    --editorial-shadow: none;
  }
}

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

  .editorial-card,
  .editorial-card.is-pending-reveal,
  .editorial-card.is-revealed,
  .editorial-content .wp-block-image img,
  .editorial-content .wp-block-gallery figure img {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
