/* ============================================
   F. Perry Wilson — Personal Site
   Editorial / Magazine-inspired design
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;1,400&family=JetBrains+Mono:wght@400&display=swap');

:root {
  --color-ink: #1a1a1a;
  --color-body: #3a3a3a;
  --color-muted: #6b6b6b;
  --color-faint: #9a9a9a;
  --color-rule: #d4d0ca;
  --color-bg: #faf9f6;
  --color-bg-alt: #f0eeea;
  --color-accent: #b44a2d;
  --color-accent-light: #d4795f;
  --color-white: #ffffff;

  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --max-width: 1100px;
  --nav-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 24px);
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--color-body);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-accent-light); }

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-rule);
  z-index: 1000;
  transition: box-shadow 0.3s;
}

.nav.scrolled {
  box-shadow: 0 1px 12px rgba(0,0,0,0.06);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}

.nav-logo span {
  color: var(--color-accent);
}

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

.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color 0.2s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--color-ink); }
.nav-links a:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-ink);
  margin: 5px 0;
  transition: 0.3s;
}

/* ---- Hero ---- */
.hero {
  padding: calc(var(--nav-height) + 80px) 24px 80px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.hero-text h1 {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-text h1 em {
  font-style: italic;
  color: var(--color-accent);
}

.hero-text .subtitle {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  font-style: italic;
  color: var(--color-muted);
  margin-bottom: 24px;
}

.hero-text .tagline {
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--color-body);
  max-width: 520px;
}

.hero-photo {
  position: relative;
  display: flex;
  justify-content: center;
}

.hero-photo img {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: center;
  border-radius: 4px;
  filter: grayscale(15%);
}


/* ---- Section Layout ---- */
.section {
  padding: 80px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-alt > .section {
  padding-top: 80px;
  padding-bottom: 80px;
}

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

.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.section-rule {
  width: 48px;
  height: 2px;
  background: var(--color-accent);
  margin-top: 16px;
}

.divider {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.divider hr {
  border: none;
  border-top: 1px solid var(--color-rule);
}

/* ---- About Section ---- */
.about-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 64px;
}

.about-text p {
  margin-bottom: 16px;
  font-size: 1.05rem;
}

.credentials {
  border-left: 2px solid var(--color-rule);
  padding-left: 24px;
}

.credential-group {
  margin-bottom: 28px;
}

.credential-group h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 10px;
}

.credential-item {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 6px;
  line-height: 1.5;
}

.credential-item strong {
  color: var(--color-body);
  font-weight: 500;
}

/* ---- Podcast Section ---- */
.podcast-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
}

.podcast-art {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.podcast-description {
  font-size: 1.05rem;
  margin-bottom: 24px;
  line-height: 1.75;
}

.podcast-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-white);
}

.btn-primary:hover {
  background: var(--color-accent-light);
  color: var(--color-white);
}

.btn-outline {
  border: 1.5px solid var(--color-rule);
  color: var(--color-body);
  background: transparent;
}

.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ---- Book Section ---- */
.book-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: start;
}

.book-cover {
  width: 100%;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

.book-text h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-ink);
  line-height: 1.3;
  margin-bottom: 12px;
}

.book-text .publisher {
  font-size: 0.9rem;
  color: var(--color-muted);
  font-style: italic;
  margin-bottom: 16px;
}

.book-text p {
  font-size: 1.05rem;
  margin-bottom: 20px;
}

/* ---- Media Section ---- */
.media-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.media-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--color-rule);
  align-items: baseline;
}

.media-item:first-child {
  padding-top: 0;
}

.media-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-faint);
  letter-spacing: 0.02em;
}

.media-outlet {
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 4px;
  font-size: 1rem;
}

.media-description {
  font-size: 0.95rem;
  color: var(--color-muted);
  line-height: 1.6;
}

/* ---- Lab Section ---- */
.lab-content {
  max-width: 680px;
}

.lab-content p {
  font-size: 1.05rem;
  margin-bottom: 16px;
}

/* ---- Course Section ---- */
.course-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.course-text h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-ink);
  line-height: 1.3;
  margin-bottom: 8px;
}

.course-text .course-platform {
  font-size: 0.9rem;
  color: var(--color-muted);
  font-style: italic;
  margin-bottom: 16px;
}

.course-text p {
  font-size: 1.05rem;
  margin-bottom: 20px;
}

.course-badge {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-rule);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
}

.course-badge .course-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.course-badge h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-ink);
  margin-bottom: 8px;
}

.course-badge p {
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* ---- Medium / Writing Section ---- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.article-card {
  background: var(--color-white);
  border: 1px solid var(--color-rule);
  border-radius: 6px;
  padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.article-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.article-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-ink);
  line-height: 1.35;
  margin-bottom: 8px;
}

.article-card .article-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-faint);
  margin-bottom: 8px;
}

.article-card p {
  font-size: 0.92rem;
  color: var(--color-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.articles-loading {
  text-align: center;
  padding: 40px;
  color: var(--color-faint);
  font-style: italic;
}

/* ---- Footer ---- */
.footer {
  border-top: 1px solid var(--color-rule);
  padding: 48px 24px;
  text-align: center;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 8px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--color-muted);
}

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

.footer-email {
  font-size: 0.85rem;
  color: var(--color-faint);
}

/* ---- Animations ---- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .hero-content {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero-text h1 { font-size: 2.5rem; }

  .hero-photo {
    order: -1;
    text-align: center;
  }

  .hero-photo img { max-width: 280px; margin: 0 auto; }
  .hero-photo::before { display: none; }

  .about-content {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .credentials {
    border-left: none;
    border-top: 1px solid var(--color-rule);
    padding-left: 0;
    padding-top: 24px;
  }

  .podcast-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .podcast-art { max-width: 200px; }

  .book-layout {
    grid-template-columns: 160px 1fr;
    gap: 24px;
  }

  .course-layout {
    grid-template-columns: 1fr;
  }

  .media-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .section-title { font-size: 1.8rem; }
}

@media (max-width: 640px) {
  :root { --nav-height: 56px; }

  .nav-links { display: none; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-rule);
    padding: 16px 24px;
    gap: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  }

  .nav-toggle { display: block; }

  .hero { padding-top: calc(var(--nav-height) + 40px); padding-bottom: 40px; }
  .hero-text h1 { font-size: 2rem; }
  .section { padding: 48px 20px; }

  .book-layout {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .book-cover { max-width: 180px; margin: 0 auto; }

  .articles-grid {
    grid-template-columns: 1fr;
  }
}
