/* Minimalist, framework-free stylesheet. Dark theme, one accent color,
   system fonts, generous whitespace, mobile-first. */

:root {
  --text: #e9e7e2;
  --muted: #9a978f;
  --bg: #15171a;
  --accent: #5fbf8f;
  --border: #2a2d31;
  --max-width: 48rem;
  --font-heading: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  font-size: 1.05rem;
}

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

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

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* Header / nav */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
}

.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-nav a { color: var(--muted); font-size: 0.95rem; }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* Skip-to-content link — hidden until keyboard-focused */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--accent);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: 4px;
  z-index: 10;
  font-size: 0.9rem;
  font-weight: 600;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Footer */
.site-footer {
  max-width: var(--max-width);
  margin: 3rem auto 0;
  padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }

/* Headings */
h1, h2, h3 { line-height: 1.25; font-family: var(--font-heading); font-weight: 600; }
h1 { font-size: 1.9rem; margin-top: 0; }
h2 {
  font-size: 1.4rem;
  position: relative;
  padding-left: 0.9rem;
}
h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  bottom: 0.2em;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.site-title { font-family: var(--font-heading); }

/* Cards used by Projects and Photos */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.6);
}

.card img { border-radius: 4px; margin-bottom: 0.6rem; }
.card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; font-family: var(--font-heading); }
.card .meta { color: var(--muted); font-size: 0.85rem; }

/* Small uppercase label at the top of a card (chess/observations/video/etc)
   -- keeps every "what kind of card is this" label the same size/weight so
   the widgets read as one family instead of each having grown its own
   slightly different heading style over time. */
.card-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.6rem;
}
.card-kicker[href] { text-decoration: none; }
.card-kicker[href]:hover { text-decoration: underline; }

/* Photo gallery grid (no card border, just the image) */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}
.photo-grid li { margin: 0; border-radius: 4px; overflow: hidden; }
.year-heading { margin: 1.75rem 0 0.5rem; color: var(--muted); font-size: 1.05rem; }
.year-heading:first-of-type { margin-top: 0.5rem; }
.photo-grid img {
  border-radius: 4px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 0.18s ease;
}
.photo-grid li a:hover img { transform: scale(1.06); }
.photo-grid li a { display: block; }

/* Blog list */
.post-list { list-style: none; padding: 0; }
.post-list li { margin-bottom: 1.25rem; }
.post-list .date { color: var(--muted); font-size: 0.85rem; margin-right: 0.5rem; }

/* Resume */
.resume-section { margin-bottom: 1.75rem; }
.resume-item { margin-bottom: 0.9rem; }
.resume-item .meta { color: var(--muted); font-size: 0.9rem; }
.skill-list { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; padding: 0; list-style: none; }
.skill-list li {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.85rem;
}

/* Tags (posts and projects) */
.tag-list { display: inline-flex; flex-wrap: wrap; gap: 0.3rem 0.45rem; margin: 0.3rem 0 0; padding: 0; vertical-align: middle; }
.tag {
  color: var(--muted);
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
}

/* Blog excerpt */
.post-list .excerpt { color: var(--muted); font-size: 0.92rem; margin: 0.3rem 0 0; }

/* Resume experience bullet highlights */
.resume-item ul.highlights { margin: 0.35rem 0 0; padding-left: 1.2rem; }
.resume-item ul.highlights li { margin-bottom: 0.2rem; }

/* iNaturalist "recent observations" widget (homepage) — dark-theme override
   of iNaturalist's own widget CSS. Layout mechanics (padding-left on the
   body cell, td spacing, image sizing) kept as iNaturalist's script expects;
   only font/colors are swapped to match the site theme. */
.observations-widget {
  overflow-x: auto;
}
.inat-widget {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 0;
  line-height: 1.4;
  color: var(--text);
}
.inat-widget-header { margin-bottom: 0.6rem; }
.inat-widget td { vertical-align: top; padding-bottom: 0.75rem; }
.inat-label { color: var(--muted); }
.inat-meta { font-size: 0.8rem; margin-top: 0.2rem; line-height: 1.3; color: var(--muted); }
.inat-observation-body, .inat-user-body { padding-left: 0.6rem; }
.inat-observation-image, .inat-user-image { width: 48px; display: inline-block; }
.inat-observation-image img, .inat-user-image img { border-radius: 4px; }
.inat-widget a { color: var(--accent); text-decoration: none; }
.inat-widget a:hover { text-decoration: underline; }

/* Video card (homepage "Latest video") — a single card that's one big
   link: thumbnail image (pulled straight from i.ytimg.com, no YouTube
   embed/script and so no cookies set) + title + date, opens the real
   video on YouTube in a new tab. */
.video-card {
  display: flex;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
}
.video-card img,
.video-card h3,
.video-card > .meta {
  flex-shrink: 0;
}
.video-card:hover {
  text-decoration: none;
  border-color: var(--accent);
}
.video-card img {
  border-radius: 4px;
  margin-bottom: 0.6rem;
}
.video-card h3 { color: var(--text); margin-bottom: 0.2rem; }
.video-card .meta { margin: 0; }

.chess-review-link { display: inline-block; font-size: 0.85rem; margin-top: 0.2rem; }

/* iNaturalist life-list widget (About page) */
.inat-life-count { font-size: 1.05rem; margin: 0 0 0.4rem; }
.inat-life-count strong { color: var(--accent); }

/* Changelog section (About page) reuses .post-list for the month rows;
   each month then lists its highlights as a plain bullet list. */
.changelog-items { margin: 0.35rem 0 0; padding-left: 1.2rem; }
.changelog-items li { margin-bottom: 0.2rem; }

/* Recent Highlights widget row (video / observations) — stacked on
   mobile, 2 columns on wider screens so cards don't sit alone with a lot of
   empty space beside them. */
.highlights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
  align-items: start;
}
@media (min-width: 640px) {
  .highlights-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.highlight-item {
  display: flex;
  flex-direction: column;
}

/* Homepage recent-photos strip: show 8 on wider screens, keep it to the
   first 6 on narrow ones so it doesn't get too tall on mobile. */
@media (max-width: 639px) {
  .highlight-photos li:nth-child(n + 7) {
    display: none;
  }
}

.video-description {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0.5rem 0 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}


/* Homepage hero -- profile photo (optional, shown only once
   assets/profile.jpg exists) next to the page heading. */
.hero {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 0.5rem;
}
.hero h1 { margin: 0; }
.hero-photo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.about-photo {
  width: 8rem;
  height: 8rem;
}

/* Inline icons used next to link text (footer, Links page) */
.icon {
  display: inline-block;
  vertical-align: -3px;
  flex-shrink: 0;
}
.footer-links a,
.link-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.link-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Simple Instagram "follow me" teaser card (no live feed -- avoids a
   Strava-style OAuth setup just to show a widget) */
.instagram-card p { margin: 0 0 0.6rem; }
.instagram-card .chess-review-link { margin-top: 0; }

/* Back-to-top floating button */
.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  z-index: 20;
}
.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover { border-color: var(--accent); color: var(--accent); }

/* Photo lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 2rem;
}
.lightbox-overlay.is-open { display: flex; }
.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 4px;
  display: block;
}
.lightbox-caption {
  margin-top: 0.75rem;
  text-align: center;
  color: var(--text);
  font-size: 0.95rem;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.5rem;
}
.lightbox-close { top: 1rem; right: 1.25rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { color: var(--accent); }
body.lightbox-locked { overflow: hidden; }
