/* CSS Variables for theming - ROACM Theme */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --border-color: #e8e8e8;
  --text-primary: #222222;
  --text-secondary: #595959; /* Darker for WCAG AA contrast (7:1 on white) */
  --card-bg: #ffffff;
  --card-border: #e8e8e8;
  --card-shadow: rgb(0, 0, 0, 0.08);
  --accent-color: #c30000;
  --sidebar-accent-color: #ff5555; /* Lighter red for WCAG AA contrast on dark sidebar */

  /* Code block colors - VS Code dark theme inspired */
  --code-bg: #1e1e1e;
}

/* ==========================================================================
   Deprecation Notice
   Visible, unobtrusive top-line banner
   ========================================================================== */
.deprecation-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-color);
  color: var(--text-secondary);
  padding: 10px 12px;
  margin: 10px 0 16px;
  font-size: 0.95rem;
}

.deprecation-notice .icon {
  flex: 0 0 auto;
  color: var(--accent-color);
}

.deprecation-notice a {
  color: var(--text-primary);
  text-decoration: underline;
}

[data-theme='dark'] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2a2a2a;
  --border-color: #404040;
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0; /* Lighter for WCAG AA contrast (7:1 on #1a1a1a) */
  --card-bg: #252525;
  --card-border: #404040;
  --card-shadow: rgb(0, 0, 0, 0.3);
  --accent-color: #ff6b6b; /* Brighter red for WCAG AA contrast (4.73:1 on #252525) */
}

/* Apply theme colors to body and main elements */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);

  /* Enhanced typography with Open Sans */
  font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
  font-size: 17px;
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.7;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Superscript styling for date ordinals */
sup {
  font-size: 0.7em;
  vertical-align: super;
  line-height: 0;
}

/* Skip link for keyboard navigation accessibility */
.skip-link {
  background: var(--accent-color);
  border-radius: 0 0 4px 4px;
  color: #ffffff;
  font-weight: 500;
  left: 50%;
  padding: 8px 16px;
  position: absolute;
  text-decoration: none;
  top: -100%;
  transform: translateX(-50%);
  transition: top 0.2s ease;
  z-index: 10001;
}

.skip-link:focus {
  color: #ffffff;
  outline: 2px solid #ffffff;
  outline-offset: 2px;
  top: 0;
}

[data-theme='dark'] .skip-link {
  color: #1a1a1a;
}

[data-theme='dark'] .skip-link:focus {
  color: #1a1a1a;
  outline-color: #1a1a1a;
}

/* Main content focus style - no outline needed for non-interactive target */
#main-content:focus {
  outline: none;
}

/* Link colors for theme support and WCAG AA compliance */
a {
  color: var(--accent-color);
  position: relative;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--accent-color);
  opacity: 0.8;
}

/* ==========================================================================
   Fluid Layout - Override theme's fixed 960px width
   Only applies above mobile breakpoint (960px) to preserve mobile behavior
   ========================================================================== */

/* Override dinky theme gradients with solid backgrounds for accessibility */
.wrapper {
  background: var(--bg-primary);
}

main {
  background: var(--bg-primary);
}

/* Ensure articles have opaque backgrounds for proper color contrast */
article {
  background: var(--bg-primary);
}

/* Desktop fluid layout - only above mobile breakpoint */
@media (width > 960px) {
  .wrapper {
    margin: 0;
    max-width: none;
    width: auto;
  }

  main {
    float: none; /* Remove float, use margin instead */
    margin-left: 250px; /* Sidebar (170px) + gap (80px) */
    margin-right: 40px; /* Right margin for breathing room */
    max-width: 1100px; /* Readable line length cap */
    width: auto;
  }
}

/* Heading colors for theme support */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary);
}

/* Better heading hierarchy */
h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 48px 0 24px;
}

h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 40px 0 20px;
}

h3 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  margin: 32px 0 16px;
}

h4 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  margin: 24px 0 12px;
}

/* First heading in post has less top margin */
.post-content h1:first-child,
.post-content h2:first-child {
  margin-top: 0;
}

/* Post metadata (date + reading time) - used on homepage cards and post pages */
.post-meta {
  align-items: center;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.875rem;
  gap: 1rem;
  margin-bottom: 1rem;
  margin-top: 0.25rem;
}

.post-meta .post-date,
.post-meta .reading-time {
  align-items: center;
  display: flex;
  gap: 0.35rem;
}

.post-meta .icon {
  flex-shrink: 0;
  opacity: 0.8; /* Increased from 0.6 for better accessibility */
}

/* Header/sidebar styling - sidebar is always dark so needs light text */
p.header {
  color: #cccccc;
  font-size: 15px;
  white-space: nowrap;
}

h1.header,
h1.header a,
a.header,
header a {
  color: #ffffff;
  font-weight: 400;
  transition: color 0.2s ease;
}

h1.header a:hover,
a.header:hover,
header a:hover {
  color: var(--accent-color);
}

/* Sidebar logo - links to homepage */
.sidebar-logo {
  color: var(--sidebar-accent-color);
  display: block;
  font-family: 'Fira Code', Monaco, Consolas, monospace;
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.sidebar-logo:hover {
  color: #ffffff;
}

/* Enhanced link styling - uses CSS variable for theme support */

/* Underline effect on hover for post content links */
.post-content a:not(.no-underline) {
  background-image: linear-gradient(
    to right,
    var(--accent-color) 0%,
    var(--accent-color) 100%
  );
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition:
    background-size 0.3s ease,
    color 0.2s ease;
}

.post-content a:not(.no-underline):hover {
  background-size: 100% 1px;
}

/* Visited links - slightly muted (uses accent color with reduced opacity) */
.post-content a:visited {
  color: var(--accent-color);
  opacity: 0.8;
}

/* External links indicator */
.post-content a[href^='http']:not([href*='karun.me'])::after {
  content: ' ↗';
  font-size: 0.8em;
  opacity: 0.6;
}

/* Link focus for accessibility */
a:focus {
  border-radius: 2px;
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Heading links should be more subtle */
h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a {
  color: inherit;
  text-decoration: none;
}

h1 a:hover,
h2 a:hover,
h3 a:hover {
  color: var(--accent-color);
}

a:hover {
  color: var(--accent-color);
}

/* Paragraph text */
p {
  color: var(--text-primary);

  /* Hanging punctuation for quotes */
  hanging-punctuation: first last;

  /* Better paragraph spacing */
  margin: 20px 0;
}

/* Strong and emphasis */
strong,
b {
  color: var(--text-primary);
  font-weight: 600;
}

em {
  color: var(--text-primary);
}

/* Buttons */
button,
.btn {
  font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 600;
}

/* Enhanced code blocks - preserve monospace font */
pre {
  background: var(--code-bg);
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgb(0, 0, 0, 0.1);
  color: var(--code-text);
  font-family: 'Fira Code', Monaco, Menlo, Consolas, 'Courier New', monospace;
  margin: 24px 0;
  overflow-x: auto;
  padding: 20px;
  position: relative;
}

code,
kbd,
samp {
  font-family: 'Fira Code', Monaco, Menlo, Consolas, 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
}

.highlight,
.highlighter-rouge .highlight {
  background: var(--code-bg);
  border-radius: 6px;
  font-family: 'Fira Code', Monaco, Menlo, Consolas, 'Courier New', monospace;
}

.highlighter-rouge .highlight pre {
  margin: 0;
  padding: 20px;
}

pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
}

/* Inline code */
p code,
li code {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--accent-color);
  font-size: 0.9em;
  padding: 2px 6px;
}

/* Copy button */
.code-block-wrapper {
  position: relative;
}

.copy-code-btn {
  background: #3a3a3a;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  padding: 6px 12px;
  position: absolute;
  right: 8px;
  top: 8px;
  transition:
    opacity 0.2s,
    background 0.2s;
}

.code-block-wrapper:hover .copy-code-btn {
  opacity: 1;
}

.copy-code-btn:hover {
  background: #4a4a4a;
}

.copy-code-btn.copied {
  background: #28a745;
}

/* Improved spacing for homepage */
main {
  padding: 40px 40px 20px;
}

/* Enhanced Post Card styling */
article {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  margin-bottom: 32px;
  padding: 24px;
  transition:
    box-shadow 0.3s ease,
    transform 0.2s ease,
    background-color 0.3s ease,
    border-color 0.3s ease;
}

/* Ensure article cards have opaque backgrounds for WCAG contrast */
main article {
  background-color: var(--card-bg);
}

article + article {
  margin-top: 48px;
}

article:hover {
  box-shadow: 0 2px 12px var(--card-shadow);
  transform: translateY(-2px);
}

article h1 {
  font-weight: 600; /* Reduced from 700 for lighter appearance */
  line-height: 1.3;
  margin-bottom: 12px;
  margin-top: 0;
}

article p {
  line-height: 1.8;
  margin: 16px 0;
}

article h1 a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

article h1 a:hover {
  color: var(--accent-color);
}

/* Blog post title - match homepage styling */
.entry-title {
  font-weight: 200;
  margin-top: -20px; /* Reduce offset on category pages */
}

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

/* Override theme's p img { display: inline } which breaks aspect ratio */
main p img {
  display: block;
}

article .entry-content {
  overflow: hidden;
}

/* Post metadata styling */
.post-meta {
  align-items: center;
  color: var(--text-secondary);
  display: flex;
  font-size: 13px;
  font-weight: 300;
  gap: 16px;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.post-meta span {
  align-items: center;
  display: flex;
  gap: 6px;
}

.post-meta .icon {
  opacity: 0.8; /* Increased from 0.7 for better accessibility */
}

/* Dark mode toggle button */
.theme-toggle {
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  box-shadow: 0 2px 8px var(--card-shadow);
  cursor: pointer;
  display: flex;
  height: 50px;
  justify-content: center;
  position: fixed;
  right: 20px;
  top: 20px;
  transition: all 0.3s ease;
  width: 50px;
  z-index: 1000;
}

.theme-toggle:hover {
  box-shadow: 0 4px 12px var(--card-shadow);
  transform: scale(1.1);
}

.theme-toggle svg {
  fill: var(--text-primary);
  height: 24px;
  transition: fill 0.3s ease;
  width: 24px;
}

/* Footer styling */
footer {
  color: var(--text-primary);
}

footer h3 {
  color: var(--accent-color);
  font-weight: 400;
}

footer p {
  color: var(--text-primary);
}

footer a {
  color: var(--text-primary);
  display: inline-block;
  transition: color 0.2s ease;
}

footer a:hover {
  color: var(--accent-color);
}

blockquote {
  background-color: var(--bg-secondary);
  border-left: 4px solid var(--accent-color);
  font-style: italic;
  margin: 20px 0;
  padding: 15px 20px 15px 60px;
  position: relative;
  transition: background-color 0.3s ease;
}

blockquote::before {
  color: var(--accent-color);
  content: '\201C'; /* Opening curly quote */
  font-family: Georgia, 'Times New Roman', serif; /* Serif for elegant quotes */
  font-size: 60px;
  font-weight: normal; /* Remove bold for more elegant appearance */
  left: 10px;
  line-height: 1;
  opacity: 0.8; /* Slightly transparent for sophistication */
  position: absolute;
  top: 10px;
}

blockquote p {
  margin: 0 0 10px;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Pagination spacing */
.pagination {
  border-top: 1px solid var(--border-color);
  margin-top: 60px;
  padding-top: 30px;
}

/* Post navigation (previous/next) */
.post-navigation {
  border-top: 2px solid var(--border-color);
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
  margin-top: 40px;
  padding-top: 32px;
}

.post-nav-link {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.post-nav-link:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.post-nav-prev {
  text-align: left;
}

.post-nav-next {
  grid-column: 2;
  text-align: right;
}

.post-nav-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-nav-title {
  color: var(--accent-color);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

/* Single nav link takes full width */
.post-navigation:has(.post-nav-prev:only-child) .post-nav-prev,
.post-navigation:has(.post-nav-next:only-child) .post-nav-next {
  grid-column: 1 / -1;
}

/* Mobile: stack vertically */
@media (max-width: 600px) {
  .post-navigation {
    grid-template-columns: 1fr;
  }

  .post-nav-next {
    grid-column: 1;
  }
}

/* Post metadata styling */
.post-metadata {
  border-top: 2px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 40px;
  padding-top: 32px;
}

.metadata-section {
  flex: 1;
  min-width: 200px;
}

.metadata-section h4 {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.metadata-content {
  font-size: 15px;
}

/* Tag pills */
.tags-list a {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: var(--text-secondary);
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 4px 4px 0;
  padding: 4px 12px;
  text-decoration: none;
  transition: all 0.2s;
}

.tags-list a:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

/* Category pills */
.metadata-content a {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: var(--text-secondary);
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 4px 4px 0;
  padding: 4px 12px;
  text-decoration: none;
  transition: all 0.2s;
}

.metadata-content a:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

/* ==========================================================================
   Share Buttons
   ========================================================================== */

.share-buttons {
  align-items: center;
  border-top: 2px solid var(--border-color);
  display: flex;
  gap: 12px;
  margin-top: 40px;
  padding-top: 32px;
}

.share-label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.share-btn {
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  font-family: inherit;
  font-size: 14px;
  gap: 6px;
  height: 44px;
  justify-content: center;
  min-width: 44px;
  padding: 0 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.share-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.share-btn:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.share-btn svg {
  flex-shrink: 0;
}

/* Filled icons (Twitter, LinkedIn, HN) */
.share-btn-twitter svg,
.share-btn-linkedin svg,
.share-btn-hn svg {
  fill: currentcolor;
}

/* Stroke-based icons (link, check) - must not have fill */
.share-btn-copy svg {
  fill: none;
  stroke: currentcolor;
}

/* Copy button states */
/* Default: show link icon, hide check icon */
.share-btn-copy .icon-link {
  display: inline-block;
}

.share-btn-copy .icon-check {
  display: none;
}

/* After copy: hide link icon, show check icon */
.share-btn-copy.copied .icon-link {
  display: none;
}

.share-btn-copy.copied .icon-check {
  display: inline-block;
}

.share-btn-copy .copy-text {
  display: none;
}

/* Mobile: show copy text, hide on very small screens */
@media (min-width: 400px) {
  .share-btn-copy .copy-text {
    display: inline;
  }
}

/* Mobile: stack if needed */
@media (max-width: 480px) {
  .share-buttons {
    flex-wrap: wrap;
  }

  .share-label {
    flex-basis: 100%;
    margin-bottom: 4px;
  }
}

/* Ensure dark theme colors apply even if theme styles are more specific */
[data-theme='dark'] .share-buttons .share-btn,
.share-buttons .share-btn {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme='dark'] .share-buttons .share-btn:hover,
.share-buttons .share-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* Copy button copied state - must come after general button rules and override hover */
.share-buttons .share-btn-copy.copied,
[data-theme='dark'] .share-buttons .share-btn-copy.copied,
.share-buttons .share-btn-copy.copied:hover,
[data-theme='dark'] .share-buttons .share-btn-copy.copied:hover {
  border-color: #22c55e !important;
  color: #22c55e !important;
}

/* ==========================================================================
   Related Posts
   ========================================================================== */

.related-posts {
  border-top: 2px solid var(--border-color);
  margin-top: 40px;
  padding-top: 32px;
}

.related-posts h2 {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px;
}

.related-posts-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}

.related-post-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  padding: 16px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.related-post-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.related-post-title {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  overflow: hidden;
}

.related-post-meta {
  color: var(--text-secondary);
  display: flex;
  font-size: 13px;
  gap: 8px;
  margin-top: auto;
}

.related-post-reading-time::before {
  content: '·';
  margin-right: 8px;
}

/* Mobile: stack cards vertically */
@media (max-width: 768px) {
  .related-posts-grid {
    grid-template-columns: 1fr;
  }
}

/* Tablet: 2 columns */
@media (min-width: 769px) and (max-width: 1024px) {
  .related-posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Blog Index Redesign
   ========================================================================== */

/* Blog Index Container */
.blog-index {
  contain: layout style;
  max-width: 100%;
  overflow-x: hidden;
  width: 100%;
}

/* Topic Navigation */
.topic-nav {
  margin-bottom: 32px;
  min-height: 38px; /* Prevent CLS during load */
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.topic-nav-list {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topic-pill {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: var(--text-secondary);
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.topic-pill:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.topic-pill--all {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

/* Dark mode: use darker text for contrast on lighter accent background */
[data-theme='dark'] .topic-pill--all,
[data-theme='dark'] .topic-pill:hover {
  color: #1a1a1a;
}

/* Featured Post Section */
.featured-post {
  float: none;
  margin-bottom: 12px;
  padding-bottom: 0;
  width: 100%;
}

.featured-post-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  min-height: 180px; /* Prevent CLS during load */
  padding: 32px;
  transition: all 0.2s ease;
}

.featured-post-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.featured-post-link {
  color: inherit;
  display: block;
  text-decoration: none;
}

.featured-post-title {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 12px;
}

.featured-post-meta {
  color: var(--text-secondary);
  display: flex;
  font-size: 14px;
  gap: 16px;
  margin-bottom: 16px;
}

.featured-post-excerpt {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
}

/* Recent Posts Section */
.recent-posts-section {
  float: none;
  margin-bottom: 48px;
  padding-bottom: 0;
  width: 100%;
}

.section-header {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.view-all-link {
  color: var(--accent-color);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.view-all-link:hover {
  text-decoration: underline;
}

/* Post Card Grid */
.recent-posts-grid,
.category-posts-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
}

.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  min-height: 160px; /* Prevent CLS during load */
  padding: 20px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.post-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.post-card-title {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 8px;
  overflow: hidden;
}

.post-card-meta {
  color: var(--text-secondary);
  display: flex;
  font-size: 13px;
  gap: 12px;
  margin-bottom: 12px;
}

.post-card-excerpt {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--text-secondary);
  display: -webkit-box;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
}

/* Responsive: Tablet (2 columns) */
@media (max-width: 900px) {
  .recent-posts-grid,
  .category-posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive: Mobile (1 column) */
@media (max-width: 600px) {
  .recent-posts-grid,
  .category-posts-grid {
    grid-template-columns: 1fr;
  }

  .topic-nav {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
  }

  .featured-post-card {
    padding: 20px;
  }

  .featured-post-title {
    font-size: 22px;
  }

  .section-header {
    flex-direction: column;
    gap: 8px;
  }
}

/* Visually hidden utility for screen reader-only messages */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Author Bio Card
   ========================================================================== */

.author-bio {
  align-items: flex-start;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  gap: 20px;
  margin-top: 40px;
  padding: 24px;
}

.author-avatar {
  background-color: var(--bg-secondary);
  border-radius: 50%;
  flex-shrink: 0;
  height: 80px;
  object-fit: cover;
  width: 80px;
}

.author-info {
  flex: 1;
  min-width: 0;
}

.author-name {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
}

.author-description {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 12px;
}

.author-social {
  align-items: center;
  display: flex;
  gap: 12px;
}

.author-social a {
  align-items: center;
  color: var(--text-secondary);
  display: flex;
  transition: color 0.2s ease;
}

.author-social a:hover {
  color: var(--accent-color);
}

/* Mobile: stack vertically */
@media (max-width: 480px) {
  .author-bio {
    flex-direction: column;
    text-align: center;
  }

  .author-avatar {
    margin: 0 auto;
  }

  .author-social {
    justify-content: center;
  }
}

/* Reading progress bar */
.reading-progress-bar {
  background: linear-gradient(90deg, #c30000, #e30000);
  height: 3px;
  left: 0;
  position: fixed;
  top: 0;
  transition: width 0.1s ease-out;
  width: 0;
  z-index: 9999;
}

/* Back to top button */
.back-to-top {
  align-items: center;
  background: #c30000;
  border: none;
  border-radius: 50%;
  bottom: 30px;
  box-shadow: 0 4px 12px rgb(195, 0, 0, 0.4);
  color: white;
  cursor: pointer;
  display: flex;
  height: 48px;
  justify-content: center;
  opacity: 0;
  position: fixed;
  right: 30px;
  transform: translateY(20px);
  transition: all 0.3s ease;
  visibility: hidden;
  width: 48px;
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.back-to-top:hover {
  background: #a30000;
  box-shadow: 0 6px 16px rgb(195, 0, 0, 0.5);
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: translateY(0);
}

/* Navigation and UI elements - ensure Open Sans */
nav {
  font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

/* Small text and metadata */
small {
  font-size: 0.9em;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* Responsive sidebar typography for limited vertical space */
@media (height <= 1080px) {
  footer h3 {
    font-size: 16px;
    margin-bottom: 8px;
  }

  footer p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 8px;
  }

  footer small {
    font-size: 11px;
  }
}

/* More aggressive scaling for very limited space */
@media (height <= 900px) {
  footer h3 {
    font-size: 15px;
    margin-bottom: 6px;
  }

  footer p {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 6px;
  }

  footer small {
    font-size: 10px;
  }
}

/* Extreme case - ensure minimum usability */
@media (height <= 800px) {
  footer h3 {
    font-size: 14px;
    margin-bottom: 5px;
  }

  footer p {
    font-size: 12px;
    line-height: 1.3;
    margin-bottom: 5px;
  }

  footer small {
    font-size: 9px;
  }
}

/* Mobile adjustments */
@media (width <= 720px) {
  .back-to-top {
    bottom: 20px;
    height: 44px;
    right: 20px;
    width: 44px;
  }
}

/* 404 Error page */
.error-page {
  padding: 20px 20px 40px;
}

/* Header with 404 + title on same line */
.error-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-bottom: 16px;
}

.error-code {
  color: var(--accent-color);
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}

.error-header h1 {
  color: var(--text-primary);
  font-size: 48px;
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
}

/* Big red shrug - centered */
.error-shrug {
  color: var(--accent-color);
  font-size: 60px;
  line-height: 1;
  margin: 0 0 16px;
  text-align: center;
}

/* Description text - centered */
.error-description {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.5;
  margin: 0 auto 20px;
  max-width: 600px;
  text-align: center;
}

/* Image - centered */
.error-image {
  margin: 0 auto 24px;
  max-width: 350px;
  text-align: center;
}

.error-image img {
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--card-shadow);
  display: block;
  height: auto;
  width: 100%;
}

/* Navigation - left-aligned with bullets */
.error-nav {
  margin: 0 auto 20px;
  max-width: 600px;
}

.error-nav h3 {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
}

.error-nav ul {
  list-style: disc;
  margin: 0;
  padding-left: 24px;
}

.error-nav li {
  color: var(--text-primary);
  font-size: 15px;
  margin: 8px 0;
}

.error-nav a {
  color: var(--accent-color);
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.error-nav a:hover {
  opacity: 0.8;
}

/* Pro tip - centered */
.error-tip {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 20px 0 0;
  text-align: center;
}

.error-tip kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
  padding: 2px 6px;
}

/* Mobile adjustments for 404 page */
@media (max-width: 600px) {
  .error-header {
    flex-direction: column;
    gap: 16px;
  }

  .error-code {
    font-size: 80px;
  }

  .error-header h1 {
    font-size: 28px;
    text-align: center;
  }

  .error-shrug {
    font-size: 60px;
  }

  .error-description {
    font-size: 16px;
  }

  .error-image {
    max-width: 100%;
  }

  .error-nav {
    padding: 0 20px;
  }
}

/* ==========================================================================
   Table of Contents - Floating Sidebar
   ========================================================================== */

#toc {
  margin: 0;
}

/* Desktop: Fixed position on the right side */
@media (min-width: 1400px) {
  #toc {
    position: fixed;
    right: 40px;
    top: 120px;
    width: 220px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    z-index: 100;
  }

  /* Collapsed state - hide the list */
  .toc-list {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition:
      max-height 0.3s ease,
      opacity 0.2s ease;
  }

  /* Expanded state on hover */
  .toc-nav:hover .toc-list {
    max-height: 500px;
    opacity: 1;
  }

  /* Collapse indicator */
  .toc-title::after {
    content: '+';
    float: right;
    font-size: 14px;
    font-weight: 400;
    transition: transform 0.2s ease;
  }

  .toc-nav:hover .toc-title::after {
    content: '−';
  }
}

/* Medium screens: Hide ToC (not enough space) */
@media (min-width: 961px) and (max-width: 1399px) {
  #toc {
    display: none;
  }
}

/* Mobile/Tablet: Inline ToC below title */
@media (max-width: 960px) {
  #toc {
    margin: 24px 0 32px;
  }
}

.toc-nav {
  backdrop-filter: blur(8px);
  background: rgb(245, 245, 245, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow:
    0 4px 12px rgb(0, 0, 0, 0.1),
    0 1px 3px rgb(0, 0, 0, 0.06);
  opacity: 0.6;
  padding: 14px 20px;
  transition:
    opacity 0.2s ease,
    background 0.2s ease,
    padding 0.2s ease;
}

.toc-nav:hover {
  background: var(--bg-secondary);
  opacity: 1;
  padding-bottom: 18px;
}

[data-theme='dark'] .toc-nav {
  background: rgb(42, 42, 42, 0.7);
  box-shadow:
    0 4px 12px rgb(0, 0, 0, 0.3),
    0 1px 3px rgb(0, 0, 0, 0.2);
}

[data-theme='dark'] .toc-nav:hover {
  background: var(--bg-secondary);
}

.toc-title {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  margin: 0;
  padding: 0;
}

.toc-link {
  border-left: 2px solid transparent;
  color: var(--text-secondary);
  display: block;
  font-size: 13px;
  line-height: 1.4;
  padding: 4px 0 4px 10px;
  text-decoration: none;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.toc-link:hover {
  color: var(--accent-color);
}

.toc-link.active {
  border-left-color: var(--accent-color);
  color: var(--accent-color);
  font-weight: 500;
}

/* Indent h3 items */
.toc-h3 .toc-link {
  font-size: 12px;
  padding-left: 18px;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .toc-nav {
    padding: 14px 16px;
  }

  .toc-link {
    font-size: 13px;
    padding: 5px 0 5px 10px;
  }

  .toc-h3 .toc-link {
    padding-left: 18px;
  }
}

/* ==========================================================================
   Search Component
   ========================================================================== */

.search-container {
  margin-top: 20px;
  position: relative;
  width: 100%;
}

.search-input-wrapper {
  align-items: center;
  display: flex;
  position: relative;
}

.search-icon {
  color: #999999;
  left: 10px;
  pointer-events: none;
  position: absolute;
}

#search-input {
  background: rgb(255, 255, 255, 0.1);
  border: 1px solid rgb(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #ffffff;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  padding: 10px 40px 10px 36px;
  transition:
    background 0.2s,
    border-color 0.2s;
  width: 100%;
}

#search-input::placeholder {
  color: rgb(255, 255, 255, 0.5);
}

#search-input:focus {
  background: rgb(255, 255, 255, 0.15);
  border-color: rgb(255, 255, 255, 0.4);
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.search-shortcut {
  background: rgb(255, 255, 255, 0.1);
  border: 1px solid rgb(255, 255, 255, 0.2);
  border-radius: 4px;
  color: rgb(255, 255, 255, 0.5);
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 11px;
  padding: 2px 6px;
  pointer-events: none;
  position: absolute;
  right: 8px;
}

.search-results {
  background-color: var(--card-bg);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgb(0, 0, 0, 0.3);
  display: none;
  left: 50px;
  max-height: 70vh;
  overflow-y: auto;
  position: fixed;
  top: 180px;
  width: 340px;
  z-index: 10000;
}

[data-theme='dark'] .search-results {
  border-color: #404040;
}

.search-result-item {
  background-color: inherit;
}

.search-results.visible {
  display: block;
}

.search-result-item {
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  transition: background 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--bg-secondary);
}

.search-result-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}

.search-result-excerpt {
  -webkit-box-orient: vertical;
  color: var(--text-secondary);
  display: -webkit-box;
  font-size: 12px;
  -webkit-line-clamp: 2;
  line-height: 1.4;
  margin-bottom: 4px;
  overflow: hidden;
}

.search-result-date {
  color: var(--text-secondary);
  font-size: 11px;
  opacity: 0.7;
}

.search-result-item mark {
  background: rgb(195, 0, 0, 0.2);
  border-radius: 2px;
  color: var(--accent-color);
  padding: 0 2px;
}

.search-no-results,
.search-loading {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 20px 16px;
  text-align: center;
}

.search-overlay {
  background: rgb(0, 0, 0, 0.3);
  display: none;
  inset: 0;
  position: fixed;
  z-index: 1000;
}

.search-overlay.visible {
  display: block;
}

/* Mobile adjustments for search */
@media (max-width: 960px) {
  .search-container {
    margin: 16px 0;
  }

  .search-results {
    left: 16px;
    right: 16px;
    top: auto;
    width: auto;
  }

  .search-shortcut {
    display: none;
  }
}

/* ==========================================================================
   Archive Page Styles
   ========================================================================== */

.archive-page {
  margin-top: 24px;
}

.archive-year {
  align-items: baseline;
  border-bottom: 2px solid var(--accent-color);
  color: var(--text-primary);
  display: flex;
  font-size: 24px;
  font-weight: 700;
  justify-content: space-between;
  margin: 32px 0 16px;
  padding-bottom: 8px;
}

.archive-year:first-of-type {
  margin-top: 0;
}

.archive-year-label {
  flex: 0 0 auto;
}

.archive-year-count {
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 400;
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-item {
  align-items: baseline;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 16px;
  padding: 12px 0;
  transition: background-color 0.2s ease;
}

.archive-item:hover {
  background-color: var(--bg-secondary);
}

.archive-date {
  color: var(--text-secondary);
  flex-shrink: 0;
  font-family: 'Fira Code', Consolas, monospace;
  font-size: 14px;
  width: 60px;
}

.archive-link {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.archive-link:hover {
  color: var(--accent-color);
}

/* ==========================================================================
   Mobile Navigation - Hamburger Menu
   Breakpoint: 1280px (mobile below, desktop above)
   ========================================================================== */

/* --- Hamburger Button --- */
.hamburger-menu {
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  display: none; /* Hidden on desktop */
  flex-direction: column;
  gap: 5px;
  height: 44px; /* Touch-friendly minimum */
  justify-content: center;
  left: 20px;
  padding: 10px;
  position: fixed;
  top: 20px;
  width: 44px;
  z-index: 10002; /* Above all other content */
}

.hamburger-menu:hover {
  background: var(--bg-secondary);
}

.hamburger-menu:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.hamburger-menu:focus:not(:focus-visible) {
  outline: none;
}

.hamburger-menu:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* --- Hamburger Icon Lines --- */
.hamburger-menu .hamburger-line {
  background: var(--text-primary) !important;
  border-radius: 2px !important;
  display: block !important;
  height: 2px !important;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  width: 20px !important;
}

/* Hamburger to X animation */
.hamburger-menu[aria-expanded='true'] .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu[aria-expanded='true'] .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-menu[aria-expanded='true'] .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Backdrop Overlay --- */
.sidebar-backdrop {
  background: rgb(0, 0, 0, 0.5);
  display: none;
  inset: 0;
  opacity: 0;
  position: fixed;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
}

.sidebar-backdrop.visible {
  display: block;
  opacity: 1;
}

/* --- Mobile Breakpoint Styles --- */
@media (max-width: 1279px) {
  /* Show hamburger on mobile */
  .hamburger-menu {
    display: flex;
  }

  /* Sidebar becomes off-canvas drawer */
  header {
    height: 100vh;
    height: 100dvh; /* iOS Safari fix */
    left: 0;
    overflow-y: auto;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px;
    z-index: 10001;
  }

  header.is-open {
    transform: translateX(0);
  }

  /* Main content takes full width */
  main {
    margin-left: 0;
    margin-right: 0;
    padding: 70px 20px 20px 20px; /* Extra top padding for hamburger menu */
    width: 100%;
  }

  /* Adjust footer for mobile */
  footer {
    margin-left: 0;
    padding: 20px;
    position: static;
  }

  /* Sidebar links need touch-friendly sizing */
  header a {
    display: block;
    min-height: 44px;
    padding: 12px 0;
  }

  /* Prevent body scroll when menu is open */
  body.menu-open {
    overflow: hidden;
  }
}

/* --- Desktop Layout Override --- */
@media (min-width: 1280px) {
  /* Ensure sidebar is always visible on desktop */
  header {
    transform: none !important;
  }

  /* Hide backdrop on desktop */
  .sidebar-backdrop {
    display: none !important;
  }
}

/* ==========================================================================
   Homepage Layout
   Professional hub landing page with full-width hero
   ========================================================================== */

/* Reset body padding for homepage to allow full-width hero */
body.homepage {
  padding: 0;
}

/* Center main content on homepage (no sidebar) */
@media (width > 960px) {
  body.homepage main {
    margin-left: auto;
    margin-right: auto;
  }
}

/* Hero Section - Full width, outside wrapper */
.homepage-hero {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  box-sizing: border-box;
  color: #ffffff;
  float: none; /* Override theme's section { float: right } */
  padding: 80px 40px;
  text-align: center;
  width: 100%;
}

[data-theme='dark'] .homepage-hero {
  background: linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 100%);
}

.homepage-hero-content {
  margin: 0 auto;
  max-width: 800px;
}

.homepage-hero-name {
  border-bottom: none;
  color: #ffffff;
  font-size: 48px;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.hero-bracket {
  color: var(--accent-color);
  font-family: 'Fira Code', Monaco, Consolas, monospace;
  font-weight: 400;
}

.homepage-hero-tagline {
  color: rgb(255, 255, 255, 0.85);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.6;
  margin: 0;
}

/* Homepage Sections */
.homepage-section {
  float: none; /* Override theme's section { float: right } */
  margin-bottom: 48px;
  padding-bottom: 48px;
  width: auto; /* Override theme's section { width: 650px } */
}

.homepage-section:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

/* Cards Grid - Reuses pattern from blog index */
.homepage-cards-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
}

.homepage-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  padding: 20px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.homepage-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.homepage-card-title {
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 8px;
}

.homepage-card-meta {
  color: var(--text-secondary);
  display: flex;
  font-size: 13px;
  gap: 12px;
  margin-bottom: 8px;
}

.homepage-card-meta span:not(:first-child)::before {
  content: '·';
  margin-right: 12px;
}

.homepage-card-description {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--text-secondary);
  display: -webkit-box;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
}

.homepage-card-reading-time::before {
  content: '·';
  margin-right: 12px;
}

/* Work Section */
.homepage-work-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
}

.homepage-work-tagline {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 16px;
}

.homepage-work-highlights {
  color: var(--text-secondary);
  list-style: disc;
  margin: 0;
  padding-left: 20px;
}

.homepage-work-highlights li {
  margin-bottom: 8px;
}

.homepage-work-highlights li:last-child {
  margin-bottom: 0;
}

/* Contact Section */
.homepage-contact-content {
  text-align: center;
}

.homepage-contact-text {
  color: var(--text-secondary);
  font-size: 16px;
  margin: 0 0 20px;
}

.homepage-contact-cta {
  align-items: center;
  background: var(--accent-color);
  border-radius: 8px;
  color: #ffffff;
  display: inline-flex;
  font-size: 16px;
  font-weight: 600;
  gap: 8px;
  padding: 12px 24px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.homepage-contact-cta:hover {
  color: #ffffff;
  opacity: 0.9;
  transform: translateY(-1px);
}

.homepage-contact-cta svg {
  fill: currentcolor;
}

.homepage-social-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
}

.homepage-social-links a {
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.homepage-social-links a:hover {
  color: var(--accent-color);
}

.homepage-social-links svg {
  fill: currentcolor;
}

/* Responsive: Tablet */
@media (max-width: 900px) {
  .homepage-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive: Mobile */
@media (max-width: 600px) {
  .homepage-hero {
    padding: 60px 20px;
  }

  .homepage-hero-name {
    font-size: 36px;
  }

  .homepage-hero-tagline {
    font-size: 17px;
  }

  .homepage-cards-grid {
    grid-template-columns: 1fr;
  }

  .homepage-section {
    margin-bottom: 32px;
    padding-bottom: 32px;
  }
}

/* ==========================================================================
   Reduced Motion - Accessibility
   Users with vestibular disorders or motion sensitivity need reduced animations
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Talks Page Styles
   ========================================================================== */

.talks-intro {
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 32px;
}

/* Featured Talk Section */
.featured-talk {
  margin-bottom: 32px;
  width: 100%;
}

.featured-talk-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.featured-talk-video {
  background: #000;
}

.video-container {
  aspect-ratio: 16 / 9;
  position: relative;
  width: 100%;
}

.video-container iframe {
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.featured-talk-content {
  padding: 24px;
}

.featured-talk-title {
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 12px;
}

.featured-talk-meta {
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 16px;
  margin-bottom: 16px;
}

.featured-talk-event {
  font-weight: 600;
}

.featured-talk-description {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

/* Talks Section */
.talks-section {
  margin-bottom: 32px;
  width: 100%;
}

.talks-section h2 {
  border-bottom: 2px solid var(--accent-color);
  font-size: 22px;
  margin: 0 0 8px;
  padding-bottom: 8px;
}

.section-description {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0 0 20px;
}

/* Talks Grid */
.talks-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Talk Card */
.talk-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.talk-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--card-shadow);
  transform: translateY(-2px);
}

.talk-card-thumbnail {
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  position: relative;
}

.talk-card-thumbnail img {
  height: 100%;
  object-fit: cover;
  object-position: center;
  width: 100%;
}

.talk-card-duration {
  background: rgb(0, 0, 0, 0.8);
  border-radius: 4px;
  bottom: 8px;
  color: #fff;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  padding: 2px 6px;
  position: absolute;
  right: 8px;
}

.talk-card-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 16px;
}

.talk-card-title {
  -webkit-box-orient: vertical;
  color: var(--text-primary);
  display: -webkit-box;
  font-size: 16px;
  font-weight: 600;
  -webkit-line-clamp: 2;
  line-height: 1.4;
  margin: 0 0 8px;
  overflow: hidden;
}

.talk-card-meta {
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
  margin-bottom: 8px;
}

.talk-card-event {
  font-weight: 500;
}

.talk-card-location::before {
  content: '\2022';
  margin-right: 8px;
}

.talk-card-description {
  -webkit-box-orient: vertical;
  color: var(--text-secondary);
  display: -webkit-box;
  flex-grow: 1;
  font-size: 14px;
  -webkit-line-clamp: 2;
  line-height: 1.5;
  margin: 0 0 12px;
  overflow: hidden;
}

/* Talk Badges */
.talk-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.talk-badge {
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  text-transform: uppercase;
}

.talk-badge-panel {
  background: rgb(103, 58, 183, 0.15);
  color: #673ab7;
}

.talk-badge-podcast {
  background: rgb(0, 150, 136, 0.15);
  color: #009688;
}

.talk-badge-live {
  background: rgb(233, 30, 99, 0.15);
  color: #e91e63;
}

.talk-badge-collab {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

[data-theme='dark'] .talk-badge-panel {
  background: rgb(103, 58, 183, 0.3);
  color: #b39ddb;
}

[data-theme='dark'] .talk-badge-podcast {
  background: rgb(0, 150, 136, 0.3);
  color: #80cbc4;
}

[data-theme='dark'] .talk-badge-live {
  background: rgb(233, 30, 99, 0.3);
  color: #f48fb1;
}

/* Talks CTA */
.talks-cta {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-top: 24px;
  padding: 20px;
  text-align: center;
  width: 100%;
}

.talks-cta p {
  margin: 0;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .talks-grid {
    grid-template-columns: 1fr;
  }

  .featured-talk-content {
    padding: 16px;
  }

  .featured-talk-title {
    font-size: 20px;
  }

  .featured-talk-meta {
    flex-direction: column;
    gap: 4px;
  }
}
