/* ==========================================================================
   Pradeep Hingorani — Essay page design (scoped under body.ph-essay)
   Ported 1:1 from essay-selling-optimism.html. Loaded on top of ph-home.css,
   which supplies the shared chrome (.ph, .ph-wrap, .ph-header, .ph-nav,
   .ph-lang, .ph-logo, .ph-footer, .ph-marginalia, .ph-meta, .ph-caption)
   and the design tokens.
   ========================================================================== */

/* ============ BASE ============ */
.ph.ph-essay{
  --ph-text-max:720px;
}

body.ph-essay{
  background:var(--ph-ivory);
  color:var(--ph-charcoal);
  font-family:var(--ph-body);
  font-size:16px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}

/* Headings keep the design's charcoal (Astra otherwise colours them). */
.ph-essay h1,
.ph-essay h2,
.ph-essay h3{
  color:var(--ph-charcoal);
}

/* ============ PHOTO FRAMES (Cover blocks) ============
   Shared frame styling (same block as ph-about.css) so an empty Cover shows
   the gradient fallback + pinned caption, and the inline 430px cover
   min-height is neutralised in favour of the frame's aspect-ratio. */
.ph-photo-frame{
  min-height:0 !important;              /* beat the cover's inline 430px */
  aspect-ratio:4/5;
  position:relative;
  border:1px solid var(--ph-hairline);
  padding:0;
  background:
    repeating-linear-gradient(135deg, var(--ph-ivory-deep), var(--ph-ivory-deep) 2px, transparent 2px, transparent 14px),
    linear-gradient(160deg, #E4DCC9, #D8CEB6);
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
}
.ph-photo-frame .wp-block-cover__inner-container{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}
.ph-photo-frame .ph-caption{
  position:absolute;
  left:16px;
  bottom:16px;
}

/* ============ HERO ============ */
.ph-essay-hero{
  padding:70px 0 0;
}
.ph-essay-hero .ph-wrap{
  max-width:var(--ph-text-max);
}
.ph-back-link{
  display:inline-block;
  font-size:13px;
  color:var(--ph-warm-gray);
  margin-bottom:34px;
  letter-spacing:0.04em;
}
.ph-back-link a{ color:inherit; }
.ph-back-link a:hover{ color:var(--ph-terracotta); }
.ph-essay-hero .ph-marginalia{
  display:inline-flex;
  margin-bottom:22px;
}
.ph-essay-title{
  font-family:var(--ph-display);
  font-weight:500;
  font-size:clamp(32px, 4.6vw, 54px);
  line-height:1.12;
  margin-bottom:26px;
}
.ph-essay-hero .ph-meta{
  margin-bottom:50px;
}

/* Hero photo — a Cover block (click-to-upload), 21/9 editorial band. Without
   an image it shows the gradient fallback + caption. */
.ph-essay-hero-photo{
  aspect-ratio:21/9;
  border:0;
  border-top:1px solid var(--ph-hairline);
  border-bottom:1px solid var(--ph-hairline);
}

/* ============ TOC ============ */
.ph-toc{
  padding:56px 0;
  border-bottom:1px solid var(--ph-hairline);
}
.ph-toc .ph-wrap{
  max-width:var(--ph-text-max);
}
.ph-toc-label{
  font-size:12px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--ph-warm-gray);
  margin-bottom:20px;
}
.ph-toc ol{
  list-style:none;
  counter-reset:toc;
  display:grid;
  gap:12px;
  margin:0;
  padding:0; /* design's global reset — WP core otherwise adds 20px */
}
.ph-toc li{
  counter-increment:toc;
  font-size:15px;
}
.ph-toc li::before{
  content: counter(toc, decimal-leading-zero) " — ";
  color:var(--ph-terracotta);
  font-family:var(--ph-display);
  font-style:italic;
}
.ph-toc a{
  border-bottom:1px solid transparent;
  transition:border-color .2s ease, color .2s ease;
}
.ph-toc a:hover,
.ph-toc a:focus-visible{
  border-color:var(--ph-terracotta);
  color:var(--ph-terracotta);
}

/* ============ ESSAY BODY ============ */
.ph-essay-body{
  padding:70px 0 40px;
}
.ph-essay-body .ph-wrap{
  max-width:var(--ph-text-max);
}
.ph-essay-body h2{
  font-family:var(--ph-display);
  font-weight:500;
  font-size:clamp(24px, 2.8vw, 32px);
  line-height:1.22;
  margin:64px 0 26px;
  padding-top:40px;
  border-top:1px solid var(--ph-hairline);
}
.ph-essay-body h2:first-of-type{
  padding-top:0;
  border-top:none;
  margin-top:0;
}
.ph-essay-body h3{
  font-family:var(--ph-display);
  font-weight:500;
  font-size:20px;
  margin:40px 0 18px;
}
.ph-essay-body p{
  font-size:17px;
  line-height:1.7;
  color:var(--ph-charcoal-soft);
  margin-bottom:14px;
}
.ph-essay-body strong{ font-weight:600; color:var(--ph-charcoal); }
.ph-essay-body ul{ margin:20px 0 24px 22px; padding:0; }
.ph-essay-body li{
  font-size:17px;
  line-height:1.7;
  color:var(--ph-charcoal-soft);
  margin-bottom:8px;
}
.ph-essay-body .ph-emphasis{
  font-weight:600;
  color:var(--ph-charcoal);
}

/* ============ PULL QUOTE ============ */
.ph-essay .ph-wrap blockquote.ph-pullquote{
  font-family:var(--ph-display);
  font-style:italic;
  font-weight:500;
  font-size:clamp(22px, 2.6vw, 30px);
  line-height:1.42;
  color:var(--ph-charcoal);
  max-width:22ch;
  margin:54px 0;
  padding:0 0 0 26px;
  border:0;
  border-left:2px solid var(--ph-terracotta);
}
.ph-essay .ph-wrap blockquote.ph-pullquote p{ margin:0; }

/* ============ NOTES & SOURCES ============ */
.ph-essay-notes{
  background:var(--ph-ivory-deep);
  padding:60px 0;
  margin-top:40px;
}
.ph-essay-notes .ph-wrap{
  max-width:var(--ph-text-max);
}
.ph-essay-notes h3{
  font-family:var(--ph-display);
  font-weight:500;
  font-size:18px;
  margin-bottom:18px;
}
.ph-essay-notes p{
  font-size:14px;
  color:var(--ph-warm-gray);
  line-height:1.7;
  margin-bottom:10px;
}

/* ============ END NAV ============ */
.ph-end-nav{
  padding:60px 0 90px;
  text-align:center;
}
.ph-essay .final-cta{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:15px;
  font-weight:600;
  letter-spacing:0.04em;
  padding-bottom:3px;
  border-bottom:1px solid var(--ph-charcoal);
  transition:gap .25s ease, border-color .25s ease, color .25s ease;
}
.ph-essay .final-cta:hover,
.ph-essay .final-cta:focus-visible{
  gap:14px;
  border-color:var(--ph-terracotta);
  color:var(--ph-terracotta);
}

/* ============ NAV CURRENT ============ */
.ph-essay .ph-nav a.current{
  opacity:1;
  color:var(--ph-terracotta);
}

/* ============ RESPONSIVE ============ */
@media (max-width:640px){
  .ph-essay-hero{ padding:50px 0 0; }
  .ph-essay-hero .ph-meta{ margin-bottom:40px; }
  .ph-essay-body{ padding:50px 0 30px; }
  .ph-end-nav{ padding:40px 0 60px; }
}

/* ============ ASTRA WRAPPER NEUTRALISATION ============ */
body.ph-essay #content,
body.ph-essay #content .ast-container,
body.ph-essay #primary,
body.ph-essay #main,
body.ph-essay article,
body.ph-essay .ast-article-single,
body.ph-essay .entry-content{
  width:100% !important;
  max-width:none !important;
  margin:0 !important;
  padding:0 !important;
  border:none;
  box-shadow:none;
  background:transparent;
}
body.ph-essay .entry-header{ display:none !important; }

/* ============ GERMAN TYPOGRAPHY ============
   German runs longer — display sizes a step down (as in the home/about CSS). */
html[lang^="de"] .ph-essay .ph-essay-title{
  font-size:clamp(28px, 4.2vw, 48px);
  line-height:1.16;
}
html[lang^="de"] .ph-essay-body h2{
  font-size:clamp(22px, 2.6vw, 29px);
}
html[lang^="de"] .ph-essay .ph-wrap blockquote.ph-pullquote{
  font-size:clamp(20px, 2.4vw, 27px);
}
