/* Clippy: de paperclip van Jeroen, overgenomen uit zijn eigen ontwerp in de cockpit
   (18-10-2026): oogjes die knipperen en de muis volgen, wiebelen, blij, rustig en verveeld.
   Op de portfolio staat hij rechts onderin en praat hij over wat je op de pagina doet. */
.clippy {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 70;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  width: 84px;
  height: 96px;
  background: none;
  border: 0;
  overflow: visible;
}
.clippy:focus-visible, .hulp-ballon-weg:focus-visible { outline: 3px solid #4f7cff; outline-offset: 2px; }

.clippy-klem {
  display: block;
  transform-origin: 50% 85%;
  /* Een wiebel en een knik, om de 9 seconden; de rest van de tijd staat hij stil en kijkt. */
  animation: hulp-klem 9s ease-in-out 2s infinite;
}
.clippy:hover .clippy-klem,
.clippy:focus-visible .clippy-klem,
.clippy.open .clippy-klem {
  animation: none;
}
/* Het gezicht: het draadje in de kleur van het merk, witte oogjes, een mondje. */
.hulp-draad {
  stroke: #2563eb;
  stroke-width: 3.2;
}
.hulp-wit {
  fill: #fff;
  stroke: #1e3a8a;
  stroke-width: .7;
}
.hulp-pupil {
  fill: #0b1f33;
  /* De pupillen volgen de muis; clippy.js zet --kijk-x en --kijk-y (in eenheden, max ±1,3). */
  transform: translate(calc(var(--kijk-x, 0) * 1px), calc(var(--kijk-y, 0) * 1px));
  transition: transform .18s ease-out;
}
.hulp-mond,
.hulp-oog-blij path {
  stroke: #0b1f33;
  stroke-width: 1.15;
  fill: none;
}
.hulp-mond-blij {
  fill: #0b1f33;
  stroke: none;
}
/* Knipperen: het hele oogpaar klapt even dicht, ruim 5 seconden na de vorige keer. */
.hulp-ogen {
  transform-box: fill-box;
  transform-origin: 50% 55%;
  animation: hulp-knip 5.4s ease-in-out infinite;
}
/* Stemmingen. Standaard (normaal): lachend mondje, ogen open. */
.hulp-mond-rustig,
.hulp-mond-blij,
.hulp-oog-blij {
  display: none;
}
/* Rustig: het paneel is open en er is nog niets te zeggen. Halfdichte ogen, klein mondje, geen wiebel. */
.clippy[data-stemming="rustig"] .hulp-mond-gewoon {
  display: none;
}
.clippy[data-stemming="rustig"] .hulp-mond-rustig {
  display: inline;
}
.clippy[data-stemming="rustig"] .hulp-oog-vol {
  transform-box: fill-box;
  transform-origin: 50% 40%;
  transform: scaleY(.62);
}
.clippy[data-stemming="rustig"] .hulp-ogen {
  animation-duration: 8s;
}
/* Blij: er is een antwoord. Lachende oogjes, open mond, een klein huppeltje. */
.clippy[data-stemming="blij"] .hulp-oog-vol,
.clippy[data-stemming="blij"] .hulp-mond-gewoon {
  display: none;
}
.clippy[data-stemming="blij"] .hulp-oog-blij,
.clippy[data-stemming="blij"] .hulp-mond-blij {
  display: inline;
}
.clippy[data-stemming="blij"] .hulp-ogen {
  animation: none;
}
.clippy[data-stemming="blij"] .clippy-klem {
  animation: hulp-blij .55s ease-in-out 3;
}
/* Verveeld: je bent al een tijd weg. Halfdichte ogen die rondkijken, een vlak mondje en af en
   toe een gaap; hij wiegt langzaam heen en weer. Zodra je weer iets doet is hij blij. */
.hulp-mond-vlak,
.hulp-mond-gaap {
  display: none;
}
.hulp-mond-gaap {
  fill: #0b1f33;
  stroke: none;
}
.clippy[data-stemming="verveeld"] .hulp-mond-gewoon,
.clippy[data-stemming="verveeld"] .hulp-mond-rustig {
  display: none;
}
.clippy[data-stemming="verveeld"] .hulp-mond-vlak {
  display: inline;
  animation: hulp-vlak 7s ease-in-out infinite;
}
.clippy[data-stemming="verveeld"] .hulp-mond-gaap {
  display: inline;
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: hulp-gaap 7s ease-in-out infinite;
}
.clippy[data-stemming="verveeld"] .hulp-oog-vol {
  transform-box: fill-box;
  transform-origin: 50% 35%;
  transform: scaleY(.5);
}
.clippy[data-stemming="verveeld"] .hulp-pupil {
  animation: hulp-rondkijken 6s ease-in-out infinite;
}
.clippy[data-stemming="verveeld"] .hulp-ogen {
  animation-duration: 9s;
}
.clippy[data-stemming="verveeld"] .clippy-klem {
  animation: hulp-suf 8s ease-in-out infinite;
}
.clippy[data-stemming="verveeld"].open .clippy-klem,
.clippy[data-stemming="verveeld"]:hover .clippy-klem {
  animation: hulp-suf 8s ease-in-out infinite;
}
/* De tekstballon van de paperclip: de mop van de dag en wat hij zegt als hij zich verveelt. */
.hulp-ballon {
  position: fixed;
  right: 30px;
  bottom: 108px;
  max-width: 290px;
  z-index: 95;
  background: var(--vlak);
  color: var(--inkt);
  border: 1px solid var(--lijn);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 28px 11px 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .22);
  font-size: .95rem;
  line-height: 1.5;
  cursor: pointer;
  animation: hulp-ballon-in .28s ease-out;
}
.hulp-ballon::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  background: var(--vlak);
  border-right: 1px solid var(--lijn);
  border-bottom: 1px solid var(--lijn);
  transform: rotate(45deg);
}
.hulp-ballon-kop {
  font-size: .8rem;
  font-weight: 600;
  color: #2563eb;
  margin-bottom: 2px;
}
.hulp-ballon-actie {
  display: inline-block;
  margin-top: 6px;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}
.hulp-ballon-actie:hover {
  text-decoration: underline;
}
.hulp-ballon-weg {
  position: absolute;
  top: 4px;
  right: 6px;
  background: none;
  border: 0;
  color: var(--grijs);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 12px;
}
.hulp-ballon-weg:hover {
  background: var(--papier);
}

@keyframes hulp-knip {
  0%, 90%, 100% { transform: scaleY(1); }
  93% { transform: scaleY(.08); }
  96% { transform: scaleY(1); }
}
@keyframes hulp-gaap {
  0%, 68%, 94%, 100% { opacity: 0; transform: scale(.3); }
  76% { opacity: 1; transform: scale(1.1); }
  84% { opacity: 1; transform: scale(1.35); }
  90% { opacity: 1; transform: scale(.9); }
}
@keyframes hulp-suf {
  0%, 100% { transform: rotate(0) translateY(0); }
  30% { transform: rotate(-4deg) translateY(1px); }
  65% { transform: rotate(3deg) translateY(0); }
}
@keyframes hulp-ballon-in {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes hulp-rondkijken {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1.2px, -.9px); }
  55% { transform: translate(1.2px, -.6px); }
  80% { transform: translate(.3px, .9px); }
}
@keyframes hulp-klem {
  0%, 56%, 100% { transform: rotate(0) translateY(0); }
  60% { transform: rotate(-9deg) translateY(-1px); }       /* wiebel */
  65% { transform: rotate(8deg) translateY(-2px); }
  70% { transform: rotate(-4deg) translateY(-1px); }
  75% { transform: rotate(0) translateY(0); }
  82% { transform: rotate(0) translateY(2px); }            /* knik */
  86% { transform: rotate(0) translateY(-1px); }
  90% { transform: rotate(0) translateY(0); }
}
@keyframes hulp-blij {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-4px) rotate(-6deg); }
  65% { transform: translateY(-1px) rotate(5deg); }
}
@keyframes hulp-vlak {
  0%, 68%, 94%, 100% { opacity: 1; }
  72%, 90% { opacity: 0; }
}
/* De ballon staat boven Clippy, rechts onderin, met het puntje naar hem toe. */
.hulp-ballon { right: 1.4rem; bottom: 6.4rem; z-index: 71; }
.licht-uit .clippy { box-shadow: 0 0 0 2px #ffd84d, 0 0 26px rgba(255, 216, 77, .5); }
@media (prefers-reduced-motion: reduce) {
  .clippy-klem, .hulp-ogen, .hulp-pupil, .hulp-mond-vlak, .hulp-mond-gaap, .hulp-ballon { animation: none !important; }
}
@media (max-width: 540px) { .clippy { width: 60px; height: 60px; right: .7rem; bottom: .7rem; } .hulp-ballon { right: .8rem; bottom: 5.4rem; max-width: 80vw; } }

/* ---- het chatvenster: Office 97 — grijs venster, blauwe titelbalk, gele ballon ---- */
.clippy-chat {
  --w98: "Tahoma", "MS Sans Serif", "Segoe UI", Geneva, Verdana, sans-serif;
  position: fixed;
  right: 1.1rem;
  bottom: 7.4rem;
  z-index: 72;
  width: min(22rem, calc(100vw - 2rem));
  background: #c0c0c0;
  color: #000;
  font: 13px/1.4 var(--w98);
  padding: 3px;
  border: 1px solid;
  border-color: #dfdfdf #000 #000 #dfdfdf;
  box-shadow: inset 1px 1px #fff, inset -1px -1px #808080, 6px 8px 0 rgba(0, 0, 0, .25);
  animation: hulp-ballon-in .2s steps(3);
}
.clippy-chat[hidden] { display: none; }
.chat-kop {
  display: flex; align-items: center; height: 22px; padding: 0 3px 0 5px;
  background: linear-gradient(90deg, #000080, #1084d0); color: #fff; font-weight: 700;
}
.chat-titel { flex: 1; font-size: 12px; }
.chat-dicht {
  width: 18px; height: 16px; padding: 0; font: 700 11px/1 var(--w98); color: #000; background: #c0c0c0; cursor: pointer;
  border: 1px solid; border-color: #fff #000 #000 #fff; box-shadow: inset -1px -1px #808080;
}
.chat-dicht:active { border-color: #000 #fff #fff #000; box-shadow: inset 1px 1px #808080; }
.chat-ballon {
  position: relative;
  margin: 8px 6px 6px;
  padding: 10px 10px 8px;
  background: #ffffe1;
  border: 1px solid #000;
  border-radius: 12px;
}
.chat-berichten { max-height: min(17rem, 42vh); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.chat-berichten:empty { display: none; }
.chat-bericht { padding: 0; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-bericht.van-clippy::before { content: "📎 "; }
.chat-bericht.jij { color: #000080; font-weight: 700; }
.chat-bericht.jij::before { content: "» "; }
.chat-bericht.denkt { color: #808080; font-style: italic; }
.chat-vraag { margin: 8px 0 4px; font-weight: 700; }
.chat-invoer textarea {
  width: 100%; resize: none; font: 13px var(--w98); font-size: max(13px, 16px * 0); padding: 3px 4px; color: #000; background: #fff;
  border: 2px solid; border-color: #808080 #fff #fff #808080; box-shadow: inset 1px 1px #000; border-radius: 0;
}
@media (pointer: coarse) { .chat-invoer textarea { font-size: 16px; } }
.chat-invoer textarea:focus { outline: 1px dotted #000; outline-offset: -4px; }
.chat-knoppen { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.chat-knoppen button {
  min-width: 72px; height: 23px; font: 13px var(--w98); color: #000; background: #c0c0c0; cursor: pointer;
  border: 1px solid; border-color: #fff #000 #000 #fff; box-shadow: inset -1px -1px #808080, inset 1px 1px #dfdfdf;
}
.chat-knoppen button:active { border-color: #000 #fff #fff #000; box-shadow: inset 1px 1px #808080; }
.chat-knoppen button:focus-visible { outline: 1px dotted #000; outline-offset: -5px; }
.chat-voet { margin: 6px 0 0; font-size: 11px; color: #555; }
@media (max-width: 540px) { .clippy-chat { right: .5rem; left: .5rem; width: auto; bottom: 6.6rem; } }

/* ---- creatiever: zilveren draad zoals de echte uit Word, schaduw, petje overdag, slaapmuts 's nachts, kunstjes ---- */
.clippy .clippy-klem { width: 84px; height: 110px; overflow: visible; filter: drop-shadow(0 6px 8px rgba(15, 23, 42, .25)); }
.clippy .draad-rand { stroke: #4b5563; stroke-width: 4.6; }
.clippy .hulp-draad { stroke: url(#draadkleur); stroke-width: 3; }
.clippy-schaduw { fill: rgba(15, 23, 42, .18); }
.pet-kap { fill: #ffcf33; stroke: #14182b; stroke-width: .7; }
.pet-klep { stroke: #ff5a36; stroke-width: 2.2; }
.pet-stok { stroke: #14182b; stroke-width: .9; }
.propeller ellipse { fill: #ff5a36; }
.propeller { transform-box: fill-box; transform-origin: center; }
.muts { display: none; }
.muts-stof { fill: #3b4cc0; stroke: #14182b; stroke-width: .6; }
.muts-rand { stroke: #fff; stroke-width: 2.6; }
.muts-bol { fill: #fff; }
.zzz text { font: 800 5px var(--kop); fill: #7db8ff; opacity: 0; }
.nacht .pet { display: none; }
.nacht .muts { display: inline; }
.nacht .clippy .hulp-oog-vol { transform-box: fill-box; transform-origin: 50% 40%; transform: scaleY(.45); }
.licht-uit .clippy .clippy-klem { filter: drop-shadow(0 0 10px rgba(255, 216, 77, .8)); }
@media (prefers-reduced-motion: no-preference) {
  .propeller { animation: propeller .35s linear infinite; }
  @keyframes propeller { 0% { transform: scaleX(1); } 50% { transform: scaleX(.15); } 100% { transform: scaleX(1); } }
  .zzz text { animation: zzz 3s ease-in infinite; }
  .zzz text:nth-child(2) { animation-delay: 1s; } .zzz text:nth-child(3) { animation-delay: 2s; }
  @keyframes zzz { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(3px, -6px); } }
  .clippy { animation: binnenhuppen .9s cubic-bezier(.3, 1.6, .5, 1) .4s both; }
  @keyframes binnenhuppen { from { transform: translateY(140px) rotate(25deg); } }
  .clippy.kunstje-salto .clippy-klem { animation: salto .9s cubic-bezier(.5, -.4, .5, 1.4); }
  @keyframes salto { 40% { transform: translateY(-40px) rotate(-180deg); } 100% { transform: translateY(0) rotate(-360deg); } }
  .clippy.kunstje-stuiter .clippy-klem { animation: stuiter .9s ease-out; }
  @keyframes stuiter { 20% { transform: translateY(-26px) scaleY(1.05); } 40% { transform: translateY(0) scaleY(.85) scaleX(1.12); } 55% { transform: translateY(-12px); } 75% { transform: translateY(0) scaleY(.95); } }
  .clippy.kunstje-zwaai .clippy-klem { animation: zwaai 1s ease-in-out; transform-origin: 50% 90%; }
  @keyframes zwaai { 20%, 60% { transform: rotate(-14deg); } 40%, 80% { transform: rotate(14deg); } }
}

/* Clippy speelt elektrische gitaar: het gitaartje verschijnt, hij headbangt, er vliegen noten. */
.gitaar { display: none; }
.clippy.speelt .gitaar { display: inline; }
.gitaar-body { fill: #e11d48; stroke: #14182b; stroke-width: .6; }
.gitaar-hals { stroke: #7c4a1e; stroke-width: 1.6; }
.gitaar-kop { fill: #14182b; }
.gitaar-snaar { stroke: #f8fafc; stroke-width: .3; }
.clippy::after { content: "♫"; position: absolute; top: -.2rem; left: .2rem; font-size: 1.3rem; color: #e11d48; opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .clippy.speelt .clippy-klem { animation: headbangen .32s ease-in-out infinite alternate; transform-origin: 50% 90%; }
  @keyframes headbangen { from { rotate: -9deg; translate: 0 1px; } to { rotate: 7deg; translate: 0 -2px; } }
  .clippy.speelt::after { animation: noot 1s ease-out infinite; }
  @keyframes noot { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-16px, -34px) rotate(-25deg); } }
}

/* ---- de tijdmachine: verschijnt waar Clippy staat, teller telt de jaren, flits, weg ---- */
.tijdmachine {
  position: fixed; right: .4rem; bottom: .6rem; z-index: 69; width: 104px;
  display: none; justify-items: center; pointer-events: none;
}
.tijdmachine.actief { display: grid; }
.tm-teller {
  font: 700 15px/1 "Courier New", ui-monospace, monospace; color: #39ff14; background: #0b0f0a;
  padding: .3rem .5rem; border-radius: 4px; border: 2px solid #3a3f3a; letter-spacing: .08em;
  text-shadow: 0 0 6px #39ff14; margin-bottom: .2rem;
}
.tm-machine { width: 104px; height: auto; overflow: visible; }
.tm-vloer { fill: rgba(15, 23, 42, .22); }
.tm-kast { fill: #9ca3af; stroke: #374151; stroke-width: 3; }
.tm-raam { fill: #0ea5e9; stroke: #374151; stroke-width: 3; opacity: .85; }
.tm-lamp { fill: #374151; }
.tm-hendel { fill: #ef4444; }
.tm-antenne { stroke: #374151; stroke-width: 3; }
.tm-bol { fill: #ffcf33; }
.tm-bliksem path { fill: none; stroke: #ffcf33; stroke-width: 3; stroke-linejoin: round; opacity: 0; }
.tm-flits { position: absolute; inset: -40px; border-radius: 50%; background: radial-gradient(circle, #fff 0, rgba(255, 255, 255, .8) 30%, transparent 65%); opacity: 0; }
.tijdmachine.reist .tm-raam { animation: raam .25s steps(2) infinite; }
.tijdmachine.reist .tm-lamp.l1 { animation: lampje .4s steps(1) infinite; }
.tijdmachine.reist .tm-lamp.l2 { animation: lampje .4s steps(1) .1s infinite; }
.tijdmachine.reist .tm-lamp.l3 { animation: lampje .4s steps(1) .2s infinite; }
.tijdmachine.reist .tm-lamp.l4 { animation: lampje .4s steps(1) .3s infinite; }
.tijdmachine.reist .tm-bliksem path { animation: bliksem .3s steps(2) infinite; }
.tijdmachine.reist .tm-machine { animation: trillen .08s linear infinite; }
.tijdmachine.flitst .tm-flits { animation: flits .6s ease-out; }
.tijdmachine.in { animation: tm-in .45s cubic-bezier(.3, 1.6, .5, 1); }
.tijdmachine.uit { animation: tm-uit .4s ease-in forwards; }
@keyframes raam { 50% { fill: #a855f7; } }
@keyframes lampje { 0% { fill: #22c55e; } 50% { fill: #ef4444; } }
@keyframes bliksem { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes trillen { 25% { translate: -1px 0; } 75% { translate: 1px 0; } }
@keyframes flits { 0% { opacity: 0; scale: .3; } 30% { opacity: 1; } 100% { opacity: 0; scale: 1.4; } }
@keyframes tm-in { from { scale: 0; opacity: 0; } }
@keyframes tm-uit { to { scale: 0; opacity: 0; } }
/* Clippy stapt in en uit */
.clippy { transition: opacity .3s ease, scale .3s ease; }
.clippy.weg { opacity: 0; scale: .2; pointer-events: none; }
.clippy.verschijnt { transition: opacity 1.4s ease, scale 1.4s cubic-bezier(.3, 1.4, .5, 1); }

/* Zonder stroom en tijdens het opstarten is Clippy er niet, wat er ook gebeurt. */
.stroomloos-aan .clippy, .uitvallen .clippy, .herstart .clippy, .stroomloos-aan .tijdmachine, .herstart .tijdmachine { visibility: hidden !important; }

/* Vangnet: is Clippy weg (tijdmachine, stroom eraf), dan hangt er ook geen ballon in de lucht. */
.clippy.weg ~ .hulp-ballon { display: none !important; }

/* Half geladen (na een kapotte start): alleen de onderste helft, grijs en haperend. */
.clippy.half .clippy-klem { clip-path: inset(48% 0 0 0); filter: grayscale(1) contrast(1.3) drop-shadow(3px 0 0 rgba(255, 0, 80, .6)) drop-shadow(-3px 0 0 rgba(0, 200, 255, .6)); }
.clippy.half::before {
  content: "LADEN… 47%"; position: absolute; top: 18%; left: 50%; translate: -50% 0; white-space: nowrap;
  font: 700 10px "Courier New", monospace; color: #fff; background: #0000aa; padding: 1px 4px;
}
@media (prefers-reduced-motion: no-preference) {
  .clippy.half .clippy-klem { animation: half-haperen 1.3s steps(1) infinite; }
  @keyframes half-haperen { 0%, 70% { translate: 0 0; } 72% { translate: 4px 0; clip-path: inset(30% 0 20% 0); } 76% { translate: -3px 2px; } 80% { translate: 0 0; clip-path: inset(48% 0 0 0); } }
}
