/* ========================================
   Merritt Wherry — Personal Website
   Color Palette:
     Background:  #0a2e1f (dark phthalo green)
     Accent:      #c9a84c (rich gold)
     Text:        #f0ebe1 (soft off-white)
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a2e1f;
  --bg-light: #0f3d2a;
  --bg-lighter: #134832;
  --gold: #c9a84c;
  --gold-dim: rgba(201, 168, 76, 0.15);
  --gold-hover: #d4b75e;
  --text: #f0ebe1;
  --text-dim: rgba(240, 235, 225, 0.6);
  --text-mid: rgba(240, 235, 225, 0.8);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Source Serif 4', Georgia, serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

::selection {
  background: var(--gold);
  color: var(--bg);
}

/* --- Container --- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 24px;
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

.nav.scrolled {
  background-color: rgba(10, 46, 31, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(201, 168, 76, 0.1);
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.nav-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.nav-logo:hover {
  color: var(--gold-hover);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 32px;
}

.nav-links a {
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(201, 168, 76, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(19, 72, 50, 0.4) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, #071f15 100%);
  z-index: 0;
}

/* Subtle noise texture via SVG */
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 0 24px;
}

.hero-ornament {
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeInDown 1s ease 0.2s forwards;
}

.hero-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeInUp 1s ease 0.4s forwards;
}

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-mid);
  font-weight: 300;
  letter-spacing: 0.04em;
  opacity: 0;
  animation: fadeInUp 1s ease 0.7s forwards;
}

.hero-rule {
  width: 60px;
  height: 2px;
  background: var(--gold);
  margin: 32px auto 0;
  opacity: 0;
  animation: fadeInUp 1s ease 0.9s forwards;
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  opacity: 0;
  animation: fadeInUp 1s ease 1.2s forwards, float 3s ease-in-out 2s infinite;
  z-index: 1;
}

.scroll-hint:hover {
  color: var(--gold);
}

/* --- Sections --- */
.section {
  padding: 120px 0;
  position: relative;
}

.section::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  pointer-events: none;
}

.section-header {
  text-align: center;
  margin-bottom: 64px;
}

.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.section-rule {
  width: 40px;
  height: 2px;
  background: var(--gold);
  margin: 20px auto 0;
}

/* --- About --- */
.about {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-light) 50%, var(--bg) 100%);
}

.about-content {
  max-width: 700px;
  margin: 0 auto;
}

.about-content p {
  margin-bottom: 24px;
  color: var(--text-mid);
  font-size: 1.05rem;
}

.about-content p:last-child {
  margin-bottom: 0;
}

/* --- Experience / Timeline --- */
.experience {
  background: var(--bg);
}

.timeline {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--gold), rgba(201, 168, 76, 0.15));
}

.timeline-item {
  position: relative;
  margin-bottom: 48px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -40px;
  top: 6px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: var(--bg);
  z-index: 1;
}

.timeline-item:first-child .timeline-marker {
  background: var(--gold);
}

.timeline-date {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.timeline-role {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.timeline-org {
  font-size: 0.95rem;
  color: var(--text-mid);
  margin-bottom: 8px;
}

.timeline-desc {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* --- Interest Cards --- */
.interests {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-light) 50%, var(--bg) 100%);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 700px;
  margin: 0 auto;
}

.card {
  background: var(--bg-lighter);
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-radius: 12px;
  padding: 32px 28px;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(201, 168, 76, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.card:hover::before {
  opacity: 1;
}

.card-icon {
  width: 44px;
  height: 44px;
  color: var(--gold);
  margin-bottom: 20px;
}

.card-icon svg {
  width: 100%;
  height: 100%;
}

.card-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.card-text {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 16px;
}

.card-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-dim);
  padding: 4px 12px;
  border-radius: 20px;
}

/* --- Footer --- */
.footer {
  padding: 100px 0 48px;
  background: var(--bg);
  text-align: center;
  border-top: 1px solid rgba(201, 168, 76, 0.08);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.2);
  color: var(--text-dim);
  transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
}

.social-link svg {
  width: 20px;
  height: 20px;
}

.social-link:hover {
  color: var(--gold);
  border-color: var(--gold);
  background-color: var(--gold-dim);
  transform: translateY(-2px);
}

.footer-email {
  margin-bottom: 48px;
}

.footer-email a {
  font-size: 1.05rem;
  color: var(--text-mid);
  border-bottom: 1px solid rgba(201, 168, 76, 0.3);
  padding-bottom: 2px;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.footer-email a:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* Scroll-triggered fade-in */
.fade-in {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.cards-grid .card.fade-in:nth-child(2) { transition-delay: 0.1s; }
.cards-grid .card.fade-in:nth-child(3) { transition-delay: 0.2s; }
.cards-grid .card.fade-in:nth-child(4) { transition-delay: 0.3s; }

.timeline .timeline-item.fade-in:nth-child(2) { transition-delay: 0.1s; }
.timeline .timeline-item.fade-in:nth-child(3) { transition-delay: 0.2s; }
.timeline .timeline-item.fade-in:nth-child(4) { transition-delay: 0.3s; }
.timeline .timeline-item.fade-in:nth-child(5) { transition-delay: 0.4s; }

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(10, 46, 31, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 24px;
    gap: 0;
    border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(240, 235, 225, 0.05);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-toggle {
    display: flex;
  }

  .section {
    padding: 80px 0;
  }

  .section-header {
    margin-bottom: 48px;
  }

  .hero-name {
    font-size: clamp(2.4rem, 10vw, 3.5rem);
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card {
    padding: 24px 20px;
  }

  .timeline {
    padding-left: 32px;
  }

  .timeline::before {
    left: 5px;
  }

  .timeline-marker {
    left: -32px;
    width: 12px;
    height: 12px;
  }

  .timeline-item {
    margin-bottom: 36px;
  }

  .footer-links {
    gap: 16px;
  }

  .social-link {
    width: 44px;
    height: 44px;
  }

  .scroll-hint {
    bottom: 24px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .hero-tagline {
    font-size: 0.95rem;
  }

  .timeline-role {
    font-size: 1.1rem;
  }
}
