/* Optimized CSS - Critical sections minified, complex sections readable */

/* Critical Above-the-fold Styles - Minified for Performance */
*,*:before,*:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content:""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}

/* Theme Variables - Readable for easy maintenance */
:root {
  --background: 49 22% 93%;
  --foreground: 20 5% 12%;
  --card: 49 22% 93%;
  --card-foreground: 20 5% 12%;
  --popover: 49 22% 93%;
  --popover-foreground: 20 5% 12%;
  --primary: 20 5% 12%;
  --primary-foreground: 49 22% 93%;
  --secondary: 43 8% 88%;
  --secondary-foreground: 20 5% 12%;
  --muted: 43 8% 88%;
  --muted-foreground: 20 5% 12%;
  --accent: 200 50% 40%;
  --accent-foreground: 49 22% 93%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 49 22% 93%;
  --border: 43 8% 85%;
  --input: 43 8% 88%;
  --ring: 25 25% 25%;
  --radius: .25rem;
  --link: #a84d2b;
  --link-hover: #b8592e;
  
  /* Layout Constants - Clear for maintainability */
  --scroll-offset: -20px;
  --resize-debounce: 50ms;
  --animation-duration: 150ms;
  --transition-fast: .15s;
  --transition-normal: .2s;
  --transition-slow: .3s;
  --toc-width-desktop: 16rem;
  --toc-width-mobile: 100%;
  --toc-top-desktop: 6rem;
  --toc-left-desktop: 1rem;
  --toc-gap-desktop: 1rem;
  --bio-mobile-breakpoint: 768px;
  --desktop-breakpoint: 1024px;
  --mobile-breakpoint: 640px;
}

.dark {
  --background: 25 15% 8%;
  --foreground: 43 20% 90%;
  --card: 25 15% 8%;
  --card-foreground: 43 20% 90%;
  --popover: 25 15% 8%;
  --popover-foreground: 43 20% 90%;
  --primary: 43 20% 90%;
  --primary-foreground: 25 15% 8%;
  --secondary: 25 12% 15%;
  --secondary-foreground: 43 20% 90%;
  --muted: 25 12% 15%;
  --muted-foreground: 43 10% 65%;
  --accent: 200 60% 60%;
  --accent-foreground: 25 15% 8%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 43 20% 90%;
  --border: 25 12% 20%;
  --input: 25 12% 15%;
  --ring: 43 20% 90%;
  --link: #e67b4f;
  --link-hover: #ff8a5c;
}

/* Utility Classes - Minified for performance */
*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));font-family:"Newsreader",Georgia,Times New Roman,serif;color:hsl(var(--foreground));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-display:swap;font-optical-sizing:auto}h1,h2,h3,h4,h5,h6{font-family:"Newsreader",Georgia,Times New Roman,serif}h2{font-weight:bold}.academic-link{color:var(--link);text-decoration-line:underline;text-decoration-thickness:1px;text-underline-offset:4px;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.academic-link:hover{color:var(--link-hover)}.content-section{margin-bottom:2rem}.content-section:last-child{margin-bottom:0}.skip-link{position:absolute;top:-40px;left:6px;background:hsl(var(--foreground));color:hsl(var(--background));padding:8px 16px;border-radius:4px;text-decoration:none;font-weight:600;z-index:1000;transition:top var(--transition-slow) ease}.skip-link:focus{top:6px;outline:2px solid hsl(var(--link));outline-offset:2px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.hidden{display:none!important}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.flex-grow{flex-grow:1}.min-h-screen{min-height:100vh}.max-w-2xl{max-width:42rem}.max-w-none{max-width:none}.mx-auto{margin-left:auto;margin-right:auto}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-3{gap:.75rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-serif{font-family:"Newsreader",Georgia,Times New Roman,serif}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.bg-background{background-color:hsl(var(--background))}.bg-muted{background-color:hsl(var(--muted))}.bg-foreground{background-color:hsl(var(--foreground))}

/* Post Content Styles - Readable for content management */
.prose {
  color: var(--tw-prose-body);
  max-width: 65ch;
}

.prose-lg {
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.leading-relaxed {
  line-height: 1.625;
}

.post-content {
  font-size: 1.25rem;
  line-height: 1.75;
  color: hsl(var(--foreground));
  max-width: 70ch;
  text-align: left;
}

.post-meta h1 {
  font-size: 3rem;
  line-height: 1.2;
  font-weight: 400;
  margin-bottom: 1rem;
}

.post-content p {
  margin-bottom: 1.5rem;
  line-height: 1.75;
}

.post-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  line-height: 1.3;
  border-top: 1px solid hsl(var(--border));
  padding-top: 2rem;
}

.post-content h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 1.5rem;
}

/* Theme Toggle - Minified for performance */
.relative{position:relative}.h-6{height:1.5rem}.w-11{width:2.75rem}.h-4{height:1rem}.w-4{width:1rem}.w-6{width:1.5rem}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-1{--tw-translate-x:.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-6{--tw-translate-x:1.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rounded-full{border-radius:9999px}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}.hover\:text-link:hover{color:var(--link)}

/* ============================================================================ */
/* READABLE RESPONSIVE SECTIONS - Complex media queries kept readable          */
/* ============================================================================ */

/* Reduced Motion Support - Important for accessibility */
@media (prefers-reduced-motion: reduce) {
  .skip-link,
  .academic-link,
  .transition,
  .transition-colors,
  #toggle-slider,
  .toc-panel,
  .toc-overlay,
  .hamburger-line,
  .close-line,
  .bio-expand-btn {
    transition: none !important;
    animation: none !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* Posts List Styling */
.posts-list {
  font-size: 1.25rem; /* 20px to match rest of page */
  line-height: 1.5;
  list-style-type: disc; /* Show bullet points */
  padding-left: 1.5rem; /* Add indentation for bullets */
}

/* TOC Typography & Spacing Improvements */
.toc-panel .toc-header h3 {
  font-size: 1.5rem; /* 24px - larger, more prominent header */
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0;
}

.toc-list {
  font-size: 1.25rem; /* 20px - larger, more readable list items */
  line-height: 1.5;
  margin: 0;
  padding: 0;
  list-style: none; /* Remove any default list styling */
}

.toc-list li {
  margin-bottom: 0.5rem; /* 8px - more generous spacing between items */
}

.toc-list a {
  display: block;
  color: hsl(var(--foreground));
  text-decoration: none;
  padding: 0.25rem 0;
  transition: color 0.15s ease;
}

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

/* TOC Active Highlighting */
.toc-list a.active {
  color: var(--link);
  font-weight: 600;
  background-color: hsl(var(--muted));
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  position: relative;
  display: inline-block;
  text-decoration: none;
  margin: -0.25rem -0.5rem;
}

/* Toggle Slider Fix - Ensure transform works */
#toggle-slider {
  transition: transform 0.2s ease;
}

#toggle-slider.translate-x-1 {
  transform: translateX(0.25rem);
}

#toggle-slider.translate-x-6 {
  transform: translateX(1.5rem);
}

/* Simple Responsive Utilities - Can stay minified */
@media (min-width: 640px) {
  .sm\:mb-12 { margin-bottom: 3rem; }
  .sm\:py-12 { padding-top: 3rem; padding-bottom: 3rem; }
  .sm\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
}

@media (min-width: 768px) {
  .post-meta h1 { font-size: 3.875rem; }
}

/* ============================================================================ */
/* TOC COMPONENT - Complex responsive behavior kept readable                   */
/* ============================================================================ */

/* Base TOC Toggle Styles */
.toc-toggle {
  position: fixed;
  z-index: 1000;
  width: 2.5rem;
  height: 2.5rem;
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: .375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

.toc-toggle:hover {
  background-color: #a84d2b;
  border-color: #a84d2b;
}

.toc-toggle:focus {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Desktop TOC Toggle Positioning */
@media (min-width: 1024px) {
  .toc-toggle {
    top: 2rem;
    left: 2rem;
    width: 3rem;
    height: 3rem;
  }
}

/* Mobile TOC Toggle - Complex responsive behavior */
@media (max-width: 1023px) {
  .toc-toggle {
    position: relative;
    top: auto;
    left: auto;
    width: 2.5rem;
    height: 2.5rem;
    box-shadow: none;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--background));
    border-radius: .375rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .post-header .toc-toggle:hover {
    background-color: #a84d2b;
    border-color: #a84d2b;
  }
}

/* TOC Icon States */
.toc-icon {
  position: relative;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: .25rem;
}

.toc-icon.hidden {
  display: none !important;
}

.hamburger-line {
  width: 1.25rem;
  height: 2px;
  background-color: hsl(var(--foreground));
  transition: all .3s ease;
  transform-origin: center;
}

.close-line {
  position: absolute;
  width: 1.25rem;
  height: 2px;
  background-color: hsl(var(--foreground));
  transition: all .3s ease;
}

.close-line:first-child {
  transform: rotate(45deg);
}

.close-line:last-child {
  transform: rotate(-45deg);
}

/* TOC Panel - Complex responsive layout */
.toc-panel {
  position: fixed;
  z-index: 999;
  background-color: hsl(var(--background));
  border: none;
  border-radius: 0;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, visibility .15s ease;
  
  /* Mobile-first: Full screen overlay */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

.toc-panel.visible {
  opacity: 1;
  visibility: visible;
}

/* Desktop TOC Panel - Complex positioning and sizing */
@media (min-width: 1024px) {
  .toc-panel {
    top: var(--toc-top-desktop);
    left: var(--toc-left-desktop);
    right: auto;
    bottom: var(--toc-gap-desktop);
    width: var(--toc-width-desktop);
    height: auto;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    display: block;
    flex-direction: unset;
  }
}

/* TOC Content Layout - Complex responsive adjustments */
.toc-panel .toc-header {
  padding: 5rem 1.5rem 1.5rem 1.5rem;
  margin-bottom: 0;
  flex-shrink: 0;
}

.toc-panel .toc-list {
  padding: 0 1.5rem 2rem 1.5rem;
  flex-grow: 1;
  overflow-y: auto;
}

/* Desktop TOC Content Adjustments */
@media (min-width: 1024px) {
  .toc-panel .toc-header {
    padding: 0 0 0 1.5rem !important; /* Left padding to align with close button */
    margin-bottom: 1rem;
    margin-left: 0;
    border-bottom: none;
    flex-shrink: unset;
  }
  
  .toc-panel .toc-list {
    padding: 0 0 0 1.5rem !important; /* Left padding to align with close button */
    margin: 0;
    flex-grow: unset;
    overflow-y: visible;
  }
}

/* TOC Overlay - Mobile only */
.toc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, .5);
  z-index: 998;
  transition: opacity .3s ease;
  opacity: 0;
  pointer-events: none;
}

.toc-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 1024px) {
  .toc-overlay {
    display: none;
  }
}

/* ============================================================================ */
/* BIO COLLAPSE COMPONENT - Complex mobile responsive behavior                 */
/* ============================================================================ */

.bio-content {
  position: relative;
}

.bio-expanded {
  display: inline;
}

.bio-ellipsis,
.bio-expand-btn {
  display: none;
}

.bio-break {
  display: block;
  margin: 1rem 0;
  content: "";
}

/* Complex Mobile Bio Collapse Behavior */
@media (max-width: 768px) {
  /* Collapsed state styles */
  .bio-content:not(.expanded) .bio-expanded {
    display: none;
  }
  
  .bio-content:not(.expanded) .bio-ellipsis {
    display: inline;
  }
  
  .bio-content:not(.expanded) .bio-expand-btn {
    display: inline-block;
    background: none;
    border: none;
    color: var(--link);
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    margin-left: .5em;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color var(--transition-normal) ease;
  }
  
  .bio-content:not(.expanded) .bio-expand-btn:hover {
    color: var(--link-hover);
  }
  
  .bio-content:not(.expanded) .bio-expand-btn:focus {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
    border-radius: 2px;
  }
  
  /* Expanded state styles */
  .bio-content.expanded .bio-ellipsis,
  .bio-content.expanded .bio-expand-btn {
    display: none;
  }
  
  .bio-content.expanded .bio-expanded {
    display: inline;
  }
  
  .bio-content.expanded .bio-break {
    display: block;
    margin: 1rem 0;
    content: "";
  }
}