/* Shared utilities */
.bg-grid {
  background-image: radial-gradient(rgba(0, 0, 0, .08) 1px, transparent 1px);
  background-size: 24px 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: .5rem .75rem;
  border-radius: .5rem;
  background: #111827;
  color: #fff;
  z-index: 10000;
}

/* Timeline window + fade */
.timeline-item {
  @apply relative pl-6 py-3 opacity-0 max-h-0 -mt-3 transition-all duration-500 ease-out;
}

.timeline-item.is-visible {
  @apply opacity-100 max-h-40 mt-0;
}

/* Timeline scrollbar – subtle, dark-friendly */
#timelineList {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.8) rgba(15, 23, 42, 0.95);
  /* thumb, track */
}

#timelineList::-webkit-scrollbar {
  width: 6px;
}

#timelineList::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.95);
  /* ~slate-900 */
}

#timelineList::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.8);
  /* ~slate-400 */
  border-radius: 9999px;
}

#timelineList:hover::-webkit-scrollbar-thumb {
  background: rgba(129, 140, 248, 0.9);
  /* ~indigo-400 on hover */
}

/* Just to be explicit; all icon spans already get absolute positioning from JS */
.timeline-icon {
  @apply pointer-events-none;
}

/* Index / Projects hover polish */
#projectGrid a,
#grid a {
  transform: translateY(0);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

#certGrid>a {
  transition: opacity .2s ease, box-shadow .2s ease, border-color .2s ease;
}

#certGrid>a:hover {
  border-color: rgb(129 140 248 / .7);
}

/* Projects page */
.chip {
  cursor: pointer;
}

/* Single project page */
.stat {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.badge {
  font-size: .75rem;
  padding: .125rem .5rem;
  border-radius: 999px;
}

.markdown-body {
  box-sizing: border-box;
  min-width: 200px;
  max-width: 100%;
}

.markdown-body img {
  max-width: 100%;
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow: auto;
}

/* --------------------------- */
/* Case study markdown styling */
/* --------------------------- */

.markdown-body {
  max-width: 65ch;
  margin-left: auto;
  margin-right: auto;
}

.markdown-body>*:first-child {
  margin-top: 0;
}

.markdown-body h1:first-child {
  margin-top: 0.5rem;
}

/* Headings */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
  /* slate-900 */
}

.dark .markdown-body h1,
.dark .markdown-body h2,
.dark .markdown-body h3,
.dark .markdown-body h4 {
  color: #e5e7eb;
  /* slate-200 */
}

.markdown-body h1 {
  font-size: 1.5rem;
  /* smaller than page title */
  margin-top: 0;
  margin-bottom: 1rem;
}

.markdown-body h2 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  /* slate-400/25 */
  padding-bottom: 0.35rem;
}

.dark .markdown-body h2 {
  border-bottom-color: rgba(148, 163, 184, 0.25);
  /* slate-400 @ 25% */
}

.markdown-body h3 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Paragraphs & lists */
.markdown-body p {
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;
  color: #111827;
  /* slate-900 */
}

.dark .markdown-body p {
  color: #e5e7eb;
  /* slate-200 */
}

.markdown-body ul,
.markdown-body ol {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
}

.markdown-body li+li {
  margin-top: 0.25rem;
}

/* Links */
.markdown-body a {
  color: #4f46e5;
  /* indigo-600 */
  text-decoration: underline;
}

.dark .markdown-body a {
  color: #818cf8;
  /* indigo-400 */
}

/* Code */
.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9em;
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  background-color: #e5e7eb;
  /* slate-200 */
}

.dark .markdown-body code {
  background-color: #1f2937;
  /* slate-800 */
}

.markdown-body pre {
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.75rem;
  background-color: #020617;
  /* slate-950 */
  overflow-x: auto;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

/* Blockquotes */
.markdown-body blockquote {
  margin: 1.25rem 0;
  padding-left: 1rem;
  border-left: 3px solid #6366f1;
  /* indigo-500 */
  color: #4b5563;
  /* slate-600 */
  font-style: italic;
}

.dark .markdown-body blockquote {
  color: #9ca3af;
  /* slate-400 */
}

/* Horizontal rule */
.markdown-body hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid #e5e7eb;
}

.dark .markdown-body hr {
  border-top-color: #1f2937;
}

/* About page "In a sentence" progress indicator */
.tagline-progress {
  position: relative;
  width: 3.5rem;
  /* ~14 */
  height: 0.125rem;
  /* ~0.5 */
  border-radius: 9999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.45);
  /* ~slate-400 */
}

.tagline-progress-inner {
  position: absolute;
  inset: 0;
  background: rgb(129, 140, 248);
  /* ~indigo-400 */
  transform-origin: left;
  animation: tagline-progress 6s linear infinite;
}

@keyframes tagline-progress {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

/* === Nav + brand underline (shared) ======================= */

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-bottom: 0.25rem;
  text-decoration: none;
  border-bottom: none;
}

/* Kill any previous underline implementation */
.nav-link::after,
.nav-link::before {
  content: none !important;
}

/* Single animated underline we fully control */
.nav-underline {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  border-radius: 9999px;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.2s ease-out, background-color 0.2s ease-out;
  background-color: rgba(248, 250, 252, 0.8);
  /* soft white */
}

/* Hover = white underline */
.nav-link:hover .nav-underline {
  transform: scaleX(1);
}

/* Active nav item = single indigo underline */
.nav-link--active .nav-underline {
  transform: scaleX(1);
  background-color: rgb(129, 140, 248);
  /* indigo-400 */
}

/* Brand defaults to white underline, except when marked active */
.brand-link:not(.nav-link--active) .nav-underline {
  background-color: rgba(248, 250, 252, 0.9);
}