/* Modern theme for danclarke.com */
:root {
  /* Theme palette */
  --background-color: #0b0c0f; /* subtle off-black for modern look */
  --surface-color: #111318;
  --elevated-color: #161922;
  --text-color: #e8e9ee;
  --muted-text-color: #aeb3c2;
  --sidebar-background: #111318;
  --link-color: #82aaff; /* bright but tasteful blue */
  --link-hover-color: #b4ccff;
  --border-color: #222737;
  --accent: #7ae582; /* green accent */
  --danger: #ff6b6b;
  /* Buttons use same shade as Buy Me A Coffee */
  --button-color: #5F7FFF;

  /* Radii, shadows, spacing, typography */
  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2), 0 0 0 1px rgba(255,255,255,.02) inset;
  --shadow-md: 0 8px 24px rgba(0,0,0,.35);
  /* Wider overall layout similar to LinkedIn */
  --container-max: 1440px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Light theme override */
html:not([data-theme="dark"]) {
  --background-color: #f8fafc;
  --surface-color: #ffffff;
  --elevated-color: #ffffff;
  --text-color: #0f172a;
  --muted-text-color: #475569;
  --sidebar-background: #ffffff;
  --link-color: #1e40af;
  --link-hover-color: #0b5cd5;
  --border-color: #e5e7eb;
  --accent: #16a34a;
  /* Keep button shade consistent across themes */
  --button-color: #5F7FFF;
}

/* Base */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(130, 170, 255, .12), transparent 60%),
              radial-gradient(1000px 500px at 90% -20%, rgba(122, 229, 130, .1), transparent 60%),
              var(--background-color);
  color: var(--text-color);
  transition: background-color .3s ease, color .3s ease, background .3s ease;
  font-family: var(--font-sans);
  line-height: 1.7;
  margin: 0;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--link-color); text-decoration: none; }
a:hover { color: var(--link-hover-color); }

/* Typography */
h1, h2, h3, h4 { color: var(--text-color); margin: 1.2em 0 .5em; line-height: 1.25; }
h1 { font-size: clamp(1.8rem, 2vw + 1.2rem, 2.4rem); }
h2 { font-size: clamp(1.4rem, 1.5vw + 1rem, 1.8rem); }
h3 { font-size: 1.25rem; }
p { color: var(--muted-text-color); margin: .6em 0; }
strong { color: var(--text-color); }

/* Layout */
.container {
  display: grid;
  /* Slightly narrower left, slightly wider right to balance a wider main column */
  grid-template-columns: 240px minmax(0, 1fr) 360px;
  gap: var(--space-4);
  max-width: var(--container-max);
  padding: 0 var(--space-4);
  margin: 0 auto;
}

@media (max-width: 1200px) {
  /* Drop to two columns a bit later given the wider layout */
  .container { grid-template-columns: 260px minmax(0,1fr); }
  .container .sidebar:last-child { display: none; }
}

@media (max-width: 800px) {
  .container { grid-template-columns: 1fr; }
  .container .sidebar:first-child { order: 2; }
  .container .content { order: 1; }
}

.content { min-width: 0; }

.sidebar {
  background: var(--surface-color);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(120%) blur(8px);
  background: linear-gradient(to bottom, rgba(17, 19, 24, .8), rgba(17, 19, 24, .6));
  border-bottom: 1px solid var(--border-color);
}

html:not([data-theme="dark"]) .site-header { background: rgba(255,255,255,.8); }

.header-inner {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "brand actions"
    "nav nav";
  align-items: center;
  gap: var(--space-2);
  max-width: var(--container-max);
  padding: var(--space-3) var(--space-4);
  margin: 0 auto;
}
.site-brand { grid-area: brand; margin: 0; font-size: 1.25rem; letter-spacing: .2px; }
.site-title { color: inherit; text-decoration: none; }

.header-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-self: end;
}

.site-nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  margin: var(--space-2) 0 0;
  width: 100%;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--surface-color);
  color: var(--muted-text-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.nav-toggle:hover,
.nav-toggle:focus-visible {
  color: var(--text-color);
  border-color: rgba(130,170,255,.35);
  background: linear-gradient(180deg, rgba(130,170,255,.12), rgba(130,170,255,.04));
}

.nav-toggle-bar {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar-top { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar-middle { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar-bottom { transform: translateY(-7px) rotate(-45deg); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 800px) {
  .site-nav { display: none; }
  .site-nav.is-open { display: flex; }
  .nav-toggle { display: inline-flex; }
}

@media (min-width: 801px) {
  .header-inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav actions";
    gap: var(--space-3);
  }

  .site-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    padding: 0;
  margin: 0;
  width: auto;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    justify-self: end;
  }

  .nav-toggle { display: none; }
}
.nav-link {
  color: var(--muted-text-color);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: block;
}
.nav-link:hover { color: var(--text-color); background: rgba(130,170,255,.08); }

/* Simplified Dark Mode Toggle */
.theme-toggle {
  font-size: 1.5rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-left: 0;
  transition: transform 0.2s ease;
  vertical-align: middle;
  line-height: 1;
  color: var(--muted-text-color);
}
.theme-toggle:hover { transform: scale(1.08); }

/* Inverted icon logic - showing sun in light mode, moon in dark mode */
html:not([data-theme="dark"]) .theme-toggle .moon-icon { display: none; }
html:not([data-theme="dark"]) .theme-toggle .sun-icon { display: inline; }
html[data-theme="dark"] .theme-toggle .sun-icon { display: none; }
html[data-theme="dark"] .theme-toggle .moon-icon { display: inline; }

/* Main spacing under sticky header */
main { margin-top: var(--space-4); }

/* Code & Pre */
code, pre, kbd, samp { font-family: var(--font-mono); }
code { background: var(--elevated-color); color: var(--text-color); border-radius: var(--radius-sm); padding: .15em .4em; }
pre { background: var(--elevated-color); border-radius: var(--radius-md); padding: var(--space-4); overflow: auto; border: 1px solid var(--border-color); }
pre code { background: transparent; padding: 0; }

/* Homepage styles */
.home-container { max-width: 1100px; padding: 0 var(--space-4); margin: 0 auto; }
.homepage-section { margin-bottom: var(--space-6); padding-bottom: var(--space-5); border-bottom: 1px solid var(--border-color); }
.homepage-section:last-child { border-bottom: none; }

/* Spotlight containers (blog + what I do) */
.blog-spotlight, .what-spotlight {
  position: relative;
  overflow: hidden;
  /* Subtle color glows to draw attention without overpowering */
  background:
    radial-gradient(900px 360px at 0% -15%, color-mix(in oklab, var(--link-color), transparent 85%), transparent 60%),
    radial-gradient(800px 320px at 100% -20%, color-mix(in oklab, var(--accent), transparent 85%), transparent 60%),
    linear-gradient(180deg, color-mix(in oklab, var(--surface-color), black 2%), var(--surface-color));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-5) var(--space-5);
  box-shadow: var(--shadow-sm), 0 12px 32px rgba(0, 0, 0, .25);
}
/* Accent ribbon on top edge */
.blog-spotlight::before, .what-spotlight::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--link-color), var(--accent));
  opacity: .85;
}
.blog-spotlight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.blog-spotlight-titlewrap { display: flex; align-items: center; gap: var(--space-3); }
.blog-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, color-mix(in oklab, var(--link-color), transparent 65%), color-mix(in oklab, var(--link-color), transparent 92%));
  border: 1px solid color-mix(in oklab, var(--link-color), transparent 55%);
  border-radius: 50%;
  /* Subtle halo to make the badge pop */
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--link-color), transparent 85%), 0 10px 24px rgba(130,170,255,.18);
  font-size: 1.2rem;
}
.blog-spotlight-sub { margin: 0; }

.recent-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}
@media (max-width: 920px) { .recent-posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .recent-posts-grid { grid-template-columns: 1fr; } }

.recent-post-card {
  background: var(--elevated-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.recent-post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(130,170,255,.35); }
.recent-post-title { margin: 0 0 6px; font-size: 1.05rem; }
.recent-post-title a { color: var(--text-color); text-decoration: none; }
.recent-post-title a:hover { color: var(--link-hover-color); }
.recent-post-meta { color: var(--muted-text-color); font-size: .9rem; margin: 0 0 var(--space-2); }
.recent-post-excerpt { margin: 0; color: var(--muted-text-color); }

/* Profile picture */
.profile-pic-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-4) 0 var(--space-3);
}
.profile-pic-link { display: inline-block; border-radius: 50%; }
.profile-pic {
  border-radius: 50%;
  border: 3px solid color-mix(in oklab, var(--link-color), transparent 65%);
  box-shadow: var(--shadow-sm);
  width: 160px;
  height: 160px;
  object-fit: cover;
}
@media (max-width: 640px) {
  .profile-pic { width: 120px; height: 120px; }
}

/* Profile hero row */
.profile-hero {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin: var(--space-5) 0;
}
.profile-intro { flex: 1; }
.profile-intro p { font-size: 1.2em; }
.profile-button-wrapper { display: flex; align-items: center; gap: 0.5rem; }
.mvp-badge { margin-left: auto; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: var(--space-2); }
.mvp-badge img { height: 84px; width: auto; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
@media (max-width: 720px) {
  .profile-hero { flex-direction: column; align-items: center; }
  .profile-intro { text-align: center; }
  .profile-button-wrapper { justify-content: center; }
  .mvp-badge { margin-top: var(--space-3); margin-left: 0; }
  .mvp-badge img { height: 56px; }
}

.social-links { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-3); }
.social-link { display: inline-flex; align-items: center; padding: 10px 14px; background: var(--surface-color); border-radius: var(--radius-md); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); color: var(--text-color); transition: transform .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease; }
.social-icon { margin-right: 8px; width: 18px; height: 18px; }
.social-link:hover { transform: translateY(-2px); background: linear-gradient(180deg, rgba(130,170,255,.15), rgba(130,170,255,.05)); border-color: rgba(130,170,255,.35); }
.social-link:hover .social-icon { color: var(--link-hover-color); }

.projects-links { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--space-4); margin-top: var(--space-3); }
@media (max-width: 1024px) { .projects-links { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 768px) { .projects-links { grid-template-columns: 1fr; } }
.project-link { padding: var(--space-3); background: var(--surface-color); border-radius: var(--radius-md); border: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; text-align: center; }
.project-link:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: rgba(130,170,255,.35); }
.project-link h3 { margin-top: 0; margin-bottom: 5px; }
.project-link p { margin: 0; color: var(--muted-text-color); }

/* Project thumbnails/icons */
.project-thumb { width: 100%; height: clamp(120px, 18vw, 200px); object-fit: contain; border-radius: var(--radius-sm); margin: 0 auto var(--space-3); box-shadow: var(--shadow-sm); }
.project-icon { display: block; margin: 0 auto var(--space-3); filter: drop-shadow(0 1px 2px rgba(0,0,0,.2)); height: clamp(120px, 18vw, 200px); width: auto; }

/* Fix podcast logo transparency in light mode */
html:not([data-theme="dark"]) img[alt="Unhandled Exception Podcast logo"] {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  padding: var(--space-3);
}

/* Fix Dometrain logo transparency in light mode */
html:not([data-theme="dark"]) img[alt="Dometrain logo"] {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  padding: var(--space-3);
}

/* Responsive media inside post content */
.content img,
.content svg,
.content video,
.content iframe { max-width: 100%; height: auto; }

/* Blog post content text size */
.post-content p { font-size: 1.125rem; }

/* Buttons */
.button {
  display: inline-block;
  padding: 10px 16px;
  margin-top: 10px;
  background: linear-gradient(180deg, var(--button-color), color-mix(in oklab, var(--button-color), black 10%));
  color: white;
  border-radius: var(--radius-sm);
  transition: background-color .2s ease, transform .08s ease;
  border: 1px solid rgba(255,255,255,.08);
}
.button:hover { background: linear-gradient(180deg, color-mix(in oklab, var(--button-color), white 8%), color-mix(in oklab, var(--button-color), black 5%)); color: white; }
.button-lg { padding: 12px 18px; font-weight: 600; }
/* Slightly elevate CTA inside the blog spotlight */
.blog-spotlight .button-lg { box-shadow: 0 10px 28px rgba(95, 127, 255, .28); }

/* Post list */
.post-list { display: grid; gap: var(--space-4); }
.post-card { background: var(--surface-color); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: var(--space-4); box-shadow: var(--shadow-sm); }
.post-title { margin: 0 0 6px; }
.post-link { color: var(--text-color); text-decoration: none; }
.post-link:hover { color: var(--link-hover-color); }
.post-meta { color: var(--muted-text-color); font-size: .9rem; margin: 0 0 var(--space-2); }
.post-excerpt { margin: 0 0 var(--space-2); }

/* Pagination */
.pagination { margin-top: var(--space-5); }
.pagination-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3); background: var(--surface-color); border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.page-link { color: var(--link-color); text-decoration: none; }
.page-link.disabled { color: var(--muted-text-color); opacity: .6; cursor: default; }
.page-status { color: var(--muted-text-color); }

/* Footer */
.site-footer { margin-top: var(--space-6); border-top: 1px solid var(--border-color); }
.footer-inner { max-width: var(--container-max); padding: var(--space-4); margin: 0 auto; color: var(--muted-text-color); }

/* Forms (for search/newsletter placeholder blocks) */
input, select, textarea {
  background: var(--surface-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
input::placeholder { color: var(--muted-text-color); }

/* Focus ring */
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid color-mix(in oklab, var(--link-color), white 10%);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Search widget */
.search-widget {
  margin-bottom: var(--space-4);
}

.search-widget h3 {
  margin: 0 0 var(--space-2) 0;
  font-size: 1.1rem;
  color: var(--text-color);
}

.search-widget form {
  display: flex;
  gap: var(--space-2);
}

.search-widget input[type="search"] {
  flex: 1;
  margin: 0;
}

.search-widget button {
  white-space: nowrap;
}

.search-page-form {
  max-width: 500px;
  margin-bottom: var(--space-5);
}

.search-summary {
  margin-bottom: var(--space-4);
  color: var(--muted-text-color);
}

.no-results {
  padding: var(--space-4);
  background: var(--surface-color);
  border-radius: var(--radius-md);
  text-align: center;
}

/* Tag cloud */
.tag-cloud .tag-cloud-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.tag-cloud .tag-item { color: var(--muted-text-color); }
.tag-cloud .tag-link { color: var(--link-color); }
.tag-cloud .tag-link:hover { color: var(--link-hover-color); }
.tag-cloud .tag-count { margin-left: 2px; color: var(--muted-text-color); font-size: .9em; }

/* Sidebar recent posts rail (horizontal list) */
.recent-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--space-2);
}
.recent-rail-item {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted-text-color);
  line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
}
.recent-rail-item:hover {
  color: var(--text-color);
  border-color: rgba(130,170,255,.35);
  background: linear-gradient(180deg, rgba(130,170,255,.08), rgba(130,170,255,.03));
}
.recent-rail-empty { color: var(--muted-text-color); }

/* Sidebar section title */
.sidebar-section-title {
  margin-top: 0;
  margin-bottom: var(--space-2);
  font-size: 1rem;
}

/* Comments Section */
.comments-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-color);
}

.comments-section h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-4);
  color: var(--text-color);
}

/* Giscus theme integration */
.giscus, .giscus-frame {
  width: 100%;
  max-width: 100%;
}
