/* ==========================================================================
   BLOG V3 — Prose typography (article body)
   ========================================================================== */

.pv3-prose {
  font-size: clamp(1.025rem, 1.05vw, 1.0875rem);
  line-height: 1.78;
  color: var(--c-text);
  letter-spacing: -.005em;
}
.pv3-prose > * + * { margin-top: var(--sp-4); }
.pv3-prose p { color: var(--c-text); font-weight: 400; margin: 0 0 var(--sp-4); }
.pv3-prose p:last-child { margin-bottom: 0; }
.pv3-prose strong { color: #fff; font-weight: 700; }
.pv3-prose em { color: var(--c-text); }

/* Drop cap */
.pv3-prose > p:first-of-type::first-letter,
.pv3-prose > p:first-child::first-letter {
  font-size: 3.4em;
  line-height: 0.9;
  float: left;
  margin: .12em .14em 0 0;
  font-weight: 800;
  color: var(--c-accent);
  letter-spacing: -.02em;
}

.pv3-prose h2,
.pv3-prose h3,
.pv3-prose h4 {
  color: #fff;
  letter-spacing: -.02em;
  scroll-margin-top: 90px;
}
.pv3-prose h2 {
  font-size: clamp(1.5rem, 2.4vw, 1.85rem);
  font-weight: 800;
  margin: var(--sp-7) 0 var(--sp-3);
  position: relative;
  padding-bottom: var(--sp-2);
}
.pv3-prose h2::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 48px; height: 3px;
  background: linear-gradient(90deg, var(--c-accent), transparent);
  border-radius: 3px;
}
.pv3-prose h3 {
  font-size: clamp(1.2rem, 1.7vw, 1.4rem);
  font-weight: 700;
  margin: var(--sp-6) 0 var(--sp-2);
}
.pv3-prose h4 { font-size: 1.1rem; margin: var(--sp-5) 0 var(--sp-2); }

.pv3-prose a {
  color: var(--c-accent);
  text-decoration: none;
  background-image: linear-gradient(0deg, rgba(21, 216, 200, .35), rgba(21, 216, 200, .35));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 1px;
  transition: background-size var(--motion-fast) var(--motion-curve), color var(--motion-fast);
}
.pv3-prose a:hover { color: var(--c-accent-glow); background-size: 100% 2px; }

.pv3-prose ul, .pv3-prose ol { padding-left: 1.5em; margin: var(--sp-3) 0; }
.pv3-prose li { margin: 6px 0; }
.pv3-prose li::marker { color: var(--c-accent); }

.pv3-prose blockquote {
  border-left: 3px solid var(--c-accent);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-5) 0;
  background: rgba(21, 216, 200, .05);
  border-radius: 0 12px 12px 0;
  color: var(--c-text-dim);
  font-style: italic;
}
.pv3-prose blockquote p:last-child { margin-bottom: 0; }

/* Inline code */
.pv3-prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: .92em;
  padding: 2px 7px;
  background: rgba(0, 0, 0, .35);
  border: var(--bv3-stroke);
  border-radius: 6px;
  color: #ffd9a8;
}

.pv3-prose img,
.pv3-prose figure img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: var(--bv3-stroke);
  display: block;
  margin: var(--sp-5) auto;
}
.pv3-prose figure { margin: var(--sp-5) 0; }
.pv3-prose figcaption {
  text-align: center;
  font-size: .85rem;
  color: var(--c-text-muted);
  margin-top: 8px;
}

/* Iframe / embeds */
.pv3-prose .embed-container {
  display: table;
  max-width: 100%;
  margin: var(--sp-5) 0;
  clear: both;
  background: transparent;
  background-color: transparent;
  isolation: auto;
}
.pv3-prose .embed-container iframe,
.pv3-prose iframe.embed-iframe {
  display: block;
  max-width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent !important;
  background-color: transparent !important;
  color-scheme: normal;
  isolation: auto;
}

/*
  Transparent WebGL iframes can be composited with an opaque white backing
  in some browsers when embedded cross-origin. For the Rubik's Cube embed we
  force a separate compositor path and avoid clipping on the iframe itself.
*/
.pv3-prose iframe.embed-iframe[src*="live.junyo.dev/rubikcube"] {
  border-radius: 0;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}
.pv3-prose .embed-container.embed-container--center,
.pv3-prose .embed-container.mx-auto {
  margin-left: auto;
  margin-right: auto;
}
.pv3-prose .embed-container.embed-container--full,
.pv3-prose .embed-container.w-full {
  display: block;
  width: 100%;
  max-width: 100%;
}
.pv3-prose .embed-container.embed-container--full iframe,
.pv3-prose .embed-container.w-full iframe {
  width: 100%;
}
.pv3-prose .embed-container.embed-container--left,
.pv3-prose .embed-container.float-left {
  float: left;
  margin-right: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.pv3-prose .embed-container.embed-container--right,
.pv3-prose .embed-container.float-right {
  float: right;
  margin-left: var(--sp-5);
  margin-bottom: var(--sp-4);
}
@media (max-width: 768px) {
  .pv3-prose .embed-container {
    display: block !important;
    float: none !important;
    width: 100% !important;
    margin: var(--sp-5) 0 !important;
  }
  .pv3-prose .embed-container iframe,
  .pv3-prose iframe.embed-iframe {
    width: 100%;
  }
}

/* Math (KaTeX rendered blocks) */
.pv3-math {
  text-align: center;
  margin: var(--sp-5) auto;
  padding: var(--sp-3) var(--sp-4);
  overflow-x: auto;
  font-size: 1.1em;
  color: var(--c-text);
  background: rgba(0,0,0,.2);
  border-radius: 10px;
  border: var(--bv3-stroke);
}
.pv3-math--plain {
  font-family: 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif;
  font-size: clamp(1.12rem, 1.3vw, 1.3rem);
  line-height: 1.7;
}
.pv3-math__text {
  display: inline-block;
  white-space: pre-wrap;
  word-break: break-word;
}
.pv3-math .katex-display {
  margin: 0;
}

/* Tables */
.pv3-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-6) 0;
  font-size: .92rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
}
.pv3-prose thead th {
  background: rgba(21, 216, 200, .08);
  color: var(--c-accent);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(21, 216, 200, .2);
}
.pv3-prose tbody tr:nth-child(even) {
  background: rgba(255,255,255,.02);
}
.pv3-prose tbody tr:hover {
  background: rgba(255,255,255,.04);
}
.pv3-prose td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  vertical-align: top;
  color: var(--c-text);
  line-height: 1.6;
}
.pv3-prose tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  .pv3-prose table { font-size: .82rem; }
  .pv3-prose td, .pv3-prose thead th { padding: 8px 10px; }
}

@media (max-width: 640px) {
  .pv3-prose > p:first-of-type::first-letter { font-size: 3em; }
}
