.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: calc(var(--pico-block-spacing-vertical) / 3);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

main.container {
  padding-top: calc(var(--pico-block-spacing-vertical) / 3);
}

/* ── Subtle link styling ─────────────────────────────────────── */
:where(a:not([role="button"])) {
  text-decoration: none;
}
:where(a:not([role="button"])):hover {
  text-decoration: underline;
}
:where(a:not([role="button"]):visited) {
  color: var(--pico-primary);
}

/* ── Home page layout ────────────────────────────────────────── */
.home-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-areas:
    "bio     bio"
    "nav     nav"
    "middle  sidebar"
    "lower   lower";
  gap: 0 3rem;
}

.home-nav        { grid-area: nav; }
.home-bio        { grid-area: bio; }

.home-middle     { grid-area: middle; }
.home-lower      { grid-area: lower; }

.home-sidebar {
  grid-area: sidebar;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.home-sidebar h2 {
  margin-top: 0;
}

.home-sidebar ul {
  list-style: none;
  padding: 0;
}

.home-sidebar li {
  margin-bottom: 0.25rem;
}

/* Sidebar captions for video and still thumbnails */
.sidebar-caption {
  font-size: 0.7rem;
  color: var(--pico-muted-color);
  margin: 0.2rem 0 0;
  line-height: 1.2;
}

.home-sidebar figcaption {
  font-size: 0.7rem;
  color: var(--pico-muted-color);
  margin-top: 0.2rem;
  line-height: 1.2;
}

/* ── Shared hover-overlay behaviour ───────────────────────────── */
.hover-trigger {
  position: relative;
  cursor: pointer;
}

.hover-overlay {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px) scale(0.9);
  /* Close: fast, no delay */
  transition: opacity 0.2s ease 0s, transform 0.2s ease 0s;
}

.hover-trigger:hover .hover-overlay {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  /* Show: 0.2s delay, spring easing */
  transition: opacity 0.35s ease 0.2s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s;
}

/* ── Sidebar overlays ────────────────────────────────────────── */
.home-sidebar .hover-overlay {
  position: absolute;
  right: 0;
  top: 50%;
  width: min(1080px, 90vw);
  z-index: 200;
  background: rgba(0, 0, 0, 0.88);
  padding: 0.5rem;
  border-radius: 4px;
  transform: translateY(-50%) translateY(-12px) scale(0.9);
  transition: opacity 0.2s ease 0s, transform 0.2s ease 0s;
}

.home-sidebar .hover-trigger:hover .hover-overlay {
  transform: translateY(-50%) scale(1);
  transition: opacity 0.35s ease 0.2s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s, width 0.3s ease;
}

.home-sidebar .hover-overlay img {
  width: 100%;
  display: block;
}

/* ── Sidebar overlays: video (25% larger) ────────────────────── */
.home-sidebar .video-thumb-entry .hover-overlay {
  width: min(1050px, 95vw);
}

.home-sidebar .video-thumb-entry .hover-overlay iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
}

.thumb-caption {
  color: #ccc;
  font-size: 0.8rem;
  margin: 0.35rem 0 0;
}

/* ── Click-to-expand stills ──────────────────────────────────── */
figure.hover-trigger.expanded .hover-overlay {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
  width: 95vw;
  transition: opacity 0.35s ease, transform 0.35s ease, width 0.3s ease;
}

/* ── Poster grid ────────────────────────────────────────────── */
.poster-grid {
  display: none;  /* disabled for now */
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  overflow: visible;
}

.poster-grid figure {
  margin: 0;
}

.poster-grid img {
  aspect-ratio: 2 / 3;
  object-fit: cover;
  width: 100%;
  display: block;
}

.poster-grid .hover-overlay {
  /* Height-driven sizing for portrait posters (2:3 aspect ratio) */
  height: 85vh;
  width: calc(85vh * 2 / 3 + 1rem);  /* poster aspect + padding */
}

.poster-grid .hover-overlay img {
  width: auto;
  height: calc(85vh - 2.5rem);
  aspect-ratio: auto;
  object-fit: contain;
}

.poster-grid figure.hover-trigger.expanded .hover-overlay {
  height: 95vh;
  width: calc(95vh * 2 / 3 + 1rem);
}

.poster-grid figure.hover-trigger.expanded .hover-overlay img {
  height: calc(95vh - 2.5rem);
}

/* ── Play button overlay on video thumbnails ─────────────────── */
.video-thumb {
  position: relative;
  display: block;
}

.video-thumb img {
  display: block;
  width: 100%;
}

.video-thumb::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: rgba(204, 0, 0, 0.85);
  border-radius: 50%;
  pointer-events: none;
}

.video-thumb::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-35%, -50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.85);
  z-index: 1;
  pointer-events: none;
}

/* ── Connect links box ───────────────────────────────────────── */
.connect-links {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 4px;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  white-space: nowrap;
}
.connect-links a {
  margin: 0 0.6em;
}

/* ── Profile photo ───────────────────────────────────────────── */
.profile-photo {
  float: right;
  margin: 0 0 1rem 1.5rem;
  width: 33%;
  max-width: 180px;
  border-radius: 4px;
}

/* Site title in header */
h1.site-title {
  font-size: 1.5rem;
  margin: 0;
}

/* Section headings — smaller than Pico default h2 (1.75rem) */
.home-layout h2 {
  font-size: 1.5rem;
}

/* ── Details/summary toggles ─────────────────────────────────── */
/* Hide summary toggle once details is open — seamless list appearance */
details[open] > summary {
  display: none;
}

details > summary {
  padding-left: 1.5rem;
}
details > summary::after {
  display: none;
}

/* De-emphasize inline notes in section headings */
.header-note {
  font-weight: normal;
  font-size: 0.75em;
}

/* Section dividers */
hr {
  border-top-color: var(--pico-border-color);
  margin: 2.5rem 0;
}

/* Indent prose descriptions inside experience details blocks */
details > p {
  padding-left: 1.5rem;
}

/* Hide "show less" unless hovering the details section */
details[open] .show-less {
  opacity: 0;
  transition: opacity 0.2s ease;
}

details[open]:hover .show-less {
  opacity: 1;
}

/* Indent description paragraph under education list items */
.home-lower li p + p {
  padding-left: 1.5rem;
}

/* Paper abstracts: no blockquote styling */
details blockquote {
  border-left: none;
  margin-left: 0;
  font-style: normal;
  color: inherit;
}

/* Papers table: invisible grid */
.papers-table {
  border-collapse: collapse;
  width: 100%;
}
.papers-table td {
  border: none;
  vertical-align: top;
  padding: 0.5rem 0;
}
.papers-table td:last-child {
  white-space: nowrap;
  padding-left: 1rem;
  text-align: right;
}

/* Print footnotes: hidden on screen, shown only in print */
.print-fn-ref, .print-footnotes { display: none; }

/* ── Section nav ─────────────────────────────────────────────── */
.nav-frame {
  width: fit-content;
  margin: 1.5rem 0 2rem;
}

.nav-frame hr {
  margin: 0;
}

nav.section-nav {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  color: var(--pico-muted-color);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow-x: auto;
}

nav.section-nav a {
  color: var(--pico-color);
  text-decoration: none;
  margin: 0 0.6em;
}

nav.section-nav a:hover {
  text-decoration: underline;
}

/* Blog post list — dense, archival */
.post-list p {
  margin: 0.15em 0;
  line-height: 1.6;
}

.post-list time {
  color: var(--pico-muted-color);
  margin-right: 0.75em;
  font-size: 0.9em;
}

/* Compact film credits table — fixed columns for consistency */
.film-table table { margin: 0.5rem 0; table-layout: fixed; width: 100%; }
.film-table td, .film-table th { padding: 0.1rem 0.75rem 0.1rem 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.film-table th:nth-child(1), .film-table td:nth-child(1) { width: 60%; }
.film-table th:nth-child(2), .film-table td:nth-child(2) { width: 15%; }
.film-table th:nth-child(3), .film-table td:nth-child(3) { width: 25%; text-align: right; }
.film-table-continuation tr:last-child td { border-top: 2px solid var(--pico-border-color); }
.film-table-continuation thead { display: none; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .home-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "bio"
      "nav"
      "sidebar"
      "middle"
      "lower";
  }

  .home-sidebar {
    position: static;
    margin-left: 0;
  }


  .home-layout {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .profile-photo {
    margin: 0 0 0.75rem 1rem;
  }

  /* No hover on mobile — hide overlays, let links work natively */
  .hover-overlay {
    display: none !important;
  }

  /* Play button unnecessary without overlay */
  .video-thumb::before,
  .video-thumb::after {
    display: none;
  }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  /* Single column, no sidebar */
  .home-layout {
    display: block;
  }

  .home-sidebar,
  nav.section-nav,
  .hover-overlay {
    display: none;
  }

  /* Summaries hidden — JS opens all details before print */
  details > summary {
    display: none;
  }

  /* No sticky, no float issues */
  .profile-photo {
    float: right;
    width: 120px;
  }

  /* Avoid page breaks inside entries */
  details, .papers-table tr, .film-table {
    break-inside: avoid;
  }

  /* Keep headings with the content that follows */
  h2, h3 {
    break-after: avoid;
  }

  /* Keep title paragraphs (bold lines) with their bullets/description */
  p {
    break-after: avoid;
  }

  ul, ol {
    break-before: avoid;
  }

  /* Per-section link footnotes */
  .print-fn-ref {
    font-size: 0.7em;
    color: #666;
    padding-left: 1px;
  }

  .print-footnotes {
    font-size: 0.75rem;
    color: #666;
    margin: 0.5rem 0 1.5rem 1.5rem;
    padding: 0;
    word-break: break-all;
  }

  .print-footnotes li {
    margin-bottom: 0.1rem;
  }

  /* Hide footer connect links when printing */
  footer small:last-child {
    display: none;
  }
}
