/* HAVEN DESK — first loop, thread line, staged desktop.
   Sits on top of veil.css and reuses its palette tokens. */

/* ---------- staged desktop: a desk that has not woken up yet ---------- */

#desktop.veil-first-boot .icon {
  opacity: 0.18;
  filter: grayscale(1) brightness(0.7);
  pointer-events: none;
  transition: opacity 220ms linear, filter 220ms linear;
}
#desktop.veil-first-boot .icon[data-id="calendar"],
#desktop.veil-first-boot .icon[data-id="readme"],
#desktop.veil-first-boot .icon[data-id="drawer"] {
  opacity: 1;
  filter: none;
  pointer-events: auto;
  animation: veil-icon-breathe 3.4s ease-in-out infinite;
}
#desktop.veil-first-reveal .icon {
  animation: veil-icon-wake 700ms ease-out both;
}
#desktop.veil-first-reveal .icon:nth-child(2n) { animation-delay: 90ms; }
#desktop.veil-first-reveal .icon:nth-child(3n) { animation-delay: 180ms; }
#desktop.veil-first-reveal .icon:nth-child(5n) { animation-delay: 270ms; }

@keyframes veil-icon-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}
@keyframes veil-icon-wake {
  from { opacity: 0.15; filter: grayscale(1) brightness(0.6); transform: scale(0.96); }
  to   { opacity: 1; filter: none; transform: scale(1); }
}

/* ---------- the note ---------- */

.veil-first {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(8, 24, 20, 0.72), rgba(2, 7, 6, 0.94));
  backdrop-filter: blur(1.5px);
  animation: veil-first-in 320ms ease-out both;
}
@keyframes veil-first-in { from { opacity: 0; } to { opacity: 1; } }

.veil-first-sheet {
  position: relative;
  width: min(720px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 26px 28px 22px;
  color: #10140f;
  background:
    linear-gradient(180deg, #efe8d4, #e2d9c1 62%, #d9cfb4);
  border: 1px solid #b9ab8b;
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  font-family: "Courier New", Courier, monospace;
  transform: rotate(-0.35deg);
}
.veil-first-sheet::before,
.veil-first-sheet::after {
  content: "";
  position: absolute;
  width: 104px;
  height: 26px;
  background: rgba(233, 226, 207, 0.55);
  border: 1px solid rgba(150, 140, 115, 0.55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.veil-first-sheet::before { top: -12px; left: 26px; transform: rotate(-3deg); }
.veil-first-sheet::after { top: -12px; right: 26px; transform: rotate(2.4deg); }

.veil-first-sheet.is-shake { animation: veil-shake 320ms ease-in-out; }
@keyframes veil-shake {
  0%, 100% { transform: rotate(-0.35deg) translateX(0); }
  25% { transform: rotate(-0.35deg) translateX(-6px); }
  50% { transform: rotate(-0.35deg) translateX(5px); }
  75% { transform: rotate(-0.35deg) translateX(-3px); }
}

.veil-first-head {
  margin: 0 0 14px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6c5f45;
  border-bottom: 1px dashed #b3a586;
  padding-bottom: 8px;
}

.veil-first-paper {
  margin: 0 0 18px;
  min-height: 132px;
  white-space: pre-wrap;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1.62;
  color: #1d2418;
}
.veil-first-paper::after {
  content: "▌";
  margin-left: 1px;
  color: #1d2418;
  animation: veil-caret 1s steps(1) infinite;
}
.veil-first-paper.is-done::after { content: ""; }
@keyframes veil-caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.veil-first-gate { display: grid; gap: 8px; }
.veil-first-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #6c5f45;
}
.veil-first-input {
  width: 100%;
  padding: 10px 12px;
  font-family: "Courier New", Courier, monospace;
  font-size: 16px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #12180f;
  background: #f7f2e2;
  border: 1px solid #a2946f;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.12);
}
.veil-first-input:focus { outline: 2px solid #7c6a3f; outline-offset: 1px; }
.veil-first-msg {
  min-height: 18px;
  margin: 0;
  font-size: 12px;
  color: #7a3a26;
}
.veil-first-foot {
  margin: 16px 0 0;
  font-size: 10px;
  color: #746a52;
  font-style: italic;
}
.veil-first .veil-primary,
.veil-first .raised {
  font-family: Tahoma, "MS Sans Serif", Verdana, sans-serif;
  font-size: 11px;
  padding: 8px 14px;
  cursor: pointer;
  border: 1px solid #7d6f4e;
  background: #ded3b6;
  color: #1a1d14;
  box-shadow: 1px 1px 0 #8b7d5c;
}
.veil-first .veil-primary {
  background: #2c3b31;
  color: #f2ecd9;
  border-color: #16211a;
  box-shadow: 1px 1px 0 #0d1410;
}
.veil-first .veil-primary:hover { background: #3a4d40; }

.veil-first-done h2 {
  margin: 0 0 10px;
  font-family: Tahoma, "MS Sans Serif", Verdana, sans-serif;
  font-size: 20px;
  color: #1b2418;
}
.veil-first-done p { margin: 0 0 10px; font-size: 13px; line-height: 1.55; }
.veil-first-small { font-size: 11px !important; color: #6c6349; }
.veil-first-done .veil-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- the thread line ---------- */

.veil-thread {
  position: absolute;
  left: 50%;
  bottom: 46px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(720px, 92vw);
  padding: 6px 8px 6px 12px;
  background: rgba(6, 17, 14, 0.92);
  border: 1px solid var(--veil-line, #2d4a40);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  font-family: Tahoma, "MS Sans Serif", Verdana, sans-serif;
}
.veil-thread-kicker {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--veil-amber, #e0b35a);
  white-space: nowrap;
}
.veil-thread-go {
  font-family: inherit;
  font-size: 11px;
  color: #dbe9e1;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 8px;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px dotted rgba(224, 179, 90, 0.55);
}
.veil-thread-go:hover { color: #fff3d2; border-color: var(--veil-amber, #e0b35a); }

/* the next room on the map */

.veil-node.is-next {
  border-color: var(--veil-cyan, #72e0d1);
  box-shadow: 0 0 0 1px rgba(114, 224, 209, 0.5), 0 0 18px rgba(114, 224, 209, 0.22);
  animation: veil-next-pulse 2.2s ease-in-out infinite;
}
@keyframes veil-next-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(114, 224, 209, 0.45), 0 0 12px rgba(114, 224, 209, 0.16); }
  50% { box-shadow: 0 0 0 2px rgba(114, 224, 209, 0.85), 0 0 26px rgba(114, 224, 209, 0.34); }
}

@media (max-width: 640px) {
  .veil-first-sheet { padding: 20px 18px 18px; transform: none; }
  .veil-first-paper { font-size: 13px; min-height: 110px; }
  .veil-thread { bottom: 52px; flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ---------- the boot screen: a machine that has been on for years ---------- */

#boot.veil-boot p { animation: veil-boot-line 360ms ease-out both; }
#boot.veil-boot p:nth-child(1) { animation-delay: 0ms; }
#boot.veil-boot p:nth-child(2) { animation-delay: 140ms; }
#boot.veil-boot p:nth-child(3) { animation-delay: 300ms; }
#boot.veil-boot p:nth-child(4) { animation-delay: 460ms; }
#boot.veil-boot p.hint { animation-delay: 700ms; }
#boot.veil-boot p.hint::after {
  content: "_";
  margin-left: 4px;
  animation: veil-caret 1.1s steps(1) infinite;
}
@keyframes veil-boot-line {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- the memorial card ---------- */

.veil-memorial {
  margin: 12px 0 14px;
  padding: 0;
  background: #0d1a16;
  border: 1px solid var(--veil-line, #2d4a40);
}
.veil-memorial img {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.92) contrast(1.02);
}
.veil-memorial figcaption {
  padding: 10px 12px;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--veil-amber, #e0b35a);
  border-top: 1px solid var(--veil-line, #2d4a40);
}

/* the completion card gets a warmer sheet */

.veil-final .veil-first-sheet {
  background: linear-gradient(180deg, #f0e8d2, #e5dabd 60%, #dccfb0);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(224, 179, 90, 0.35);
}

/* map filter button */

.veil-filter {
  margin-left: auto;
  font-family: Tahoma, "MS Sans Serif", Verdana, sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 3px 8px;
}

/* ---------- respect reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .veil-first,
  .veil-first-sheet,
  .veil-first-sheet.is-shake,
  #boot.veil-boot p,
  .veil-first-paper::after,
  .veil-node.is-next,
  #desktop.veil-first-boot .icon,
  #desktop.veil-first-reveal .icon {
    animation: none !important;
    transition: none !important;
  }
  .veil-first-paper::after { content: ""; }
}
