/*
 * Personal site with warm, layered color palette
 * Three accent colors: rose, sage, gold
 * Subtle grain texture and refined typography
 */

:root {
  /* Base */
  --bg: #fdfcfa;
  --bg-alt: #f7f5f2;
  --fg: #1a1a1a;
  --muted: #6b6860;

  /* Three-color accent system */
  --rose: #c45d5d;
  --rose-soft: #f5e8e8;
  --rose-muted: #d4a5a5;

  --sage: #5d8a6b;
  --sage-soft: #e8f0ea;
  --sage-muted: #a5c4ad;

  --gold: #b8860b;
  --gold-soft: #f5f0e0;
  --gold-muted: #d4c4a0;

  /* Utilities */
  --border: #e8e5e0;
  --border-dark: #d0cdc8;
  --max-width: 900px;
  --radius: 12px;
  --radius-sm: 6px;
}

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

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Subtle grain texture overlay */
.grain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.03;
  z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
}

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

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Navigation */
nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: fadeIn 0.5s ease-out;
}

.nav-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

.nav-name:hover {
  color: var(--rose);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--rose), var(--gold));
  border-radius: 1px;
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Main */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

/* Hero */
.hero {
  padding: 4rem 0 5rem;
  animation: fadeInUp 0.7s ease-out;
}

.hero-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.hero-text {
  flex: 1;
}

.hero-photo {
  flex: 0 0 auto;
  width: 160px;
  height: 160px;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sage);
  background: var(--sage-soft);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  margin-bottom: 1.2rem;
}

.hero h1 {
  font-family: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.2rem;
  background: linear-gradient(135deg, var(--fg) 0%, #4a4a4a 50%, var(--fg) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .intro {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.currently {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--sage);
  margin-bottom: 1.5rem;
}

.hero-tags {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .hero-content {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
  }

  .hero-tags {
    justify-content: center;
  }

  .hero-photo {
    width: 120px;
    height: 120px;
  }
}

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  text-transform: lowercase;
}

.tag-rose {
  background: var(--rose-soft);
  color: var(--rose);
}

.tag-sage {
  background: var(--sage-soft);
  color: var(--sage);
}

.tag-gold {
  background: var(--gold-soft);
  color: var(--gold);
}

/* Sections */
.section {
  animation: fadeInUp 0.7s ease-out backwards;
}

.research-section {
  position: relative;
  padding: 2.5rem 0;
  animation-delay: 0.1s;
}

.research-section .cards-grid {
  position: relative;
}

/* Decorative section divider: gradient line — dot — gradient line */
.section-divider {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 1rem 0;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
}

.section-divider::before {
  background: linear-gradient(90deg, transparent, var(--rose-muted) 40%, var(--gold-muted));
}

.section-divider::after {
  background: linear-gradient(90deg, var(--gold-muted), var(--sage-muted) 60%, transparent);
}

.divider-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-muted), var(--gold-muted));
  flex-shrink: 0;
  margin: 0 0.75rem;
}

.writing-section {
  padding: 2.5rem 0;
  animation-delay: 0.2s;
}

.section h2 {
  font-family: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--fg);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.section-icon {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.5;
}

.section-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  margin-top: -0.8rem;
}

/* Cards */
.cards,
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .cards,
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  position: relative;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.5rem 1.75rem;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.6);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.8);
}

.card-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  opacity: 0.8;
  transition: opacity 0.25s ease;
}

.card:hover .card-accent {
  opacity: 1;
}

.accent-rose { background: var(--rose); }
.accent-sage { background: var(--sage); }
.accent-gold { background: var(--gold); }

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--fg);
}

.card p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}

.card-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.8rem;
  opacity: 0.6;
}

.card-tag-rose { color: var(--rose); }
.card-tag-sage { color: var(--sage); }
.card-tag-gold { color: var(--gold); }

/* Clickable card link */
a.card-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

a.card-link:hover h3 {
  color: var(--rose);
}

a.card-link::after {
  content: '→';
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

a.card-link:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* Post list */
.post-list {
  display: flex;
  flex-direction: column;
}

.post-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: padding-left 0.2s ease;
}

.post-preview:last-child {
  border-bottom: none;
}

.post-preview:hover {
  padding-left: 0.5rem;
}

.post-preview:hover .post-title {
  color: var(--rose);
}

.post-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg);
  transition: color 0.2s ease;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.post-tag {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.see-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--rose);
  text-decoration: none;
  transition: gap 0.2s ease;
}

.see-all:hover {
  gap: 0.7rem;
}

.see-all .arrow {
  transition: transform 0.2s ease;
}

.see-all:hover .arrow {
  transform: translateX(3px);
}

/* For fun section */
.fun-section {
  padding: 2.5rem 0;
  animation-delay: 0.3s;
}

.fun-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .fun-grid {
    grid-template-columns: 1fr;
  }
}

.fun-item {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fun-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.fun-image-placeholder {
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, var(--border) 0%, var(--bg-alt) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

.fun-item:hover .fun-image-placeholder {
  background: linear-gradient(135deg, var(--rose-soft) 0%, var(--gold-soft) 100%);
}

.fun-image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
}

.fun-item-image-only {
  position: relative;
}

.fun-image-full {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: cover;
  display: block;
}

.fun-label {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
}

/* Replace placeholder with actual image:
.fun-image-placeholder {
  background: url('your-image.jpg') center/cover;
  border-bottom: none;
}
.fun-image-placeholder span { display: none; }
*/

.fun-text {
  padding: 1rem 1.25rem 1.25rem;
}

.fun-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--fg);
}

.fun-text p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Footer */
footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  animation: fadeIn 0.6s ease-out 0.5s backwards;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-tagline {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 2.5rem;
}

.footer-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.footer-link:hover {
  transform: translateY(-2px);
}

.footer-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.7;
}

.footer-link span:last-child {
  font-size: 0.9rem;
  color: var(--fg);
  font-weight: 500;
}

.footer-link:hover span:last-child {
  color: var(--rose);
}

/* ========================================
   Blog page styles
   ======================================== */

.page-header {
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 0.7s ease-out;
}

.page-header h1 {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.blog-list {
  padding: 1rem 0 2rem;
}

.blog-post-item {
  display: block;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: padding-left 0.2s ease;
  animation: fadeInUp 0.5s ease-out backwards;
}

.blog-post-item:nth-child(1) { animation-delay: 0.1s; }
.blog-post-item:nth-child(2) { animation-delay: 0.15s; }
.blog-post-item:nth-child(3) { animation-delay: 0.2s; }
.blog-post-item:nth-child(4) { animation-delay: 0.25s; }
.blog-post-item:nth-child(5) { animation-delay: 0.3s; }

.blog-post-item:last-child {
  border-bottom: none;
}

.blog-post-item:hover {
  padding-left: 0.75rem;
}

.blog-post-item:hover h3 {
  color: var(--rose);
}

.blog-post-item h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.4rem;
  transition: color 0.2s ease;
}

.blog-post-item .excerpt {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.blog-post-item .meta {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--sage);
}

/* ========================================
   Article styles
   ======================================== */

article {
  padding: 4rem 0;
  max-width: 680px;
  margin: 0 auto;
  animation: fadeInUp 0.7s ease-out;
}

article header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

article h1 {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  line-height: 1.25;
  color: var(--fg);
}

article .meta {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--sage);
}

article .content {
  font-size: 1.05rem;
  line-height: 1.75;
}

article .content p {
  margin-bottom: 1.5rem;
}

article .content h2 {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin: 3rem 0 1.25rem;
  color: var(--fg);
  position: relative;
  padding-left: 1rem;
}

article .content h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 4px;
  height: 1em;
  background: linear-gradient(180deg, var(--rose), var(--gold));
  border-radius: 2px;
}

article .content ul,
article .content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

article .content li {
  margin-bottom: 0.5rem;
}

article .content li::marker {
  color: var(--rose);
}

article .content blockquote {
  border-left: 3px solid var(--sage);
  background: var(--sage-soft);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--fg);
}

article .content blockquote p {
  margin-bottom: 0;
}

article .content code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--rose-soft);
  padding: 0.2em 0.45em;
  border-radius: 4px;
  color: var(--rose);
}

article .content pre {
  background: #2d2d2d;
  color: #f8f8f2;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.5rem 0;
}

article .content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.9rem;
}

article .content strong {
  font-weight: 600;
  color: var(--fg);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

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

/* ========================================
   Global utilities
   ======================================== */

/* Links */
a {
  color: inherit;
  text-decoration-color: var(--border-dark);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  color: var(--rose);
  text-decoration-color: var(--rose-muted);
}

/* Selection */
::selection {
  background: var(--rose-soft);
  color: var(--fg);
}

/* Focus */
a:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Responsive */
@media (max-width: 600px) {
  html {
    font-size: 15px;
  }

  nav {
    padding: 1.25rem 1.25rem;
  }

  main {
    padding: 0 1.25rem 3rem;
  }

  .hero {
    padding: 2.5rem 0 3rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .two-col {
    padding: 1.5rem 0;
  }

  .footer-content {
    padding: 2rem 1.25rem;
    flex-direction: column;
    align-items: flex-start;
  }

  article {
    padding: 2rem 0;
  }

  article h1 {
    font-size: 1.7rem;
  }
}

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

  html {
    scroll-behavior: auto;
  }
}
