/* Site mockup layout — structure only. Colors and fonts come entirely from
   theme.css, which defines the role variables (--bg, --surface, --overlay,
   --text, --subtle, --muted, --love, --gold, --rose, --pine, --foam,
   --iris, --shadow, --shadow-soft) for light and dark, plus
   --font-display / --font-body. */

html {
  /* Also declared here (not just on body): body is capped at 1440px, and
     extensions like Dark Reader can break body→canvas propagation on
     first load, leaving a differently-colored frame around the page. */
  background: var(--bg);
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Anchor targets: <section id> in the mockup, labeled headings and
   TOC-anchored section headings (<h2 id>/<h3 id>) in the Typst build. */
section,
h2[id],
h3[id] {
  scroll-margin-top: 2rem;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.625;
  max-width: 1440px;
  margin: 1rem auto;
  padding: 0 1rem;
  display: flex;
  gap: 2rem;
}

@media (min-width: 1024px) {
  body {
    margin-top: 5rem;
    padding: 0 1.5rem;
  }
}

/* ---- Layout columns ---- */

/* Sticks to the viewport while the page scrolls. align-self keeps the
   sidebar its natural height (flex would otherwise stretch it to match the
   page column, leaving sticky nothing to do). */
.sidebar {
  width: 16rem;
  flex: none;
  position: sticky;
  top: 2rem;
  align-self: flex-start;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.page {
  flex: 1;
  min-width: 0;
}

/* ---- Brand (logo + name) ---- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.brand:hover {
  background: var(--surface);
}

.brand-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2.1rem;
  user-select: none;
  white-space: nowrap;
}

/* Logo photo carried over from the current live site (52×52 source). */
.logo {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 10px;
  object-fit: cover;
}

/* ---- Nav ---- */

.site-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-nav a {
  text-decoration: none;
  transition: background-color 0.15s;
}

.site-nav a:hover {
  background: var(--surface);
}

.nav-main {
  font-size: 1.5rem;
}

.nav-main a {
  color: var(--love);
}

/* Projects expands into the showcased write-ups: the summary's link
   navigates, its caret toggles the sub-list. */
.nav-expand summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
}

.nav-expand summary::-webkit-details-marker {
  display: none;
}

/* Border-drawn chevron — no glyph, so no font-fallback surprises. */
.nav-expand summary::after {
  content: "";
  width: 0.4em;
  height: 0.4em;
  align-self: center;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.nav-expand[open] summary::after {
  transform: rotate(45deg);
}

.site-nav .nav-sub {
  font-size: 1rem;
  margin: 0.5rem 0 0.25rem;
  padding-left: 1rem;
  border-left: 1px dashed var(--muted);
}

.nav-sub a {
  color: var(--subtle);
}

/* Standalone pages — set apart from the index anchors above them. */
.nav-pages {
  font-size: 1.15rem;
}

.nav-pages a {
  color: var(--subtle);
}

.nav-group-title {
  font-variant-caps: all-small-caps;
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
}

.nav-group a {
  color: var(--subtle);
}

/* ---- On this page (per-page TOC) ---- */

/* Pages with headings add a nav-group listing their own sections; sub-
   sections (h3s) hang under their section like the Projects sub-list.
   The whole group is a <details> — same caret as .nav-expand — but
   starts open: the current page's sections are the most useful links. */
.page-toc summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
}

.page-toc summary::-webkit-details-marker {
  display: none;
}

.page-toc summary::after {
  content: "";
  width: 0.4em;
  height: 0.4em;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.page-toc[open] summary::after {
  transform: rotate(45deg);
}

.page-toc ul ul {
  font-size: 0.9rem;
  margin-top: 0.35rem;
  padding-left: 1rem;
  border-left: 1px dashed var(--muted);
  gap: 0.35rem;
}

/* ---- Mobile header (hidden on desktop) ---- */

.mobile-header {
  display: none;
}

@media (max-width: 768px) {
  body {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    display: block;
    border-bottom: 1px dashed var(--muted);
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    text-align: center;
  }

  .mobile-header summary {
    font-variant-caps: all-small-caps;
    font-size: 1.3rem;
    cursor: pointer;
    margin-top: 1rem;
  }

  .mobile-header nav {
    text-align: left;
    margin-top: 0.75rem;
  }
}

/* ---- Content ---- */

main a {
  color: var(--foam);
}

main a:focus-visible,
.site-nav a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--iris);
  outline-offset: 2px;
}

/* Page title above the intro gives the content some air at the top. */
.page-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.4rem;
  line-height: 1.2;
  margin: 2.5rem 0 0.75rem;
}

.title-sep {
  color: var(--muted);
  font-weight: 400;
}

.intro {
  font-size: 1.15rem;
  margin-top: 0;
}

/* Small rotated-diamond accent before section headings. */
h2 {
  font-family: var(--font-display);
  font-variant-caps: all-small-caps;
  font-weight: normal;
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  color: var(--subtle);
  margin: 3rem 0 1rem;
}

h2::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.6rem;
  transform: rotate(45deg);
  background: var(--love);
  vertical-align: 2px;
}

#writing h2::before,
h2#writing::before {
  background: var(--foam);
}

/* One-line section subtitle sitting under an h2. */
.section-lede {
  margin: -0.25rem 0 1.75rem;
  color: var(--muted);
}

/* ---- Project cards ---- */

/* Default stretch alignment keeps cards in a row exactly the same height;
   the flex column inside pins tags/details to the card bottom. */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

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

/* No overflow:hidden here — the hover preview must extend past the card.
   The thumbnail rounds its own top corners instead. */
.project {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 6px;
  transition: box-shadow 0.15s;
}

.project:hover {
  box-shadow: 0 2px 10px var(--shadow-soft);
}

/* Thumbnail band: fixed ratio keeps the grid neat regardless of image.
   Real screenshots, untinted (decided in the thumbnail lab). Images pulled
   from the current live site (jenningsliamd.me). */
.thumb {
  aspect-ratio: 3 / 1;
  border-bottom: 1px solid var(--overlay);
  border-radius: 5px 5px 0 0;
  background-size: cover;
  background-position: center;
}

.thumb-motion  { background-image: url("img/real-motion.png"); }
.thumb-formula { background-image: url("img/real-formula.jpg"); }
.thumb-arm     { background-image: url("img/real-arm.jpg"); }
.thumb-quad    { background-image: url("img/real-quad.png"); background-color: #fff; }
.thumb-derain  { background-image: url("img/real-derain.png"); }
/* Symbotic has no shareable photos — logo on navy, like the live site. */
.thumb-sym {
  background: #1a1a2e url("img/real-sym.svg") center / auto 55% no-repeat;
}

.card-body {
  padding: 1rem 1.25rem 0.9rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-style: italic;
  font-weight: normal;
}

.project h3 a {
  color: var(--pine);
  text-decoration: none;
}

.project h3 a:hover {
  text-decoration: underline;
}

.card-body > p {
  margin: 0;
  font-size: 0.95rem;
}

.tags {
  list-style: none;
  margin: auto 0 0;
  padding: 0.75rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.tags li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.35rem;
  transform: rotate(45deg);
  background: var(--gold);
  vertical-align: 1px;
}

.tags li:nth-child(2)::before {
  background: var(--foam);
}

.tags li:nth-child(3)::before {
  background: var(--iris);
}

/* ---- Whole-card link ---- */

/* Covers the card (m4xc-style); real links sit above it via z-index. */
.project {
  position: relative;
}

.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 6px;
}

.card-body h3 a,
details.more,
.blurb-links a {
  position: relative;
  z-index: 2;
}

/* ---- Hover-deployed preview (CSS-only, no JS) ----
   The deployed preview sits above the card-link, so it carries its own
   whole-surface link to the same destination; the source links inside
   stay on top via the shared .blurb-links z-index rule. */

.preview-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.preview {
  position: absolute;
  top: -0.75rem;
  left: -0.75rem;
  right: -0.75rem;
  /* Never smaller than the card it covers (plus the overhang), even when
     the preview's own content is short. */
  min-height: calc(100% + 1.5rem);
  display: flex;
  flex-direction: column;
  z-index: 5;
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 8px;
  box-shadow: 0 14px 36px var(--shadow);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0s linear 0.2s;
}

/* Small delay so grazing the grid with the cursor doesn't flash previews. */
.project:hover .preview {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0.18s, 0.18s, 0.18s;
}

@media (prefers-reduced-motion: reduce) {
  .preview {
    transition: none;
  }
}

.preview-thumb {
  aspect-ratio: 2 / 1;
  flex: none;
  border-bottom: 1px solid var(--overlay);
  background-size: cover;
  background-position: center;
}

.preview-body {
  padding: 1rem 1.25rem 1.1rem;
}

.preview-body h3 {
  margin: 0;
}

.preview-body p {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
}

/* Hover devices get the preview; touch devices get the <details> fallback. */
@media (hover: hover) {
  details.more {
    display: none;
  }
}

@media (hover: none) {
  .preview {
    display: none;
  }
}

/* ---- Click-to-expand blurb (touch fallback) ---- */

details.more {
  margin-top: 0.75rem;
  border-top: 1px dashed var(--overlay);
  interpolate-size: allow-keywords;
}

details.more summary {
  list-style: none;
  cursor: pointer;
  padding: 0.4rem 0 0.3rem;
  font-variant-caps: all-small-caps;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--subtle);
}

details.more summary::-webkit-details-marker {
  display: none;
}

details.more summary::after {
  content: " ▾";
  color: var(--muted);
}

details.more[open] summary::after {
  content: " ▴";
}

details.more summary:hover {
  color: var(--love);
}

/* Slide animation where supported (interpolate-size + ::details-content);
   elsewhere the blurb simply appears. */
details.more::details-content {
  block-size: 0;
  overflow: hidden;
  opacity: 0;
  transition: block-size 0.3s ease, opacity 0.3s ease, content-visibility 0.3s allow-discrete;
}

details.more[open]::details-content {
  block-size: auto;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  details.more::details-content {
    transition: none;
  }
}

.blurb {
  padding-bottom: 0.5rem;
}

.blurb p {
  margin: 0.5rem 0 0;
  font-size: 0.92rem;
}

.badges {
  margin: 0.4rem 0 0;
}

.badge {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
}

.badge.open  { color: var(--pine); border-color: var(--pine); background: color-mix(in srgb, var(--pine) 8%, transparent); }
.badge.study { color: var(--iris); border-color: var(--iris); background: color-mix(in srgb, var(--iris) 9%, transparent); }
.badge.lab   { color: var(--gold); border-color: var(--gold); background: color-mix(in srgb, var(--gold) 9%, transparent); }

.blurb-links a {
  margin-right: 1rem;
  font-size: 0.9rem;
}

/* ---- Article list ---- */

/* Whole row is clickable (overlay link, like the cards) but stays a plain
   list — no thumbnails or expansion, so articles read differently from
   projects. Negative margin lets the hover wash extend past the text. */
.article-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 40rem;
}

.article-list li {
  position: relative;
  padding: 1rem;
  margin: 0 -1rem;
  border-bottom: 1px dashed var(--overlay);
  border-radius: 6px;
  transition: background-color 0.15s;
}

.article-list li:hover {
  background: var(--surface);
}

.row-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 6px;
}

.article-list li > a:not(.row-link) {
  position: relative;
  z-index: 2;
}

.article-list a {
  color: var(--love);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  text-decoration: none;
}

.article-list a:hover {
  text-decoration: underline;
}

.article-list p {
  margin: 0.25rem 0;
  font-size: 0.95rem;
}

.article-list time {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---- Colophon ---- */

.colophon {
  margin-top: 4rem;
  padding: 1.5rem 0 0.5rem;
  border-top: 1px dashed var(--muted);
  font-size: 0.85rem;
  color: var(--muted);
}

.colophon a {
  color: var(--subtle);
}


/* ---- Article page (post.html) ----
   Long-form prose gets a readable measure, centered in the main column;
   figures may break out slightly wider than the text. Section h2s and
   .tags inherit the landing-page styles for consistency. */

.post {
  max-width: 46rem;
  margin: 0 auto;
}

.post-header {
  margin: 2.5rem 0 2.25rem;
}

.post-eyebrow {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--subtle);
  margin: 0;
}

.post-eyebrow .post-category {
  color: var(--rose);
}

.post-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.5rem;
  line-height: 1.15;
  margin: 0.4rem 0 0.5rem;
}

.post-header .tags {
  padding-top: 0.25rem;
}

.post h2 {
  margin-top: 2.75rem;
}

.post figure {
  /* Breakout: images may run wider than the prose measure. */
  margin: 2rem -3rem;
  text-align: center;
}

.post figure img {
  max-width: 100%;
  border: 1px solid var(--overlay);
  border-radius: 6px;
  background: var(--surface);
}

/* Sub-sections inside a post (e.g. per-report entries). */
.post h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
}

/* Embedded demo videos. */
.post .video-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--overlay);
  border-radius: 6px;
  background: var(--surface);
}

.post figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

.post code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.post pre {
  background: var(--surface);
  border: 1px solid var(--overlay);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.55;
}

.post blockquote {
  margin: 1.5rem 0;
  padding: 0.15rem 0 0.15rem 1.25rem;
  border-left: 3px solid var(--pine);
  color: var(--subtle);
}

/* PDF / download buttons (posts and the resume page). */
.button {
  display: inline-block;
  border: 1px solid var(--pine);
  color: var(--pine);
  border-radius: 6px;
  padding: 0.4rem 1.1rem;
  text-decoration: none;
  font-size: 0.95rem;
}

.button:hover {
  background: color-mix(in srgb, var(--pine) 10%, transparent);
}

/* Older/newer footer navigation between posts. */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--muted);
  font-size: 0.95rem;
}

.post-nav .next {
  text-align: right;
  margin-left: auto;
}

.post-nav .post-nav-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

@media (max-width: 1023px) {
  .post figure {
    margin: 2rem 0;
  }
}

/* ---- Resume page ---- */

/* The sheet is the resume flake's SVG export — a paper page, so it stays
   white in both color schemes. */
.resume-sheet {
  display: block;
  width: 100%;
  max-width: 52rem;
  margin: 0.5rem auto 0;
  background: #fff;
  border: 1px solid var(--overlay);
  border-radius: 6px;
  box-shadow: 0 2px 10px var(--shadow-soft);
}
