/* Keen Design System CSS - Optimized
 * Clean, minimal, functional, timeless with minimal, eye-catching accents
 */

/* ==========================================================================
   CSS VARIABLES - KEEN DESIGN COLOR PALETTE
   ========================================================================== */

:root {
  /* Base Colors */
  --background: #FEFEFE;
  --text-primary: #1A1A1A;
  --accent: #2563EB;
  
  /* Supporting Grays */
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  
  /* Accent Colors */
  --dot-accent: #6B7280;
  --success: #10B981;
  --warning: #EF4444;
}

/* ==========================================================================
   RESET AND BASE STYLES
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-primary);  /* This should work now */
  background-color: var(--background);  /* This should work now */
  max-width: 95ch;
  margin: 0 auto;
  padding: 40px 15px;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

.display {
  font-family: Georgia, serif;
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 1rem;
  font-weight: 400;
}

h1 {
  font-family: Georgia, serif;
  font-size: 2rem;
  line-height: 1.3;
  margin-bottom: 1.5rem;
  font-weight: 400;
}

h2 {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  line-height: 1.4;
  margin-bottom: 1.5rem;
  margin-top: 2rem;
  font-weight: 400;
}

h3 {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.4;
  margin-bottom: 1.5rem;
  margin-top: 1.5rem;
  font-weight: 400;
}

p {
  margin-bottom: 1.5rem;
}

small {
  font-size: 0.875rem;
  line-height: 1.5;
}

label, 
.label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.75rem;
  line-height: 1.4;
}

/* ==========================================================================
   LINKS
   ========================================================================== */

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

nav {
  margin-bottom: 3rem;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
}

nav a {
  margin: 0 1rem;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.nav-separator {
  color: var(--dot-accent);
  margin: 0 0.5rem;
  user-select: none;
}

/* ==========================================================================
   CODE STYLING
   ========================================================================== */

code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
  background-color: var(--gray-100);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--text-primary);
  border: 1px solid var(--gray-200);
}

pre {
  font-family: "Courier New", Courier, monospace;
  background-color: var(--gray-900);
  color: var(--gray-100);
  padding: 20px;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
  font-size: 0.875rem;
  margin: 24px 0;
}

pre code {
  background: none;
  padding: 0;
  border: none;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
}

/* ==========================================================================
   TABLES
   ========================================================================== */

table {
  border-collapse: collapse;
  width: 100%;
  font-family: "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.6;
  margin: 24px 0;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border: 1px solid var(--gray-200);
}

th {
  background-color: var(--gray-50);
  font-weight: 600;
  color: var(--text-primary);
}

tr:hover {
  background-color: var(--gray-50);
}

/* ==========================================================================
   CALLOUTS
   ========================================================================== */

.callout {
  padding: 16px 20px;
  margin: 24px 0;
  border-left: 4px solid;
  border-radius: 0 4px 4px 0;
  font-family: "Times New Roman", serif;
  font-size: 0.9em;
  line-height: 1.6;
}

.callout-icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 1.1em;
}

.callout-info {
  background-color: var(--gray-50);
  border-left-color: var(--accent);
  color: var(--text-primary);
}

.callout-warning {
  background-color: var(--gray-50);
  border-left-color: var(--warning);
  color: var(--text-primary);
}

.callout-success {
  background-color: var(--gray-50);
  border-left-color: var(--success);
  color: var(--text-primary);
}

.callout-quote {
  background-color: var(--gray-50);
  border-left-color: var(--gray-300);
  color: var(--text-primary);
  font-style: italic;
}

.callout-quote p {
  margin: 0;
}

/* ==========================================================================
   LISTS
   ========================================================================== */

ul, ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
}

ul ul, 
ol ol, 
ul ol, 
ol ul {
  margin-bottom: 0;
  margin-top: 0.5rem;
}

/* ==========================================================================
   LAYOUT COMPONENTS
   ========================================================================== */

.header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}

h2:not(.display):not(.header h1), 
h3:not(.display):not(.header h1), 
h4:not(.display):not(.header h1),
h5:not(.display):not(.header h1),
h6:not(.display):not(.header h1) {
  position: relative;
  cursor: pointer;
}

h2:not(.display):not(.header h1):hover::before,
h3:not(.display):not(.header h1):hover::before,
h4:not(.display):not(.header h1):hover::before,
h5:not(.display):not(.header h1):hover::before,
h6:not(.display):not(.header h1):hover::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

h2:not(.display):not(.header h1):hover,
h3:not(.display):not(.header h1):hover,
h4:not(.display):not(.header h1):hover,
h5:not(.display):not(.header h1):hover,
h6:not(.display):not(.header h1):hover {
  color: var(--accent);
  transition: color 0.2s ease;
}

.subtitle {
  color: var(--gray-500);
  font-size: 1.1rem;
  margin-top: 0.25rem;
}

.post-meta {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

.section-divider {
  text-align: center;
  margin: 3rem 0;
  color: var(--dot-accent);
  font-size: 1.2rem;
  user-select: none;
}

article {
  margin-bottom: 3rem;
}

article h3 {
  margin-top: 2rem;
}

footer {
  text-align: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-200);
  color: var(--gray-500);
  font-size: 0.875rem;
}

.contact-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    fill: currentColor;
    transition: fill 0.2s ease;
}

.contact-item a {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.contact-item a:hover .contact-icon {
    fill: var(--accent);
}

/* ==========================================================================
   ANIMATIONS & INTERACTIONS
   ========================================================================== */

.fade-element {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.6s ease;
}

.js-loaded .fade-element {
    opacity: 0;
    transform: translateY(20px);
}

.js-loaded .fade-element.visible {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(30px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* ==========================================================================
   THEME TOGGLE & PROGRESS BAR
   ========================================================================== */

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orbital-container {
    width: 36px;
    height: 36px;
    position: relative;
    transform: rotate(-25deg);
}

.orbit-dot {
    position: absolute;
    border-radius: 50%;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.orbit-dot.large {
    width: 16px;
    height: 16px;
    top: 9px;
    left: 4px;
    background: var(--text-primary);
}

.orbit-dot.small {
    width: 8px;
    height: 8px;
    top: 4px;
    right: 4px;
    background: var(--text-primary);
}

.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--accent);
    z-index: 1000;
    transition: width 0.1s ease;
}

/* ==========================================================================
   DARK MODE
   ========================================================================== */

:root.dark-mode {
    --background: #0F0F0F;
    --text-primary: #E5E5E5;
    --gray-50: #1A1A1A;
    --gray-100: #262626;
    --gray-200: #404040;
    --gray-300: #525252;
    --gray-500: #A3A3A3;
    --gray-700: #D4D4D4;
    --gray-900: #F5F5F5;
    --accent: #60A5FA;
}

.dark-mode .orbit-dot.large {
    transform: translate(18px, -9px) scale(0.5);
}

.dark-mode .orbit-dot.small {
    transform: translate(-18px, 9px) scale(2);
}

/* ==========================================================================
   PROFILE & PROJECT COMPONENTS
   ========================================================================== */

.profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    background-color: var(--gray-200);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); 
    flex-shrink: 0;
    overflow: hidden;
    margin-top: 0;
    align-self: flex-start;
    float: left;
    margin-right: 2rem;
    margin-bottom: 1rem;
}

.profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    transition: opacity 0.3s ease;
}

.profile-caption {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: center;
    margin-top: 0rem;
    font-style: italic;
    width: 200px;
    float: left;
    clear: left;
    margin-right: 2rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.project-card {
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
    border-radius: 8px;
    background: var(--gray-50);
}

.project-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.project-description {
    color: var(--gray-700);
    margin-bottom: 1rem;
}

.project-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.project-links a {
    font-size: 0.875rem;
    color: var(--accent);
}

.contact-item {
    max-width: 400px;
    margin: 0 auto;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: var(--gray-50);
}

.contact-item h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.contact-item ul {
    list-style: none;
    padding-left: 0;
    display: inline-block;
}

.contact-item li {
    margin-bottom: 0.5rem;
}

.footer-badge {
    display: inline-block;
    margin-top: 1rem;
    width: 131px;
    height: 42px;
}

.footer-badge img {
    width: 100%;
    height: 100%;
    display: block;
}

/* Image loading placeholders */
.profile-photo,
.life-image {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.profile-photo img,
.life-image img {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.profile-photo img.loaded,
.life-image img.loaded {
  opacity: 1;
}

.life-image.loaded,
.profile-photo.loaded {
    background: none;
    animation: none;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ==========================================================================
   LIFE PAGE COMPONENTS
   ========================================================================== */

.life-section {
    margin-bottom: 3rem;
}

.life-section .life-image {
    float: left;
    margin-right: 2rem;
    margin-bottom: 1rem;
    width: 300px;
}

.life-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.life-section .life-content::after {
    content: "";
    display: table;
    clear: both;
}

.caption {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
    line-height: 1.4;
}

.life-image .caption {
    width: 300px;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
  body {
    padding: 20px 10px;
  }
  
  .display {
    font-size: 1.75rem;
  }
  
  .header {
    margin-bottom: 2rem;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.375rem;
  }
  
  h3 {
    font-size: 1.125rem;
  }
  
  nav {
    margin-bottom: 2rem;
  }
  
  nav a {
    margin: 0 0.5rem;
    font-size: 0.8rem;
  }
  
  .nav-separator {
    margin: 0 0.25rem;
  }
  
  pre {
    margin: 16px -16px;
    border-radius: 0;
    padding: 16px;
    font-size: 0.8rem;
  }
  
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    margin: 16px -16px;
    border-radius: 0;
    font-size: 0.875rem;
  }
  
  .callout {
    margin: 16px -16px;
    border-radius: 0;
    border-left-width: 3px;
  }
  
  .theme-toggle {
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
  }
  
  .profile-photo {
    margin: 0 auto;
  }
  
  .footer-badge {
    width: 110px;
    height: 35px;
  }
  
  .life-section .life-image {
    float: none;
    width: 100%;
    margin-right: 0;
    margin-bottom: 1rem;
  }
  
  .life-image .caption {
    width: 100%;
  }
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--gray-500); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--gray-300); }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.font-normal { font-weight: 400; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-4 { margin-bottom: 2rem; }

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

/* ==========================================================================
   DARK MODE ENHANCED STYLES
   ========================================================================== */

body.dark-mode .profile-photo,
body.dark-mode .project-card,
body.dark-mode .contact-item,
body.dark-mode .life-image img {
    box-shadow: 0 2px 8px rgba(100, 100, 100, 0.1);
}

/* Habit Tracker Styles */
.habit-grid-container {
    background-color: var(--gray-50);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    overflow-x: auto; /* Add horizontal scroll */
}

.habit-grid {
    display: flex;
    gap: 4px;
    margin-bottom: 1rem;
    min-width: max-content; /* Remove the margin-top: 8px */
}

.habit-grid-wrapper {
    min-width: max-content; /* Prevent compression */
    width: 100%;
}

.habit-week {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.habit-day {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.habit-day:hover {
    transform: scale(1.2);
}

.habit-empty { background: transparent; cursor: default; }
.habit-pre-tracking { background: var(--gray-300); }
.habit-miss { background: var(--gray-400); }
.habit-early { background: #3B82F6; }
.habit-midday { background: #2563EB; }
.habit-evening { background: #1D4ED8; }

.habit-tooltip {
    position: absolute;
    background: var(--gray-700);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    display: none;
    z-index: 1000;
    pointer-events: none;
}

/* Month labels */
.habit-months {
    position: relative;
    height: 16px;
    margin-bottom: 16px; /* Increase from 8px to 16px */
    min-width: max-content;
}

.habit-month-label {
    position: absolute;
    font-size: 0.75rem;
    color: var(--gray-500);
    font-family: Georgia, serif;
}