/* markdown.css — pleasant, readable styling for Markdown-generated HTML */

:root{
  --bg: #ffffff;
  --fg: #0f172a;         /* slate-900 */
  --muted: #475569;      /* slate-600 */
  --border: #e2e8f0;     /* slate-200 */
  --card: #f8fafc;       /* slate-50 */
  --accent: #2563eb;     /* blue-600 */
  --accent-2: #7c3aed;   /* violet-600 */

  --code-bg: #0b1220;    /* deep navy */
  --code-fg: #e5e7eb;    /* gray-200 */
  --inline-code-bg: #f1f5f9; /* slate-100 */

  --shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
  --radius: 14px;
  --maxw: 78ch;
}

@media (prefers-color-scheme: dark) {
  :root{
    --bg: #0b1220;
    --fg: #e5e7eb;
    --muted: #94a3b8;
    --border: #1f2a44;
    --card: #0f1a2e;

    --accent: #60a5fa;   /* blue-400 */
    --accent-2: #c084fc; /* violet-400 */

    --code-bg: #050814;
    --code-fg: #e5e7eb;
    --inline-code-bg: rgba(148, 163, 184, 0.14);

    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  }
}

*{ box-sizing: border-box; }

html{
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body{
  margin: 0;
  background: radial-gradient(1200px 800px at 20% 0%, rgba(37, 99, 235, 0.10), transparent 55%),
              radial-gradient(1000px 700px at 100% 20%, rgba(124, 58, 237, 0.10), transparent 50%),
              var(--bg);
  color: var(--fg);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Centered content container.
   If you have your own layout, apply .md-container to the main content wrapper. */
.md-container, main, article{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px clamp(20px, 5vw, 56px) 80px; /* <- wider side padding on big screens */
}

/* Optional “card” wrapper for the content */
.md-card{
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px;
  backdrop-filter: blur(6px);
}

a{
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover{
  text-decoration: underline;
}

p{ margin: 0.9em 0; color: color-mix(in srgb, var(--fg) 92%, var(--muted)); }

strong{ color: var(--fg); }

hr{
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.2rem 0;
}

h1, h2, h3, h4, h5, h6{
  color: var(--fg);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 1.4em 0 0.55em;
  scroll-margin-top: 84px;
}

h1{ font-size: clamp(2rem, 3.2vw, 2.6rem); margin-top: 0.2em; }
h2{ font-size: 1.65rem; padding-top: 0.35rem; border-top: 1px solid var(--border); }
h3{ font-size: 1.3rem; }
h4{ font-size: 1.1rem; color: color-mix(in srgb, var(--fg) 90%, var(--muted)); }
h5, h6{ font-size: 1rem; color: var(--muted); }

ul, ol{
  padding-left: 1.25rem;
  margin: 0.8rem 0 1rem;
}
li{ margin: 0.25rem 0; }
li::marker{ color: color-mix(in srgb, var(--muted) 70%, var(--accent)); }

blockquote{
  margin: 1.2rem 0;
  padding: 0.95rem 1.05rem;
  border-left: 4px solid color-mix(in srgb, var(--accent) 70%, var(--border));
  background: color-mix(in srgb, var(--card) 70%, transparent);
  border-radius: 10px;
  color: color-mix(in srgb, var(--fg) 88%, var(--muted));
}
blockquote p{ margin: 0.4rem 0; }

img{
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.12);
  margin: 1rem 0;
}

/* Inline code */
code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}
p code, li code, table code{
  background: var(--inline-code-bg);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  padding: 0.14em 0.38em;
  border-radius: 8px;
  color: color-mix(in srgb, var(--fg) 90%, var(--muted));
}

/* Code blocks (works well with codehilite, fenced_code, etc.) */
pre{
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 14px 16px;
  border-radius: 14px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  margin: 1.15rem 0;
}
pre code{
  background: transparent;
  color: inherit;
  padding: 0;
  border: 0;
  font-size: 0.92em;
  line-height: 1.55;
}

/* Tables */
table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.2rem 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--card) 92%, transparent);
}
th, td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th{
  text-align: left;
  font-weight: 650;
  color: var(--fg);
  background: color-mix(in srgb, var(--card) 75%, transparent);
}
tr:last-child td{ border-bottom: 0; }

/* Simple keyboard / UI text */
kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.15em 0.45em;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 90%, transparent);
  box-shadow: 0 2px 0 rgba(2, 6, 23, 0.14);
}

/* “Table of contents” styling (Python-Markdown toc extension commonly emits .toc) */
.toc{
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 1.2rem 0 1.8rem;
}
.toc > ul{ margin: 0.4rem 0 0; }
.toc a{ color: color-mix(in srgb, var(--accent) 88%, var(--fg)); }
.toc li{ margin: 0.18rem 0; }

/* Footnotes (if you use footnotes extension) */
.footnote, .footnotes{
  font-size: 0.95em;
  color: var(--muted);
}
.footnotes hr{ margin: 1.4rem 0; }

/* Selection */
::selection{
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Navbar */
.navbar{
  position: sticky;
  top: 0;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;

  /* Full-width bar */
  max-width: none;
  width: calc(100% - 2 * clamp(12px, 3vw, 28px));
  margin: 16px auto 28px;

  /* Inner padding so items aren't against the navbar edges */
  padding: 14px clamp(14px, 2.2vw, 22px);

  background: color-mix(in srgb, var(--card) 85%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);

  /* Only show scrollbar if it truly overflows */
  overflow-x: auto;
  overflow-y: hidden;

  /* Hide scrollbar visuals across browsers (still scrolls if needed) */
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge legacy */
  -webkit-overflow-scrolling: touch;
}
.navbar::-webkit-scrollbar{
  width: 0;
  height: 0;
}

/* Optional: if you want the left menu group to wrap instead of scrolling when it gets long */
.navbar > div{
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;   /* lets items wrap onto a second line before scrolling */
}

/* Keep the Contact pill from shrinking weirdly */
.navbar > a{
  flex: 0 0 auto;
  white-space: nowrap;
}

.navbar::-webkit-scrollbar-thumb{
  background: color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 999px;
}
.navbar::-webkit-scrollbar-track{ background: transparent; }

/* Menu items */
.menu-item{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;

  padding: 8px 10px;
  border-radius: 999px;

  color: color-mix(in srgb, var(--fg) 78%, var(--muted));
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;

  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.menu-item:hover{
  color: var(--fg);
  background: color-mix(in srgb, var(--border) 34%, transparent);
  transform: translateY(-1px);
}

.menu-item:focus-visible{
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 75%, var(--border));
}

/* Underline accent */
.menu-item::after{
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 2px;
  border-radius: 999px;

  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transform: scaleX(0.7);
  transform-origin: center;

  transition: opacity 160ms ease, transform 160ms ease;
}

.menu-item:hover::after{
  opacity: 0.55;
  transform: scaleX(1);
}

/* “Active” page hint (works if you add class="menu-item active") */
.menu-item.active{
  color: var(--fg);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.menu-item.active::after{
  opacity: 0.85;
  transform: scaleX(1);
}

/* Slightly tighten on small screens */
@media (max-width: 720px){
  .navbar{
    padding: 12px 14px;
    margin: 12px auto 22px;
  }
  .menu-item{
    font-size: 0.9rem;
    padding: 7px 9px;
  }
}
