/* ============================================================
   Pilar Minye Morlán — Portfolio
   Editorial design system — dark sidebar + bento grid
   ============================================================ */

/* --- Tokens ----------------------------------------------- */
:root {
  --sidebar-w:      240px;
  --sidebar-bg:     #111111;
  --sidebar-name:   #ffffff;
  --sidebar-link:   rgba(255,255,255,0.65);
  --sidebar-header: rgba(255,255,255,0.35);
  --sidebar-active: #ffffff;
  --content-bg:     #ffffff;
  --title-col:      #111111;
  --body-col:       #444444;
  --label-col:      #999999;
  --border-col:     #e8e8e8;
  --font:           'Inter', -apple-system, sans-serif;
  --tile-color:     rgba(0,0,0,0.55);
}

/* --- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* --- No scrollbars ---------------------------------------- */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }
body {
  font-family: var(--font);
  background: var(--content-bg);
  color: var(--title-col);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* --- Sidebar ---------------------------------------------- */
#sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 36px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-name {
  font-size: 60px;
  font-weight: 300;
  color: var(--sidebar-name);
  line-height: 0.95;
  letter-spacing: -1.5px;
  margin-bottom: 36px;
  cursor: pointer;
}

.sidebar-nav { flex: 1; }

.sidebar-section {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sidebar-header);
  margin-top: 22px;
  margin-bottom: 6px;
}

.sidebar-link {
  display: block;
  font-size: 13px;
  font-weight: 300;
  color: var(--sidebar-link);
  padding: 5px 0 5px 10px;
  cursor: pointer;
  transition: color 0.15s;
  line-height: 1.5;
}
.sidebar-link:hover { color: var(--sidebar-active); }
.sidebar-link.active {
  color: var(--sidebar-active);
  font-weight: 500;
}
.sidebar-link.top-link {
  padding-left: 10px;
  font-weight: 400;
  font-size: 13px;
  margin-bottom: 4px;
  margin-top: 4px;
}

/* Sliding active indicator */
.sidebar-indicator {
  position: fixed;
  left: 24px;
  top: 0;
  width: 2px;
  height: 1px;
  background: rgba(255,255,255,0.6);
  border-radius: 1px;
  pointer-events: none;
  z-index: 51;
  transform-origin: top center;
}
.sidebar-link.compact {
  font-size: 12px;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 20px;
  line-height: 1.35;
}

.sidebar-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-contact {
  font-size: 12px;
  font-weight: 300;
  color: var(--sidebar-header);
  line-height: 1.8;
}
.sidebar-contact a {
  color: var(--sidebar-header);
  transition: color 0.15s;
}
.sidebar-contact a:hover { color: var(--sidebar-link); }

.sidebar-lang {
  margin-top: 16px;
}
.lang-track {
  position: relative;
  display: inline-flex;
  gap: 4px;
}
.lang-slider {
  position: absolute;
  top: 0; left: 0;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 2px;
  pointer-events: none;
  z-index: 1;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.lang-btn {
  font-size: 11px;
  font-weight: 400;
  color: var(--sidebar-header);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 6px;
  border-radius: 2px;
  position: relative;
  z-index: 2;
  transition: color 0.15s;
}
.lang-btn:hover { color: var(--sidebar-link); }
.lang-btn.active {
  color: var(--sidebar-active);
  font-weight: 500;
  pointer-events: none;
  cursor: default;
}

.sidebar-home-btn {
  margin-top: 16px;
  display: flex;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s;
}
.sidebar-home-btn:hover { opacity: 0.8; }
.sidebar-home-btn svg { width: 18px; height: 18px; fill: #ffffff; }

/* --- Main content ----------------------------------------- */
#app {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

/* --- Bento grid (home) ------------------------------------ */
.bento-grid {
  animation: fadeUp 0.2s ease;
  display: grid;
  grid-template-columns: 55fr 45fr;
  gap: 3px;
  padding: 3px;
}

.bento-tile {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-height: 300px;
  background: #1a1a1a;
  transform: translateZ(0);
}
.bento-tile.featured { grid-row: span 2; min-height: 600px; }
.bento-tile.bento-tile-personal {
  grid-column: 1 / -1;
  min-height: 140px;
  max-height: 180px;
}

.bento-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.12) saturate(1.1);
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.5s ease;
  will-change: transform;
}
.bento-tile:hover img { transform: scale(1.05); }

.bento-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tile-color);
  pointer-events: none;
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: opacity;
}
.bento-tile:hover::after { opacity: 0.65; }

.bento-tile-name {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-size: 40px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.bento-tile.featured .bento-tile-name { font-size: 54px; }

/* --- Image reveal ----------------------------------------- */
.bento-tile img,
.detail-images img,
.personal-grid-item img {
  opacity: 0;
  transform: translateY(12px);
}
.bento-tile img.img-visible,
.detail-images img.img-visible,
.personal-grid-item img.img-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

/* --- Project detail --------------------------------------- */
.detail-view { animation: fadeUp 0.2s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.detail-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 56px 40px 40px;
  align-items: start;
}

.detail-title {
  font-size: 80px;
  font-weight: 700;
  color: var(--title-col);
  line-height: 0.95;
  padding-top: 30px;
  letter-spacing: -2px;
  text-transform: uppercase;
}

.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-year {
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--label-col);
}
.detail-desc {
  font-size: 14px;
  font-weight: 300;
  color: var(--body-col);
  line-height: 1.75;
}
.detail-desc + .detail-desc { margin-top: 12px; }
.detail-desc a { color: var(--accent); text-decoration: none; }
.detail-desc a:hover { text-decoration: underline; }

.detail-section-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--label-col);
  padding: 32px 40px 12px;
}

.detail-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
}
.detail-images.cols-1 { grid-template-columns: 1fr; gap: 20px; padding: 0 20px 20px; }
.detail-images.cols-1.imgs-centered { padding: 0 40px 40px; }
.detail-images.cols-1.imgs-centered img { max-width: 100%; }
.detail-wide-margins .detail-header { padding-left: 80px; padding-right: 80px; }
.detail-wide-margins .detail-section-label { padding-left: 80px; padding-right: 80px; }
.detail-images.cols-2 img { aspect-ratio: 3/2; object-fit: cover; }
.detail-images.cols-3 { grid-template-columns: repeat(3, 1fr); padding-bottom: 20px; }
.detail-images.cols-3 img { aspect-ratio: 3/2; object-fit: cover; }
[data-id="era-mitgera"] .detail-images.cols-3 img { aspect-ratio: auto; object-fit: unset; }
.detail-images.cols-4 { grid-template-columns: repeat(4, 1fr); }
.detail-images.cols-6 { grid-template-columns: repeat(6, 1fr); }
.detail-images.cols-6 img { aspect-ratio: 1; object-fit: cover; }
.detail-images.imgs-square img { aspect-ratio: 1; object-fit: cover; }
.detail-images.bento-left {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: repeat(3, 1fr);
  aspect-ratio: 3/2;
}
.detail-images.bento-left img { height: 100%; object-fit: cover; }
.detail-images.bento-left img:first-child { grid-row: 1 / span 3; }
.detail-images.bento-left-4 {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: repeat(4, 1fr);
  aspect-ratio: 1/1;
}
.detail-images.bento-left-4 img { height: 100%; object-fit: cover; }
.detail-images.bento-left-4 img:first-child { grid-row: 1 / span 4; }
.detail-images.imgs-centered { justify-items: center; }
.detail-images.imgs-centered img { max-width: 70%; height: auto; }

/* --- Escenografia bento: vertical | 2×square | vertical | vertical --- */
.detail-images.bento-escena {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1fr 1fr;
}
.detail-images.bento-escena img { width: 100%; height: 100%; object-fit: cover; }
.detail-images.bento-escena img:nth-child(1) { grid-column: 1; grid-row: 1 / span 2; }
.detail-images.bento-escena img:nth-child(2) { grid-column: 2; grid-row: 1; aspect-ratio: 1; }
.detail-images.bento-escena img:nth-child(3) { grid-column: 2; grid-row: 2; aspect-ratio: 1; }
.detail-images.bento-escena img:nth-child(4) { grid-column: 3; grid-row: 1 / span 2; }
.detail-images.bento-escena img:nth-child(5) { grid-column: 4; grid-row: 1 / span 2; }

/* --- Project video ---------------------------------------- */
.detail-video-wrap {
  position: relative;
  width: calc(100% - 48px);
  margin: 0 24px 3px;
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 4px 24px rgba(50,50,93,0.12), 0 1px 6px rgba(0,0,0,0.06);
}
.detail-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* shared base for all three video buttons */
.video-play-btn, .video-sound-btn, .video-fullscreen-btn {
  position: absolute;
  bottom: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: background 0.2s;
}
.video-play-btn:hover, .video-sound-btn:hover, .video-fullscreen-btn:hover { background: rgba(0,0,0,0.72); }
/* left side: play then sound */
.video-play-btn  { left: 16px; }
.video-sound-btn { left: 64px; }
/* right side: fullscreen */
.video-fullscreen-btn { right: 16px; }
/* icons */
.video-play-btn svg, .video-sound-btn svg, .video-fullscreen-btn svg { width: 16px; height: 16px; }
.video-play-btn .icon-play        { display: none; }
.video-play-btn.paused .icon-play  { display: block; }
.video-play-btn.paused .icon-pause { display: none; }
.video-sound-btn .icon-sound-on   { display: none; }
.video-sound-btn .icon-sound-off  { display: block; }
.video-sound-btn:not(.muted) .icon-sound-on  { display: block; }
.video-sound-btn:not(.muted) .icon-sound-off { display: none; }
.video-fullscreen-btn .icon-shrink { display: none; }
.video-fullscreen-btn.active .icon-expand { display: none; }
.video-fullscreen-btn.active .icon-shrink { display: block; }
@media (max-width: 640px) {
  .video-play-btn, .video-sound-btn, .video-fullscreen-btn {
    width: 28px;
    height: 28px;
    bottom: 10px;
  }
  .video-play-btn svg, .video-sound-btn svg, .video-fullscreen-btn svg { width: 12px; height: 12px; }
  .video-play-btn  { left: 10px; }
  .video-sound-btn { left: 46px; }
  .video-fullscreen-btn { right: 10px; }
}

/* --- Project slideshow ------------------------------------ */
.detail-images.no-bottom-gap { padding-bottom: 3px; }
.detail-slideshow {
  position: relative;
  width: calc(100% - 6px);
  margin: 0 3px 3px;
  aspect-ratio: 16/9;
  overflow: hidden;
}
.detail-slideshow .slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
  cursor: pointer;
}
.detail-slideshow .slide.slide-active { opacity: 1; }
.slideshow-hint {
  position: absolute;
  top: 50%;
  right: 24px;
  z-index: 10;
  color: #fff;
  font-size: clamp(28px, 4vw, 56px);
  pointer-events: none;
  text-shadow: 0 0 18px rgba(245, 225, 185, 0.7), 0 2px 8px rgba(0,0,0,0.35);
  opacity: 0;
}
@keyframes ssHint {
  0%   { opacity: 0; transform: translateY(-50%); }
  20%  { opacity: 1; transform: translateY(-50%); }
  50%  { opacity: 1; transform: translate(6px, -50%); }
  70%  { opacity: 1; transform: translateY(-50%); }
  85%  { opacity: 1; transform: translate(6px, -50%); }
  100% { opacity: 0; transform: translate(8px, -50%); }
}
.slideshow-hint.animate { animation: ssHint 4s ease forwards; }
.detail-images img {
  width: 100%;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}
.detail-wide-margins .detail-images img {
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
}
[data-id="flower-meadow"] .detail-images img { box-shadow: none; }
[data-id="temporalitat"] .detail-title { line-height: 1.2; }
[data-id="temporalitat"] .detail-images.cols-2 img { aspect-ratio: auto; object-fit: unset; }
@media (min-width: 641px) {
  [data-id="temporalitat"] .detail-images.cols-1:last-child { padding: 0 3px 3px; }
}
[data-id="espurna"] .detail-images.cols-2 img { aspect-ratio: auto; object-fit: unset; }
.detail-images img:hover { opacity: 0.9; }
[data-id="ohpera"] .detail-images img.img-shadow { box-shadow: 0 2px 12px rgba(50,50,93,0.12), 0 1px 4px rgba(0,0,0,0.08); }

/* --- Personal drawings grid view -------------------------- */
.personal-grid-view {
  animation: fadeUp 0.2s ease;
  padding: 3px;
}
.personal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}
.personal-grid-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #e8e4e0;
  cursor: zoom-in;
}
.personal-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.personal-grid-item:hover img { transform: scale(1.05); }

/* --- Personal drawing single view (legacy, kept for direct hash access) */
.personal-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px;
  background: var(--content-bg);
}
.personal-image-wrap {
  cursor: zoom-in;
  max-width: 800px;
  width: 100%;
}
.personal-image-wrap img {
  width: 100%;
  display: block;
  box-shadow: rgba(0,0,0,0.08) 0 8px 32px;
}

/* --- About page ------------------------------------------- */
.about-view { animation: fadeUp 0.2s ease; }

.about-video-section {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

/* Pulsating background image */
.about-bg {
  position: absolute;
  inset: -5%;           /* slight oversizing so pulse doesn't show edges */
  background-image: url('Projects/1687958630812.webp');
  background-size: cover;
  background-position: center;
  animation: bgPulse 3.75s ease-in-out 1 forwards;
  filter: blur(0px) brightness(0.85);
  transition: filter 1.4s ease;
  will-change: transform, filter;
}
.about-bg.revealed {
  filter: blur(2.5px) brightness(0.65);
}

@keyframes bgPulse {
  0%   { transform: scale(1);     }
  100% { transform: scale(1.012); }
}

/* Dark gradient over background */
.about-video-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.76) 0%,
    rgba(0,0,0,0.45) 40%,
    rgba(0,0,0,0.12) 70%,
    rgba(0,0,0,0.0)  100%
  );
  pointer-events: none;
  z-index: 1;
}

/* Content overlay */
.about-overlay-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.about-overlay-content.revealed { pointer-events: auto; }

/* BlurFade — matches the Framer Motion component exactly */
.blur-fade {
  opacity: 0;
  transform: translateY(6px);
  filter: blur(6px);
}
.about-overlay-content.revealed .blur-fade {
  opacity: 1;
  transform: translateY(-6px);
  filter: blur(0px);
  transition: opacity 0.4s ease-out,
              transform 0.4s ease-out,
              filter 0.4s ease-out;
}
/* Staggered delays: image → name line 1 → name line 2 → bio */
.about-overlay-content.revealed .bf-1 { transition-delay: 0.04s; }
.about-overlay-content.revealed .bf-2 { transition-delay: 0.18s; }
.about-overlay-content.revealed .bf-3 { transition-delay: 0.32s; }
.about-overlay-content.revealed .bf-4 { transition-delay: 0.52s; }

.about-portrait {
  width: 200px;
  height: 250px;
  object-fit: cover;
  object-position: top center;
  border: none;
  filter: grayscale(1);
  margin-bottom: 36px;
}

.about-name-large {
  font-size: clamp(32px, 9vw, 72px);
  font-weight: 300;
  color: #ffffff;
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 28px;
}

.about-bio {
  font-size: 14px;
  font-weight: 300;
  color: rgba(255,255,255,0.78);
  line-height: 1.8;
  max-width: 500px;
}

/* --- About gallery ---------------------------------------- */
.about-gallery {
  background: #fff;
}

.about-gallery > * + * { margin-top: 4px; }

.ag-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.ag-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.ag-bento {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  aspect-ratio: 3/2;
}

.about-gallery img {
  width: 100%;
  display: block;
}

/* Regular grids: natural aspect ratio, no cropping */
.ag-grid-3 img,
.ag-grid-2 img {
  height: auto;
}

/* Bento only: fixed height needed for grid positioning */
.ag-bento img {
  height: 100%;
  object-fit: cover;
}

.ag-bento-tall {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.ag-bento-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  aspect-ratio: 2/3;
}

.ag-bento-2 img {
  height: 100%;
  object-fit: cover;
}

.ag-bento-2-tall-right {
  grid-column: 2;
  grid-row: 1 / span 2;
}

/* --- Lightbox --------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.96);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeUp 0.15s ease;
}
.lb-track {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.lb-slot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}
.lb-slot img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}
.lb-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.lightbox-close {
  position: absolute;
  top: 16px; right: 20px;
  padding: 10px;
  color: rgba(255,255,255,0.6);
  font-size: 28px;
  line-height: 1;
  transition: color 0.18s;
  pointer-events: auto;
}
.lightbox-close:hover { color: #fff; }
.lightbox-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  padding: 20px 16px;
  color: rgba(255,255,255,0.4);
  font-size: 36px;
  line-height: 1;
  transition: color 0.18s;
  pointer-events: auto;
}
.lightbox-nav:hover { color: #fff; }
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-counter {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 300;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.08em;
}

/* --- Project prev/next navigation ------------------------- */
.proj-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border-col);
}
.proj-nav-btn {
  font-size: 12px;
  font-weight: 400;
  color: var(--label-col);
  cursor: pointer;
  transition: color 0.15s;
  letter-spacing: 0.02em;
}
.proj-nav-btn:hover { color: var(--title-col); }
.proj-nav-disabled { pointer-events: none; }
.proj-nav-next { text-align: right; }

/* --- Responsive ------------------------------------------- */
@media (max-width: 960px) {
  .detail-header { grid-template-columns: 1fr; gap: 16px; padding: 40px 24px 32px; }
  .detail-title  { font-size: 52px; }
  .detail-images { padding-bottom: 60px; }
  .about-portrait { width: 160px; height: 200px; }
  .personal-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  #sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  #sidebar.open { transform: translateX(0); }
  #app { margin-left: 0; position: relative; padding-top: 44px; }

  #app::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(6, 27, 49, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 40;
  }
  body.sidebar-open #app::after {
    opacity: 1;
    pointer-events: auto;
  }

  .bento-tile.bento-tile-personal { min-height: 80px; max-height: 100px; }

  /* Bento home: featured full-width, rest 2-col */
  .bento-grid { grid-template-columns: 1fr 1fr; }
  .bento-tile.featured { grid-column: 1 / -1; min-height: 340px; grid-row: span 1; }
  .bento-tile { min-height: 200px; }
  .bento-tile-name { font-size: 22px; }
  .bento-tile.featured .bento-tile-name { font-size: 30px; }

  /* Detail header: 20px side padding */
  .detail-title { font-size: 36px; letter-spacing: -0.5px; }
  .detail-header { padding: 13px 20px 24px; }
  .detail-section-label { padding: 24px 20px 8px; font-size: 10px; }
  .detail-wide-margins .detail-header { padding-left: 20px; padding-right: 20px; }
  .detail-wide-margins .detail-section-label { padding-left: 20px; padding-right: 20px; }

  /* Detail images: edge-to-edge, no gap, no outer padding on mobile */
  .detail-images { grid-template-columns: 1fr 1fr; padding: 0; gap: 0; }
  .detail-images.cols-3 { grid-template-columns: 1fr 1fr; }
  .detail-images.cols-6 { grid-template-columns: repeat(3, 1fr); }
  .detail-images.cols-4 { grid-template-columns: 1fr 1fr; }
  .detail-images.cols-4.imgs-square { grid-template-columns: repeat(4, 1fr); }
  .detail-images.cols-1 { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .detail-images.cols-1.imgs-centered { padding: 0 3px 3px; }

  /* Bento stacks: collapse to single column */
  .detail-images.bento-left,
  .detail-images.bento-left-4 {
    grid-template-columns: 1fr;
    grid-template-rows: unset;
    aspect-ratio: unset;
  }
  .detail-images.bento-left img,
  .detail-images.bento-left-4 img { height: auto; }
  .detail-images.bento-left img:first-child,
  .detail-images.bento-left-4 img:first-child { grid-row: unset; }
  [data-id="temporalitat"] .detail-images.bento-left-4 {
    grid-template-columns: 1fr 1fr;
  }
  [data-id="temporalitat"] .detail-images.bento-left-4 img:first-child {
    grid-column: 1 / -1;
  }
  [data-id="temporalitat"] .detail-images.cols-1:last-child img {
    aspect-ratio: 5/6;
    object-fit: cover;
    width: 100%;
    object-position: calc(50% + 44px) center;
  }

  .personal-grid { grid-template-columns: repeat(2, 1fr); }

  .about-portrait { width: 130px; height: 165px; }
  .about-view { margin-top: -44px; }
  .bento-grid { margin-top: -44px; }
  .personal-grid-view { margin-top: -44px; }

  .lightbox-prev,
  .lightbox-next {
    top: auto;
    bottom: 32px;
    transform: none;
    padding: 12px 24px;
  }
  .lightbox-prev { left: calc(50% - 80px); right: auto; }
  .lightbox-next { right: calc(50% - 80px); left: auto; }

  .proj-nav { display: none; }

  .hamburger {
    display: flex;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 60;
    width: 36px; height: 36px;
    background: rgba(6, 27, 49, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 4px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
  }
  .hamburger span {
    display: block; width: 18px; height: 1.5px; background: rgba(255,255,255,0.85);
  }
  body.sidebar-open .hamburger { display: none; }

  .sidebar-close {
    display: none;
    position: absolute;
    top: 14px; right: 14px;
    color: rgba(255,255,255,0.4);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
    z-index: 2;
  }
  .sidebar-close:hover { color: rgba(255,255,255,0.85); }
  #sidebar.open .sidebar-close { display: block; }

  /* Per-project mobile overrides — add data-id targets here for future projects */
  [data-id="refuge-room"] .detail-images { grid-template-columns: 1fr; padding: 0; gap: 0; }
  [data-id="refuge-room"] .detail-images.cols-3 { grid-template-columns: 1fr 1fr; }
  [data-id="era-mitgera"] .detail-images.cols-3 { grid-template-columns: repeat(3, 1fr); }
  /* Slideshow centered in remaining vertical space */
  [data-id="refuge-room"] .detail-view {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
  }
  [data-id="refuge-room"] .detail-slideshow {
    aspect-ratio: 4/3;
    width: 100%;
    margin: auto 0;
    flex-shrink: 0;
  }
}
@media (min-width: 641px) {
  .hamburger { display: none; }
  .read-more-btn { display: none; }
  .detail-meta.collapsed { max-height: none; overflow: visible; }
}

/* Read-more button — mobile only */
.read-more-btn {
  display: none;
  background: none;
  border: none;
  padding: 6px 0 0;
  font-size: 12px;
  font-family: inherit;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: 0.02em;
}

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

  .detail-meta {
    position: relative;
    overflow: hidden;
    max-height: 1200px;
  }
  .detail-meta.collapsed { max-height: 106px; }
  .detail-meta::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 48px;
    background: linear-gradient(transparent, #fff);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .detail-meta.collapsed::after { opacity: 1; }
}
