/* Photorealistic paired leaves; each half of a photograph rotates on its hinge. */
#projects > .container { max-width: 1160px; }
.rooms-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 62px 48px; margin-top: 64px; }
.virtual-room { --door-paint: #ecebe4; --door-photo: url('/assets/doors/office.webp'); --handle-top: 64%; --room-accent: #746348; margin: 0; min-width: 0; }
.room-heading { min-height: 76px; text-align: center; }
.virtual-room .project-category-title { min-height: 56px; margin: 0; padding: 0; border: 0; font-family: var(--display); font-size: 30px; font-weight: 500; line-height: 1.15; letter-spacing: 0; }
.door-portal { position: relative; height: 470px; padding: 30px 20px 14px; background: radial-gradient(ellipse at 50% 25%, #fff 0, #f3f2ee 60%, #e9e7e0 100%); border: 1px solid #e7e4db; overflow: hidden; }
.door-portal::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 39px; background: linear-gradient(#d6d1c7 0 2px, #eeebe4 2px 6px, #f5f2ec 7px); border-top: 1px solid #c6bfb3; pointer-events: none; }
.door-wall { position: relative; width: min(100%, 316px); height: 410px; margin: 0 auto; perspective: 1200px; }
.door-frame { position: relative; height: 100%; padding: 12px; background: #eeeae1; border-top: 10px solid #f5f2eb; box-shadow: 8px 8px 15px #29231625, -2px 0 3px #fff, inset 0 0 0 2px #d0c9bc; transform-style: preserve-3d; }
.door-frame::before { content: ''; position: absolute; z-index: 5; top: -16px; left: -6px; right: -6px; height: 8px; border-top: 2px solid #fff; border-bottom: 1px solid #d7d0c4; background: #f0ece3; box-shadow: 1px 2px 3px #0002; }
.door-step { position: absolute; z-index: 6; bottom: -10px; left: -10px; right: -10px; height: 12px; background: linear-gradient(#fbf8f1, #c7beb0); border: 1px solid #d2cabb; box-shadow: 0 4px 7px #0003; }
.door-leaf { position: absolute; z-index: 4; top: 12px; bottom: 0; width: calc(50% - 12px); padding: 0; background-color: var(--door-paint); background-image: var(--door-photo); background-size: 200% 100%; background-repeat: no-repeat; border: 0; box-shadow: 0 0 1px #0005, 4px 1px 7px #0003; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.25,.7,.25,1), filter 1s ease; }
.door-left { left: 12px; background-position: left center; transform-origin: 0 50%; }
.door-right { right: 12px; background-position: right center; transform-origin: 100% 50%; }
.door-leaf::after { content: ''; position: absolute; top: 0; bottom: 0; width: 4px; background: var(--door-paint); transform: translateZ(-2px); }
.door-left::after { right: -2px; }.door-right::after { left: -2px; }
.door-handle { position: absolute; z-index: 7; top: var(--handle-top); left: 5%; display: flex; align-items: center; justify-content: center; min-width: 66px; min-height: 44px; padding: 8px 12px; border: 1px solid #d5cdbd; border-radius: 4px; color: #332d22; background: #fffffff0; box-shadow: 0 3px 9px #0002; backdrop-filter: blur(5px); transform: translateZ(6px); cursor: pointer; }
.door-handle:hover { background: #f6f0e3; border-color: #b29b74; }
.handle-label { font-size: 13px; font-weight: 500; line-height: 1.15; letter-spacing: .03em; }
.virtual-room.is-opening .door-left { transform: rotateY(-112deg); filter: brightness(.8); }
.virtual-room.is-opening .door-right { transform: rotateY(112deg); filter: brightness(.8); }
.room-scene { position: absolute; inset: 12px 12px 0; overflow: hidden; background-color: #554a3b; background-image: var(--door-photo); background-size: 600% 170%; background-position: 8% 5%; filter: blur(5px) brightness(.85); }
.room-gaming { --door-photo: url('/assets/doors/gaming.webp'); --door-paint: #777c7e; --handle-top: 63%; --room-accent: #566b73; }
.room-forest { --door-photo: url('/assets/doors/forest.webp'); --door-paint: #173f32; --handle-top: 67%; --room-accent: #28513d; }
.room-living { --door-photo: url('/assets/doors/living.webp'); --door-paint: #222321; --handle-top: 61%; --room-accent: #4a4a42; }
.room-library { --door-photo: url('/assets/doors/library.webp'); --door-paint: #714c32; --handle-top: 63%; --room-accent: #785536; }
.publication-section > .container > .virtual-room { width: min(100%, 560px); margin: 52px auto 0; }
.publication-section .room-heading { display: none; }
.publication-section .door-portal { height: 505px; padding-top: 45px; }
.publication-section .door-wall { width: min(100%, 342px); height: 430px; }

body.room-open { overflow: hidden; }
.room-dialog { width: min(1120px, calc(100% - 40px)); max-width: none; max-height: calc(100svh - 48px); margin: auto; padding: 0; border: 1px solid #c9c4b8; border-top: 5px solid var(--room-accent); border-radius: 4px; background: #f6f4ef; color: var(--foreground); box-shadow: 0 28px 90px #0005; overscroll-behavior: contain; }
.room-dialog::backdrop { background: #1d211de0; backdrop-filter: blur(7px); }
.room-dialog[open] { animation: room-enter .4s ease-out; }
@keyframes room-enter { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.room-dialog-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 32px; border-bottom: 1px solid #ded9ce; background: #f6f4eff5; backdrop-filter: blur(12px); }
.room-dialog-header h2 { margin: 0; font: 500 clamp(27px, 3.3vw, 42px)/1.1 var(--display); }
.room-close { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; flex-shrink: 0; padding: 10px 15px; border: 1px solid #c8c1b3; border-radius: 3px; background: white; font-size: 14px; cursor: pointer; }
.room-close:hover { background: #e9e5db; }
.room-gallery { padding: 30px; }
.room-dialog .project-grid, .room-dialog .publication-grid { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.room-dialog .project-card, html[lang="pt-PT"] .room-dialog .project-card { grid-template-rows: 170px auto auto 1fr auto auto; gap: 12px; padding: 18px; }
.room-dialog .project-card .project-media { height: 170px; }
.room-dialog .project-card > .meta-label { font-size: 11px; }
.room-dialog .project-card > p:not(.meta-label) { font-size: 14px; line-height: 1.7; }
.room-dialog .project-card h4 { align-self: start; }
.room-dialog .project-card .project-tags li { font-size: 11px; }
.room-dialog .project-play { min-height: 42px; font-size: 12px; }
.room-dialog .reveal { opacity: 1; transform: none; }
.room-dialog .publication-cover { height: 300px; background: #e9e5dc; border-color: #d8d0c3; }
.room-dialog .publication-actions { padding-top: 12px; }
.room-dialog .publication-actions .button { padding-inline: 12px; }

@media (max-width: 960px) {
  .rooms-grid { gap: 48px 28px; }
  .virtual-room .project-category-title { font-size: 26px; }
  .door-portal { padding-inline: 18px; }
  .room-dialog .project-grid, .room-dialog .publication-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .rooms-grid { grid-template-columns: 1fr; gap: 46px; margin-top: 48px; }
  .virtual-room { width: min(100%, 480px); margin-inline: auto; }
  .room-heading { min-height: 84px; }
  .virtual-room .project-category-title { min-height: 0; max-width: 330px; margin-inline: auto; font-size: 28px; }
  .room-dialog { width: calc(100% - 20px); max-height: calc(100svh - 24px); }
  .room-dialog-header { padding: 20px 18px; gap: 12px; align-items: start; }
  .room-dialog-header h2 { font-size: 30px; }
  .room-close { padding: 8px 10px; }
  .room-close span { max-width: 62px; line-height: 1.2; }
  .room-gallery { padding: 18px; }
  .room-dialog .project-grid, .room-dialog .publication-grid { grid-template-columns: 1fr; }
  .room-dialog .publication-cover { height: 340px; }
}
@media (max-width: 480px) {
  .door-portal { height: 445px; padding-inline: 14px; }
  .door-wall { height: 385px; width: min(100%, 290px); }
  .publication-section .door-portal { height: 470px; padding-top: 32px; }
  .publication-section .door-wall { height: 410px; width: min(100%, 310px); }
}
@media (prefers-reduced-motion: reduce) {
  .door-leaf { transition: none; }
  .room-dialog[open] { animation: none; }
}

/* A plain content view remains available in browsers without native dialogs. */
.rooms-fallback .door-portal, .rooms-fallback .room-close { display: none; }
.rooms-fallback .rooms-grid { display: block; }
.rooms-fallback .virtual-room { margin-top: 48px; }
.rooms-fallback .room-dialog { display: block; position: static; width: 100%; max-height: none; }
