:root {
  --color-bg: #ffffff;
  --color-fg: #1f2937;
  --color-muted: #6b7280;
  --color-teal: #0f9ba8;
  --color-card: #ffffff;
  --focus: 2px dashed var(--color-teal);
  --container: 1100px;
  --radius: 16px;
  --sidebar: 280px;
  --sidebar-collapsed: 64px;
}
}
:root.dark {
  --color-bg: #0b0e12 !important;
  --color-fg: #e5e7eb !important;
  --color-muted: #9ca3af !important;
  --color-card: #12161c !important;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Cantarell, "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-fg);
  line-height: 1.6;
}
a { color: var(--color-teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: var(--sidebar); min-height: 100vh; padding: .75rem;
  background: var(--color-teal); color: #fff;
  display: flex; flex-direction: column; gap: .5rem;
}
.sidebar__top { display:flex; align-items:center; justify-content: space-between; gap:.5rem; }
.sidebar__brand { font-weight: 900; font-size: 1.25rem; color:#fff; letter-spacing: .5px; }
.sidebar__controls .btn { color:#fff; border-color:#fff; }
.side__menu { display:flex; flex-direction: column; gap:.25rem; margin-top: .5rem; }
.side__link { color:#ecfeff; padding: .5rem .75rem; border-radius: 10px; display:block; }
.side__link--active, .side__link:hover { background: rgba(255,255,255,.15); text-decoration:none; }

.content { flex: 1; padding: 1rem 1.25rem 3rem; max-width: var(--container); }
.container { margin: 0 auto; }

/* Collapsed state */
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .nav-link-text { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }
/* Keep buttons visible */
body.sidebar-collapsed .sidebar__controls .btn { padding:.3rem .5rem; }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link
.skip-link:focus { position: static; width: auto; height: auto; padding: .5rem; background: var(--color-teal); color: #fff; }


/* Buttons */
.btn {
  display: inline-block; background: var(--color-teal); color: white; padding: .6rem 1rem;
  border-radius: 999px; border: none; font-weight: 600; box-shadow: 0 2px 12px rgba(0,0,0,.12);
}
.btn:hover { filter: brightness(0.95); text-decoration: none; }
.btn--ghost { background: transparent; color: inherit; border: 2px solid currentColor; }

/* Hero */
.hero { display: grid; gap: 1rem; align-items: center; grid-template-columns: 1fr; padding: 1.5rem 0; }
.hero__title { font-size: clamp(1.6rem, 3vw, 2.25rem); margin: 0 0 .25rem; }
.hero__subtitle { color: var(--color-muted); margin: 0 0 1rem; }
.hero__img { width: 160px; height: 160px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.2); }

@media (min-width: 768px) { .hero { grid-template-columns: 2fr 1fr; } }

.grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid { grid-template-columns: 2fr 1fr; } }

.cards { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--color-card); border: 1px solid rgba(0,0,0,.06); border-radius: var(--radius); overflow: hidden; }
.card__img { aspect-ratio: 16/9; object-fit: cover; background: #e5e7eb; }
.card__body { padding: 1rem; }

/* Blog */
.blog-controls { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.posts { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.post-card { background: var(--color-card); border: 1px solid rgba(0,0,0,.06); border-radius: var(--radius); padding: 1rem; }
.post-card h3 { margin: 0 0 .5rem; }
.post-card .meta { color: var(--color-muted); font-size: .9rem; }
.post-card .tags { display:flex; gap:.5rem; flex-wrap:wrap; margin-top:.5rem; }
.tag { background: rgba(15,155,168,0.12); color: var(--color-teal); padding: .15rem .5rem; border-radius: 999px; font-size: .85rem; }

.post__hero { width:100%; max-height: 380px; object-fit: cover; border-radius: var(--radius); border: 1px solid rgba(0,0,0,.06); }
.post__meta { color: var(--color-muted); margin-top: -.5rem; }
.post__body { margin-top: 1rem; }
.post__body pre { overflow: auto; padding: .75rem; border-radius: 12px; border: 1px solid rgba(0,0,0,.06); }

/* Timeline */
.timeline { list-style: none; padding: 0; }
.timeline li { border-left: 3px solid var(--color-teal); padding-left: .75rem; margin: .75rem 0; }

/* Footer */
.site-footer { border-top: 1px solid rgba(0,0,0,.05); text-align: center; padding: 2rem 0; color: var(--color-muted); }

/* Focus styles */
/* removed generic focus outline */


/* Responsive: sidebar stacks on small screens */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; border-bottom: 3px solid rgba(255,255,255,.25); }
  body.sidebar-collapsed .sidebar { width: 100%; }
  body.sidebar-collapsed .nav-link-text { position: static; width:auto; height:auto; }
}

html.dark {
  --color-bg: #0b0e12;
  --color-fg: #e5e7eb;
  --color-muted: #9ca3af;
  --color-card: #111827;
}
.topbar{position:sticky;top:0;z-index:50;display:flex;justify-content:flex-end;align-items:center;height:48px;padding:0 16px;background:transparent;}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:8px 10px;border-radius:999px;border:1px solid transparent;cursor:pointer;}
.btn--ghost{background:transparent;border-color:transparent;}

.sidebar{width:var(--sidebar);}
body.sidebar-collapsed .sidebar{width:var(--sidebar-collapsed);}
.sidebar__top{display:flex;align-items:center;justify-content:space-between;padding:12px;}
body.sidebar-collapsed .nav-link-text{display:none;}
body.sidebar-collapsed .side__link{justify-content:center;}
body.sidebar-collapsed .sidebar__top a.side__brand{overflow:hidden;white-space:nowrap;width:0;padding:0;margin:0;}
#collapseSidebar{font-size:20px;width:36px;height:36px;border-radius:8px;line-height:1;}
main#content{padding-top:4px;}


/* Ensure brand and hamburger share a single top row */
.sidebar__top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

/* When collapsed: hide brand and the entire nav; show only the hamburger */
body.sidebar-collapsed .sidebar__brand { display: none; }
body.sidebar-collapsed .side__menu { display: none; }
body.sidebar-collapsed .sidebar { padding: 12px; }

/* Keep hamburger aligned and visible */
.sidebar__top #collapseSidebar {
  justify-self: end;
}


/* Remove dotted focus outline for clickable UI elements */
.btn:focus, .btn:focus-visible,
a:focus, a:focus-visible,
.side__link:focus, .side__link:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* Keep skip link behavior intact (if any separate styling exists) */


/* Suppress outlines globally (user request), keep skip-link usable */
*:focus, *:focus-visible { outline: none !important; box-shadow: none !important; }
main#content:focus { outline: none !important; }
section:focus, section:focus-within, article:focus, article:focus-within, .card:focus, .card:focus-within { outline: none !important; }


/* Remove white outline/border from the hamburger */
.sidebar__controls .btn,
#collapseSidebar {
  border: none !important;
  border-color: transparent !important;
  background: transparent;
  box-shadow: none !important;
}

/* Center hamburger when collapsed; hide brand/menu */
body.sidebar-collapsed .sidebar { align-items: center; }
body.sidebar-collapsed .sidebar__top { display: flex; justify-content: center; width: 100%; }
body.sidebar-collapsed .sidebar__brand { display: none; }
body.sidebar-collapsed .side__menu { display: none; }


/* === Themed moon toggle === */
:root { --moon-fill: #111; }        /* black in light theme */
html.dark { --moon-fill: #fff; }    /* white in dark theme */

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--color-teal);
  background: transparent;
  border-radius: 9999px;
  padding: 0;
  line-height: 0;
  box-shadow: none;
}
.theme-toggle svg { width: 20px; height: 20px; display: block; }
.theme-toggle .crescent {
  fill: var(--moon-fill);
  stroke: var(--color-teal);
  stroke-width: 1.5;
}

/* Subtle hover (no outlines) */
.theme-toggle:hover { background: rgba(15, 155, 168, 0.08); }
.theme-toggle:active { transform: scale(0.98); }

/* Keep outlines removed per user's preference */
.theme-toggle:focus, .theme-toggle:focus-visible { outline: none !important; box-shadow: none !important; }

/* === chip styles (non-clickable skill pills) === */
.skills-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: .5rem .8rem;
  border-radius: 9999px;
  background: rgba(15, 155, 168, 0.10);
  border: 1px solid rgba(15, 155, 168, 0.35);
  color: #0f9ba8;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1;
  user-select: none;
  cursor: default;
  pointer-events: none;
  box-shadow: 0 1px 0 rgba(0,0,0,.03), inset 0 -1px 0 rgba(255,255,255,.4);
  transition: transform .05s ease;
}
.chip:hover { transform: translateY(-1px); }
@media (max-width: 600px) {
  .chip { padding: .45rem .7rem; font-weight: 600; }
}
.dark .chip {
  background: rgba(15, 155, 168, 0.18);
  border-color: rgba(15, 155, 168, 0.45);
  color: #e6fbff;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
/* === end chip styles === */

/* === hero avatar fix: larger, circular, no distortion === */
.hero img.hero-avatar,
.hero .hero-avatar,
.hero .avatar img,
.hero .headshot,
.hero img.headshot {
  width: clamp(140px, 22vw, 240px);
  height: clamp(140px, 22vw, 240px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  display: block;
  flex-shrink: 0;
}

/* If a wrapper is used for the frame */
.hero .avatar,
.hero .photo-circle {
  width: clamp(140px, 22vw, 240px);
  height: clamp(140px, 22vw, 240px);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
/* === end hero avatar fix === */

/* Tag chips: keep small pills only under .tags */
.tags .chip {
  padding: .2rem .6rem;
  font-size: .8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-elev-1);
}

.post__header { margin-bottom: 1rem; }
.post-hero { width: 100%; height: auto; border-radius: 1rem; margin-top: .5rem; }
.post__body pre { padding: .75rem; border-radius: .75rem; overflow: auto; }
.post__footer { margin-top: 1rem; }
.crumbs { margin-bottom: .5rem; }
.crumbs a { text-decoration: none; }

#pager { margin-top: 1rem; }
.pager { display: flex; gap: .5rem; align-items: center; }
.pager .btn[aria-disabled="true"] { pointer-events: none; opacity: .5; }

/* Back to top button */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999;
  display: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: #0f9ba8;
  color: #fff;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  cursor: pointer;
}
.back-to-top:hover { transform: translateY(-1px); }
.back-to-top:focus { outline: 2px solid #0f9ba8; outline-offset: 2px; }

/* KaTeX color in dark mode */
.dark .katex { color: var(--color-fg); }

/* Force-hide index UI when viewing a single post */
.post-view #content > h1,
.post-view .blog-controls,
.post-view #postsList,
.post-view #pager { display: none !important; }

/* Inline vs block code reset */
:not(pre) > code {
  background: var(--color-elev-1);
  padding: .15em .35em;
  border-radius: .4em;
}
pre > code {
  background: none !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}
pre[class*="language-"] .token {
  background: none !important;
  box-shadow: none !important;
}
pre, code, kbd, samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono","Courier New", monospace;
  font-variant-ligatures: none;
}

.back-to-top svg { width: 22px; height: 22px; fill: currentColor; }
.back-to-top:hover { transform: translateY(-1px); }
.back-to-top:focus { outline: 2px solid #fff; outline-offset: 2px; }


#themeToggle,
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1200;
}
