/* =========================================================
   NAVBAR — Classical Layout with Title Above Border
   For theme: flatly
========================================================= */

/* Reset Flatly’s gray background and padding */
.navbar {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  margin: 0 auto 3rem !important;
  padding: 0 !important;
  max-width: 796px !important;   /* keep constant width */
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  box-sizing: border-box !important;
}

/* ---------------------------------------------------------
   NAVIGATION BAR (double border style)
--------------------------------------------------------- */
.navbar-nav {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 2.2rem !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0.8rem 0 !important;
  width: 100%;
  border-top: 1px solid #bbb !important;
  border-bottom: 1px solid #bbb !important;
}

/* Navigation links */
.navbar-nav > li > a.nav-link {
  font-family: "Inter", sans-serif !important;
  font-weight: 500 !important;
  font-size: 0.95rem !important;
  color: #222 !important;
  text-decoration: none !important;
  letter-spacing: 0.02em;
  background: transparent !important;
  padding: 0.25rem 0 !important;
  transition: color 0.2s ease;
}

.navbar-nav > li > a.nav-link:hover,
.navbar-nav > li.active > a.nav-link {
  color: #000 !important;
  text-decoration: underline !important;
}

/* Remove Quarto’s default shadow / bg */
.bg-light,
.navbar-light,
.navbar-default {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

/* Hide hamburger toggle */
.navbar-toggler {
  display: none !important;
}

/* =========================================================
   BRAND ABOVE NAVBAR (Flatly-compatible patch)
   ========================================================= */

/* Lift brand above the nav container visually */
.navbar-brand {
  position: absolute !important;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Cormorant Garamond", serif !important;
  font-weight: 700 !important;
  font-size: 2.6rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #111 !important;
  text-align: center;
  background: transparent !important;
  pointer-events: auto !important; /* clickable again */
  z-index: 10;
  margin-bottom: 1.6rem !important; /* space between brand & top border */
}

.navbar-nav {
  position: relative !important;
  top: 3rem !important; /*align with brand */
  z-index: 10;
}

/* Keep navbar centered under it */
.navbar {
  position: relative !important;
  margin-top: 3.6rem !important; /* create space for lifted brand */
}

/* =========================================================
   RESPONSIVE FIX — Keep Navbar in One Row on Smaller Screens
   ========================================================= */

/* Applies from large phones to tablets */
@media (max-width: 825px) {

  /* Container adjustments */
  .navbar,
  .navbar-container,
  .navbar-collapse {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    overflow-x: visible !important;
  }

   .navbar-nav {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;

    /* ✅ Adaptive spacing and padding */
    gap: clamp(0.6rem, 2.5vw, 1.4rem) !important;
    padding: clamp(0.4rem, 1.5vw, 0.7rem) 0 !important;

    /* ✅ Borders that visually scale with screen size */
    border-top: 1px solid #bbb !important;
    border-bottom: 1px solid #bbb !important;
    width: 100% !important;
    max-width: 100% !important;

    /* ✅ Prevent scroll bars from appearing */
    box-sizing: border-box !important;

    top: 1rem !important; /*align with brand */
  }

  .navbar-nav > li > a.nav-link {
    font-size: 0.8rem !important;
  }
}

/* =========================================================
   ULTRA-SMALL SCREEN OPTIMIZATION (width < 360px)
   ========================================================= */

@media (max-width: 360px) {

  .navbar-nav > li > a.nav-link {
    font-size: 0.65rem !important; /* tighter, proportional nav links */
    letter-spacing: 0.01em !important;
  }

  .navbar-nav {
    gap: 0.8rem !important; /* reduce spacing between tabs */
  }
}

/* =========================================================
   ACTIVE TAB STYLING — Elegant underline indicator
========================================================= */

/* Base: all links are neutral */
.navbar-nav > li > a.nav-link {
  color: #222 !important;
  text-decoration: none !important;
  position: relative;
  transition: color 0.2s ease;
}

/* Subtle hover feedback */
.navbar-nav > li > a.nav-link:hover {
  color: #000 !important;
}

/* Active link — underline accent */
.navbar-nav > li.active > a.nav-link,
.navbar-nav > li > a.nav-link.active {
  color: #000 !important;
  font-weight: 600 !important;  /* small typographic lift */
}

/* =========================================================
   CUSTOM TOOLTIP — Minimal Floating Text on Hover
========================================================= */

/* Base tooltip container (hidden by default) */
.navbar-nav > li > a[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -4em;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
}

/* Fade in tooltip on hover */
.navbar-nav > li > a[data-tooltip]:hover::after {
  opacity: 1;
  transform: translate(-50%, -2.2em);
}

/* =========================================================
   GLOBAL BACKGROUND — Parchment Swirl Texture
   ========================================================= */
html, body {
  height: 100%;
  background-image: url("../media/images/background.png");
  background-repeat: repeat-y;
  background-size: cover;
  background-attachment: scroll;
  background-position: top center;
  color: #1b1b1b;
  font-family: "Source Serif 4", "Georgia", serif;
  line-height: 1.6;
  margin: 0 auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.navbar-logo {
  display: block;
  margin: 0 auto;
  max-height: 120px; /* adjust image height */
  padding-bottom: 0.5rem;
}

.navbar-title {
  margin-top: 0;
};


/* =========================================================
   MAYANK LAL — CALM INTELLIGENT TYPOGRAPHY SYSTEM
   Inspired by Minimalist Japanese + Editorial Aesthetics
========================================================= */

/* -------- Base Type System -------- */
html {
  font-size: 16px; /* Root for consistent rem scaling */
  scroll-behavior: smooth;
}

body {
  font-family: "Source Serif 4", "Georgia", serif;
  font-weight: 400;
  color: #1b1b1b;
  background: transparent;
  font-size: 1.06rem;
  line-height: 1.7;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
}

/* =========================================================
   HEADINGS — Modern Serif-Sans Blend with Visual Hierarchy
========================================================= */
h1, h2, h3, h4, h5, h6 {
  font-family: "EB Garamond", "Inter", sans-serif;
  font-weight: 600;
  line-height: 1.25;
  color: #111;
  letter-spacing: 0.01em;
  text-align: center;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  text-transform: none;
  letter-spacing: 0.015em;
  padding-bottom: 0.3em;
}

h2 {
  font-size: clamp(1.6rem, 3.2vw, 2rem);
  border-left: 3px solid rgba(0,0,0,0.1);
  padding-left: 0.75rem;
  margin-top: 2.2rem;
  margin-bottom: 0.8rem;
}

h3 {
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  font-weight: 500;
  color: #222;
  margin-top: 1.8rem;
  margin-bottom: 0.5rem;
}

h4, h5, h6 {
  font-size: 1.1rem;
  font-weight: 500;
  color: #333;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

/* =========================================================
   PARAGRAPHS — Gentle Contrast, Longform Readability
========================================================= */
p {
  max-width: 72ch;
  /* margin: 0 auto 1.3em; */
  text-align: justify;
  color: #2a2a2a;
  line-height: 1.75;
  font-size: clamp(1rem, 1.2vw, 1.06rem);
}

/* Small visual rhythm tweak for paragraph spacing */
p + p {
  margin-top: 0.8em;
}

/* =========================================================
   EMPHASIS & INLINE ELEMENTS
========================================================= */
em, i {
  font-style: italic;
  color: #444;
  letter-spacing: 0.01em;
}

strong, b {
  font-weight: 600;
  color: #111;
}

/* =========================================================
   FOOTER TYPOGRAPHY — Quiet, Grounded Presence
========================================================= */
.page-footer {
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
  color: #444;
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.4;
  padding: 2rem 1rem 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.page-footer a {
  color: #8c1b0f;
  font-weight: 500;
  text-decoration: none;
}

.page-footer a:hover {
  color: #b8321a;
  text-decoration: underline;
}

/* -----------------------------------------------------
   MOBILE — Make it smaller & centered neatly below footer
------------------------------------------------------ */
@media (max-width: 1024px) {
  .image-attribution {
    font-size: 0.65rem !important;
    text-align: center;
    line-height: 1.3;
    white-space: normal;   /* allow wrapping if needed */
    margin-top: 0.3rem;
  }
}

/* =========================================================
   RESPONSIVE TYPE SCALE — Fluid Adaptation
========================================================= */
@media (max-width: 1024px) {
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.3rem; }
  p   { font-size: 1rem; line-height: 1.65; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.2rem; }
  p   { font-size: 0.8rem; line-height: 1.6; }
  blockquote { font-size: 0.95rem; padding-left: 1rem; }
  .page-footer { font-size: 0.85rem; line-height: 1.3; }
}

/* =========================================================
   PAGE TITLE — "Quantitative Storyteller" Style
   ========================================================= */
h1.title,
.page-title,
.quarto-title-block .title {
  font-family: "Cormorant Garamond", serif !important;
  font-style: italic !important;
  font-weight: 500 !important;
  font-size: clamp(1.8rem, 3vw + 1rem, 2.6rem) !important;
  color: #1a1a1a !important;
  text-align: center !important;
  letter-spacing: 0.02em;
  word-spacing: 0.05em;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  text-rendering: optimizeLegibility;
  padding-top:1rem;
}

/* -----------------------------------------------------
   Footer Alignment Fix — Always Centered
------------------------------------------------------ */
.nav-footer {
  background-color: inherit !important;  /* same as page background */
  color: inherit !important;              /* same as main text */
  text-align: center;
  justify-content: center;
  width: 100%;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: none;
}

/* Target the <p> tag inside footer and center it */
.nav-footer-center p {
  margin: 0 auto;
  text-align: center;
  max-width: none;          /* remove Quarto’s inner limit */
  width: fit-content;       /* adapt exactly to text width */
  display: inline-block;    /* ensures true centering */
}

.nav-footer-left {
  display: none !important;
}

/* On smaller screens — keep centered, slightly smaller */
@media (max-width: 1024px) {
    .nav-footer {
    padding: 0;          /* less padding vertically on mobile */
  }

  .nav-footer-center p {
    margin-top: 0;         /* snug to the border */
  }
}

/* ----------------------------------------------------
   Sync grid width with main document content on mobile
---------------------------------------------------- */
@media (max-width: 1024px) {
  .grid {
    width: 100% !important;
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  main.quarto-document-content.content {
    width: 100% !important;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
  }
}

/* =========================================================
   DISABLE HEADROOM.JS — Keep Navbar Always Visible
========================================================= */

.headroom.fixed-top {
  position: absolute !important;
  top: 3rem !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1000 !important;
  background: transparent !important;
  transform: none !important;
  transition: none !important;
}

.headroom.fixed-top .navbar {
  max-width: 825px !important;
  margin: 0 auto !important;
}

/* =========================================================
   FIX: Prevent body title/content overlap with fixed navbar
========================================================= */

main.content,
main.quarto-document-content,
#quarto-content {
  padding-top: 2rem !important;  /* adjust height of header + brand + navbar */
  position: relative;
  z-index: 1;
}

/* =========================================================
   FOOTER — Re-arranged Layout with Attribution Below Center
   ========================================================= */

/* Stack center footer text and attribution vertically */
footer .nav-footer {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 0.25rem !important;
  padding-bottom: 0.5rem !important;
}

/* Keep main "Powered by Quarto · Mayank Lal © 2025" centered */
footer .nav-footer .nav-footer-center {
  order: 1 !important;
  width: 100% !important;
  text-align: center !important;
}

/* Move the right-block attribution to its own row */
footer .nav-footer .nav-footer-right {
  order: 2 !important;
  width: 100% !important;
  text-align: right !important;
  padding-right: 1rem !important;
}

/* =========================================================
   HOME HERO — FINAL EDITORIAL POLISH
   ========================================================= */

/* ---------- Center the hero axis ---------- */
.hero {
  align-items: center;
}

/* Image stays centered */
.hero-image {
  width: fit-content;       /* 👈 key line */
  margin: 0 auto;           /* center container */
  display: flex;
  justify-content: center;
}

.hero-image p {
  margin: 0;
  width: auto;
}


/* Center subtitle/title */
.hero-title {
  width: 100%;
  text-align: center;
}

.hero-title p {
  max-width: none;          /* break global paragraph constraint */
  margin: 0 auto;
  text-align: center;       /* THIS is the key */
}


/* ---------- Summary block (centered container, left text) ---------- */
.hero-summary {
  max-width: 62ch;
  margin: 0.4rem auto 0;
}

.hero-summary p {
  text-align: justify;
}

/* ---------- Editorial action links (same row, balanced) ---------- */
.hero-root,
.hero-cv {
  max-width: 62ch;
  margin: 1.1rem auto 0;
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 1rem;
}

/* Place links on one line */
.hero-root {
  float: left;
}

.hero-cv {
  float: right;
}

.hero-root,
.hero-cv {
  white-space: nowrap;
}


/* Clear floats cleanly */
.hero-cv::after {
  content: "";
  display: block;
  clear: both;
}

/* ---------- Link styling: FT-style editorial ---------- */
.hero-root a,
.hero-cv a {
  color: #8c1b0f;
  text-decoration: none;
  font-weight: 500;
  border-bottom: none;
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.hero-root a:hover,
.hero-cv a:hover {
  color: #b8321a;
  border-bottom-color: rgba(184, 50, 26, 0.6);
}

/* ---------- Mobile: stack actions naturally ---------- */
@media (max-width: 640px) {
  .hero-root,
  .hero-cv {
    float: none;
    display: block;
    text-align: left;
    margin-top: 0.6rem;
  }
}

@media (max-width: 640px) {
  .navbar {
    margin-bottom: 1.6rem !important;
  }
}

@media (max-width: 825px) {
  main.content,
  main.quarto-document-content,
  #quarto-content {
    padding-top: 1rem !important;
  }
}

@media (max-width: 420px) {
  .hero-root,
  .hero-cv {
    float: none;
    display: inline-block;
    white-space: nowrap;
    font-size:0.5em;
  }

  .hero-root {
    margin-right: 1rem;
  }

  .hero-cv {
    float: right;
  }
}

/* ============================================
   FIX: Prevent tooltips from being clipped on mobile
============================================ */

/* Allow overflow for navbar containers */
.navbar,
.navbar-nav,
.navbar-collapse,
.navbar-nav-scroll,
header,
.quarto-header,
.headroom,
.headroom.fixed-top {
  overflow: visible !important;
}

/* Ensure tooltip can escape stacking context */
.navbar-nav > li {
  position: relative;
}

/* Mobile-specific: give tooltip room below */
@media (max-width: 810px) {
  .navbar-nav > li > a[data-tooltip]::after {
    bottom: -3.5em;          /* slightly closer */
    font-size: 0.5rem;      /* tighter on mobile */
    white-space: nowrap;
  }
}


