/* ===========================
   static/css/extra.css
   =========================== */

/* ---------------------------------
   Link styling: modern & accessible
   --------------------------------- */

/* Baseline: no underline globally (UI chrome stays clean) */
a {
  text-decoration: none;
  text-underline-offset: 2px;
  text-decoration-skip-ink: auto;
}

/* Link colors inside readable content (beat theme rules) */
.post__content a,
.post__content a:visited,
.post .post-content a,
.page .post-content a,
.widget .widget__content a,
.about-bio .bio-text a {
  color: #1a73e8 !important;          /* pleasant blue */
  text-decoration: none;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  text-decoration-skip-ink: auto;
}

.post__content a:hover,
.post .post-content a:hover,
.page .post-content a:hover,
.widget .widget__content a:hover,
.about-bio .bio-text a:hover {
  color: #1257a0 !important;          /* darker hover */
  text-decoration: underline;
}

/* Optional distinct visited color (keep accessible contrast) */
.post__content a:visited,
.post .post-content a:visited,
.page .post-content a:visited,
.widget .widget__content a:visited,
.about-bio .bio-text a:visited {
  color: #5a2ca0 !important;          /* purple-ish visited */
}

/* Hover/focus: underline everywhere as an extra cue */
a:hover,
a:focus,
a:focus-visible {
  text-decoration: underline;
}

/* UI elements that should NOT look like inline links */
.post-title a,                 /* post titles */
.menu a,                       /* nav menu */
.btn, .btn a,                  /* buttons/pills */
.widget-taglist__link,         /* tag list chips */
.bio-avatar-link,              /* linked avatar image */
.pagination a {                /* pagination controls */
  text-decoration: none !important;
}

/* Optional: visited links are visibly distinct in content */
.post .post-content a:visited,
.page .post-content a:visited,
.widget .widget__content a:visited,
.about-bio .bio-text a:visited {
  color: #5a2ca0; /* tweak to your palette; maintain contrast */
}

/* ---------------------------------
   Sidebar bio widget (avatar + wrap)
   ---------------------------------- 
   Markup (custom widget partial):
   <div class="widget widget-bio">
     <h4 class="widget__title">About</h4>
     <div class="widget__content">
       <div class="bio-wrap">
         <a class="bio-avatar-link" href="/about/">
           <img class="bio-avatar" ...>
         </a>
         <div class="bio-text">...</div>
       </div>
       <p class="more"><a class="link-more" href="/about/">Read more →</a></p>
     </div>
   </div>
*/
.widget-bio .bio-wrap { 
  display: block !important;        /* ensure floats can wrap even if parent uses flex */
}

.widget-bio .bio-avatar {
  float: left;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 2px 12px 6px 0;           /* space to right/bottom */
  shape-outside: circle(50%);       /* nicer wrap on modern browsers */
}

.widget-bio .bio-avatar-link {
  float: left;                      /* keep the wrap with the image */
  display: block;
  text-decoration: none !important; /* no underline around the image */
}

.widget-bio .bio-text {
  clear: none !important;
  margin-top: 0.2rem;
  /* Keep the widget compact while preserving links */
  display: -webkit-box;
  -webkit-line-clamp: 3;            /* show ~3 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Clear the float after the bio block */
.widget-bio .bio-wrap::after {
  content: "";
  display: table;
  clear: both;
}

/* Compact “Read more →” link (underline comes from content-link rules above) */
.widget-bio .more { margin: .35rem 0 0 0; }

/* Hide any legacy button or HR if still present in older markup */
.btn-read-more { display: none !important; }
.widget-bio .widget-separator,
.widget-disclaimer .widget-separator { display: none; }

/* -----------------------------
   About page bio (no avatar)
   ----------------------------- 
   Markup (shortcode): <div class="about-bio"> ... </div>
*/
.about-bio {
  display: block;
  margin-bottom: 1rem;              /* gap before the first paragraph after the bio */
}

/* Hide the avatar on the About page to avoid duplication with sidebar image */
.about-bio .bio-avatar { display: none !important; }
.about-bio .bio-text { clear: none !important; }
.about-bio::after { content: ""; display: table; clear: both; }

/* ---------------------------------------------------
   Home/section post list styling (Mainroad selectors)
   --------------------------------------------------- */
.posts-list .post-title {
  font-size: 1.6rem !important;
  font-weight: 800 !important;
  line-height: 1.25;
  margin: 0 0 .25rem !important;
}

.posts-list .post-title a {
  color: #0d1a2d !important;        /* dark navy */
}
.posts-list .post-title a:hover { text-decoration: underline !important; }

/* Accent shape before each list title (pick one: ◆ ▸ ■ ●) */
.posts-list .post-title a::before {
  content: "◆";
  display: inline-block;
  color: #2b7cff;                   /* accent */
  font-size: .95rem;
  margin-right: .5rem;
  transform: translateY(-1px);
}

/* Date + tags smaller, gray, italic under the title.
   Mainroad may use .post-meta OR .post__meta depending on version. */
.posts-list .post-meta,
.posts-list .post__meta {
  font-style: italic;
  color: #6a6f77 !important;
  font-size: .9rem;
  margin: 0 0 .75rem !important;
}
.posts-list .post-meta a,
.posts-list .post__meta a { color: inherit; }
.posts-list .post-meta a:hover,
.posts-list .post__meta a:hover { text-decoration: underline; }

/* ---------------------------------------
   Post delimiters & spacing between posts
   --------------------------------------- */

/* Neutralize any theme border to avoid doubling */
.posts-list .post { border-top: none !important; }

/* Space above each post */
.posts-list .post {
  margin-top: 1.25rem;
  padding-top: 0;
}

/* Simple 1px gray line above every post except the first */
.posts-list .post:not(:first-child) { padding-top: 1rem; }
.posts-list .post:not(:first-child)::before {
  content: "";
  display: block;
  height: 1px;
  background: #e4e4e4;              /* same gray used for widget separators */
  margin: 0 0 1rem 0;               /* space under the line */
}

/* ---------------------------------------------------
   Thumbnails that replace the diamond (inline, 96x96)
   --------------------------------------------------- */
/* Float a 96×96 thumbnail before the title; title+meta flow to the right.
   Summary clears below the image so it starts on a new line. */
.posts-list .post.post--has-title-thumb .post-title-thumb {
  float: left;
  width: 200px;
  height: 200px;
  margin: 0 12px 8px 0;    /* space to the right & below */
  text-decoration: none !important;
}
.posts-list .post.post--has-title-thumb .post-title-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;      /* optional rounding */
}

/* Title + meta block sits to the right; overflow hidden avoids awkward wraps */
.posts-list .post.post--has-title-thumb .post-header-text {
  overflow: hidden;
}

/* Start the summary (and read-more) below the bottom of the image */
.posts-list .post.post--has-title-thumb .post-summary,
.posts-list .post.post--has-title-thumb .read-more,
.posts-list .post.post--has-title-thumb p.read-more {
  clear: both;
}

/* Hide the diamond only when a thumbnail is present */
.posts-list .post.post--has-title-thumb .post-title a::before {
  content: none !important;
}

/* Optional: nudge title alignment when thumb exists */
.posts-list .post.post--has-title-thumb .post-title { margin-top: 0; }

/* Responsive: stack on small screens (thumbnail above title) */
@media (max-width: 520px) {
  .posts-list .post.post--has-title-thumb .post-title-thumb {
    float: none;
    display: block;
    margin: 0 0 8px 0;
    width: 100%;
    height: auto; /* keep aspect ratio when full width */
    max-width: 320px; /* cap size */
  }
  .posts-list .post.post--has-title-thumb .post-summary,
  .posts-list .post.post--has-title-thumb .read-more,
  .posts-list .post.post--has-title-thumb p.read-more {
    clear: none;
  }
}

/* More space between summary and Read more button */
.posts-list .post .post-summary {
  margin-bottom: 0.9rem;            /* adjust to taste */
}

/* Nudge the paragraph that immediately follows the summary */
.posts-list .post .post-summary + p {
  margin-top: 0.4rem;               /* extra gap above the button */
}

/* If a 96x96 thumb is floated, ensure the button also clears the image */
.posts-list .post.post--has-title-thumb .post-summary + p {
  clear: both;
}

pre {
  margin-bottom: 2rem;
}
.highlight {
  margin-bottom: 2rem;
}

/* Force white text on visited tag buttons with higher specificity */
.widget-taglist__link.widget__link.btn:visited {
    color: white !important;
}

/* Also target all states to be sure */
.widget-taglist__link.widget__link.btn,
.widget-taglist__link.widget__link.btn:link,
.widget-taglist__link.widget__link.btn:visited {
    color: white !important;
}

/* Keep hover as theme default */
.widget-taglist__link.widget__link.btn:hover {
    /* Theme handles this */
}

.share {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 1.25rem 0;
}

.share__label {
  color: #666;
  font-size: 0.95rem;
}

.share__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  background: #f2f2f2;
  color: #333;
  text-decoration: none;
  font-weight: 700;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  border: 1px solid #e2e2e2;
  cursor: pointer;
  line-height: 1;
}

.share__btn:hover {
  background: #e9e9e9;
}

.share__btn--native {
  padding: 0 .75rem;
  width: auto;
  height: 2.1rem;
  border-radius: 999px;
}

/* Override inline styles for Python comments */
code.language-python span[style*="color:#6272a4"],
pre code span[style*="color:#6272a4"] {
    color: #9cdb7f !important;
    font-style: italic !important;
}

/* Mobile-specific styling - more specific selectors */
@media screen and (max-width: 768px) {
    /* Target any figure with inline float style */
    figure {
        float: none !important;
        width: 100% !important;
        max-width: 300px !important;
        margin: 20px auto 30px auto !important;
        display: block !important;
    }
    
    /* Also target the image inside */
    figure img {
        width: 100% !important;
        height: auto !important;
    }
}

/* Ensure code blocks are scrollable on mobile */
/* Make scrollbars visible and styled on mobile code blocks */
@media (max-width: 768px) {
    pre {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        
        /* Add padding at bottom for scrollbar */
        padding-bottom: 15px;
    }
    
    /* Style the scrollbar itself */
    pre::-webkit-scrollbar {
        height: 10px;
        background-color: #f1f1f1;
        border-radius: 5px;
    }
    
    pre::-webkit-scrollbar-thumb {
        background-color: #888;
        border-radius: 5px;
        border: 2px solid #f1f1f1;
    }
    
    pre::-webkit-scrollbar-thumb:hover {
        background-color: #555;
    }
    
    /* For Firefox */
    pre {
        scrollbar-width: thin;
        scrollbar-color: #888 #f1f1f1;
    }
}

/* Disable links in post excerpts on list pages */
.list p a {
    pointer-events: none !important;
    color: inherit !important;
    text-decoration: none !important;
}

.copy-button {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 4px 8px;
    font-size: 11px;
    font-family: monospace;
    background-color: #2e3440;
    color: #d8dee9;
    border: 1px solid #4c566a;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
}

pre:hover .copy-button {
    opacity: 0.9;
}

.copy-button:hover {
    background-color: #3b4252;
}

/* Signal & Syntax wordmark sizing */
.logo__img {
  max-height: 140px !important;
  width: auto !important;
  height: 140px !important;
  display: block !important;
  margin: 0 auto !important;
}

.logo__imagebox,
.logo__item {
  height: 140px !important;
  max-height: 140px !important;
  overflow: visible !important;
  display: block !important;
  text-align: center !important;
}

.logo {
  min-height: 0 !important;
  padding-top: 5px !important;
  padding-bottom: 5px !important;
  text-align: center !important;
}

.logo__link {
  display: inline-block !important;
}

.posts-list .post.post--pinned .post-title a::before {
  content: none !important;
  display: none !important;
}

.roadmap-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0 2rem;
}

.roadmap-jump a {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #f7f7f7;
  font-weight: 700;
  text-decoration: none !important;
}

.roadmap-jump a:hover {
  background: #eeeeee;
}

.glossary-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 2rem;
}

.glossary-letters a,
.glossary-letter-empty {
  display: inline-block;
  min-width: 1.4rem;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.glossary-letter-empty {
  opacity: 0.3;
}

/* ---------------------------------
   Glossary term tooltips
   --------------------------------- */

.post__content .glossary-term {
  position: relative;
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

/* Tooltip */
.post__content .glossary-term::after {
  content: attr(data-definition);

  position: absolute;
  z-index: 1000;

  left: 50%;
  bottom: calc(100% + 0.6rem);
  transform: translateX(-50%);

  width: max-content;
  max-width: 320px;
  min-width: 220px;
  padding: 0.65rem 0.8rem;

  background: #222;
  color: #fff;

  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;

  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition: opacity 0.15s ease;
}

/* Little pointer underneath the tooltip */
.post__content .glossary-term::before {
  content: "";

  position: absolute;
  z-index: 1001;

  left: 0;
  bottom: calc(100% + 0.6rem);
  transform: none;

  border: 6px solid transparent;
  border-top-color: #222;

  opacity: 0;
  visibility: hidden;

  transition: opacity 0.15s ease;
}

/* Show with mouse or keyboard */
.post__content .glossary-term:hover::after,
.post__content .glossary-term:hover::before,
.post__content .glossary-term:focus::after,
.post__content .glossary-term:focus::before {
  opacity: 1;
  visibility: visible;
  left: 0.75rem;
  bottom: calc(100% + 0.25rem);
  transform: none;
  max-width: 300px;
}

.lightbox-trigger {
  display: inline-block;
  cursor: zoom-in;
}

.lightbox-trigger img {
  display: block;
}

/* Full-screen overlay */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;

  display: none;
  align-items: center;
  justify-content: center;

  padding: 30px;

  background: rgba(0, 0, 0, 0.9);
}

/* Visible state */
.image-lightbox.is-open {
  display: flex;
}

/* Full-size image, constrained to viewport */
.image-lightbox img {
  max-width: 95vw;
  max-height: 95vh;

  width: auto;
  height: auto;

  object-fit: contain;
}

/* Close button */
.image-lightbox-close {
  position: absolute;
  top: 15px;
  right: 25px;

  border: 0;
  background: transparent;

  color: white;
  font-size: 42px;
  line-height: 1;

  cursor: pointer;
}

.post-subtitle {
  margin-top: 0.2rem;
  margin-bottom: 0.35rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  line-height: 1.4;
  font-style: italic;
  color: #666;
}

.post-learning {
  clear: both;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
}

.post-learning-title {
  margin-bottom: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.post-learning-list {
  margin: 0 0 0.75rem 1.25rem;
}

.post-learning-list li {
  margin-bottom: 0.2rem;
}

.post-header {
  transition: background-color 0.15s ease;
}

.post-header:hover {
  background-color: rgba(0, 0, 0, 0.025);
}

.post-header:hover .post-title a {
  text-decoration: underline;
}

.post-title-thumb img {
  transition: transform 0.15s ease;
}

.post-header:hover .post-title-thumb img {
  transform: scale(1.02);
}

.what-youll-learn {
  margin: 0.35rem 0 1.5rem;
  padding: 0.75rem 1rem;
  background: #fafafa;
  border-top: 2px solid #c44a2c;
  border-bottom: 2px solid #c44a2c;
}

.what-youll-learn__title {
  margin-bottom: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.what-youll-learn__intro {
  margin-bottom: 0.35rem;
}

.what-youll-learn ul {
  margin: 0.25rem 0 0 1.25rem;
}

.what-youll-learn li {
  margin-bottom: 0.2rem;
}

.post-hero+.what-youll-learn {
  margin-top: 0.75rem;
}

.post-learning ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2rem;
  row-gap: 0.25rem;
}

.post-learning li {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .post-learning ul {
    grid-template-columns: 1fr;
  }
}

.post-references {
  margin-top: 2rem;
}

.post-references__list {
  margin-top: 1rem;
}

.post-reference {
  padding-left: 2em;
  text-indent: -2em;
  margin-bottom: 1em;
}

.post-reference {
  padding: 0.4em 0.5em 0.4em 2.5em;
  text-indent: -2em;
  margin-bottom: 1em;
  border-radius: 4px;
  scroll-margin-top: 1.5rem;
}

.post-reference:target {
  background-color: #eeeeee;
}

.references-end {
  margin: 28px 0 18px;
  border: 0;
  border-top: 1px solid #ddd;
}

/* ============================================================
   Learning paths
   ============================================================ */

.learning-path-step {
  margin-top: 2rem;
}

/* Step label above each article */
.learning-path-step__number {
  margin-bottom: 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #b7472a;

  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Status used for planned and in-progress entries */
.learning-path-status {
  display: inline-block;
  margin: 0.25rem 0 0.5rem;

  font-size: 0.85rem;
  font-weight: 600;
}

/* Planned entries intentionally lighter than real articles */
.learning-path-planned {
  padding: 0.75rem 1rem;
  border-left: 4px solid #b7472a;
  background: #f7f7f7;
}

.learning-path-planned__title {
  margin: 0;
  font-size: 1.25rem;
}

.learning-path-planned p:last-child {
  margin-bottom: 0;
}

/* Path metadata beneath the description */
.learning-path-level {
  margin-top: 0.75rem;
}

/* Path metadata beneath the description */
.learning-path-subtitle {
  margin-top: 0.75rem;
  font-size: 1.25rem;
  font-weight: bold;
}

/* Give the path introduction some separation from Step 1 */
.taxonomy-header {
  margin-bottom: 2rem;
}

.latest-articles-title {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.75rem;
}

.pagination {
  display: flex;
  gap: 0.25rem;
  margin-top: 1.5rem;
}

.pagination__item {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
}

.pagination__item--current {
  font-weight: bold;
}

.pagination--top {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}
