@font-face { font-family: "Caveat"; font-weight: 400; font-display: swap; src: url(fonts/caveat-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Caveat"; font-weight: 700; font-display: swap; src: url(fonts/caveat-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Patrick Hand"; font-weight: 400; font-display: swap; src: url(fonts/patrick-hand-latin-400-normal.woff2) format("woff2"); }

:root {
  --karton: #b48a5c;
  --karton-dunkel: #8d6440;
  --stift: #3b2a1e;
  --rot: #c2463d;
  --creme: #fbf6ea;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --schrift: "Patrick Hand", "Segoe Print", "Comic Sans MS", cursive;
  --weich: cubic-bezier(.25, .7, .25, 1);
  --sp: 3;
  --luecke: 12px;
  --rand: 16px;
}
@media (min-width: 620px) { :root { --sp: 5; --luecke: 16px; --rand: 28px; } }
@media (min-width: 900px) { :root { --sp: 6; --luecke: 18px; } }

* { box-sizing: border-box; }

html {
  background: var(--karton);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--stift);
  font-family: var(--schrift);
  font-size: 18px;
  line-height: 1.5;
  background:
    radial-gradient(ellipse 90% 70% at 50% 35%, rgba(255, 236, 200, .28), rgba(255, 236, 200, 0) 70%),
    radial-gradient(ellipse 140% 110% at 50% 40%, rgba(60, 35, 15, 0) 55%, rgba(60, 35, 15, .38) 100%),
    url(karton.svg) 0 0 / 600px 600px,
    var(--karton);
  background-attachment: fixed;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.seite {
  width: min(100%, 1000px);
  margin: 0 auto;
  padding: 28px var(--rand) 40px;
}

/* ---------------------------------------------------------------- header */

.kopf {
  text-align: center;
  margin-bottom: 26px;
}
.kopf h1 {
  margin: 0;
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(3rem, 11vw, 5.4rem);
  line-height: 1;
  letter-spacing: .01em;
  color: var(--stift);
  transform: rotate(-2deg);
  text-shadow: 0 1px 0 rgba(255, 240, 215, .35);
  animation: rein .9s var(--weich) both;
}
.kringel {
  display: block;
  width: min(330px, 70%);
  height: 20px;
  margin: -4px auto 4px;
  overflow: visible;
}
.kringel path {
  fill: none;
  stroke: var(--rot);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: malen 1.1s .45s ease-out forwards;
}
@keyframes malen { to { stroke-dashoffset: 0; } }
.unterzeile {
  margin: 0;
  font-family: var(--hand);
  font-size: 1.55rem;
  color: rgba(59, 42, 30, .85);
  animation: rein .9s .2s var(--weich) both;
}
@keyframes rein {
  from { opacity: 0; translate: 0 -10px; }
}

/* --------------------------------------------------------------- doors */

.kalender {
  --zelle: calc((min(100vw, 1000px) - 2 * var(--rand) - (var(--sp) - 1) * var(--luecke)) / var(--sp));
  display: grid;
  grid-template-columns: repeat(var(--sp), 1fr);
  grid-auto-rows: var(--zelle);
  grid-auto-flow: dense;
  gap: var(--luecke);
}

.tuer {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
  rotate: var(--kipp);
  -webkit-tap-highlight-color: transparent;
  animation: hinlegen .7s calc(var(--i) * 35ms + .3s) var(--weich) both;
}
@keyframes hinlegen {
  from { opacity: 0; transform: translateY(-14px) scale(.96); }
}
.tuer-breit { grid-column: span 2; }
.tuer-gross { grid-column: span 2; grid-row: span 2; }
.tuer:focus-visible { outline: 3px dashed var(--stift); outline-offset: 5px; border-radius: 4px; }

/* The hole in the cardboard behind each door. */
.loch {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: url(papier.svg) 0 0 / 300px, #f3e8d0;
  box-shadow:
    inset 0 3px 7px rgba(50, 28, 10, .45),
    inset 0 0 0 1px rgba(80, 50, 25, .35);
}
.kritzel {
  width: 52%;
  height: 52%;
  max-width: 120px;
  fill: none;
  stroke: var(--stift);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#krakel);
  opacity: .8;
}

.klappe {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform-style: preserve-3d;
  transition: transform .2s ease;
}
.vorne,
.hinten {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* slightly uneven edges, like cut with scissors */
  clip-path: polygon(0.6% 1.2%, 34% 0, 71% 0.9%, 99.4% 0, 100% 37%, 99.2% 72%, 100% 99.3%, 64% 100%, 28% 99.1%, 0 100%, 0.8% 63%, 0 28%);
}
.vorne {
  display: grid;
  place-items: center;
  background: url(papier.svg) 0 0 / 300px, var(--farbe);
  box-shadow: inset 0 0 0 100vmax rgba(255, 255, 255, .04);
}
.hinten {
  transform: rotateY(180deg);
  background: url(papier.svg) 0 0 / 300px, #e9dcc0;
}
.tuer::after {
  /* shadow of the closed door on the cardboard */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 3px;
  box-shadow: 0 3px 5px rgba(50, 28, 10, .35), 0 8px 18px rgba(50, 28, 10, .18);
  transition: opacity .3s ease;
}
.nummer {
  font-family: var(--hand);
  font-weight: 700;
  font-size: calc(var(--zelle) * .5);
  line-height: 1;
  color: #fff8ec;
  rotate: calc(var(--kipp) * -3);
  text-shadow: 1px 2px 0 rgba(0, 0, 0, .18);
  user-select: none;
}
.tuer-gross .nummer { font-size: calc(var(--zelle) * .95); }
.tuer-breit .nummer { font-size: calc(var(--zelle) * .55); }

/* A strip of tape keeps unopened doors shut. */
.tesa {
  position: absolute;
  width: 22px;
  height: 46%;
  right: -9px;
  top: 27%;
  background: rgba(255, 246, 205, .55);
  box-shadow: 0 1px 2px rgba(60, 40, 10, .18);
  rotate: 4deg;
  clip-path: polygon(0 4%, 18% 0, 40% 5%, 62% 0, 84% 4%, 100% 0, 100% 96%, 80% 100%, 58% 95%, 35% 100%, 15% 96%, 0 100%);
  pointer-events: none;
}
.tuer-gross .tesa { height: 30%; top: 35%; width: 28px; }

@media (hover: hover) {
  .tuer:hover .klappe { transform: rotateY(-7deg); }
  .tuer:not(.ist-dran):hover .klappe { transform: rotateY(-2deg); }
}

.tuer.ist-offen .tesa { display: none; }
.tuer.ist-offen .klappe { transform: rotateY(-112deg); }
.tuer.ist-offen::after { opacity: 0; }
.tuer.ist-offen { z-index: 1; }
@media (hover: hover) {
  .tuer.ist-offen:hover .klappe { transform: rotateY(-104deg); }
}

.tuer.rappelt .klappe { animation: rappeln .5s ease; }
@keyframes rappeln {
  0%, 100% { transform: none; }
  20% { transform: rotateY(-4deg); }
  40% { transform: rotateY(1deg); }
  60% { transform: rotateY(-2.5deg); }
  80% { transform: rotateY(.5deg); }
}

/* ------------------------------------------------------------ snow */

.schnee {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.flocke {
  position: absolute;
  top: -20px;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  background: #fffaf0;
  opacity: .75;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  animation: fallen var(--d) var(--delay) linear infinite;
}
.flocke.rund { clip-path: none; border-radius: 47% 53% 44% 56%; }
@keyframes fallen {
  from { transform: translate(0, 0) rotate(0); }
  50% { transform: translate(var(--wind), 55vh) rotate(180deg); }
  to { transform: translate(0, 110vh) rotate(360deg); }
}
.seite { position: relative; z-index: 1; }

/* ------------------------------------------------- stage for animations */

.buehne {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}
.schnipsel {
  position: absolute;
  width: var(--w);
  height: var(--h);
  background: var(--c);
  border-radius: 1px;
}

/* ---------------------------------------------------------- note sheet */

.zettel-huelle {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(40, 24, 10, 0);
  transition: background .5s ease;
}
.zettel-huelle.ist-da { background: rgba(40, 24, 10, .55); }
.zettel-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(40px, 7vh) 16px 60px;
}
.zettel {
  --kaestchen: 26px;
  position: relative;
  width: min(560px, 100%);
  min-height: 300px;
  margin: 0 auto;
  padding: calc(var(--kaestchen) * 2) calc(var(--kaestchen) * 1.5) calc(var(--kaestchen) * 2);
  background:
    linear-gradient(90deg, transparent calc(var(--kaestchen) - 1px), rgba(90, 140, 190, .28) 0) 0 0 / var(--kaestchen) var(--kaestchen),
    linear-gradient(transparent calc(var(--kaestchen) - 1px), rgba(90, 140, 190, .28) 0) 0 0 / var(--kaestchen) var(--kaestchen),
    url(papier.svg) 0 0 / 300px,
    var(--creme);
  box-shadow: 0 2px 3px rgba(40, 24, 10, .25), 0 18px 40px rgba(20, 10, 0, .35);
  rotate: -1deg;
  opacity: 0;
}
.zettel-huelle.ist-da .zettel { opacity: 1; }
.zettel .tesa {
  width: 96px;
  height: 30px;
  top: -13px;
  right: auto;
  rotate: -8deg;
  background: rgba(255, 246, 205, .7);
}
.zettel .tesa-l { left: -18px; }
.zettel .tesa-r { right: -18px; left: auto; rotate: 9deg; }

.zu {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--hand);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--stift);
  cursor: pointer;
  transition: transform .2s ease;
}
.zu:hover { transform: rotate(90deg); }
.zu:focus-visible { outline: 2px dashed var(--stift); border-radius: 50%; }

.zettel-tag {
  margin: 0;
  font-family: var(--hand);
  font-size: 1.5rem;
  line-height: var(--kaestchen);
  color: var(--rot);
}
.zettel h2 {
  margin: 0 0 var(--kaestchen);
  font-family: var(--hand);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: calc(var(--kaestchen) * 2);
}
.zettel-text {
  font-size: 1.2rem;
  line-height: var(--kaestchen);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.zettel-text a {
  color: #2f5d8a;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.zettel-medien {
  display: grid;
  gap: 22px;
  margin-top: var(--kaestchen);
}
.zettel-medien:empty { display: none; }
.polaroid {
  justify-self: center;
  max-width: 100%;
  margin: 0;
  padding: 10px 10px 34px;
  background: #fffdf8;
  box-shadow: 0 2px 4px rgba(40, 24, 10, .25), 0 8px 18px rgba(40, 24, 10, .15);
  rotate: 1.5deg;
}
.polaroid:nth-child(even) { rotate: -2deg; }
.polaroid img,
.polaroid video {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  height: auto;
}
.zettel-medien audio { width: 100%; }

/* -------------------------------------------------------- sticky note */

.notiz {
  position: fixed;
  z-index: 40;
  left: 0;
  top: 0;
  width: 170px;
  padding: 16px 14px 18px;
  background: #fbe57a;
  color: var(--stift);
  font-family: var(--hand);
  font-size: 1.45rem;
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 2px 3px rgba(40, 24, 10, .25), 0 10px 20px rgba(40, 24, 10, .2);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .schnee { display: none; }
}
