/* sketchbook.css — styles for js/sketchbook.js. Loaded after style.css. */

/* ---------- Mascot ---------- */

.mascot-sticker--hero.sb-mascot,
.sb-error-mascot.sb-mascot {
  pointer-events: auto;
  cursor: pointer;
  rotate: var(--sb-lean, 0deg);
  translate: var(--sb-look-x, 0px) var(--sb-look-y, 0px);
  transition: transform .32s cubic-bezier(.16,1,.3,1), filter .32s ease, rotate .5s cubic-bezier(.16,1,.3,1), translate .5s cubic-bezier(.16,1,.3,1);
}

.sb-mascot:focus-visible {
  outline: 3px dashed var(--black, #121212);
  outline-offset: 6px;
  border-radius: 50%;
}

.sb-bubble {
  position: absolute;
  z-index: 9000;
  max-width: 230px;
  padding: 9px 13px 10px;
  background: #fffdf7;
  border: 2.5px solid #121212;
  border-radius: 14px 16px 4px 15px;
  box-shadow: 4px 4px 0 #121212;
  font-family: var(--font-hand, 'Kalam', cursive);
  font-size: 1.02rem;
  line-height: 1.25;
  color: #121212;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) rotate(-2deg) scale(.92);
  transform-origin: 85% 100%;
  transition: opacity .2s ease, transform .35s cubic-bezier(.2,.9,.3,1.4);
}

.sb-bubble::after {
  content: '';
  position: absolute;
  right: 18px;
  bottom: -11px;
  width: 16px;
  height: 16px;
  background: #fffdf7;
  border-right: 2.5px solid #121212;
  border-bottom: 2.5px solid #121212;
  transform: skewX(-25deg) rotate(45deg);
}

/* Tail pointing right, towards the mascot. */
.sb-bubble--left::after {
  right: -11px;
  bottom: auto;
  top: calc(50% - 8px);
  border-right: 2.5px solid #121212;
  border-bottom: 0;
  border-top: 2.5px solid #121212;
  transform: skewY(-20deg) rotate(45deg);
}

/* Tail pointing up, towards the mascot. */
.sb-bubble--below::after {
  top: -11px;
  bottom: auto;
  right: 26px;
  border-right: 0;
  border-bottom: 0;
  border-left: 2.5px solid #121212;
  border-top: 2.5px solid #121212;
  transform: skewX(-20deg) rotate(45deg);
}

.sb-bubble.is-in {
  opacity: 1;
  transform: translateY(0) rotate(-2deg) scale(1);
}

.sb-confetti {
  position: absolute;
  z-index: 8999;
  font-size: 1.15rem;
  color: #121212;
  pointer-events: none;
}

.sb-confetti:nth-child(3n) { color: #f2b632; }
.sb-confetti:nth-child(3n + 1) { color: #4af626; text-shadow: 0 0 0 #121212; }

/* 404 mascot */
.sb-error-mascot {
  display: block;
  width: 118px;
  height: auto;
  margin: 0 auto 18px;
  filter: drop-shadow(5px 6px 0 rgba(18,18,18,.18));
  transform-origin: 60% 85%;
}

@media (prefers-reduced-motion: no-preference) {
  .sb-error-mascot { animation: sb-wave 1.6s ease-in-out infinite; }
}

@keyframes sb-wave {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(8deg); }
}

/* ---------- Throwable stickers ---------- */

.hero .badge.sb-sticker {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hero .badge.sb-sticker.is-thrown {
  translate: var(--sb-x, 0px) var(--sb-y, 0px) !important;
  rotate: var(--sb-r, 0deg);
  z-index: 40;
  transition: box-shadow .2s ease, background .2s ease;
}

.hero .badge.sb-sticker.is-dragging {
  cursor: grabbing;
  box-shadow: 10px 12px 0 #121212;
}

.hero .badge.sb-sticker.is-homing {
  transition: translate .6s cubic-bezier(.2,.9,.3,1.2), rotate .6s cubic-bezier(.2,.9,.3,1.2) !important;
}

.sb-reset {
  position: absolute;
  left: 50%;
  bottom: -6px;
  z-index: 41;
  padding: 6px 13px 7px;
  border: 2px solid #121212;
  border-radius: 9px 4px 10px 5px;
  background: #fff4b8;
  box-shadow: 3px 3px 0 #121212;
  font-family: var(--font-hand, 'Kalam', cursive);
  font-size: 1rem;
  color: #121212;
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, 8px) rotate(-1.5deg);
  transition: opacity .2s ease, transform .3s cubic-bezier(.2,.9,.3,1.4);
  pointer-events: none;
}

.sb-reset.is-in {
  opacity: 1;
  transform: translate(-50%, 0) rotate(-1.5deg);
  pointer-events: auto;
}

.sb-reset:hover { background: #ffe36e; }

/* ---------- Live "now" ---------- */

.sb-now-push {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .4s ease, transform .4s ease;
}

.sb-now-push.is-in { opacity: 1; transform: none; }

.sb-now-push a {
  display: inline-block;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.sb-now-push em {
  display: block;
  font-style: normal;
  opacity: .55;
  font-size: .9em;
}

/* ---------- Page transitions ---------- */

/* Set before first paint by the inline head snippet; js/sketchbook.js erases it. */
html.scribble-in::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #ffc94a;
}

.sb-scribble {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
}

.sb-scribble svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sb-scribble path {
  fill: none;
  stroke: #ffc94a;
  stroke-width: 16;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  transition: stroke-dashoffset .42s cubic-bezier(.65,0,.35,1);
}

/* ---------- Mobile menu ---------- */

.sb-menu-toggle { display: none; }

@media (max-width: 680px) {
  nav.sb-nav {
    position: relative;
    z-index: 200; /* the nav is its own layer (it has a transform), so lift the whole layer */
    flex-wrap: nowrap !important;
    justify-content: space-between;
  }

  .sb-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 7px 11px 7px 9px;
    border: 2.5px solid #121212;
    border-radius: 8px 4px 9px 5px;
    background: #fffdf7;
    box-shadow: 3px 3px 0 #121212;
    font-family: var(--font-hand, 'Kalam', cursive);
    font-size: 1.05rem;
    font-weight: 700;
    color: #121212;
    cursor: pointer;
    transform: rotate(1deg);
  }

  .sb-menu-lines {
    display: grid;
    gap: 3px;
    width: 18px;
  }

  .sb-menu-lines i {
    display: block;
    height: 2.5px;
    border-radius: 2px;
    background: #121212;
    transition: transform .25s ease, opacity .2s ease;
  }

  .sb-menu-lines i:nth-child(1) { width: 100%; transform: rotate(-2deg); }
  .sb-menu-lines i:nth-child(2) { width: 80%; }
  .sb-menu-lines i:nth-child(3) { width: 92%; transform: rotate(2deg); }

  .sb-menu-open .sb-menu-lines i:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  .sb-menu-open .sb-menu-lines i:nth-child(2) { opacity: 0; }
  .sb-menu-open .sb-menu-lines i:nth-child(3) { width: 100%; transform: translateY(-5.5px) rotate(-45deg); }

  /* The links become a lined notebook sheet that drops below the nav. */
  nav.sb-nav .nav-links {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 60;
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    gap: 0 !important;
    width: auto !important;
    order: 0 !important;
    padding: 14px 18px 18px 46px;
    background-color: #fffdf7;
    background-image:
      linear-gradient(to right, transparent 33px, rgba(226, 85, 85, .55) 33px, rgba(226, 85, 85, .55) 35px, transparent 35px),
      repeating-linear-gradient(to bottom, transparent 0 47px, rgba(70, 120, 200, .22) 47px 48px);
    border: 2.5px solid #121212;
    border-radius: 6px 12px 8px 10px;
    box-shadow: 6px 6px 0 #121212;
    transform-origin: top center;
    transform: rotate(-.6deg) translateY(-8px) scaleY(.96);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, transform .3s cubic-bezier(.2,.9,.3,1.2), visibility 0s linear .3s;
  }

  nav.sb-nav.sb-menu-open .nav-links {
    opacity: 1;
    visibility: visible;
    transform: rotate(-.6deg);
    transition: opacity .2s ease, transform .3s cubic-bezier(.2,.9,.3,1.2), visibility 0s;
  }

  nav.sb-nav .nav-links .nav-link {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 !important;
    font-size: 1.55rem !important;
  }

  nav.sb-nav .nav-links .link-text {
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
  }

  nav.sb-nav .nav-links .command-trigger {
    display: inline-flex !important;
    align-self: flex-start;
    margin: 12px 0 2px !important;
  }

  nav.sb-nav .nav-links .cmd-label { display: inline !important; }
}

@media (prefers-reduced-motion: reduce) {
  .sb-scribble path,
  nav.sb-nav .nav-links,
  .sb-bubble { transition: none !important; }
  html.scribble-in::after { display: none; }
}

/* ---------- Selected work: polaroids taped to the page ---------- */

.sw-section {
  position: relative;
  padding: 40px 0 72px;
}

.sw-note {
  margin: 10px 0 0;
  font-family: var(--font-hand);
  font-size: 1.15rem;
  color: rgba(18, 18, 18, .65);
}

.sw-note a {
  color: #121212;
  text-decoration: underline wavy rgba(18, 18, 18, .45);
  text-underline-offset: 4px;
}

.sw-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 56px);
  max-width: 1080px;
  margin: 34px auto 0;
  padding: 0 8px;
}

.sw-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 22px;
  background: var(--white, #fffdf7);
  border: var(--border-sketch, 2.5px solid #121212);
  border-radius: 4px 6px 5px 3px;
  box-shadow: var(--shadow-hard, 6px 6px 0 #121212);
  transform: rotate(-1.8deg);
  transition: transform .45s cubic-bezier(.2, .9, .3, 1.2), box-shadow .3s ease;
}

.sw-card--voice { transform: rotate(1.6deg) translateY(18px); }

@media (hover: hover) {
  .sw-card:hover {
    transform: rotate(0deg) translateY(-6px);
    box-shadow: 10px 12px 0 #121212;
    z-index: 2;
  }
}

/* A strip of yellowish tape holding the photo on. */
.sw-tape {
  position: absolute;
  top: -15px;
  left: 50%;
  width: 118px;
  height: 30px;
  background: rgba(255, 228, 140, .78);
  border-left: 1px dashed rgba(18, 18, 18, .18);
  border-right: 1px dashed rgba(18, 18, 18, .18);
  transform: translateX(-50%) rotate(-3deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  z-index: 3;
}

.sw-card--voice .sw-tape { transform: translateX(-50%) rotate(4deg); left: 40%; }

.sw-photo {
  position: relative;
  aspect-ratio: 11 / 10;
  overflow: hidden;
  border: 2px solid #121212;
  background: #15171c;
}

.sw-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}

.sw-photo-note {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 3px 10px 4px;
  background: #fff4b8;
  border: 2px solid #121212;
  box-shadow: 2px 2px 0 #121212;
  font-family: var(--font-hand);
  font-size: .95rem;
  color: #121212;
  transform: rotate(-3deg);
}

.sw-caption {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 6px 0;
}

.sw-kind {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(18, 18, 18, .55);
}

.sw-caption h3 {
  margin: -4px 0 0;
  font-family: var(--font-hand);
  font-size: clamp(2rem, 3.4vw, 2.6rem);
  line-height: 1;
}

.sw-caption p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(18, 18, 18, .82);
}

.sw-facts {
  display: grid;
  gap: 4px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: .8rem;
}

.sw-facts li::before {
  content: '\2713  ';
  color: #2f9e44;
  font-weight: 700;
}

.sw-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.sw-stack span {
  padding: 3px 9px;
  border: 2px solid #121212;
  border-radius: 6px 3px 7px 4px;
  background: var(--paper-tint, #f0ebd8);
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 700;
}

.sw-link {
  align-self: flex-start;
  margin-top: 6px;
  font-family: var(--font-hand);
  font-size: 1.1rem;
  font-weight: 700;
  color: #121212;
  text-decoration: underline;
  text-decoration-color: var(--accent-yellow, #ffc247);
  text-decoration-thickness: 5px;
  text-underline-offset: -1px;
  text-decoration-skip-ink: none;
}

.sw-link:hover { text-decoration-color: #121212; }

/* ---------- RomkaVoice sketch ---------- */

.sw-voice {
  display: grid;
  place-items: center;
  background-color: var(--paper-yellow, #fff9e6);
  background-image:
    linear-gradient(to right, rgba(18, 18, 18, .06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(18, 18, 18, .06) 1px, transparent 1px);
  background-size: 22px 22px;
}

.sw-voice-window {
  position: absolute;
  top: 12%;
  left: 9%;
  right: 9%;
  border: 2.5px solid #121212;
  border-radius: 10px;
  background: #fffdf7;
  box-shadow: 5px 5px 0 #121212;
  overflow: hidden;
}

.sw-voice-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-bottom: 2px solid #121212;
  background: var(--paper-tint, #f0ebd8);
  font-family: var(--font-mono);
  font-size: .68rem;
}

.sw-voice-bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #121212;
}

.sw-voice-bar span { margin-left: 6px; opacity: .6; }

.sw-voice-text {
  min-height: 3.4em;
  margin: 0;
  padding: 14px 14px 16px;
  font-family: var(--font-hand);
  font-size: clamp(1rem, 1.7vw, 1.25rem);
  line-height: 1.35;
  color: #121212;
}

.sw-voice-typed {
  display: inline;
  background: linear-gradient(transparent 62%, rgba(255, 194, 71, .55) 62%);
}

.sw-voice-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -2px;
  background: #121212;
}

.sw-voice-pill {
  position: absolute;
  left: 50%;
  bottom: 13%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 7px;
  border: 2.5px solid #121212;
  border-radius: 999px;
  background: #171a24;
  color: #fff;
  box-shadow: 4px 4px 0 #121212;
  transform: translateX(-50%);
}

.sw-voice-pill img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.sw-voice-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 0 0 0 3px rgba(255, 95, 86, .25);
}

.sw-voice-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
}

.sw-voice-wave i {
  display: block;
  width: 3px;
  height: 40%;
  border-radius: 2px;
  background: #7aa7ff;
}

.sw-voice-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  opacity: .8;
}

.sw-key {
  position: absolute;
  left: 9%;
  bottom: 12%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 42px;
  border: 2.5px solid #121212;
  border-radius: 8px;
  background: #fffdf7;
  box-shadow: 0 5px 0 #121212;
  font-family: var(--font-mono);
  font-size: .9rem;
  font-weight: 700;
}

.sw-voice .sw-photo-note { right: 9%; bottom: auto; top: 3.5%; }

@media (prefers-reduced-motion: no-preference) {
  /* The story loops: the key goes down, the pill listens, the sentence types itself. */
  .sw-voice-typed {
    display: inline-block;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: bottom;
    animation: sw-type 6s steps(40, end) infinite;
  }

  .sw-voice-text { white-space: nowrap; overflow: hidden; }
  .sw-voice-caret { animation: sw-blink .9s steps(1) infinite; }
  .sw-key { animation: sw-key 6s ease-in-out infinite; }
  .sw-voice-wave i { animation: sw-wave .9s ease-in-out infinite alternate; }
  .sw-voice-wave i:nth-child(2) { animation-delay: -.2s; }
  .sw-voice-wave i:nth-child(3) { animation-delay: -.5s; }
  .sw-voice-wave i:nth-child(4) { animation-delay: -.1s; }
  .sw-voice-wave i:nth-child(5) { animation-delay: -.7s; }
  .sw-voice-wave i:nth-child(6) { animation-delay: -.35s; }
  .sw-voice-wave i:nth-child(7) { animation-delay: -.6s; }
}

@keyframes sw-type {
  0%, 18% { max-width: 0; }
  62%, 92% { max-width: 100%; }
  100% { max-width: 0; }
}

@keyframes sw-blink { 50% { opacity: 0; } }

@keyframes sw-key {
  0%, 4% { transform: translateY(0); box-shadow: 0 5px 0 #121212; }
  8%, 60% { transform: translateY(4px); box-shadow: 0 1px 0 #121212; background: #ffe36e; }
  66%, 100% { transform: translateY(0); box-shadow: 0 5px 0 #121212; }
}

@keyframes sw-wave {
  from { height: 25%; }
  to { height: 100%; }
}

@media (max-width: 820px) {
  .sw-grid { grid-template-columns: minmax(0, 1fr); gap: 46px; max-width: 520px; }
  .sw-card { transform: rotate(-1deg); }
  .sw-card--voice { transform: rotate(1deg); }
}

@media (max-width: 560px) {
  .sw-voice-pill { left: auto; right: 7%; transform: none; gap: 8px; padding-right: 12px; }
  .sw-voice-label { display: none; }
  .sw-key { left: 7%; }
  .sw-voice-text { font-size: .86rem; padding: 12px 10px 14px; }
}
