/* ======================================================
   ENERGY ECONOMICS BOOK – FULL STYLE
   Font: Aptos
   Header: Red (by level)
   Background: White
   Figures: Floating, rounded corners
   Text: Justified
   ====================================================== */

/* ------------------ COLOR VARIABLES ------------------ */
:root {
  --red-h1: #7a1717;   /* Chapter */
  --red-h2: #8b1e1e;   /* Section */
  --red-h3: #a82424;   /* Subsection */
  --red-h4: #bb2d2d;
  --red-h5: #c74a4a;
  --red-h6: #d16767;

  --red-border-strong: #c92a2a;
  --red-border-light:  #ffe3e3;
}

/* ------------------ BASE TYPOGRAPHY ------------------ */
body {
  font-family: "Aptos", "Segoe UI", "Inter", system-ui, -apple-system,
               BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: #212529;
  line-height: 1.75;
}

/* Justified text */
main, p {
  text-align: justify;
  text-justify: inter-word;
}

/* ------------------ HEADER BANNER ------------------ */
.quarto-title-banner {
  background: linear-gradient(
    135deg,
    #7a1717 0%,
    #c92a2a 45%,
    #ffe3e3 100%
  );
  border-bottom: 1px solid rgba(122,23,23,0.35);
}

/* Book title */
.quarto-title-banner h1 {
  color: var(--red-h1);
  font-weight: 700;
}

/* Subtitle */
.quarto-title-banner .subtitle {
  color: #9b2c2c;
  font-weight: 400;
}

/* ------------------ HEADERS BY LEVEL ------------------ */

/* H1 – Chapter */
h1,
h1.anchored {
  color: var(--red-h1) !important;
}

/* H2 – Section */
h2,
h2.anchored {
  color: var(--red-h2) !important;
  border-left: 6px solid var(--red-border-strong);
  padding-left: 0.8rem;
  margin-top: 2.2rem;
}

/* H3 – Subsection */
h3,
h3.anchored {
  color: var(--red-h3) !important;
  border-left: 4px solid var(--red-border-light);
  padding-left: 0.6rem;
}

/* H4 */
h4,
h4.anchored {
  color: var(--red-h4) !important;
}

/* H5 */
h5,
h5.anchored {
  color: var(--red-h5) !important;
}

/* H6 */
h6,
h6.anchored {
  color: var(--red-h6) !important;
}

/* Header numbers: 1, 1.1, 1.2.0.1 ... */
.header-section-number,
.quarto-section-identifier {
  color: #c92a2a !important;
  font-weight: 600;
}

/* Anchor links inside headers */
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
  color: inherit !important;
}

/* ------------------ LINKS ------------------ */
a {
  color: #c92a2a;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: #7a1717;
}

/* ------------------ PAGE BACKGROUND ------------------ */
.page-columns main {
  background: #ffffff;
}

/* ------------------ FIGURES & IMAGES ------------------ */
main img {
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  max-width: 100%;
}

main img:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.16);
}

/* Figure container */
figure {
  padding: 0.75rem;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(201,42,42,0.15);
  margin: 1.4rem auto;
}

/* Caption */
figcaption {
  font-size: 0.95rem;
  color: #495057;
  margin-top: 0.5rem;
  text-align: center;
}

/* ------------------ TABLES ------------------ */
table {
  border-radius: 14px;
  overflow: hidden;
}

thead {
  background: linear-gradient(
    90deg,
    #ffe3e3 0%,
    #ffffff 90%
  );
}

/* ------------------ CALLOUTS ------------------ */
.callout.callout-style-default {
  border-left: 6px solid var(--red-border-strong);
  background: #ffffff;
}

/* ------------------ CODE ------------------ */
pre, code {
  border-radius: 12px;
}
