/* The "bad website" intro. A joke layer that intro.js puts on top of the real page on a first visit.
   Everything here starts with .bad or .intro so it cannot touch the real portfolio's styles. */

html.intro-on { overflow: hidden; }

.bad {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #000;
  font: 16px/1.3 "Times New Roman", Times, serif;
  -webkit-font-smoothing: auto;
}
.bad *, .bad *::before, .bad *::after { box-sizing: border-box; }

/* Tiled busy background */
.bad-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: #008080;
  background-image:
    radial-gradient(circle, #ffff00 0 5px, transparent 6px),
    radial-gradient(circle, #ff00ff 0 4px, transparent 5px),
    linear-gradient(45deg, rgba(0, 0, 128, .35) 25%, transparent 25% 75%, rgba(0, 0, 128, .35) 75%);
  background-size: 44px 44px, 44px 44px, 22px 22px;
  background-position: 0 0, 22px 22px, 0 0;
}

.bad-page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 760px;
  min-height: 100%;
  margin: 0 auto;
  padding: 0 8px 58px;
}

/* Scrolling welcome line */
.bad-marquee { width: 100%; overflow: hidden; background: #000080; border: 3px ridge #c0c0c0; color: #ffff00; font: bold 15px/1.5 "Courier New", Courier, monospace; white-space: nowrap; }
.bad-marquee span { display: inline-block; padding-left: 100%; animation: bad-marquee 13s linear infinite; }
@keyframes bad-marquee { to { transform: translateX(-100%); } }

/* Word-art title */
.bad-title-wrap { position: relative; width: 100%; padding: 4px 0; text-align: center; }
.bad-title {
  display: inline-block;
  margin: 0;
  rotate: -3deg;
  background: linear-gradient(90deg, #ff0000, #ff9900, #ffff00, #33ff00, #00ffff, #3366ff, #ff00ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px #000080;
  filter: drop-shadow(3px 3px 0 #000);
  font: bold clamp(2.1rem, 11vw, 4.6rem)/1 "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Comic Neue", cursive;
  letter-spacing: -.01em;
}
.bad-new { position: absolute; right: 2px; bottom: -14px; z-index: 1; width: 62px; height: 62px; rotate: 14deg; }
.bad-new svg { display: block; width: 100%; height: 100%; animation: bad-wobble 1s steps(2) infinite; }
@keyframes bad-wobble { 50% { transform: rotate(-12deg) scale(1.08); } }

/* Under construction */
.bad-construction { display: flex; align-items: center; justify-content: center; gap: 8px; width: 96%; margin-left: -6px; padding: 5px 6px; background: #ffd500; border-top: 10px solid; border-bottom: 10px solid; border-image: repeating-linear-gradient(45deg, #000 0 10px, #ffd500 10px 20px) 10; color: #000; font: bold 15px/1.2 Arial, Helvetica, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.bad-construction svg { flex: none; width: 24px; height: 21px; }

/* Table layout */
.bad-table { width: 100%; border: 4px ridge #ff00ff; border-collapse: separate; border-spacing: 3px; background: #c0c0c0; }
.bad-table td { padding: 6px; border: 2px inset #fff; vertical-align: top; }
.bad-links { width: 34%; background: #00ff00; }
.bad-links b { display: block; margin-bottom: 2px; color: #ff0000; font: bold 15px "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive; text-decoration: underline; }
.bad-links span { display: block; color: #0000ee; font-size: 15px; text-decoration: underline; }
.bad-links span:nth-child(odd) { color: #551a8b; }
.bad-links span:nth-child(3) { padding-left: 9px; }
.bad-links span:nth-child(5) { margin-left: -3px; font-size: 17px; }
.bad-hello { background: #ffff00; }
.bad-hello p { margin: 0 0 4px; color: #ff0000; font: bold 17px/1.2 "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive; }
.bad-hello p + p { padding-left: 14px; color: #0000ff; font: italic 14px/1.25 "Times New Roman", Times, serif; text-align: right; }
.bad-hello p + p + p { margin: 0; padding: 0 0 0 4px; color: #008000; font: bold 12px/1.2 Arial, Helvetica, sans-serif; text-align: left; text-transform: uppercase; }

/* The one good thing on the page */
.bad-cta { padding: 12px 0; }
.bad-fix {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  margin: 0;
  padding: 22px 34px;
  background: #2f5bff;
  border: 0;
  border-radius: 4px;
  box-shadow: 0 0 0 6px #fff, 0 16px 40px rgba(0, 0, 0, .5);
  color: #fff;
  cursor: pointer;
  font: 600 1.25rem/1 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  transition: background-color .18s ease;
}
.bad-fix:hover { background: #1f47e0; }
.bad-fix:focus-visible { outline: 3px solid #000; outline-offset: 9px; }

/* Bottom row: blurry photo, counter, clip art */
.bad-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; width: 100%; }
.bad-photo { flex: none; width: 104px; margin: 0 0 0 -4px; padding: 4px; background: #fff; border: 4px ridge #ff9900; rotate: 4deg; }
.bad-photo div { height: 64px; overflow: hidden; background: #6fa8dc; }
.bad-photo div::before { content: ""; display: block; width: 100%; height: 100%; background: radial-gradient(circle at 50% 38%, #f1c27d 0 15px, transparent 16px), radial-gradient(ellipse at 50% 108%, #cc0000 0 34px, transparent 35px), linear-gradient(#6fa8dc 60%, #38761d 60%); filter: blur(5px); }
.bad-photo figcaption { margin-top: 2px; color: #000; font: 11px/1.2 Arial, Helvetica, sans-serif; text-align: center; }
.bad-counter { margin: 0; color: #fff; font: bold 13px/1.4 Arial, Helvetica, sans-serif; text-align: center; text-shadow: 1px 1px 0 #000; }
.bad-digits { display: block; width: max-content; margin: 2px auto 0; padding: 2px; background: #000; border: 3px inset #c0c0c0; text-shadow: none; }
.bad-digits i { display: inline-block; min-width: 15px; margin: 0 1px; background: #111; color: #33ff00; font: bold 19px/1.2 "Courier New", Courier, monospace; }
.bad-art { display: flex; align-items: center; gap: 8px; }
.bad-art svg { display: block; width: 40px; height: 40px; }
.bad-art span { color: #ffff00; font: bold 13px/1.1 "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive; text-shadow: 1px 1px 0 #000; }

/* Corner skip link: small, plain and readable on purpose */
.bad-skip { position: fixed; right: 8px; bottom: 8px; z-index: 2; min-height: 40px; margin: 0; padding: 8px 12px; background: #fff; border: 1px solid rgba(0, 0, 0, .25); border-radius: 4px; color: #0f1115; cursor: pointer; font: 500 .85rem/1.4 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; text-decoration: underline; text-underline-offset: 3px; }
.bad-skip:focus-visible { outline: 3px solid #000; outline-offset: 2px; }

/* Caption shown during the change */
.bad-caption { position: fixed; inset: 0; z-index: 3; width: fit-content; max-width: calc(100vw - 40px); height: fit-content; margin: auto; padding: 18px 24px; background: #fff; border-radius: 4px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); color: #0f1115; font: 600 clamp(1.3rem, 5.6vw, 2rem)/1.15 "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: -.03em; text-align: center; opacity: 0; pointer-events: none; -webkit-font-smoothing: antialiased; }

/* ---------- The change: pieces leave one at a time (about 2.5 seconds in all) ---------- */
.bad.is-fixing { overflow: hidden; pointer-events: none; }
.bad.is-fixing .bad-marquee span, .bad.is-fixing .bad-new svg { animation: none; }
.bad.is-fixing [data-out] { animation: bad-fade .7s var(--d, 0ms) ease-in forwards; }
.bad.is-fixing [data-out="fall"] { animation-name: bad-fall; }
.bad.is-fixing [data-out="left"] { animation-name: bad-left; }
.bad.is-fixing [data-out="right"] { animation-name: bad-right; }
.bad.is-fixing [data-out="spin"] { animation-name: bad-spin; }
.bad.is-fixing [data-out="pop"] { animation-name: bad-pop; }
.bad.is-fixing .bad-bg { animation: bad-fade 1.1s .95s ease forwards; }
.bad.is-fixing .bad-caption { animation: bad-caption 2.1s .3s ease both; }

@keyframes bad-fade { to { opacity: 0; } }
@keyframes bad-fall { 15% { transform: translateY(-8px) rotate(-3deg); } to { transform: translateY(115vh) rotate(24deg); opacity: .8; } }
@keyframes bad-left { to { transform: translateX(-125vw) rotate(-14deg); opacity: .8; } }
@keyframes bad-right { to { transform: translateX(125vw) rotate(14deg); opacity: .8; } }
@keyframes bad-spin { to { transform: scale(0) rotate(540deg); opacity: 0; } }
@keyframes bad-pop { 20% { transform: scale(1.06); } to { transform: scale(.5); opacity: 0; } }
@keyframes bad-caption { 0% { opacity: 0; transform: translateY(12px); } 14%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }

/* The real page rises in underneath while the bad one clears */
html.intro-fixing main { animation: intro-rise 1.3s .9s cubic-bezier(.2, .7, .2, 1) both; }
html.intro-fixing .sk-header { animation: intro-in .9s 1.1s ease both; }
@keyframes intro-rise { from { opacity: 0; transform: translateY(28px); } }
@keyframes intro-in { from { opacity: 0; } }

/* Reduced motion: no flying pieces, just a cross-fade */
.bad.is-fading { pointer-events: none; }
.bad.is-fading .bad-page, .bad.is-fading .bad-bg, .bad.is-fading .bad-skip { opacity: 0; transition: opacity .8s ease; }
.bad.is-fading .bad-caption { transition: opacity .4s ease; }
.bad.is-fading .bad-caption.is-shown { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .bad-marquee { white-space: normal; text-align: center; }
  .bad-marquee span { padding-left: 0; animation: none; }
  .bad-new svg { animation: none; }
  .bad-fix { transition: none; }
}

/* ---------- Added to the real page ---------- */
.intro-note { margin: 0; padding: 6px 16px; background: var(--sk-surface, #f4f5f7); border-bottom: 1px solid var(--sk-line, rgba(15, 17, 21, .12)); color: var(--sk-text, #0f1115); font-size: .9rem; line-height: 1.4; text-align: center; animation: intro-in .6s ease both; }
.intro-note a { display: inline-block; padding: 8px 0; color: var(--sk-accent, #2f5bff); font-weight: 600; text-underline-offset: 3px; }
.intro-replay { margin: 0; padding: 10px 0; background: none; border: 0; color: inherit; cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .intro-note { animation: none; } }

@media (min-width: 700px) {
  .bad-page { gap: 14px; padding-bottom: 64px; }
  .bad-marquee { font-size: 17px; }
  .bad-new { right: 0; bottom: -44px; width: 84px; height: 84px; }
  .bad-construction { font-size: 19px; }
  .bad-links b, .bad-links span { font-size: 18px; }
  .bad-links span:nth-child(5) { font-size: 21px; }
  .bad-hello p { font-size: 22px; }
  .bad-hello p + p { font-size: 18px; }
  .bad-hello p + p + p { font-size: 14px; }
  .bad-table td { padding: 10px; }
  .bad-fix { padding: 26px 44px; font-size: 1.45rem; }
  .bad-photo { width: 136px; }
  .bad-photo div { height: 84px; }
  .bad-row { gap: 10px 34px; }
}
