/* ================================================================= */
/* Doodle wall                                                       */
/* ================================================================= */

.doodle-wall {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 6px 7px 0 var(--ink);
  padding: 0.7rem;
  transform: rotate(-1deg);
}

.doodle-wall canvas {
  display: block;
  width: 100%;
  height: clamp(20rem, 55vh, 32rem);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Cpath d='M0 29.5h30M29.5 0v30' stroke='%23182c48' stroke-opacity='.1'/%3E%3C/svg%3E");
  touch-action: none;
  cursor: crosshair;
}

.toy-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem;
  border-top: 2px solid var(--ink);
  font: 0.6rem var(--mono);
  text-transform: uppercase;
}

.toy-toolbar button {
  border: 2px solid var(--ink);
  background: var(--yellow);
  padding: 0.45rem 0.6rem;
  font: 0.58rem var(--mono);
  text-transform: uppercase;
}

.toy-toolbar button:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: 3px;
}

/* ================================================================= */
/* Excuse box                                                        */
/* ================================================================= */

.excuse-box {
  padding: clamp(1.5rem, 4vw, 3rem);
  background: var(--pink);
  border: 2px solid var(--ink);
  box-shadow: 6px 7px 0 var(--ink);
  min-height: 16rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: rotate(2deg);
}

/* Match both <blockquote> and the corrected <p> element. */
.excuse-box blockquote,
.excuse-box #excuseText {
  font: clamp(2rem, 5vw, 4.3rem) / 0.9 var(--hand);
  margin: 1rem 0;
}

/* ================================================================= */
/* Danfo board                                                       */
/* ================================================================= */

.danfo-board {
  overflow: hidden;
  background: var(--ink);
  color: var(--yellow);
  border: 4px solid var(--yellow);
  padding: 1.2rem 0;
  box-shadow: 6px 7px 0 var(--ink);
}

.danfo-marquee {
  white-space: nowrap;
  animation: marquee 20s linear infinite;
  font: 700 clamp(2.5rem, 7vw, 7rem) / 0.8 var(--display);
  letter-spacing: -0.08em;
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ================================================================= */
/* Bug toy                                                           */
/* ================================================================= */

.bug-toy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.bug-pile,
.bug-tray {
  min-height: 13rem;
  border: 2px dashed var(--ink);
  padding: 1rem;
}

.bug-tray { background: var(--green); }

.bug {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem;
  padding: 0.5rem 0.7rem;
  border: 2px solid var(--ink);
  background: var(--yellow);
  border-radius: 48% 52% 44% 56%;
  font: 0.65rem var(--mono);
  cursor: grab;
}

.bug.is-fixed {
  background: var(--paper);
  text-decoration: line-through;
  /* Keep cursor: grab — the corrected lab.js allows dragging back. */
}

.bug:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: 3px;
}

/* ================================================================= */
/* NEPA overlay + prompt                                             */
/* ================================================================= */

.nepa-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  display: none;
  background: rgba(0, 0, 0, 0.84);
  -webkit-mask-image: radial-gradient(
    circle clamp(6rem, 20vw, 9rem)
    at var(--torch-x, 50%) var(--torch-y, 50%),
    transparent 0 75%, #000 100%
  );
  mask-image: radial-gradient(
    circle clamp(6rem, 20vw, 9rem)
    at var(--torch-x, 50%) var(--torch-y, 50%),
    transparent 0 75%, #000 100%
  );
}

body.nepa .nepa-overlay { display: block; }

.nepa-prompt {
  position: fixed;
  z-index: 80;
  right: 1rem;
  bottom: 5rem;
  width: min(21rem, calc(100% - 2rem));
  background: var(--yellow);
  border: 2px solid var(--ink);
  padding: 1rem;
  box-shadow: 5px 6px 0 var(--ink);
  transform: rotate(-2deg);
}

.nepa-prompt p {
  font-size: 0.9rem;
  line-height: 1.2;
  margin-bottom: 0.8rem;
}

.nepa-prompt__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nepa-prompt button {
  padding: 0.45rem 0.6rem;
  border: 2px solid var(--ink);
  background: var(--paper);
  font: 0.58rem var(--mono);
  text-transform: uppercase;
}

.nepa-prompt button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ================================================================= */
/* Power panel — driven by [hidden], not display                     */
/* ================================================================= */

.power-panel {
  position: fixed;
  z-index: 90;
  inset: auto 1rem 5rem auto;
  width: min(23rem, calc(100% - 2rem));
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 1rem;
  box-shadow: 6px 7px 0 var(--ink);
}

/* Only hidden when the [hidden] attribute is present.
   This matches the corrected nepa.js, which uses panel.hidden = true/false. */
.power-panel[hidden] { display: none; }

.power-panel h3 { font-size: 2rem; }

.power-panel p {
  color: var(--ink-soft);
  line-height: 1.25;
  margin: 0.5rem 0 1rem;
}

.power-button {
  border: 2px solid var(--ink);
  background: var(--yellow);
  padding: 0.7rem;
  width: 100%;
  font: 700 0.65rem var(--mono);
  text-transform: uppercase;
}

.power-button:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: 3px;
}

/* ================================================================= */
/* Responsive                                                        */
/* ================================================================= */

@media (max-width: 767px) {
  .doodle-wall canvas { height: 20rem; }
  .bug-toy { grid-template-columns: 1fr; }
  .nepa-overlay {
    -webkit-mask-image: radial-gradient(
      circle 7rem at var(--torch-x, 50%) var(--torch-y, 50%),
      transparent 0 75%, #000 100%
    );
    mask-image: radial-gradient(
      circle 7rem at var(--torch-x, 50%) var(--torch-y, 50%),
      transparent 0 75%, #000 100%
    );
  }
}

/* ================================================================= */
/* Card tilt — driven by --tilt from motion.js                        */
/* ================================================================= */

/* Option A: keep JS-driven tilt (recommended if you want
   deterministic pseudo-random angles per card). */
.project-card,
.note-card,
.home-media-strip figure {
  transform: rotate(var(--tilt, 0deg));
}

.project-card:hover,
.note-card:hover {
  transform: rotate(var(--tilt, 0deg)) translateY(-0.6rem);
}

/* Option B: remove the JS tilt from motion.js and use only the
   nth-child rotations in components.css. (Pick one, not both.) */