/* ==========================================================
   single-post.css — Colony Creative
   Editorial single post article layout + full editor typography
   ========================================================== */

.single-post {
  position: relative;
  width: 100%;
  padding-top: clamp(140px, 22vh, 240px);
  background: var(--bg);
}

/* keep anchor context for the absolute back link */

/* ── Header ── */

.single-post__header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 80px);
  text-align: center;
  will-change: transform, opacity;
}

.single-post__back {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: clamp(2rem, 4vw, 3rem);
  transition: color 0.3s ease, opacity 0.3s ease;
}

.single-post__back:hover {
  color: var(--text-primary);
}

/* Header instance: small, quiet, centered above the meta row */
.single-post__back--top {
  display: inline-block;
  margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  color: var(--text-secondary);
}

.single-post__back--top:hover {
  color: var(--text-primary);
}

.single-post__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.single-post__meta-dot {
  opacity: 0.5;
}

.single-post__category {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.single-post__category:hover {
  color: var(--text-primary);
}

.single-post__title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(2.25rem, 5.5vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin: 0 0 1.5rem;
}

.single-post__subtitle {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: -0.5rem 0 1.5rem;
}

.single-post__standfirst {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 1.04em;
  font-style: italic;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto;
}

.single-post__media {
  max-width: 1080px;
  margin: clamp(2.5rem, 5vw, 4rem) auto 0;
  padding: 0 clamp(24px, 5vw, 80px);
  will-change: transform, opacity;
}

.single-post__image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
}

/* ── Body ── */

.single-post__body {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) clamp(24px, 5vw, 80px) 0;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: clamp(1rem, 1.15vw, 1.125rem);
  line-height: 1.8;
  color: var(--text-secondary);
  overflow-wrap: break-word;
}

.single-post__body > * {
  margin: 0 0 1.5rem;
}

.single-post__body h2 {
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2.125rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: clamp(2.5rem, 5vw, 3.5rem) 0 1rem;
}

.single-post__body h3 {
  font-weight: 600;
  font-size: clamp(1.25rem, 1.9vw, 1.5rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 2.25rem 0 0.875rem;
}

.single-post__body h4 {
  font-weight: 600;
  font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
}

.single-post__body a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.3s ease;
}

.single-post__body a:hover {
  text-decoration-color: var(--text-primary);
}

.single-post__body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.single-post__body ul,
.single-post__body ol {
  padding-left: 1.5rem;
}

/* Restore markers stripped by the global ul/ol reset */
.single-post__body ul {
  list-style: disc;
}

.single-post__body ol {
  list-style: decimal;
}

.single-post__body ul ul,
.single-post__body ol ul {
  list-style: circle;
  margin-top: 0.625rem;
}

.single-post__body li {
  margin: 0 0 0.625rem;
}

.single-post__body li::marker {
  color: var(--text-muted);
}

.single-post__body blockquote {
  border-left: 2px solid var(--border-strong);
  padding: 0.25rem 0 0.25rem 1.75rem;
  margin: 2.25rem 0;
}

.single-post__body blockquote p {
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  line-height: 1.5;
  font-style: italic;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

/* Perceived-weight compensation: italic dark-on-light reads thinner than
   the same face light-on-dark (same treatment as the h1/h2 bump). */
[data-theme="light"] .single-post__body blockquote p {
  font-weight: 500;
}

.single-post__body blockquote p:last-child {
  margin-bottom: 0;
}

.single-post__body blockquote cite {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.single-post__body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.single-post__body iframe {
  max-width: 100%;
}

.single-post__body figure {
  margin: 2.25rem 0;
}

.single-post__body figcaption,
.single-post__body .wp-caption-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.75rem;
  text-align: center;
}

.single-post__body code {
  font-family: 'DM Mono', monospace;
  font-size: 0.85em;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.15em 0.4em;
  color: var(--text-primary);
}

.single-post__body pre {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 2.25rem 0;
}

.single-post__body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Code blocks keep the dark terminal look in both themes — a light code
   plate reads like a spreadsheet, and the dark values are the exact ones
   the dark theme resolves to. */
[data-theme="light"] .single-post__body pre {
  background: #161616;
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .single-post__body pre code {
  color: #888888;
}

.single-post__body hr {
  border: none;
  height: 1px;
  /* border-subtle (6% white) was invisible on the dark ground, so the
     divider read as unexplained blank space */
  background: var(--border-strong);
  margin: clamp(2.5rem, 5vw, 3.5rem) auto;
  width: 80px;
}

.single-post__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 2.25rem 0;
  /* Wide tables scroll internally instead of blowing out the column */
  display: block;
  overflow-x: auto;
}

.single-post__body th {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-medium);
}

.single-post__body td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.single-post__body .aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.single-post__body .alignleft {
  float: left;
  margin: 0.5rem 1.5rem 1rem 0;
}

.single-post__body .alignright {
  float: right;
  margin: 0.5rem 0 1rem 1.5rem;
}

.screen-reader-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ── Share ──
   Mobile / narrow: styled inline row at the end of the article.
   Desktop (≥960px): floating glass dock, bottom-right, fades in
   once the reader is into the piece. */

.single-post__share {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.single-post__share-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.single-post__share-buttons {
  display: flex;
  gap: 0.625rem;
}

.single-post__share-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-medium);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease, transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.single-post__share-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.single-post__share-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-family: 'DM Mono', monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.single-post__share-copy.is-copied .single-post__share-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 960px) {
  .single-post__share {
    position: fixed;
    right: clamp(16px, 2.5vw, 40px);
    bottom: calc(clamp(24px, 5vh, 48px) + env(safe-area-inset-bottom, 0px));
    margin: 0;
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), visibility 0s linear 0.4s;
  }

  .single-post__share.is-visible,
  .single-post__share:focus-within {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), visibility 0s;
  }

  .single-post__share-label {
    display: none;
  }

  .single-post__share-buttons {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    border: 1px solid var(--border-subtle);
    border-radius: 100px;
    background: var(--glass-surface);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
  }

  .single-post__share-btn {
    width: 40px;
    height: 40px;
    border-color: transparent;
  }

  .single-post__share-btn:hover {
    border-color: transparent;
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    transform: none;
  }

  /* Tooltip flips to the left of the dock */
  .single-post__share-tooltip {
    bottom: auto;
    left: auto;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
  }

  .single-post__share-copy.is-copied .single-post__share-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* ── Footer ── */

.single-post__footer {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(2.5rem, 5vw, 4rem) clamp(24px, 5vw, 80px) clamp(4rem, 8vw, 6rem);
  text-align: center;
}

.single-post__footer-line {
  width: 80px;
  height: 1px;
  background: var(--border-medium);
  margin: 0 auto clamp(2rem, 4vw, 3rem);
}

.single-post__back--footer {
  margin-bottom: 0;
}

/* ── Related posts ── */

.single-post-related {
  padding: clamp(80px, 12vh, 140px) 0 clamp(100px, 16vh, 200px);
  background: var(--bg-elevated);
}

.single-post-related__container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 80px);
}

.single-post-related__header {
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.single-post-related__headline {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: 1rem 0 0;
}

.single-post-related__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.25rem, 2vw, 1.75rem);
}

.single-post-related__footer {
  display: flex;
  justify-content: center;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.single-post-related__button {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.875rem 1.75rem;
  border: 1px solid var(--border-medium);
  border-radius: 100px;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.single-post-related__button:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

@media (prefers-reduced-motion: reduce) {
  .single-post-related__button {
    transition: none;
  }
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  .single-post-related__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  /* Phones: fixed compact offset instead of viewport-height padding,
     so the article starts just under the navbar */
  .single-post {
    padding-top: 104px;
  }

  .single-post__back {
    margin-bottom: 1.25rem;
  }

  .single-post__back--top {
    margin: 0 0 1.25rem;
  }

  .single-post__title {
    margin-bottom: 1rem;
  }
}

@media (max-width: 600px) {
  .single-post-related__grid {
    grid-template-columns: 1fr;
  }

  .single-post__body .alignleft,
  .single-post__body .alignright {
    float: none;
    margin: 1.5rem 0;
  }
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  .single-post__back,
  .single-post__category,
  .single-post__body a,
  .single-post__share,
  .single-post__share-btn,
  .single-post__share-tooltip {
    transition: none;
  }
}

/* ── No orphaned words ──
   Balance these display lines (titles, section headings, the standfirst
   and pull quotes) so short heads don't strand a lone word. Running body
   copy still uses the global p { text-wrap: pretty } rule. */
.single-post__title,
.single-post__subtitle,
.single-post__standfirst,
.single-post__body h2,
.single-post__body h3,
.single-post__body h4,
.single-post__body blockquote p,
.single-post-related__headline {
  text-wrap: balance;
}
