/* The "bad website" intro. A joke layer that intro.js plays on top of the real page on every page load.
   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: hidden;
  color: #000;
  font: 16px/1.3 "Times New Roman", Times, serif;
  -webkit-font-smoothing: auto;
}
.bad *, .bad *::before, .bad *::after { box-sizing: border-box; }

/* The ugly site itself. The sweep uncovers the real page by clipping this box from the left. */
.bad-site { position: absolute; inset: 0; overflow: hidden; isolation: isolate; }

/* 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 128px;
}

/* 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; }

/* 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: 4; min-height: 40px; margin: 0; padding: 8px 14px; 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 pinned near the bottom: clean and readable, so it clearly is not part of the ugly site */
.bad-caption { position: fixed; right: 16px; bottom: 62px; left: 16px; z-index: 3; width: fit-content; max-width: 34em; margin: 0 auto; padding: 14px 20px; background: #fff; border-radius: 4px; box-shadow: 0 14px 44px rgba(0, 0, 0, .4); color: #0f1115; font: 600 clamp(1.05rem, 4.5vw, 1.5rem)/1.2 "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: -.02em; text-align: center; pointer-events: none; -webkit-font-smoothing: antialiased; }

/* The sweep line, the cursor and its click ripple. Hidden until their moment. */
.bad-line { position: fixed; top: 0; bottom: 0; left: -3px; z-index: 2; width: 6px; background: #fff; box-shadow: 0 0 0 1px rgba(47, 91, 255, .7), 0 0 26px 7px rgba(47, 91, 255, .8), 0 0 70px 16px rgba(255, 255, 255, .55); opacity: 0; pointer-events: none; }
.bad-cursor { position: fixed; top: 50%; left: 50%; z-index: 5; width: 30px; opacity: 0; pointer-events: none; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .45)); }
.bad-cursor svg { display: block; width: 100%; height: auto; transform-origin: 12% 8%; }
.bad-ripple { position: fixed; top: 50%; left: 50%; z-index: 4; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #2f5bff, inset 0 0 0 2px #2f5bff; opacity: 0; pointer-events: none; }

/* ---------- The sequence (about 3.5 seconds). intro.js uses the same times. ----------
   0s      the ugly site, first caption
   1.2s    second caption; the cursor glides in from the corner and clicks the middle
   1.5s    the line sweeps left to right for 1.7s; the real page shows behind it, the ugly one stays ahead of it
   3.5s    intro.js removes the layer */
.bad.is-playing .bad-site { animation: bad-wipe 1.7s 1.5s linear forwards; }
.bad.is-playing .bad-line { animation: bad-line 2s 1.5s linear forwards; }
.bad.is-playing .bad-cursor { animation: bad-cursor .9s 1.2s ease-out forwards; }
.bad.is-playing .bad-cursor svg { animation: bad-press .9s 1.2s ease-out forwards; }
.bad.is-playing .bad-ripple { animation: bad-ripple .65s 1.45s ease-out forwards; }
.bad.is-playing .bad-caption, .bad.is-playing .bad-skip { animation: bad-fade .3s 3.15s ease forwards; }
.bad-caption.is-new { animation: bad-caption-in .35s cubic-bezier(.2, .7, .2, 1); }
.bad.is-playing .bad-caption.is-new { animation: bad-caption-in .35s cubic-bezier(.2, .7, .2, 1), bad-fade .3s 3.15s ease forwards; animation-delay: 0s, 3.15s; }
/* Ugly pieces drop or shrink just before the line reaches them (intro.js sets --d for each one) */
.bad.is-playing [data-out] { animation: bad-pop .55s var(--d, 1.5s) ease-in forwards; }
.bad.is-playing [data-out="fall"] { animation-name: bad-fall; }
.bad.is-playing [data-out="spin"] { animation-name: bad-spin; }

@keyframes bad-wipe { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 0 100%); } }
@keyframes bad-line { 0% { opacity: 1; transform: translateX(0); } 85% { opacity: 1; transform: translateX(100vw); } 100% { opacity: 0; transform: translateX(100vw); } }
@keyframes bad-cursor { 0% { opacity: 0; transform: translate(42vw, 44vh); } 8% { opacity: 1; } 30% { opacity: 1; transform: translate(0, 0); } 75% { opacity: 1; transform: translate(0, 0); } 100% { opacity: 0; transform: translate(0, 0); } }
@keyframes bad-press { 0%, 28% { transform: scale(1); } 36% { transform: scale(.78); } 46%, 100% { transform: scale(1); } }
@keyframes bad-ripple { 0% { opacity: .95; transform: scale(.2); } 100% { opacity: 0; transform: scale(5.5); } }
@keyframes bad-caption-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes bad-fade { to { opacity: 0; } }
@keyframes intro-in { from { opacity: 0; } }
@keyframes bad-fall { 15% { transform: translateY(-6px) rotate(-3deg); } to { transform: translateY(60vh) rotate(18deg) scale(.7); opacity: 0; } }
@keyframes bad-spin { to { transform: scale(0) rotate(540deg); opacity: 0; } }
@keyframes bad-pop { 20% { transform: scale(1.05); } to { transform: scale(.3); opacity: 0; } }

/* Reduced motion: no cursor, no sweep, no falling pieces. The ugly site holds for a second, then cross-fades away. */
.bad.is-fading .bad-site, .bad.is-fading .bad-skip, .bad.is-fading .bad-caption { opacity: 0; transition: opacity .5s ease; }

@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-caption.is-new { animation: 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: 136px; }
  .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-photo { width: 136px; }
  .bad-photo div { height: 84px; }
  .bad-row { gap: 10px 34px; }
}
