/* ==========================================================================
   Jeff Harris Personal Website - Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Theming)
   -------------------------------------------------------------------------- */
:root {
  /* Colors - Light Mode */
  --bg-primary: #FAF8F5;
  --bg-secondary: #F3F0EB;
  --bg-tertiary: #EBE7E0;
  --text-primary: #2D2A26;
  --text-secondary: #6B6560;
  --accent: #C9973B;
  --accent-hover: #A67B2C;
  --accent-subtle: rgba(201, 151, 59, 0.1);
  --border: #E5E0D8;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Typography */
  --font-heading: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Misc */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(201, 151, 59, 0.15);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-primary: #1A1918;
  --bg-secondary: #242220;
  --bg-tertiary: #2E2C28;
  --text-primary: #E8E4DF;
  --text-secondary: #9A9590;
  --accent: #D4A853;
  --accent-hover: #E5BC6A;
  --accent-subtle: rgba(212, 168, 83, 0.1);
  --border: #3A3634;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(212, 168, 83, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #1A1918;
    --bg-secondary: #242220;
    --bg-tertiary: #2E2C28;
    --text-primary: #E8E4DF;
    --text-secondary: #9A9590;
    --accent: #D4A853;
    --accent-hover: #E5BC6A;
    --accent-subtle: rgba(212, 168, 83, 0.1);
    --border: #3A3634;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(212, 168, 83, 0.2);
  }
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color var(--transition-base), color var(--transition-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 var(--space-md) 0;
}

h1 {
  font-size: var(--text-4xl);
  font-weight: 400;
}

/* Fix Fraunces ligature issue - disable ligatures on the title */
.site-title {
  font-feature-settings: "liga" 0, "clig" 0;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

p {
  margin: 0 0 var(--space-md) 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.text-secondary {
  color: var(--text-secondary);
}

.text-sm {
  font-size: var(--text-sm);
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-lg);
}

.site-header {
  padding: var(--space-2xl) 0 var(--space-xl);
  text-align: center;
}

.site-footer {
  padding: var(--space-2xl) 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

section {
  margin-bottom: var(--space-3xl);
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

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

.animate-fade-in {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-delayed {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.15s forwards;
}

.animate-fade-in-delayed-2 {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.3s forwards;
}

/* --------------------------------------------------------------------------
   Hero / Intro
   -------------------------------------------------------------------------- */
.hero {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.profile-photo-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: var(--space-lg);
}

.profile-photo-wrapper::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius-lg) + 4px);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
}

.profile-photo-wrapper:hover::before {
  opacity: 0.3;
}

.profile-photo {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.profile-photo-wrapper:hover .profile-photo {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.hero h1 {
  margin-bottom: var(--space-sm);
}

.tagline {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: var(--space-xl);
}

.bio {
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Theme Toggle
   -------------------------------------------------------------------------- */
.theme-toggle {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--text-lg);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  z-index: 100;
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle__icon {
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Social Grid
   -------------------------------------------------------------------------- */
.social-section h2 {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.social-grid--secondary {
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-sm);
}

.social-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  text-decoration: none;
  color: var(--text-primary);
  overflow: visible;
}

.social-link:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.social-link:active {
  transform: translateY(-2px);
}

.social-link__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-sm);
  transition: transform var(--transition-base);
}

.social-link:hover .social-link__icon {
  transform: scale(1.1);
}

.social-link__icon img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
}

.social-link__icon .x-icon {
  width: 48px;
  height: 48px;
  color: var(--text-primary);
}

.social-link span {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.social-link:hover span {
  color: var(--text-primary);
}

/* Secondary social links - smaller */
.social-grid--secondary .social-link {
  padding: var(--space-sm);
}

.social-grid--secondary .social-link__icon img {
  width: 32px;
  height: 32px;
  margin-bottom: var(--space-xs);
}

.social-grid--secondary .social-link span {
  font-size: var(--text-xs);
}

/* --------------------------------------------------------------------------
   Social Preview Cards
   -------------------------------------------------------------------------- */
.preview-card {
  position: absolute;
  bottom: calc(100% + var(--space-md));
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  width: 280px;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  text-align: left;
  pointer-events: none;
}

.preview-card--wide {
  width: 320px;
}

.social-link:hover .preview-card,
.social-link:focus .preview-card,
.preview-card.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

.preview-card::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: var(--bg-secondary);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
}

.preview-card__title {
  font-weight: 600;
  margin-bottom: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.preview-card__content {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.preview-card__content + .preview-card__content {
  margin-top: var(--space-sm);
}

.preview-card__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
}

.loading-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: var(--radius-full);
  animation: pulse 1s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.3s;
}

/* Book list in preview */
.preview-card__books {
  list-style: none;
  padding: 0;
  margin: 0;
}

.preview-card__book {
  padding: var(--space-xs) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.preview-card__book:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.preview-card__book-title {
  font-weight: 500;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Garden Section
   -------------------------------------------------------------------------- */
.garden-section h2 {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.garden-teaser {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.garden-teaser:hover {
  box-shadow: var(--shadow-md);
}

.garden-teaser__post {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.garden-teaser__post:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.garden-teaser__status {
  font-size: var(--text-sm);
  margin-right: var(--space-sm);
}

.garden-teaser__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  margin-bottom: var(--space-xs);
}

.garden-teaser__excerpt {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0;
}

.garden-link {
  display: inline-block;
  margin-top: var(--space-lg);
  font-size: var(--text-sm);
}

/* --------------------------------------------------------------------------
   Now Page Styles
   -------------------------------------------------------------------------- */
.now-section {
  max-width: 600px;
  margin: 0 auto;
}

.now-section h2 {
  margin-bottom: var(--space-sm);
}

.now-updated {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-xl);
}

.now-section ul {
  padding-left: var(--space-lg);
  margin: var(--space-md) 0;
}

.now-section li {
  margin-bottom: var(--space-sm);
}

/* --------------------------------------------------------------------------
   Posts / Garden Page
   -------------------------------------------------------------------------- */
.posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.posts-list__item {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border);
}

.posts-list__item:first-child {
  padding-top: 0;
}

.posts-list__link {
  display: block;
  color: var(--text-primary);
}

.posts-list__link:hover .posts-list__title {
  color: var(--accent);
}

.posts-list__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.posts-list__title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  margin-bottom: var(--space-xs);
  transition: color var(--transition-fast);
}

.posts-list__excerpt {
  color: var(--text-secondary);
  margin: 0;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
}

/* --------------------------------------------------------------------------
   Back Link
   -------------------------------------------------------------------------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-xl);
  transition: all var(--transition-fast);
}

.back-link:hover {
  color: var(--accent);
  transform: translateX(-4px);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .container {
    padding: var(--space-md);
  }

  h1 {
    font-size: var(--text-3xl);
  }

  .social-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .social-grid--secondary {
    grid-template-columns: repeat(3, 1fr);
  }

  .preview-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: translateY(100%);
    width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-xl);
    max-height: 50vh;
    overflow-y: auto;
  }

  .preview-card--wide {
    width: 100%;
  }

  .social-link:hover .preview-card,
  .social-link:focus .preview-card,
  .preview-card.is-visible {
    transform: translateY(0);
  }

  .preview-card::after {
    display: none;
  }

  .theme-toggle {
    top: var(--space-sm);
    right: var(--space-sm);
    width: 40px;
    height: 40px;
  }
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.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;
}

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