/* ==========================================================================
   modern.css — light refresh layered over Hyde/Poole.
   Loaded LAST so it wins on cascade. Uses CSS variables for theming.
   ========================================================================== */

:root {
  /* Light theme: page is tinted grey so white cards pop. */
  --bg: #eef0f4;
  --bg-elev: #ffffff;
  --text: #111418;
  --text-muted: #5b6473;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #d8dde5;
  --card-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 20px rgba(15, 23, 42, 0.08);
  --card-shadow-hover: 0 2px 6px rgba(15, 23, 42, 0.08), 0 16px 36px rgba(15, 23, 42, 0.14);
  --radius: 14px;
  --radius-sm: 8px;
  --content-max: 920px;
  --sidebar-bg: #0f1115;
  --sidebar-text: #e8eaee;
  --sidebar-muted: rgba(232, 234, 238, 0.62);
  --tag-bg: #eef2ff;
  --tag-text: #3b3f8f;
  --transition: 160ms cubic-bezier(0.2, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Dark theme — three clear tiers of elevation:
       sidebar (darkest)  →  page  →  cards (lightest). */
  --bg: #11141c;
  --bg-elev: #1f2533;
  --text: #e8eaee;
  --text-muted: #9aa3b2;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --border: #2f3645;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 20px rgba(0, 0, 0, 0.55);
  --card-shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.55), 0 16px 36px rgba(0, 0, 0, 0.7);
  --sidebar-bg: #06070a;
  --tag-bg: rgba(96, 165, 250, 0.18);
  --tag-text: #93c5fd;
}

/* Typography reset
   ----------------------------------------------------------------- */
html {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
}

.content {
  color: var(--text);
}

.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: -0.015em;
  color: var(--text);
}

.content h1 { font-size: 2.25rem; font-weight: 700; line-height: 1.15; }
.content h2 { font-size: 1.5rem;  font-weight: 650; line-height: 1.25; }
.content h3 { font-size: 1.2rem;  font-weight: 600; }

.content p,
.content li {
  color: var(--text);
  line-height: 1.7;
}

.content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.content a:hover {
  color: var(--accent-hover);
  border-bottom-color: currentColor;
}

.content blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-elev);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0;
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* Sidebar
   ----------------------------------------------------------------- */
.sidebar {
  background: var(--sidebar-bg) !important;
  color: var(--sidebar-muted);
  padding: 2.5rem 1.5rem;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.sidebar a { color: var(--sidebar-text); }
.sidebar-about h1 { font-family: "Inter", system-ui, sans-serif !important; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.sidebar-about h1 a { border: none; }
.sidebar .lead { color: var(--sidebar-muted); font-size: 0.92rem; line-height: 1.5; }

.sidebar-nav { margin: 1.75rem 0 1.25rem; }
.sidebar-nav-item {
  color: var(--sidebar-muted) !important;
  font-size: 0.95rem;
  padding: 0.4rem 0;
  border-bottom: none !important;
  transition: color var(--transition);
}
.sidebar-nav-item:hover,
.sidebar-nav-item:focus {
  color: var(--sidebar-text) !important;
  text-decoration: none !important;
  opacity: 1 !important;
}

#sidebar-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
  margin: 1.5rem 0 1rem;
  padding: 0;
  list-style: none;
}
#sidebar-buttons li { margin: 0; padding: 0; display: inline-flex; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sidebar-text) !important;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.30);
  transform: translateY(-1px);
  text-decoration: none !important;
  opacity: 1 !important;
}
.icon-btn svg { width: 16px; height: 16px; display: block; }
.icon-btn .icon-sun { display: none; }
[data-theme="dark"] .icon-btn .icon-sun { display: block; }
[data-theme="dark"] .icon-btn .icon-moon { display: none; }

#credits {
  color: var(--sidebar-muted);
  font-size: 0.78rem;
  margin-top: 1.25rem;
}
#credits a { color: var(--sidebar-muted); border: none; }
#credits a:hover { color: var(--sidebar-text); }

/* Hero (homepage)
   ----------------------------------------------------------------- */
.hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 0 2rem;
  margin-bottom: 1rem;
}
.hero-photo {
  flex: 0 0 auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-elev);
  box-shadow: var(--card-shadow);
  font-style: normal !important;
  font-family: inherit !important;
}
.hero-text { flex: 1 1 auto; min-width: 0; }
.hero-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.hero h1 {
  font-size: 2.5rem !important;
  font-weight: 800 !important;
  margin: 0 0 0.4rem !important;
  letter-spacing: -0.025em !important;
  line-height: 1.1 !important;
}
.hero-role {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}
.hero-cta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .hero { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .hero-photo { width: 110px; height: 110px; }
  .hero h1 { font-size: 2rem !important; }
}

/* Buttons
   ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 550;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text) !important;
  transition: all var(--transition);
  text-decoration: none !important;
  border-bottom: 1px solid var(--border) !important;
}
.btn:hover {
  border-color: var(--text-muted) !important;
  transform: translateY(-1px);
  color: var(--text) !important;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent) !important;
  color: #fff !important;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover) !important;
  color: #fff !important;
}
.btn svg { width: 16px; height: 16px; }

/* Entries — full-width horizontal cards (projects, publications, experience)
   ----------------------------------------------------------------- */
.entries {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: none;
  margin: 1.5rem 0 0;
}

.entry {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.5rem 1.75rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.entry:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}

/* Split row that lives BELOW the title + subtitle: image (50%) + body (50%). */
.entry-main {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  margin-top: 0.85rem;
}
.entry-image,
.entry-body-wrap {
  flex: 1 1 0;
  min-width: 0;
}

.entry-image {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  text-decoration: none !important;
  border-bottom: 1px solid var(--border) !important;
}
.entry-image img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  max-width: 100%;
  font-style: normal;
  font-family: inherit;
  transition: transform 400ms cubic-bezier(0.2, 0, 0.2, 1);
}
.entry:hover .entry-image img { transform: scale(1.03); }

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.25rem;
}
.entry-title {
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  margin: 0 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.018em !important;
  flex: 1 1 auto;
  min-width: 0;
}
.entry-title a {
  color: var(--text) !important;
  border-bottom: none !important;
  transition: color var(--transition);
}
.entry-title a:hover { color: var(--accent) !important; }
.entry-duration {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
}
.entry-meta {
  display: block;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0.85rem;
  line-height: 1.5;
}
.entry-body {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--text);
}
.entry-body p { margin: 0 0 0.7rem; }
.entry-body p:last-child { margin-bottom: 0; }
.entry-body ul { margin: 0.25rem 0 0.7rem 1.2rem; padding: 0; }
.entry-body li { margin-bottom: 0.3rem; line-height: 1.6; }

/* Inline body images: only render in entries WITHOUT an extracted cover image */
.entry-body img {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  margin: 0.25rem 0 0.85rem;
  font-style: normal;
  font-family: inherit;
}

/* The cover image is already stripped from .entry-body via Liquid (see
   projects/index.md) — this just hides any empty <p> the strip leaves behind. */
.entry-body p:empty { display: none; }
/* Safety net: in case any inline <img> survives, hide it inside an entry that
   already shows a cover image up top. */
.entry-has-image .entry-body img { display: none; }

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.9rem;
}

/* Mobile: collapse the 50/50 split to a stack. */
@media (max-width: 720px) {
  .entry { padding: 1.25rem; }
  .entry-main { flex-direction: column; gap: 1rem; }
  .entry-title { font-size: 1.2rem !important; }
}

/* Pager — client-side pagination controls injected below .entries.paginated.
   ----------------------------------------------------------------- */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 0;
  padding: 0.5rem 0;
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 0;
  transition: border-color var(--transition), color var(--transition), transform var(--transition), background var(--transition);
}
.pager-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.pager-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pager-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pager-btn svg { width: 18px; height: 18px; display: block; }
.pager-status {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 7em;
  text-align: center;
}

/* Role sub-headers inside an experience entry (multiple roles at one company). */
.entry-body .role {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 1.6rem 0 0.6rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border);
}
.entry-body .role:first-child {
  margin-top: 0.25rem;
  padding-top: 0;
  border-top: none;
}
.entry-body .role-title {
  font-weight: 650;
  color: var(--text);
  font-size: 1rem;
  letter-spacing: -0.005em;
}
.entry-body .role-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 550;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  letter-spacing: 0.01em;
}

/* Page title spacing
   ----------------------------------------------------------------- */
.page-title {
  padding-bottom: 0.25rem !important;
  margin-bottom: 0.25rem !important;
  font-size: 2rem !important;
  font-weight: 750 !important;
  letter-spacing: -0.02em !important;
}

/* Code blocks
   ----------------------------------------------------------------- */
pre, code {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
}
pre {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
code {
  background: var(--bg-elev);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre code { background: transparent; padding: 0; }

/* Dark-mode adapters for legacy poole.css color rules
   -----------------------------------------------------------------
   poole.css hard-codes near-black colors (#303030, #313131, #555, …) on
   <strong>, <code>, blockquote, tables, etc. Those values are invisible on
   the dark theme — re-route them through CSS variables so they flip with the
   theme. Affects every page since modern.css is the last stylesheet loaded. */
.content strong,
.content b,
.content dt { color: inherit; }
.content abbr { color: var(--text-muted); }
.content abbr[title] { border-bottom-color: var(--border); }

.content code {
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.content pre code { border: none; }

.content blockquote {
  color: var(--text);
  border-left-color: var(--accent);
}

.content table { border-color: var(--border); }
.content th,
.content td { border-color: var(--border); }
.content tbody tr:nth-child(odd) td,
.content tbody tr:nth-child(odd) th { background-color: var(--bg-elev); }

.content hr {
  border-top: 1px solid var(--border);
  border-bottom: none;
}
.content .lead { color: var(--text); }
.content .message { color: var(--text); background: var(--bg-elev); }

.page-title,
.post-title,
.post-title a { color: var(--text); }
.post-date,
.related-posts li small { color: var(--text-muted); }

/* Misc cleanups
   ----------------------------------------------------------------- */
.content img { font-style: normal; font-family: inherit; }

/* Scrollbar (subtle) */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  html { scroll-behavior: auto; }
}
