/* Portaal: twee deuren, één hoofd. --snij is de plek van de kniplijn. */
@property --snij { syntax: "<percentage>"; inherits: true; initial-value: 50%; }

html[data-wereld="portaal"], html[data-wereld="portaal"] body { height: 100%; overflow: hidden; }
.portaal { position: fixed; inset: 0; overflow: hidden; --snij: 50%; transition: --snij .7s cubic-bezier(.3, .9, .2, 1); --hoofd-h: min(66vh, 56vw); }
.portaal.kiest { transition-duration: .55s; transition-timing-function: cubic-bezier(.7, 0, .2, 1); }

.portaal-kop { position: absolute; z-index: 6; left: 0; right: 0; top: calc(84px + var(--veilig-b)); text-align: center; display: grid; gap: 8px; pointer-events: none; padding-inline: var(--rand); }
.portaal-titel { font-family: var(--f-wonk); font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; font-weight: 560; font-size: clamp(2rem, 5.2vw, 4.4rem); line-height: 1; letter-spacing: -.02em; }

.deur { position: absolute; inset: 0; display: block; text-decoration: none; color: var(--inkt); overflow: hidden; }
.deur-raar { background: var(--zalm); z-index: 1; clip-path: inset(0 calc(100% - var(--snij)) 0 0); }
.deur-raak { background: var(--papier); z-index: 2; clip-path: inset(0 0 0 var(--snij)); }

/* raak: fijn kobalt raster */
.deur-raak .deur-decor { position: absolute; inset: -40px; opacity: .22; transition: opacity .5s;
  background-image: linear-gradient(var(--kobalt) 1px, transparent 1px), linear-gradient(90deg, var(--kobalt) 1px, transparent 1px); background-size: 36px 36px; }
.deur-raak .deur-decor::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 30%; background: linear-gradient(transparent, rgba(52, 70, 217, .35), transparent); opacity: 0; }
.portaal.levend-raak .deur-raak .deur-decor { opacity: .5; }
.portaal.levend-raak .deur-raak .deur-decor::after { opacity: 1; animation: scan 2.4s linear infinite; }
@keyframes scan { from { transform: translateY(-100%); } to { transform: translateY(340%); } }

/* raar: zwevende knipsels */
.deur-raar .deur-decor { position: absolute; inset: 0; }
.deur-decor .plek { position: absolute; left: var(--x); top: var(--y); transform: rotate(var(--r, 0deg)); }
.portaal.levend-raar .plek { animation: wiebel .5s steps(2) infinite alternate; }
@keyframes wiebel { from { transform: rotate(calc(var(--r, 0deg) - 7deg)) scale(1.06); } to { transform: rotate(calc(var(--r, 0deg) + 7deg)) scale(1.06); } }

/* het hoofd: twee keer op precies dezelfde plek, de kniplijn bepaalt welke versie je ziet */
.deur-hoofd { position: absolute; left: 50%; bottom: 0; height: var(--hoofd-h); aspect-ratio: 900 / 1086; transform: translateX(-50%); isolation: isolate; }
.deur-hoofd > img.hoofd { width: 100%; height: 100%; object-fit: contain; }
.deur-hoofd .plek { position: absolute; left: var(--x); top: var(--y); transform: rotate(var(--r, 0deg)); z-index: 2; }
.deur-raak .deur-hoofd > img.hoofd { filter: grayscale(1) contrast(1.2) brightness(1.05); }
.deur-raak .deur-hoofd::before, .deur-raak .deur-hoofd::after { content: ""; position: absolute; inset: 0; -webkit-mask: url("../../media/hoofd/portaal.webp") center / contain no-repeat; mask: url("../../media/hoofd/portaal.webp") center / contain no-repeat; pointer-events: none; }
.deur-raak .deur-hoofd::before { background: var(--kobalt); mix-blend-mode: screen; z-index: 1; }
.deur-raak .deur-hoofd::after { background: repeating-linear-gradient(rgba(52, 70, 217, .5) 0 1px, transparent 1px 5px); z-index: 2; }

.deur-tekst { position: absolute; bottom: 13vh; width: min(30vw, 400px); display: grid; gap: 14px; justify-items: start; transition: transform .7s cubic-bezier(.3, .9, .2, 1); z-index: 3; }
.deur-raar .deur-tekst { left: calc(var(--rand) + var(--veilig-l)); }
.deur-raak .deur-tekst { right: calc(var(--rand) + var(--veilig-r) + 20px); bottom: 20vh; text-align: right; justify-items: end; }
.deur-label { font-size: clamp(2.1rem, 4.6vw, 4.4rem); line-height: .98; }
.deur-raar .deur-label { font-family: var(--f-wonk); font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; font-weight: 600; letter-spacing: -.02em; }
.deur-raak .deur-label { font-family: var(--f-sans); font-weight: 600; letter-spacing: -.035em; }
/* het ene woord dat meteen zegt wat er achter de deur zit */
.deur-woord { font-family: var(--f-poster); text-transform: uppercase; font-size: clamp(1.9rem, 4.2vw, 4rem); line-height: 1; letter-spacing: .03em; padding: .14em .34em .1em; }
.deur-raar .deur-woord { background: var(--mosterd); color: var(--inkt); transform: rotate(-2.5deg); box-shadow: var(--schaduw); }
.deur-raak .deur-woord { background: var(--kobalt); color: var(--wit); }
.deur-sub { font-size: 1.02rem; max-width: 22em; }
.deur-raar .deur-knop { font-family: var(--f-wonk); font-style: normal; font-weight: 500; font-variation-settings: "SOFT" 100, "WONK" 1; }
.deur:hover .deur-knop, .deur:focus-visible .deur-knop, .deur.vorige .deur-knop { transform: rotate(0deg); color: var(--papier); }
.deur:hover .deur-knop::before, .deur:focus-visible .deur-knop::before, .deur.vorige .deur-knop::before { transform: scaleY(1); }
.deur:focus-visible { outline: none; }
.deur:focus-visible .deur-knop { outline: 3px solid var(--inkt); outline-offset: 4px; }

/* kniplijn met schaartje */
.kniplijn { position: absolute; inset: 0; z-index: 4; pointer-events: none; transform: translateX(calc(var(--snij) - 50%)); }
.kniplijn-streep { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2.5px dashed var(--inkt); margin-left: -1px; }
.kniplijn-schaar { position: absolute; left: 50%; top: calc(100% - 15vh); width: 46px; height: 46px; margin: -23px; transform: rotate(-90deg); }
.kniplijn-schaar .blad { transform-origin: 22px 22px; }
.kniplijn-schaar .blad.a { animation: knip-a .5s steps(2) infinite alternate; }
.kniplijn-schaar .blad.b { animation: knip-b .5s steps(2) infinite alternate; }
@keyframes knip-a { from { transform: rotate(0deg); } to { transform: rotate(18deg); } }
@keyframes knip-b { from { transform: rotate(0deg); } to { transform: rotate(-18deg); } }

.twijfel { position: absolute; z-index: 6; left: 50%; bottom: calc(22px + var(--veilig-o)); transform: translateX(-50%); padding: 10px 18px; min-height: 44px; display: inline-flex; align-items: center; background: var(--papier-licht); border-radius: 999px; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .03em; text-underline-offset: 4px; white-space: nowrap; box-shadow: var(--schaduw); }

/* mobiel: boven en onder */
@media (max-width: 760px) {
  .portaal { --hoofd-h: min(33vh, 74vw); }
  .portaal-kop { top: calc(64px + var(--veilig-b)); gap: 4px; }
  .portaal-titel { font-size: clamp(1.7rem, 8vw, 2.4rem); }
  .deur-raar { clip-path: inset(0 0 calc(100% - var(--snij)) 0); }
  .deur-raak { clip-path: inset(var(--snij) 0 0 0); }
  .deur-hoofd { bottom: auto; top: 50%; transform: translate(-50%, -50%); }
  .kniplijn { transform: translateY(calc(var(--snij) - 50%)); }
  .kniplijn-streep { left: 0; right: 0; top: 50%; bottom: auto; border-left: 0; border-top: 2.5px dashed var(--inkt); margin: -1px 0 0; }
  .kniplijn-schaar { left: 88%; top: 50%; transform: none; }
  .deur-tekst { width: auto; gap: 6px; }
  .deur-raar .deur-tekst { left: var(--rand); right: var(--rand); bottom: auto; top: calc(138px + var(--veilig-b)); }
  .deur-raak .deur-tekst { left: var(--rand); right: calc(var(--rand) + 92px); bottom: calc(74px + var(--veilig-o)); text-align: left; justify-items: start; }
  .deur-label { font-size: clamp(1.6rem, 8vw, 2.2rem); }
  .deur-woord { font-size: clamp(1.7rem, 8.6vw, 2.4rem); }
  .deur-sub { font-size: .92rem; line-height: 1.35; max-width: 19em; }
  .twijfel { left: var(--rand); transform: none; bottom: calc(14px + var(--veilig-o)); font-size: .68rem; padding-inline: 12px; max-width: calc(100% - 2 * var(--rand) - 96px); white-space: normal; line-height: 1.25; }
}
@media (max-width: 760px) and (max-height: 720px) { .deur-sub { display: none; } .portaal { --hoofd-h: 30vh; } }
@media (min-width: 761px) and (max-height: 620px) { .deur-sub { display: none; } }
