/* Prevent accidental horizontal overflow/scroll */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

*, *::before, *::after {
    box-sizing: border-box;
}

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
}

body {
    background: #ffffff;
    color: #000000;
  }

  /* Theme icon should always be visible regardless of Hacker theme defaults */
  .theme-toggle {
    color: currentColor;
  }

  /* Ensure accent is defined in both modes (used for focus outlines). */
  html {
    --accent-color: #b5e853;
  }

  /* Light mode accent override: the Hacker theme uses neon green (#b5e853)
     for headings which has low contrast on a white background. */
  html:not(.dark-mode) {
    --accent-color: #007acc;
  }

  html:not(.dark-mode) header h1,
  html:not(.dark-mode) h1,
  html:not(.dark-mode) h2,
  html:not(.dark-mode) h3,
  html:not(.dark-mode) h4,
  html:not(.dark-mode) h5,
  html:not(.dark-mode) h6 {
    color: var(--accent-color) !important;
  }

  html:not(.dark-mode) hr {
    border-bottom-color: var(--accent-color) !important;
    color: var(--accent-color) !important;
  }

  html:not(.dark-mode) header {
    /* theme has dashed green border in light mode; override */
    border-bottom-color: var(--accent-color) !important;
  }

  html:not(.dark-mode) th {
    border-bottom-color: var(--accent-color) !important;
  }

  html:not(.dark-mode) a,
  html:not(.dark-mode) a:visited,
  html:not(.dark-mode) a:hover,
  html:not(.dark-mode) a:focus {
    color: var(--accent-color);
  }

  /* Light mode: the base Hacker theme renders unordered list bullets as a
     neon-green image (bullet.png) that looks like ">>".
     Override it to use our light-mode accent color instead. */
  html:not(.dark-mode) #main_content ul li {
    list-style-image: none;
  }

  html:not(.dark-mode) #main_content ul {
    list-style: none;
    padding-left: 1.4em;
  }

  html:not(.dark-mode) #main_content ul li {
    position: relative;
  }

  html:not(.dark-mode) #main_content ul li::before {
    content: ">>";
    position: absolute;
    left: -1.4em;
    color: var(--accent-color);
    font-weight: bold;
  }

  /* Code blocks: in the hacker theme `pre` text is neon green on a black bg.
     In light mode we want a light background and normal readable text. */
  html:not(.dark-mode) pre {
    background: #f6f8fa !important;
    color: #24292f !important;
    border: 1px solid #d0d7de !important;
  }

  /* Rouge/Jekyll often wraps code blocks as `.highlight > pre` */
  html:not(.dark-mode) .highlight,
  html:not(.dark-mode) pre.highlight,
  html:not(.dark-mode) .highlight pre {
    background: #f6f8fa !important;
    color: #24292f !important;
    border: 1px solid #d0d7de !important;
  }

  html:not(.dark-mode) pre code {
    color: inherit !important;
    background: transparent !important;
  }

  html:not(.dark-mode) code.highlighter-rouge {
    background: #f6f8fa !important;
    border: 1px solid #d0d7de !important;
    color: #24292f !important;
  }

  /* Light mode: remove Hacker theme glow/text-shadow (looks blurry on white) */
  a,
  a:visited,
  a:hover,
  a:focus,
  h1, h2, h3, h4, h5, h6 {
    text-shadow: none !important;
  }
  
  header {
    position: relative;
    display: flex;
    justify-content: space-between;
    padding: 1rem;
  }

  /* Header nav: ensure equal spacing between links (avoid &nbsp; hacks) */
  #pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem;
    margin-top: 0.4rem;
  }

  /* Make sure the left nav doesn't run underneath the right-side actions */
  #pages {
    padding-right: 18rem;
  }

  @media (max-width: 720px) {
    #pages {
      padding-right: 0;
    }

    #a-title {
      display: inline-block;
      padding-right: 3rem;
    }
  }

  #pages a {
    display: inline-block;
  }

  /* The base hacker theme uses a negative left margin on the header title.
     On some screens this can create page-level horizontal scrolling. */
  header h1 {
    margin-left: 0;
  }

  /* Hacker theme adds "./ " before the site title via a pseudo-element.
     Remove it so the header shows only the site title text. */
  header h1::before {
    content: none !important;
  }

  /* Right-side actions in header (social links + theme toggle) */
  .header-actions {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.9rem;
  }

  .header-links {
    position: absolute;
    top: 1.2rem;
    right: 4.4rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.95rem;
    white-space: nowrap;
  }

  /* Mobile: move social icons below the page links row and center them */
  @media (max-width: 720px) {
    .header-links {
      position: static;
      top: auto;
      right: auto;
      z-index: auto;
      width: 100%;
      margin-top: 0.6rem;
      justify-content: center;
    }
  }

  .header-links a {
    text-decoration: none;
  }

  /* Icon links (GitHub / LinkedIn / Email) */
  .header-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    line-height: 1;
  }

  .header-icon {
    width: 18px;
    height: 18px;
    display: block;
  }

  .header-icon-link:hover {
    text-decoration: none;
    background: rgba(127, 127, 127, 0.18);
  }

  .header-icon-link:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
  }

  html.dark-mode .header-icon-link:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  /* Theme toggle (compact icon button) */
  .theme-toggle-wrapper {
    position: static;
  }

  .theme-toggle {
    appearance: none;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;

    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
  }

  .theme-toggle:hover {
    background: rgba(127, 127, 127, 0.18);
  }

  html.dark-mode .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  .theme-toggle:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
  }

  .theme-toggle__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
  }

  .theme-toggle__svg {
    width: 18px;
    height: 18px;
    display: block;
  }

  /* Global Back-to-Top button */
  .back-to-top {
    position: fixed;
    right: 1.2rem;
    bottom: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(127, 127, 127, 0.45);
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    z-index: 1100;

    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  }

  .back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .back-to-top:hover {
    background: rgba(255, 255, 255, 1);
  }

  .back-to-top:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
  }

  html.dark-mode .back-to-top {
    background: rgba(20, 20, 20, 0.92);
    color: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  }

  html.dark-mode .back-to-top:hover {
    background: rgba(35, 35, 35, 0.96);
  }

  @media (max-width: 520px) {
    .back-to-top {
      right: 0.9rem;
      bottom: 0.9rem;
      width: 38px;
      height: 38px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .back-to-top {
      transition: none;
      transform: none;
    }
  }

  .img-center {
    display: block;
    margin-left: auto;
    margin-right: auto;
    border: 2px solid #ddd;
    background-color: #fff;
    padding: 4px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }

  .img-center:not([width]) {
    width: 50%;
  }
  
  .poem {
    /* font-family: 'Georgia', serif; */
    font-size: 1.1rem;
    white-space: pre-wrap;
    background-color: #f0f0f0;
    padding: 1rem;
    border-left: 5px solid #007acc;
    margin: 1.5rem 0;
    color: #222;
  }

  /* --------------------
   * Projects page
   * -------------------- */
  .projects-page {
    max-width: 980px;
    margin: 0 auto;
  }

  /* --------------------
   * About page timeline
   * -------------------- */
  .timeline {
    --tl-line: rgba(127, 127, 127, 0.3);
    --tl-card-bg: rgba(255, 255, 255, 0.6);
    --tl-card-border: rgba(127, 127, 127, 0.32);
    --tl-text-muted: rgba(0, 0, 0, 0.62);
    --tl-logo-bg: rgba(255, 255, 255, 0.92);
    --tl-axis-dot: rgba(127, 127, 127, 0.6);
    --tl-logo-border: rgba(127, 127, 127, 0.28);
    --tl-logo-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);

    position: relative;
    margin: 1.2rem 0 1.8rem;
    padding-left: 0;
  }

  html.dark-mode .timeline {
    --tl-line: rgba(255, 255, 255, 0.18);
    --tl-card-bg: rgba(0, 0, 0, 0.15);
    --tl-card-border: rgba(255, 255, 255, 0.18);
    --tl-text-muted: rgba(255, 255, 255, 0.72);
    --tl-axis-dot: rgba(255, 255, 255, 0.55);
  }

  .timeline::before {
    content: "";
    position: absolute;
    left: 0.6rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 1px;
    background: var(--tl-line);
    z-index: 0;
  }

  .timeline__item {
    position: relative;
    display: grid;
    grid-template-columns: 1.2rem 3.2rem 1fr;
    gap: 0.9rem;
    align-items: center;
    margin: 0 0 1.1rem;
  }

  /* Small dot on the Y-axis for each milestone */
  .timeline__axis-dot {
    position: relative;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background: var(--tl-axis-dot);
    z-index: 3;
    justify-self: center;
  }

  .timeline__logo-wrap {
    position: relative;
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--tl-logo-bg);
    border: 1px solid var(--tl-logo-border);
    box-shadow: var(--tl-logo-shadow);
    margin-left: 0;
    z-index: 2;
  }

  .timeline__logo {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 6px;
    object-fit: contain;
  }

  /* Only the Srichaitanya photo needs a more "icon-like" treatment */
  .timeline__logo--photo {
    object-fit: cover;
    border-radius: 999px;
  }

  .timeline__card {
    border: 1px solid var(--tl-card-border);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    background: var(--tl-card-bg);
  }

  .timeline__meta {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tl-text-muted);
    margin-bottom: 0.3rem;
  }

  .timeline__title {
    font-weight: 700;
    line-height: 1.3;
  }

  .timeline__subtitle {
    margin-top: 0.2rem;
    color: var(--tl-text-muted);
  }

  .timeline__desc {
    margin-top: 0.55rem;
    line-height: 1.55;
  }

  @media (max-width: 520px) {
    .timeline {
      padding-left: 0;
    }

    .timeline::before {
      left: 0.5rem;
    }

    .timeline__item {
      grid-template-columns: 1rem 2.7rem 1fr;
      gap: 0.75rem;
    }

    .timeline__logo-wrap {
      width: 2.7rem;
      height: 2.7rem;
      margin-left: 0;
    }

    .timeline__logo {
      width: 2.1rem;
      height: 2.1rem;
    }
  }
  