/* ============================================
   Matt Lovett - Personal Site
   Clean, modern, fast
   ============================================ */

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

:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-muted: #6b7280;
  --color-brand: #0072d4;
  --color-accent: var(--color-brand);
  --color-accent-hover: #005ba8;
  --color-border: #e5e7eb;
  --color-border-light: #f3f4f6;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  --max-width: 720px;
  --max-width-wide: 960px;
  --nav-height: 72px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.1);
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  object-position: top;
}

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

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

::selection {
  background: var(--color-accent);
  color: #fff;
}

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 8px 16px;
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.skip-link:focus {
  left: 16px;
}

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

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

.nav__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.nav__logo img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav__links a {
  display: block;
  padding: 8px 16px;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  text-decoration: none;
}

.nav__links a:hover,
.nav__links a[aria-current="page"] {
  color: var(--color-text);
  background: var(--color-border-light);
}

/* Mobile menu toggle */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--color-text);
}

.nav__toggle svg {
  width: 24px;
  height: 24px;
  display: block;
}

@media (max-width: 640px) {
  .nav__toggle {
    display: block;
  }

  .nav__links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: 8px 16px 16px;
    gap: 2px;
    box-shadow: var(--shadow-md);
  }

  .nav__links.is-open {
    display: flex;
  }

  .nav__links a {
    padding: 12px 16px;
    width: 100%;
  }
}

/* --- Main Content --- */
main {
  flex: 1;
}

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

.container--wide {
  max-width: var(--max-width-wide);
}

/* --- Hero Section (Homepage) --- */
.hero {
  padding: 80px 0 60px;
}

.hero__inner {
  display: flex;
  align-items: center;
  gap: 48px;
}

.hero__image {
  flex-shrink: 0;
}

.hero__image img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-lg);
}

.hero__content {
  flex: 1;
}

.hero__greeting {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-accent);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.hero__name {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero__bio {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: 8px;
}

.hero__bio a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  .hero {
    padding: 48px 0 40px;
  }

  .hero__inner {
    flex-direction: column;
    text-align: center;
    gap: 32px;
  }

  .hero__image img {
    width: 160px;
    height: 160px;
  }

  .hero__name {
    font-size: 2rem;
  }
}

/* --- Social Icons --- */
.social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  list-style: none;
}

.social__link {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border-light);
  color: var(--color-text-muted);
  transition: all var(--transition);
  border: 1px solid var(--color-border);
}

.social__link:hover,
.social__link:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.social__link:focus-visible {
  outline: 3px solid rgba(0, 114, 212, 0.4);
  outline-offset: 2px;
}

.social__link svg {
  width: 20px;
  height: 20px;
  display: block;
}

.social__link--linkedin:hover { background: #0a66c2; color: #fff; border-color: #0a66c2; }
.social__link--x:hover { background: #000; color: #fff; border-color: #000; }
.social__link--mastodon:hover { background: #6364ff; color: #fff; border-color: #6364ff; }

@media (max-width: 640px) {
  .social {
    justify-content: center;
  }
}

/* --- Section --- */
.section {
  padding: 60px 0;
}

.section--alt {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

/* --- Page Header --- */
.page-header {
  padding: 60px 0 0;
}

.page-header__title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-header__subtitle {
  margin-top: 12px;
  font-size: 1.125rem;
  color: var(--color-text-muted);
}

/* --- Prose (article body text) --- */
.prose {
  padding: 40px 0 80px;
}

.prose p {
  margin-bottom: 1.25em;
}

.prose h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2em;
  margin-bottom: 0.75em;
}

.prose h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.75em;
  margin-bottom: 0.5em;
}

.prose strong {
  font-weight: 600;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5em 0;
}

.prose ul, .prose ol {
  padding-left: 1.5em;
  margin-bottom: 1.25em;
}

.prose li {
  margin-bottom: 0.35em;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5em;
  font-size: 0.9375rem;
}

.prose th, .prose td {
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--color-border-light);
  font-weight: 600;
}

.prose figcaption {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* --- About Photo Grid --- */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 2em 0;
}

.photo-grid img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

  .photo-grid img {
    height: 220px;
  }
}

/* --- Contact / Tally Form Placeholder --- */
.form-embed {
  margin: 32px 0 0;
  padding: 48px 32px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  text-align: center;
  background: var(--color-surface);
}

.form-embed p {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* --- CTA Link --- */
.cta {
  display: inline-flex;
  align-items: center;
  margin-bottom: 20px;
  text-decoration: none !important;
  gap: 6px;
  margin-top: 20px;
  padding: 12px 24px;
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), transform var(--transition);
}

.cta:hover {
  background: var(--color-accent-hover);
  color: #fff;
  transform: translateY(-1px);
}

.cta svg {
  width: 16px;
  height: 16px;
}

/* --- Footer --- */
.footer {
  margin-top: auto;
  padding: 32px 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.footer__inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer__links {
  display: flex;
  gap: 20px;
  list-style: none;
}

.footer__links a {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.footer__links a:hover {
  color: var(--color-text);
}

.footer__copy {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .footer__inner {
    flex-direction: column;
    text-align: center;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Fade-in animation --- */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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