/* ==========================================================================
   Nieuwsbrief "Een brief van Anja"
   news.js zet .is-sealing op de brief na inschrijven.
   ========================================================================== */

.as-news { position: relative; overflow: hidden; background: var(--mint); color: var(--kop); padding-block: clamp(80px, 9vw, 140px); }
.as-news__mono { position: absolute; left: -6%; bottom: -12%; width: min(46vw, 680px); color: var(--wit); opacity: .5; pointer-events: none; }
.as-news__mono path { stroke-width: 26; }
.as-news__inner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 104px); align-items: center; }
.as-news__lead { max-width: 40ch; margin-bottom: 2rem; font-size: 1.12rem; }

.as-news__form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 0 1rem; align-items: end; max-width: 620px; }
.as-news__form .as-btn { grid-column: 1 / -1; justify-self: start; margin-top: .4rem; }
.as-news__calm { grid-column: 1 / -1; margin: .9rem 0 0; font-size: .95rem; color: rgba(59, 52, 45, .78); }
.as-news__form .as-form__status { grid-column: 1 / -1; margin-top: .8rem; }

/* De brief */
.as-letterstage { position: relative; height: clamp(480px, 42vw, 580px); overflow: hidden; }
.as-envgroup { position: absolute; inset: 0; }
.as-letter {
	position: absolute;
	left: 9%;
	right: 9%;
	top: 4%;
	bottom: 8%;
	z-index: 3;
	display: flex;
	flex-direction: column;
	padding: clamp(22px, 2.6vw, 36px);
	border-radius: 3px;
	background: #FBF7F1;
	box-shadow: 0 30px 60px -30px rgba(59, 52, 45, .55), 0 2px 6px -2px rgba(59, 52, 45, .2);
	transform: rotate(-2deg);
	transform-origin: 50% 100%;
	animation: as-float 7s ease-in-out infinite;
}
@keyframes as-float { 0%, 100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(-1.2deg) translateY(-6px); } }
.as-letter__date { align-self: flex-end; margin: 0 0 .6rem; font-size: .88rem; color: var(--taupe-diep); }
.as-letter__hello { margin: 0 0 .6rem; font: 400 clamp(2.2rem, 3vw, 2.9rem)/1.1 var(--f-script); color: var(--kop); }
.as-letter__hello [data-letter-name] { display: inline-block; min-width: 1ch; transition: color .3s; }
.as-letter__hello.is-typing [data-letter-name] { color: var(--roze-diep); }
.as-letter__body { margin: 0 0 1.1rem; font-size: 1.02rem; }
.as-letter__pieces { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.as-letter__thumb { display: block; aspect-ratio: 1; border-radius: 50%; background: var(--linnen) var(--img) var(--pos, center) / cover; box-shadow: 0 0 0 3px #fff, 0 8px 16px -10px rgba(59, 52, 45, .6); }
.as-letter__name { display: block; margin-top: .45rem; font-size: .82rem; line-height: 1.25; text-align: center; color: var(--taupe-diep); }
.as-letter__expo { display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 .8rem; font: 400 1.05rem/1 var(--f-h1); letter-spacing: .08em; color: var(--kop); }
.as-letter__expo::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.as-letter__sign { display: flex; flex-direction: column; margin: auto 0 0; }
.as-letter__anja { font: 400 2.6rem/1 var(--f-script); color: var(--kop); }
.as-letter__mono { position: absolute; right: 7%; bottom: 7%; width: 64px; color: var(--taupe); opacity: .35; }

/* De envelop (verborgen tot het verzegelen) */
.as-env { position: absolute; left: 4%; right: 4%; bottom: 0; height: 52%; border-radius: 4px 4px 0 0; opacity: 0; }
.as-env--back { z-index: 2; background: #E6DACB; }
.as-env--front { z-index: 4; background: linear-gradient(170deg, #F3EADF, #EADFD1); clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%); box-shadow: 0 30px 60px -30px rgba(59, 52, 45, .55); }
.as-env--flap {
	z-index: 5;
	bottom: auto;
	top: 48%;
	height: 30%;
	border-radius: 4px 4px 0 0;
	background: linear-gradient(180deg, #EFE4D7, #E2D5C4);
	clip-path: polygon(0 0, 100% 0, 50% 100%);
	transform-origin: 50% 0;
	transform: perspective(900px) rotateX(180deg);
}
.as-seal {
	position: absolute;
	left: 50%;
	top: 76%;
	z-index: 6;
	display: grid;
	place-items: center;
	width: 78px;
	height: 78px;
	border-radius: 47% 53% 50% 48% / 52% 46% 54% 48%;
	background: radial-gradient(circle at 35% 30%, #D97AA0, var(--roze) 45%, var(--roze-diep) 100%);
	box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .25), inset 0 3px 6px rgba(255, 255, 255, .3), 0 10px 20px -8px rgba(59, 52, 45, .6);
	color: rgba(255, 255, 255, .92);
	transform: translate(-50%, -50%) scale(2.2);
	opacity: 0;
}
.as-seal .as-mono { width: 58%; height: auto; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .25)); }

.as-letterstage__done {
	position: absolute;
	inset: 0;
	z-index: 7;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .6rem;
	margin: 0;
	padding: 2rem;
	text-align: center;
	opacity: 0;
	pointer-events: none;
}
.as-letterstage__done-title { font: 700 clamp(2.4rem, 3.4vw, 3.4rem)/1 var(--f-h2); color: var(--kop); }
.as-letterstage__done span:last-child { max-width: 32ch; font-size: 1.05rem; }

/* Verzegelen */
.is-sealing .as-env--back, .is-sealing .as-env--front { animation: as-env-in .5s var(--ease) forwards; }
.is-sealing .as-letter { animation: as-letter-in 1s cubic-bezier(.6, 0, .3, 1) .35s forwards; }
.is-sealing .as-env--flap { animation: as-flap 1.4s var(--ease) 1.1s forwards; }
.is-sealing .as-seal { animation: as-seal-pop .6s cubic-bezier(.3, 1.6, .5, 1) 2s forwards; }
.is-sealing .as-envgroup { animation: as-fly .9s cubic-bezier(.6, 0, .3, 1) 3s forwards; }
.is-sealing .as-letterstage__done { animation: as-done .8s var(--ease) 3.6s forwards; pointer-events: auto; }
@keyframes as-env-in { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes as-letter-in { from { transform: rotate(-2deg); } to { transform: translateY(46%) scale(.86) rotate(0deg); } }
@keyframes as-flap { 0% { opacity: 1; transform: perspective(900px) rotateX(180deg); } 45% { opacity: 1; transform: perspective(900px) rotateX(180deg); } 100% { opacity: 1; transform: perspective(900px) rotateX(0deg); } }
@keyframes as-seal-pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2) rotate(-20deg); } 70% { opacity: 1; transform: translate(-50%, -50%) scale(.92) rotate(-8deg); } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); } }
@keyframes as-fly { to { opacity: 0; transform: translate(42%, -14%) rotate(9deg) scale(.82); } }
@keyframes as-done { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

@media (max-width: 1023px) {
	.as-news__inner { grid-template-columns: minmax(0, 1fr); gap: 32px; }
	.as-letterstage { height: 480px; max-width: 520px; width: 100%; justify-self: center; }
}
@media (max-width: 559px) {
	.as-news__form { grid-template-columns: minmax(0, 1fr); }
	.as-letterstage { height: 440px; }
	.as-letter { left: 4%; right: 4%; }
}
@media (prefers-reduced-motion: reduce) {
	.as-letter { animation: none; }
	.is-sealing .as-envgroup { animation: none; opacity: 0; }
	.is-sealing .as-letterstage__done { animation: none; opacity: 1; }
}
