/* Homepage hero "signing desk": each service is a filing sheet that gets digitally
   signed and stamped. Slides are still driven by initHeroShowcase() in main.js. */

.hero .hero-visual .visual-frame.wd-desk {
  --paper: #fbf8f1;
  --paper-edge: #e9e2d2;
  --ink: #1b2a41;
  --ink-soft: #5b6475;
  --stamp: #c2410c;
  --sig: #1d3f8f;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  aspect-ratio: 4 / 3.15;
  overflow: visible;
  border: 0;
  box-shadow: none;
  background: transparent;
  perspective: 1400px;
  perspective-origin: 60% 20%;
}

/* The desk surface the sheets lie on */
.wd-desk-surface {
  position: absolute;
  inset: 4% 2% 6% 2%;
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 70% 0%, rgba(232, 84, 30, .22), transparent 60%),
    radial-gradient(90% 70% at 0% 100%, rgba(37, 99, 235, .28), transparent 65%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 26px),
    #0b1730;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .08);
  transform: rotateX(18deg) rotateZ(-2deg);
  transform-origin: 50% 100%;
}

/* Whole scene follows the pointer slightly */
.wd-desk-scene {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--desk-rx, 8deg)) rotateY(var(--desk-ry, -10deg));
  transition: transform 600ms cubic-bezier(.23, 1, .32, 1);
}

/* Sheets stacked under the active one, for depth */
.wd-desk-sheet-under {
  position: absolute;
  left: 13%;
  right: 11%;
  top: 9%;
  bottom: 12%;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  box-shadow: 0 18px 30px -18px rgba(0, 0, 0, .6);
}
.wd-desk-sheet-under.u1 { transform: translate3d(14px, 10px, -30px) rotateZ(4deg); background: #f1ece0; }
.wd-desk-sheet-under.u2 { transform: translate3d(26px, 20px, -60px) rotateZ(8deg); background: #e7e1d2; }

/* Override the old image-slide styling for the desk */
.hero .hero-visual .wd-desk .wd-showcase-slide {
  inset: 0;
  transform: none;
  opacity: 0;
  transition: none;
}
.hero .hero-visual .wd-desk .wd-showcase-slide.is-active { opacity: 1; }

.wd-doc {
  position: absolute;
  left: 11%;
  right: 13%;
  top: 6%;
  bottom: 15%;
  display: flex;
  flex-direction: column;
  gap: 2.2%;
  padding: 5% 6% 4%;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 30%),
    var(--paper);
  border: 1px solid var(--paper-edge);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 30px 50px -20px rgba(0, 0, 0, .75), 0 2px 0 rgba(255, 255, 255, .6) inset;
  transform: translateZ(30px) rotateZ(-1.5deg);
  transform-style: preserve-3d;
  overflow: hidden;
}
.wd-doc:hover { color: var(--ink); }
.wd-doc:focus-visible { outline: 3px solid #f59e0b; outline-offset: 4px; }
.is-active .wd-doc { animation: wdDocIn 620ms cubic-bezier(.23, 1, .32, 1) both; }
@keyframes wdDocIn {
  from { opacity: 0; transform: translate3d(-30px, -40px, 120px) rotateX(-18deg) rotateZ(-6deg); }
  to   { opacity: 1; transform: translateZ(30px) rotateZ(-1.5deg); }
}

/* Tricolour hairline at the top of a government form */
.wd-doc::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: linear-gradient(90deg, #ff9933 0 33.3%, #ffffff 33.3% 66.6%, #138808 66.6%);
  border-bottom: 1px solid var(--paper-edge);
}

.wd-doc-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px dashed #cfc6b2;
  padding-bottom: 6px;
}
.wd-doc-title {
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  font-size: clamp(15px, 1.55vw, 21px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
}
.wd-doc-rows { display: flex; flex-direction: column; gap: 5px; }
.wd-doc-row {
  display: grid;
  grid-template-columns: 34% 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.35;
  padding-bottom: 4px;
  border-bottom: 1px solid #ebe4d4;
}
.wd-doc-row i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.wd-doc-row b { font-weight: 600; color: var(--ink); }

/* Signature block */
.wd-doc-sign {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.wd-doc-sigbox { flex: 1; min-width: 0; }
.wd-sig { display: block; width: 72%; max-width: 220px; height: auto; overflow: visible; }
.wd-sig path {
  fill: none;
  stroke: var(--sig);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
}
.is-active .wd-sig path { animation: wdSign 1.1s cubic-bezier(.55, .1, .35, 1) .55s forwards; }
@keyframes wdSign { to { stroke-dashoffset: 0; } }
.wd-doc-sigline {
  display: block;
  border-top: 1px solid #b9ae95;
  margin-top: 2px;
  padding-top: 3px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.wd-doc-sigline em { font-style: normal; color: #15803d; font-weight: 700; }

/* Rubber stamp */
.wd-stamp {
  flex: none;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 3px double var(--stamp);
  color: var(--stamp);
  font-family: var(--mono);
  font-weight: 800;
  font-size: 10px;
  line-height: 1.1;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(-14deg);
  opacity: 0;
  mix-blend-mode: multiply;
  background: radial-gradient(circle, rgba(194, 65, 12, .06), transparent 70%);
}
.wd-stamp strong { display: block; font-size: 15px; letter-spacing: .1em; }
.is-active .wd-stamp { animation: wdStamp 420ms cubic-bezier(.2, 1.6, .4, 1) 1.7s both; }
@keyframes wdStamp {
  0%   { opacity: 0; transform: rotate(-14deg) scale(2.1); }
  60%  { opacity: .95; transform: rotate(-14deg) scale(.92); }
  100% { opacity: .9; transform: rotate(-14deg) scale(1); }
}

/* USB crypto token resting on the desk */
.wd-token {
  position: absolute;
  right: 3%;
  top: 8%;
  width: 26%;
  aspect-ratio: 3.2 / 1;
  transform: translateZ(90px) rotateZ(-28deg);
  transform-style: preserve-3d;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, .55));
  animation: wdTokenFloat 5s ease-in-out infinite;
  pointer-events: none;
  z-index: 3;
}
@keyframes wdTokenFloat {
  0%, 100% { transform: translateZ(90px) translateY(0) rotateZ(-28deg); }
  50%      { transform: translateZ(90px) translateY(-7px) rotateZ(-25deg); }
}
.wd-token-body {
  position: absolute;
  inset: 0 0 0 22%;
  border-radius: 10px 14px 14px 10px;
  background: linear-gradient(160deg, #2b3445 0%, #121826 55%, #0a0f1a 100%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.wd-token-body::after { /* brand chip */
  content: "DSC";
  position: absolute;
  right: 14%;
  top: 50%;
  transform: translateY(-50%);
  font: 800 10px/1 var(--mono);
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .7);
}
.wd-token-plug {
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 26%;
  border-radius: 3px;
  background: linear-gradient(180deg, #e5e7eb, #9ca3af);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .12);
}
.wd-token-led {
  position: absolute;
  left: 30%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px 2px rgba(34, 197, 94, .8);
  animation: wdLed 1.6s ease-in-out infinite;
}
@keyframes wdLed { 50% { background: #f59e0b; box-shadow: 0 0 12px 3px rgba(245, 158, 11, .85); } }

/* Status chip under the sheet */
.wd-desk-status {
  position: absolute;
  right: 6%;
  bottom: 4%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font: 700 11px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #dcfce7;
  background: rgba(21, 128, 61, .35);
  border: 1px solid rgba(74, 222, 128, .45);
  backdrop-filter: blur(6px);
}
.wd-desk-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

@media (max-width: 991.98px) {
  .hero .hero-visual .visual-frame.wd-desk { aspect-ratio: 4 / 3.4; }
  .wd-doc { left: 6%; right: 9%; }
  .wd-desk-sheet-under { left: 8%; right: 7%; }
}
@media (max-width: 575.98px) {
  .wd-doc { padding: 6% 6% 4%; gap: 1.6%; }
  .wd-doc-row { font-size: 11px; grid-template-columns: 38% 1fr; }
  .wd-doc-row i { font-size: 9px; }
  .wd-doc-row:nth-child(3) { display: none; }
  .wd-stamp { width: 60px; height: 60px; font-size: 8px; }
  .wd-stamp strong { font-size: 12px; }
  .wd-desk-status { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wd-desk-scene { transition: none; transform: rotateX(6deg) rotateY(-8deg); }
  .is-active .wd-doc,
  .wd-token,
  .wd-token-led { animation: none; }
  .wd-sig path { stroke-dashoffset: 0; }
  .is-active .wd-sig path { animation: none; }
  .wd-stamp { opacity: .9; }
  .is-active .wd-stamp { animation: none; }
}

/* The sheet already names the service, so the old floating caption card would only cover the signature */
.hero .hero-visual .wd-desk + .floating-card { display: none; }
