/* =========================================================
   Varela Digital — Historical Context page 
   ========================================================= */

/* ---- Tokens (keep consistent with the rest of the site) ---- */
:root{
  --vd-bg: #F8F5EF;
  --vd-ink: #2f2f2f;
  --vd-accent: #5E121A;
  --vd-border: #C4B3B2;
  --vd-card: #ffffff;
  --vd-nav-offset: 90px;
  --vd-maxw: 1100px;
}

/* ---- Page baseline ---- */
body{
  background: var(--vd-bg);
  color: var(--vd-ink);
  font-size: 15px;    
  line-height: 1.65;
}

.vd-page.vd-context-page{
  max-width: var(--vd-maxw);
  margin: 0 auto;
  padding: 2.2rem 1.2rem 3rem;
}

.vd-context-header{
  margin-bottom: 1.4rem;
}

.vd-context-page h1{
  font-size: 2.35rem;
  letter-spacing: -0.02em;
  margin: 0.2rem 0 0.8rem;
  color: var(--vd-ink);
}

.vd-context-page h2{
  font-size: 1.55rem;  
  font-weight: 600;
  margin: 1.6rem 0 0.65rem;
  color: var(--vd-ink);
}

.vd-context-page h3{
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.1rem 0 0.5rem;
  color: var(--vd-ink);
}

.vd-lead{
  max-width: 78ch;
  margin: 0 0 0.25rem 0;
  opacity: 0.95;
}


.vd-context-content p{
  margin: 0.65rem 0;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.vd-context-page code{
  color: var(--vd-accent);
  font-weight: 600;
  background: rgba(122, 31, 41, 0.08);
  padding: 0.08rem 0.35rem;
  border-radius: 6px;
}

.vd-context-layout{
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  align-items: start;
}


.vd-context-content{
  min-width: 0;
}

/* ---- Sidebar (TOC) ---- */
.vd-toc{
  position: sticky;
  top: 110px; 
  background: rgba(94, 18, 26, 0.08);
  border: 1px solid rgba(196,179,178,0.9);
  border-left: 6px solid var(--vd-accent);
  border-radius: 12px;
  padding: 1rem 1rem;
}

.vd-toc-title{
  font-weight: 700;
  color: var(--vd-ink);
  margin-bottom: 0.65rem;
}

.vd-toc-list{
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.vd-toc-list li{
  margin: 0.4rem 0;
  line-height: 1.35;
}

.vd-toc-list a{
  color: var(--vd-accent);
  text-decoration: none;
  font-weight: 600;
}

.vd-toc-list a:hover{
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* ---- Section spacing ---- */
.vd-section{
  scroll-margin-top: var(--vd-nav-offset);
}

.vd-section + .vd-section{
  margin-top: 1.35rem;
  padding-top: 1.35rem;
  border-top: 1px solid shows rgba(196,179,178,0.0); 
}

/* ---- Bibliography dropdown ---- */
.vd-biblio{
  margin-top: 1.1rem;
  background: var(--vd-card);
  border: 1px solid rgba(196,179,178,0.95);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.vd-biblio > summary{
  cursor: pointer;
  font-weight: 700;
  color: var(--vd-accent);
  list-style: none;
}

.vd-biblio > summary::-webkit-details-marker{
  display: none;
}

.vd-biblio > summary::after{
  content: "▾";
  float: right;
  color: var(--vd-accent);
}

.vd-biblio[open] > summary::after{
  content: "▴";
}

.vd-biblio-body{
  margin-top: 0.75rem;
}

.vd-biblio-note{
  margin: 0 0 0.65rem 0;
  opacity: 0.92;
}

.vd-biblio-list{
  margin: 0;
  padding-left: 1.1rem;
}

.vd-biblio-list li{
  margin: 0.5rem 0;
  text-align: left; 
}

/* ---- Buttons (match documentation vibe) ---- */
.vd-context-page .btn-outline-primary{
  color: var(--vd-accent);
  border-color: var(--vd-border);
  background-color: transparent;
  font-weight: 500;
  padding: 0.45rem 1.1rem;
  border-radius: 12px;
  transition: all 0.2s ease-in-out;
}

.vd-context-page .btn-outline-primary:hover,
.vd-context-page .btn-outline-primary:focus{
  color: #ffffff;
  background-color: var(--vd-accent);
  border-color: var(--vd-accent);
  box-shadow: none;
}

.vd-context-page .btn-outline-primary:active{
  background-color: #4a0e14;
  border-color: #4a0e14;
  color: #ffffff;
}

.vd-context-page .btn-outline-primary:focus-visible{
  outline: none;
  box-shadow: 0 0 0 0.15rem rgba(94, 18, 26, 0.25);
}

/* ----Historical Context — Figures ---- */

/* never let figures collapse */
.vd-figure,
.vd-figure-right,
.vd-figure-wide,
.vd-figure-small {
  display: block;
  margin: 1rem 0 1.25rem 0;
  padding: 0.85rem;
  background: #ffffff;
  border: 1px solid rgba(196, 179, 178, 0.85);
  border-radius: 14px;
  overflow: hidden; 
}

.vd-figure img,
.vd-figure-right img,
.vd-figure-wide img,
.vd-figure-small img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  object-fit: contain;
}

.vd-figure figcaption,
.vd-figure-right figcaption,
.vd-figure-wide figcaption,
.vd-figure-small figcaption {
  margin-top: 0.75rem;
  color: #5E121A;
  font-size: 0.75rem;
  line-height: 1.35;
}

@media (min-width: 992px) {
  .vd-figure-right {
    float: right;
    width: min(420px, 42%);
    margin: 0.25rem 0 1rem 1.25rem;
  }
}

/* ---- Historical Context —--- */

@media (min-width: 992px) {
  .vd-figure-small {
    float: right;
    width: min(320px, 34%);
    margin: 0.25rem 0 1rem 1.25rem;
  }


  .vd-figure-small img {
    max-height: 180px;
    object-fit: contain;
  }
}

@media (max-width: 991.98px) {
  .vd-figure-small {
    float: none;
    width: 100%;
    margin: 1rem 0 1.25rem 0;
  }

  .vd-figure-small img {
    max-height: none;
  }
}

@media (min-width: 992px) {
  .vd-figure-right.small-portrait {
    width: min(300px, 30%);
  }

  .vd-figure-right.small-portrait img {
    max-height: 360px;
    object-fit: contain;
  }
}

@media (max-width: 991.98px) {
  .vd-figure-right.small-portrait {
    width: 100%;
    float: none;
    margin: 1rem 0 1.25rem 0;
  }

  .vd-figure-right.small-portrait img {
    max-height: none;
  }
}

@media (min-width: 992px) {
  .vd-figure-left.small-portrait {
    float: left;
    width: min(300px, 30%);
    margin: 0.25rem 1.25rem 1rem 0;
  }

  .vd-figure-left.small-portrait img {
    max-height: 360px;
    object-fit: contain;
  }
}

@media (max-width: 991.98px) {
  .vd-figure-left.small-portrait {
    float: none;
    width: 100%;
    margin: 1rem 0 1.25rem 0;
  }

  .vd-figure-left.small-portrait img {
    max-height: none;
  }
}

.vd-figure-wide {
  width: 100%;
}

.vd-figure-small {
  width: min(360px, 100%);
}

.vd-section::after,
.vd-context-layout::after,
section::after {
  content: "";
  display: block;
  clear: both;
}

.vd-footer{
  margin-top: 3rem;
  padding-top: 1.6rem;
  padding-bottom: 3rem;
  border-top: 1px solid rgba(196,179,178,0.75);
  text-align: center;
  color: var(--vd-ink);
}

.vd-footer a{
  color: var(--vd-accent);
  text-decoration: none;
  font-weight: 600;
}

.vd-footer a:hover{
  text-decoration: underline;
}

.vd-footer .footer-links{
  margin-bottom: 0.55rem;
}

.vd-footer .footer-small{
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ---- Responsive ---- */
@media (max-width: 992px){
  .vd-context-layout{
    grid-template-columns: 1fr; 
    gap: 1.2rem;
  }

  .vd-toc{
    position: static;
    top: auto;
  }

  .vd-lead{
    max-width: none;
  }
}

@media (max-width: 576px){
  .vd-page.vd-context-page{
    padding: 1.6rem 1rem 2.4rem;
  }

  .vd-context-page h1{
    font-size: 2.05rem;
  }

  .vd-context-page h2{
    font-size: 1.35rem;
  }

  body{
    font-size: 14.5px;
  }
}