/* CSS Custom Properties (Variables) */
:root {
  /* Colors */
  --primary-color: #007bff;
  --primary-hover: #0056b3;
  --primary-light: rgba(0, 123, 255, 0.1);
  --primary-lighter: rgba(0, 123, 255, 0.2);
  --text-color: black;
  --text-muted: #999;
  --text-error: #ff6b6b;
  --background-primary: white;
  --background-secondary: #f5f5f5;
  --background-dark: #2a1a1a;
  --border-color: #ddd;
  --border-primary: #007bff;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --shadow-strong: rgba(0, 0, 0, 0.15);
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-xxl: 4rem;
  
  /* Borders and Radii */
  --border-width: 2px;
  --border-radius: 0.5rem;
  --border-radius-sm: 0.25rem;
  --border-radius-lg: 8px;
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-cubic: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Typography */
  --font-family: Helvetica, Arial, sans-serif;
  --font-size-base: 14px;
  --line-height-base: 1.6em;
  
  /* Layout */
  --content-width-mobile: 95%;
  --content-width-tablet: 92%;
  --content-width-desktop: 90%;
  --max-width-content: 100em;
  --max-width-heading: 66.67em;
  
  /* Interactive elements */
  --min-touch-target: 44px;
  --dropdown-max-height: 200px;
  --tooltip-max-width: 90vw;
  --modal-max-width: 95vw;
  --modal-max-height: 95vh;
}

/* Dark mode color overrides */
@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #e0e0e0;
    --background-primary: #2a2a2a;
    --background-secondary: #333;
    --background-dark: #1a1a1a;
    --border-color: #444;
    --shadow-color: rgba(0, 0, 0, 0.3);
  }
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

/* Universal styles */
img {
  max-width: 100%;
  height: auto;
  border: var(--border-width) solid var(--text-color);
}

/* Profile image styles */
.about-section {
  position: relative;
}

.profile-image {
  float: right;
  width: 200px;
  height: 200px;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--border-radius);
  border: var(--border-width) solid var(--background-primary);
  margin: 0 0 var(--spacing-lg) var(--spacing-lg);
  box-shadow: 0 4px 8px var(--shadow-color);
}

/* Base styles (mobile-first approach) */
body {
  margin: 0 auto;
  padding: 4px;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--text-color);
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--background-primary);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: sans-serif;
  font-weight: normal;
}

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

.header {
  background-color: var(--background-secondary);
  padding: var(--spacing-md);
  width: 100%;
}

h1 {
  font-size: 24px;
  padding: 16px 8px;
  margin: 0;
  text-align: center;
  font-weight: bold;
}

h2 {
  font-size: 20px;
  margin: 0;
  text-align: center;
}

h3 {
  font-size: 16px;
}

hr {
  margin-top: 0.5em;
  margin-bottom: 1em;
}

.about-list li {
  display: block;
  margin-bottom: 10px;
}

.about-info {
  display: block;
  margin-bottom: 5px;
}

.date {
  display: block;
  text-align: right;
}


/* Consolidated spacing for content elements */
h3, p, ul {
  margin: 0 auto;
  text-align: justify;
}

.about-section {
  margin: 0 auto;
  text-align: justify;
}

/* Consolidated responsive content widths */
@media (max-width: 480px) {
  h3, p, ul, hr {
    width: var(--content-width-mobile);
    padding: 0 var(--spacing-sm);
  }
  
  .about-section {
    width: var(--content-width-mobile);
    padding: 0 var(--spacing-sm);
  }
  
  .about-section p {
    width: 100%;
    padding: 0;
    max-width: none;
  }
}

@media (min-width: 481px) {
  h3, p, ul, hr {
    width: var(--content-width-tablet);
    padding: 0 12px;
  }
  
  .about-section {
    width: var(--content-width-tablet);
    padding: 0 12px;
  }
  
  .about-section p {
    width: 100%;
    padding: 0;
    max-width: none;
  }
}

@media (min-width: 901px) {
  h3, p, ul, hr {
    width: var(--content-width-desktop);
    padding: 0 16px;
  }
  
  .about-section {
    width: var(--content-width-desktop);
    padding: 0 16px;
  }
  
  .about-section p {
    width: 100%;
    padding: 0;
    max-width: none;
  }
  
  h3 {
    max-width: var(--max-width-heading);
  }
  
  p, ul, hr {
    max-width: var(--max-width-content);
  }
  
  .about-section {
    max-width: var(--max-width-content);
  }
}

/* Small mobile styles (max-width: 480px) */
@media (max-width: 480px) {
  body {
    padding: 2px;
  }
  
  /* Mobile profile image - center above text */
  .profile-image {
    float: none;
    display: block;
    margin: 0 auto var(--spacing-lg) auto;
    width: 150px;
    height: 150px;
  }
  
  .about-section {
    text-align: center;
    margin: 0 auto;
  }
  
  .about-section p {
    text-align: justify;
  }
}

/* Tablet styles (481px - 900px) */
@media (min-width: 481px) {
  body {
    font-size: 15px;
    padding: 8px;
  }

  h1 {
    font-size: 28px;
    padding: 20px 16px;
  }

  h2 {
    font-size: 22px;
  }

  h3 {
    font-size: 18px;
  }

  .header {
    padding: 20px;
  }
  
  /* Tablet profile image - slightly smaller float */
  .profile-image {
    width: 180px;
    height: 180px;
    margin: 0 0 var(--spacing-lg) var(--spacing-lg);
  }
}

/* Desktop styles (901px+) */
@media (min-width: 901px) {
  body {
    font-size: 16px;
    padding: 4px;
  }

  h1 {
    font-size: 48px;
    padding: 32px;
  }

  h2 {
    font-size: 32px;
  }

  h3 {
    font-size: 24px;
  }

  hr {
    margin-bottom: 2em;
  }

  .header {
    padding: 32px;
    max-width: 100em;
  }

  .about-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .about-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .date {
    margin-left: 20px;
    text-align: right;
  }
}

/* Print styles */
@media print {
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
}

/* Footer styles */
footer {
  color: var(--text-color);
  text-align: center;
  padding: 1em 0;
}

footer a {
  color: var(--primary-color);
  text-decoration: underline;
}
/* End Footer Styles */

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

/* Blog post collapsible styles */
.blog-post {
  margin-bottom: 2rem;
}

.post-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  padding: 0.25rem;
}

.post-header:hover {
  background-color: var(--background-secondary);
}

.post-header h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  text-align: justify;
}

.post-title-content {
  display: flex;
  align-items: center;
}

.collapse-icon {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--primary-color);
  margin-right: 0.5rem;
  transition: opacity 0.2s ease;
  display: inline-block;
  flex-shrink: 0;
}

.post-date {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
  margin-left: 1rem;
}

.post-content {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  max-height: 5000px;
  opacity: 1;
}

.post-content.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
}

/* Dark mode support - Additional overrides beyond CSS variables */
@media (prefers-color-scheme: dark) {
  body {
    background-color: var(--background-dark);
  }

  footer a {
    color: #58a6ff;
  }

  .post-header:hover {
    background-color: var(--background-dark);
  }
}

/* Mobile adjustments for blog posts */
@media (max-width: 480px) {
  .post-header h3 {
    flex-direction: column;
    align-items: stretch;
  }
  
  .post-title-content {
    margin-bottom: 0.25rem;
  }
  
  .post-date {
    margin-left: 0;
    text-align: right;
    font-size: 0.8rem;
  }
}