/* ==========================================================================
   Custom properties
   ========================================================================== */

:root {
  --color-bg: #fafaf9;
  --color-bg-raised: #ffffff;
  --color-text: #18181b;
  --color-text-muted: #71717a;
  --color-text-subtle: #a1a1aa;
  --color-accent: #b565a8;
  --color-accent-hover: #944e88;
  --color-accent-subtle: #fdf0fc;
  --color-border: #e4e4e7;
  --color-border-subtle: #f0f0f0;
  --color-surface: #f4f4f5;

  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-serif: "Playfair Display", Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Code", "Fira Code", monospace;

  --size-header: 3.5rem;
  --sidebar-width: 260px;
  --container-max: 1120px;
  --gap: clamp(1rem, 4vw, 2rem);

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);
  --transition: 180ms ease;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

a, button, [role="button"], input, label, select, textarea { touch-action: manipulation; }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

html {
  scroll-behavior: smooth;
  background: var(--color-bg);
}

body {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--color-text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Sidebar pages: constrain to viewport so sidebar-main is the scroll container */
body:has(.sidebar-layout) {
  height: 100vh;
  overflow: hidden;
}

body:has(.sidebar-layout) .site-main {
  min-height: 0;
}

body:has(.sidebar-layout) .sidebar-layout {
  grid-template-rows: 1fr;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--color-accent-hover); }

strong, b { font-weight: 600; }

ul, ol { padding-left: 1.5em; }

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: 2.5rem;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header & nav
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--size-header);
  background: rgba(250, 250, 249, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-max);
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--gap);
}

.site-header__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-header__logo img {
  display: block;
  max-height: calc(var(--size-header) * 0.55);
  width: auto;
  border-radius: 0;
}

/* Hamburger — hidden on desktop */
.nav-toggle { display: none; }

.site-nav__list {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
}

.site-nav__link {
  display: block;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 1rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
}

.site-nav__link:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.site-nav__link.is-active {
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}

/* Section links and labels — only visible in mobile hamburger, hidden on desktop */
.site-nav__divider,
.site-nav__item--section,
.site-nav__label { display: none; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  margin-top: 4rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.site-footer__inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* ==========================================================================
   Prose (shared content styles)
   ========================================================================== */

.prose {
  font-size: 1.25rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 0.6em;
  scroll-margin-top: calc(var(--size-header) + 1.5rem);
}

.prose h1 { font-size: 2.25rem; }
.prose h2 { font-size: 1.625rem; }
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1.0625rem; font-style: italic; }

/* Don't add top margin on first heading */
.prose > h1:first-child,
.prose > h2:first-child,
.prose > h3:first-child { margin-top: 0; }

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

.prose ul,
.prose ol { margin-bottom: 1em; }

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

.prose blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin-left: 0;
  margin-bottom: 1em;
  color: var(--color-text-muted);
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-surface);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
}

.prose pre {
  background: var(--color-text);
  color: #e5e7eb;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.25em;
  font-size: 0.875em;
  line-height: 1.7;
}

.prose pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: 1em;
  color: inherit;
}

.prose figure {
  margin-bottom: 1.75em;
}

.prose figure img,
.prose figure video {
  border-radius: var(--radius);
}

.prose figcaption {
  font-size: 0.825em;
  color: var(--color-text-subtle);
  margin-top: 0.5em;
  text-align: left;
}

/* Auto-heading anchor links */
.prose .header-anchor {
  opacity: 0;
  margin-left: 0.4em;
  font-size: 0.75em;
  text-decoration: none;
  color: var(--color-text-subtle);
  font-weight: 400;
  transition: opacity var(--transition);
}

.prose h2:hover .header-anchor,
.prose h3:hover .header-anchor,
.prose h4:hover .header-anchor {
  opacity: 1;
}

/* Inline video / embedded media */
.prose video,
.prose iframe {
  border-radius: var(--radius);
  width: 100%;
  margin-bottom: 1.5em;
}

/* ==========================================================================
   Page layout
   ========================================================================== */

.page-content { padding-block: 2rem; }

.page-header { margin-bottom: 2.5rem; }

.page-header__title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* ==========================================================================
   Post layout
   ========================================================================== */

.post-content { }

.post-header { margin-bottom: 2.5rem; }

.post-header__title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.post-header__date {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.post-header__tags {
  display: flex;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  flex-wrap: wrap;
}

.post-header__tags a {
  font-size: 0.775rem;
  padding: 0.2em 0.65em;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 2em;
  text-decoration: none;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}

.post-header__tags a:hover {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-color: transparent;
}

/* ==========================================================================
   Shared sidebar layout (projects + blog)
   ========================================================================== */

.sidebar-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 3rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-main {
  min-width: 0;
  overflow-y: auto;
  height: 100%;
  scroll-behavior: smooth;
  padding-right: 0.5rem;
}

.sidebar-main .prose { max-width: 68ch; }


.project-header {
  margin-bottom: 2.5rem;
  scroll-margin-top: var(--size-header);
}

.project-header__title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.project-header__date {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-top: 0.4rem;
}

/* ==========================================================================
   Sidebar — shared sticky behaviour
   ========================================================================== */

.project-sidebar,
.about-sidebar,
.contact-sidebar {
  min-width: 0;
  overflow: hidden;
  padding-block: 2rem;
}

.blog-sidebar {
  min-width: 0;
  overflow: hidden;
}

.sidebar-layout--right {
  grid-template-columns: 1fr var(--sidebar-width);
}

.sidebar-layout--right .project-sidebar,
.sidebar-layout--right .blog-sidebar,
.sidebar-layout--right .about-sidebar,
.sidebar-layout--right .contact-sidebar {
  order: 2;
}

/* ==========================================================================
   About sidebar
   ========================================================================== */

.about-sidebar__heading,
.contact-sidebar__heading,
.blog-sidebar__heading {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  margin-bottom: 1rem;
}

.about-sidebar__list {
  list-style: none;
  padding: 0;
}

.about-sidebar__item {
  margin-bottom: 0.25rem;
}

.about-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 1rem;
  transition: color var(--transition), background var(--transition);
}

.about-sidebar__link:hover {
  color: var(--color-text);
  background: var(--color-border);
}

.about-sidebar__link i {
  width: 1.1em;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Inline meta block — desktop: hidden (sidebar covers it).
   Chained selector needed: both classes on same element, and
   .project-meta__list { display: grid } comes later in the cascade. */
.project-meta__list.project-meta__list--inline { display: none; }

/* Meta table */
.project-meta__list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 0.875rem;
  font-size: 0.825rem;
  margin-bottom: 1.75rem;
}

.project-meta__list dt {
  color: var(--color-text-subtle);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  align-self: start;
  padding-top: 0.2em;
  white-space: nowrap;
}

.project-meta__list dd {
  color: var(--color-text);
  line-height: 1.4;
  overflow-wrap: break-word;
  min-width: 0;
}

.project-meta__contributor { font-weight: 600; }

.project-meta__role { color: var(--color-text-muted); }

.project-meta__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Section nav */
.project-nav__list {
  list-style: none;
  padding: 0;
  border-left: 1px solid var(--color-border);
}

.project-nav__item { margin-bottom: 0; }

.project-nav__link {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--color-text-muted);
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.project-nav__link:hover {
  color: var(--color-text);
  background: var(--color-border);
}

.project-nav__link.is-active {
  color: var(--color-accent);
  border-left-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

/* ==========================================================================
   Gallery
   ========================================================================== */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-block: 1.75rem;
  /* Override prose max-width so gallery fills the content column */
  max-width: none;
}

.gallery__item { margin: 0; }

.gallery__link {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: zoom-in;
  background: var(--color-surface);
  aspect-ratio: 1;
}

.gallery__link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 250ms ease;
}

.gallery__link:hover img { transform: scale(1.05); }

/* Caption as hover overlay — keeps grid cells uniformly square */
.gallery__caption {
  position: absolute;
  inset: auto 0 0;
  padding: 1.5rem 0.625rem 0.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.3;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.gallery__link:hover .gallery__caption { opacity: 1; }

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] { display: none; }

.lightbox__figure {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox__caption {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.825rem;
  margin-top: 0.875rem;
  text-align: center;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: fixed;
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  transition: opacity var(--transition), background var(--transition);
  border-radius: var(--radius);
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  opacity: 1;
  background: rgba(255,255,255,0.16);
}

.lightbox__close {
  top: 1rem;
  right: 1rem;
  padding: 0.4rem 0.65rem;
  font-size: 1.25rem;
}

.lightbox__prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.75rem 1rem;
  font-size: 1.5rem;
}

.lightbox__next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.75rem 1rem;
  font-size: 1.5rem;
}


.blog-sidebar__section { margin-bottom: 2rem; }


.blog-sidebar__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
}

.blog-sidebar__tag {
  font-size: 0.775rem;
  padding: 0.2em 0.65em;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 2em;
  text-decoration: none;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.blog-sidebar__tag:hover {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-color: transparent;
}

.blog-sidebar__archive {
  list-style: none;
  padding: 0;
  border-left: 1px solid var(--color-border);
}

.blog-sidebar__archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
}

.blog-sidebar__archive-item a {
  text-decoration: none;
  color: var(--color-text-muted);
  transition: color var(--transition);
}

.blog-sidebar__archive-item a:hover { color: var(--color-text); }

.blog-sidebar__count {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
}

/* ==========================================================================
   Listing pages (blog, projects)
   ========================================================================== */

.listing { }

.listing__header { margin-bottom: 3rem; }

.listing__title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.card-grid {
  display: grid;
  /* grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); */
  grid-template-columns: repeat(auto-fill, minmax(560px, 1fr));
  gap: 1.25rem;
  list-style: none;
  padding: 0;
}

.card {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  /* border-radius: var(--radius-lg); */
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card__thumb {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
}

.card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.card:hover .card__thumb img { transform: scale(1.04); }

.card__body { padding: 1.375rem 1.5rem; }

.card__title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 0.35rem;
}

.card__title a {
  text-decoration: none;
  color: var(--color-text);
}

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

.card__date {
  font-size: 0.775rem;
  color: var(--color-text-subtle);
  margin-bottom: 0.6rem;
  display: block;
}

.card__excerpt {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* ==========================================================================
   Responsive — tablet
   ========================================================================== */

@media (max-width: 900px) {
  :root { --sidebar-width: 220px; }
  .sidebar-layout { gap: 2rem; }
}

/* ==========================================================================
   Contact page
   ========================================================================== */

.page-header__description,
.page-header__intro,
.page-header__sub {
  margin-top: 0.75rem;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  line-height: 1.6;
}

.page-header__intro p { margin-bottom: 0.5em; }
.page-header__intro p:last-child { margin-bottom: 0; }


.contact-sidebar__address {
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.contact-sidebar__address .fa-location-dot {
  font-size: 1.1rem;
  color: var(--color-text-subtle);
  margin-bottom: 0.75rem;
}


.contact-form__note {
  font-size: 1rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 1.75rem;
  line-height: 1.6;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group label span { color: var(--color-accent); }

.form-group input,
.form-group textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 300;
  color: var(--color-text);
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(181, 101, 168, 0.15);
}

.form-group input.is-invalid,
.form-group textarea.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group textarea { resize: vertical; min-height: 9rem; }

.contact-alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.contact-alert--success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.contact-alert--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.contact-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.5rem;
  background: var(--color-accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  margin-top: 0.5rem;
}

.contact-submit:hover { background: var(--color-accent-hover); }
.contact-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.contact-submit__spinner { display: none; }
.contact-submit__spinner.fa-spin { display: inline-block; }

.contact-recaptcha-notice {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  margin-bottom: 1rem;
}

.contact-recaptcha-notice a { color: var(--color-text-subtle); }

/* ==========================================================================
   Responsive — mobile
   ========================================================================== */

@media (max-width: 767px) {

  /* --- Hamburger button --- */
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text);
    transition: background var(--transition);
  }

  .nav-toggle:hover { background: var(--color-surface); }

  .nav-toggle__icon--close { display: none; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon--open { display: none; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon--close { display: block; }

  /* --- Mobile nav dropdown --- */
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-raised);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    z-index: 99;
  }

  .site-nav.is-open { display: block; }

  .site-nav__list {
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
  }

  .site-nav__item { display: block; }

  .site-nav__link {
    padding: 0.75rem var(--gap);
    border-radius: 0;
    font-size: 1rem;
  }

  /* Show section links in mobile menu */
  .site-nav__item--section { display: block; }

  .site-nav__link--section {
    padding-left: calc(var(--gap) + 0.75rem);
    font-size: 0.875rem;
    color: var(--color-text-muted);
  }

  .site-nav__link--section.is-active {
    color: var(--color-accent);
    background: var(--color-accent-subtle);
  }

  /* Divider between main links and section links */
  .site-nav__divider {
    display: block;
    height: 1px;
    background: var(--color-border);
    margin: 0.4rem var(--gap);
  }

  /* --- Sidebar layout on mobile — reset inner-scroll, single column --- */
  body:has(.sidebar-layout) {
    height: auto;
    overflow: visible;
  }

  body:has(.sidebar-layout) .sidebar-layout {
    grid-template-rows: auto;
  }

  .sidebar-layout {
    grid-template-columns: 1fr;
    gap: 0;
    height: auto;
    overflow: visible;
  }

  .sidebar-main {
    height: auto;
    overflow-y: visible;
  }

  /* Both sidebars hidden — content injected into hamburger menu */
  .project-sidebar,
  .blog-sidebar,
  .about-sidebar,
  .contact-sidebar { display: none; }

  /* Group labels inside mobile nav */
  .site-nav__label {
    display: block;
    padding: 0.25rem var(--gap);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-subtle);
  }

  .site-nav__count {
    font-size: 0.75rem;
    color: var(--color-text-subtle);
    margin-left: auto;
    padding-left: 0.5rem;
  }

  /* Archive links need space-between for the count */
  .site-nav__link--section:has(.site-nav__count) {
    display: flex;
    align-items: center;
  }

  /* Inline meta shown at top of article header */
  .project-meta__list.project-meta__list--inline {
    display: grid;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
  }

  /* Cards stack on mobile */
  .card-grid { grid-template-columns: 1fr; }

  /* Contact page */
  .form-row { grid-template-columns: 1fr; }

  /* Full-bleed images — break out of container padding */
  /* :not(.gallery__item) keeps gallery figures out of this rule */
  .prose p > img,
  .prose figure:not(.gallery__item) {
    margin-inline: calc(-1 * var(--gap));
    width: calc(100% + 2 * var(--gap));
    max-width: none;
    border-radius: 0;
  }

  .prose figure:not(.gallery__item) img {
    width: 100%;
    margin-inline: 0;
    border-radius: 0;
  }

  /* Gallery: fixed 3-column grid, cells scale with viewport width */
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}
