/* ============================================================
   Sealed "locked" state for the Aktueller Hinweis section.
   When no hunt is active, we add .locked to the section, which:
     · hides the carousel + chronik (they leak real case data)
     · shows a decorative "versiegeltes Dossier" overlay instead
   The JS toggles .locked in updateHuntStatusUI().
   ============================================================ */
.clue-sealed {
  display: none;
}
.current-clue-section.locked .clue-carousel,
.current-clue-section.locked .hints-timeline {
  display: none;
}
.current-clue-section.locked .clue-sealed {
  display: flex;
  justify-content: center;
  margin: 0 auto 2.75rem;
  max-width: 1060px;
  padding: 2.5rem 1rem 1.5rem;
}

/* ============================================================
   Old letter
   -------------------------------------------------------------
   Structure:
     .clue-sealed-envelope   — the letter body (bottom)
     .clue-sealed-flap       — the folded-down triangular flap (top)
     .clue-sealed-wax        — the wax seal sitting on the seam where
                               the flap meets the body
   Everything is positioned relative to .clue-sealed-envelope.
   ============================================================ */
.clue-sealed-envelope {
  position: relative;
  width: min(620px, 100%);
  /* Seitenverhältnis des freigestellten Umschlag-Fotos (1354x833) —
     so bleiben alle prozentual positionierten Overlays formstabil */
  aspect-ratio: 1354 / 833;
  /* Fotorealistischer Kraftpapier-Umschlag (Rückseite, Klappe zu).
     Klappe, Falze, Prägekanten und Papiertextur sind im Bild —
     die alten CSS-Dreiecke (::before/::after) entfallen. */
  background: url('/assets/props/briefumschlag.webp') center / 100% 100% no-repeat;
  border-radius: 0;
  /* drop-shadow statt box-shadow: folgt der Alpha-Kontur des Fotos
     (leicht unregelmäßige Papierkanten) statt einem harten Rechteck */
  filter: drop-shadow(0 14px 24px rgba(26, 22, 19, 0.22))
          drop-shadow(0 3px 6px rgba(26, 22, 19, 0.14));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  padding: 0 3rem 2.2rem;
}

/* Wax seal — sits on the tip of the folded-down flap, where it
   would physically hold the flap closed against the letter. That's
   the bottom vertex of our triangular flap overlay: 45% from the top
   of the envelope body. */
.clue-sealed-wax {
  position: absolute;
  /* Klappenspitze im Umschlag-Foto liegt bei ~72.3 % der Höhe;
     das Siegel sitzt mittig auf der Spitze und hält sie zu */
  top: 72.3%;
  left: 50%;
  /* Rotation keeps the "thrown on" feel */
  transform: translate(-50%, -50%) rotate(-4deg);
  z-index: 3;

  /* Sized to fit the original seal footprint plus the image's natural
     transparent margins (the wax has uneven "finger" edges that extend
     slightly beyond a perfect circle). */
  width: 150px;
  height: 150px;

  /* The image is the seal — organic blob shape, convex rim, concave
     depression, highlights, all pre-baked. */
  background: url('/assets/wachsstempel.png') center / contain no-repeat;

  /* Cast shadow onto the paper. drop-shadow respects the image's alpha
     channel (follows the blob outline), unlike box-shadow which would
     draw a rectangular shadow. */
  filter: drop-shadow(2px 5px 8px rgba(40, 10, 10, 0.55));

  display: flex;
  align-items: center;
  justify-content: center;
}

/* Old CSS-based layers are no longer needed — the image carries the
   rim highlight, splatter halo, and arc highlight itself. */
.clue-sealed-wax::before,
.clue-sealed-wax::after,
.clue-sealed-wax-ornament {
  display: none;
}

/* The pressed monogram — metallic gold, deeply recessed look */
.clue-sealed-wax-mark {
  position: relative;
  z-index: 3;
  font-family: 'Cinzel Decorative', 'Cinzel', 'Playfair Display', serif;
  font-weight: 900;
  font-size: 2.2rem;
  line-height: 1;
  letter-spacing: -0.02em;

  /* Gold metallic gradient via background-clip: text */
  background: linear-gradient(165deg,
    #fff0b8 0%,
    #f9e194 20%,
    #e3b94a 50%,
    #a37b12 80%,
    #543d08 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;

  /* Stacked drop-shadows make the letter look pressed INTO the wax:
     a brown halo where wax was displaced + a dark pit behind the relief */
  filter:
    drop-shadow(0 1px 0 rgba(120, 90, 30, 0.5))
    drop-shadow(0 2px 2px rgba(30, 5, 5, 0.75))
    drop-shadow(0 0 3px rgba(251, 220, 126, 0.22));

  /* Counter-rotate a touch so it doesn't look perfectly aligned */
  transform: rotate(4deg);
}

/* Remove the old horizontal twine — we don't need a wrapped-cord look
   anymore since we have a proper envelope with a sealed flap. */
.clue-sealed-twine { display: none; }

/* "Vertraulich" stamp in the corner — slightly adjusted position for
   the new envelope dimensions. */
.clue-sealed-stamp {
  position: absolute;
  top: 1.2rem;
  right: 1.4rem;
  font-family: var(--font-mono, 'Courier Prime', monospace);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--stamp-red, #b82727);
  border: 1.5px solid var(--stamp-red, #b82727);
  padding: 0.35rem 0.75rem;
  border-radius: 2px;
  transform: rotate(6deg);
  opacity: 0.78;
  z-index: 2;
}

/* ============================================================
   Postage stamp (top-left, decorative)
   ============================================================ */
.env-postage {
  position: absolute;
  top: 22px;
  left: 28px;
  width: 94px;
  transform: rotate(-5deg);
  z-index: 4;
  /* Zähnung, Papier und Schatten stecken jetzt im Motiv selbst */
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.22));
}
.env-postage-img {
  display: block;
  width: 100%;
  height: auto;
}
/* Postmark overlay — circular stamp half-on, half-off the postage stamp */
.env-postmark {
  position: absolute;
  top: -8px;
  right: -18px;
  width: 58px;
  height: 58px;
  border: 2.5px solid var(--stamp-red, #8a2818);
  border-radius: 50%;
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--stamp-red, #8a2818);
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-align: center;
  transform: rotate(-12deg);
  padding: 4px;
  z-index: 5;
}

/* ============================================================
   Archive sticker (bottom-right, carries the QR)
   ============================================================ */
.env-archive-sticker {
  position: absolute;
  bottom: 22px;
  right: 26px;
  background: #f2e5c4;
  padding: 7px 10px;
  border: 1px solid rgba(42,31,21,0.25);
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
  transform: rotate(2deg);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* The QR sits inside a button so it's clickable and keyboard-focusable.
   Reset the button's native chrome so it visually matches the sticker. */
.env-archive-qr-btn {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: zoom-in;
  display: block;
  line-height: 0;
  border-radius: 2px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.env-archive-qr-btn:hover,
.env-archive-qr-btn:focus-visible {
  transform: scale(1.06);
  outline: 2px solid var(--stamp-red, #8a2818);
  outline-offset: 3px;
}
.env-archive-qr-btn:focus { outline: none; }
.env-archive-qr {
  width: 62px;
  height: 62px;
  display: block;
  /* The generated SVG has a transparent background; the sticker's cream
     color shows through, which is what we want. */
}
.env-archive-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint, #6f5f47);
  line-height: 1.5;
  white-space: nowrap;
}
.env-archive-text b {
  display: block;
  color: var(--ink, #2a1f15);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  margin-bottom: 3px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .current-clue-section.locked .clue-sealed { padding-top: 3rem; }
  .clue-sealed-envelope {
    aspect-ratio: 4 / 3;
    padding: 0 1.5rem 1.6rem;
  }
  .clue-sealed-stamp {
    top: 0.9rem;
    right: 1rem;
    font-size: 0.6rem;
    padding: 0.25rem 0.55rem;
  }
  .env-postage {
    top: 14px;
    left: 16px;
    width: 70px;
  }
  .env-postmark {
    width: 44px;
    height: 44px;
    font-size: 0.42rem;
    top: -5px;
    right: -12px;
  }
  .env-archive-sticker {
    bottom: 12px;
    right: 12px;
    padding: 5px;
    gap: 0;
  }
  /* Auf Mobile nur den QR zeigen: Der "Archiv-Ref."-Text ist rein
     dekorativ (aria-hidden) und bei der nötigen Mini-Schrift ohnehin
     unlesbar — und ohne ihn ist der Sticker so kompakt, dass er dem
     mittig sitzenden Wachssiegel garantiert nicht in die Quere kommt. */
  .env-archive-text { display: none; }
  .env-archive-qr { width: 46px; height: 46px; }
  .clue-sealed-wax {
    width: 115px;
    height: 115px;
  }
  .clue-sealed-wax-mark { font-size: 1.7rem; }
}

/* Carousel wrapper: nav arrows + document */
.clue-carousel {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  max-width: 1060px;
  margin: 0 auto 2.75rem;
  touch-action: pan-y;
  position: relative;
}

.clue-document {
  /* Leder-Schreibtischunterlage (assets/leder.webp, nahtlos
     kachelbar): Beweisfoto und Requisiten liegen jetzt auf dem
     dunkelgruenen Leder des Ermittler-Schreibtischs. Texte auf der
     Unterlage sind entsprechend HELL (siehe .clue-meta,
     .photo-caption, Watermark) — dunkle Tinte waere hier unlesbar.
     Kachel bei 420px angenehm fein; box-shadow bleibt (das Element
     ist ein opakes Rechteck, keine Saum-Gefahr). */
  background: url("/assets/leder.webp") repeat;
  background-size: 420px auto;
  border: 1px solid rgba(12, 16, 11, 0.55);
  border-radius: 2px;
  padding: 2.5rem 2.75rem 2.25rem;
  position: relative;
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 250, 230, 0.06);
  flex: 1;
  min-width: 0;
  min-height: 540px;
  transform: rotate(-0.4deg);
}
/* (CONFIDENTIAL-Wasserzeichen entfernt — auf der Leder-Unterlage
   wirkte der Schriftzug fehl am Platz; Praegung ins Leder waere
   die stimmige Variante, falls je wieder gewuenscht.) */



/* ==================================================================
   SIEGELBRUCH — der Spieler bricht das Siegel einmal pro Jagd, um
   an die Hinweise zu kommen (js/25-siegelbruch.js, Flag pro Jagd
   im localStorage). Das Siegel besteht aus vier deckungsgleichen
   Kopien der Wachs-Grafik mit gezackten clip-paths.
   ================================================================== */
/* Das Wachs-Div trägt den Hintergrund nicht mehr selbst — die vier
   Scherben tragen ihn (sonst bliebe beim Bruch das intakte Siegel
   darunter sichtbar). Der ED-Schriftzug lebt in jeder Scherbe und
   wird vom jeweiligen clip-path mit zerteilt. */
.clue-sealed-wax { background: none; }
.seal-shard {
  position: absolute; inset: 0;
  background: url('/assets/wachsstempel.png') center / contain no-repeat;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.75s cubic-bezier(0.3, 0.8, 0.4, 1), opacity 0.75s ease;
  will-change: transform;
}
.seal-sh1 { clip-path: polygon(0% 0%, 100% 0%, 96% 12%, 62% 30%, 55% 54%, 38% 47%, 20% 52%, 0% 42%); }
.seal-sh2 { clip-path: polygon(100% 0%, 100% 64%, 84% 58%, 70% 66%, 55% 54%, 62% 30%, 96% 12%); }
.seal-sh3 { clip-path: polygon(0% 42%, 20% 52%, 38% 47%, 55% 54%, 44% 74%, 30% 100%, 0% 100%); }
.seal-sh4 { clip-path: polygon(55% 54%, 70% 66%, 84% 58%, 100% 64%, 100% 100%, 30% 100%, 44% 74%); }
.clue-sealed-wax.seal-broken .seal-sh1 { transform: translate(-52px, -58px) rotate(-26deg); opacity: 0; }
.clue-sealed-wax.seal-broken .seal-sh2 { transform: translate(58px, -40px) rotate(20deg); opacity: 0; }
.clue-sealed-wax.seal-broken .seal-sh3 { transform: translate(-46px, 54px) rotate(15deg); opacity: 0; }
.clue-sealed-wax.seal-broken .seal-sh4 { transform: translate(50px, 62px) rotate(-18deg); opacity: 0; }

/* Risse: laufen beim Klick übers Wachs, verschwinden mit dem Bruch */
.seal-crack { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 2;
  transition: opacity 0.35s ease; }
.clue-sealed-wax.seal-cracking .seal-crack { opacity: 1; }
.clue-sealed-wax.seal-broken .seal-crack { opacity: 0; }
.seal-crack path { stroke: rgba(20, 8, 6, 0.9); stroke-width: 2.5; fill: none; stroke-linecap: round;
  stroke-dasharray: 240; stroke-dashoffset: 240; }
.clue-sealed-wax.seal-cracking .seal-crack path { animation: seal-crack-draw 0.3s ease-out forwards; }
.clue-sealed-wax.seal-cracking .seal-crack path:nth-child(2) { animation-delay: 0.08s; }
@keyframes seal-crack-draw { to { stroke-dashoffset: 0; } }

/* Scharf geschaltet (Jagd läuft, Siegel noch zu): Umschlag ist
   klickbar, das Siegel atmet dezent — KEIN Pfeil, keine Notiz,
   die Erklärung steht im Untertitel der Sektion. */
.current-clue-section.seal-armed .clue-sealed-envelope { cursor: pointer; }
.current-clue-section.seal-armed .clue-sealed-wax {
  animation: seal-breathe 2.6s ease-in-out infinite;
  /* Nur das SIEGEL ist der Klickpunkt zum Oeffnen (js/25-siegelbruch.js).
     Bewusst normaler pointer — ein Werkzeug-Cursor (Brieffoeffner)
     war eingebaut und wurde auf Wunsch wieder entfernt. */
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.current-clue-section.seal-armed .clue-sealed-wax:hover {
  animation: none;
  transform: translate(-50%, -50%) rotate(-2deg) scale(1.1);
  filter: drop-shadow(2px 6px 10px rgba(40, 10, 10, 0.6)) drop-shadow(0 0 18px rgba(184, 39, 39, 0.4));
}
@keyframes seal-breathe {
  0%, 100% { transform: translate(-50%, -50%) rotate(-4deg) scale(1); }
  50% { transform: translate(-50%, -50%) rotate(-4deg) scale(1.04);
        filter: drop-shadow(2px 5px 8px rgba(40,10,10,0.55)) drop-shadow(0 0 14px rgba(184,39,39,0.3)); }
}
.clue-sealed-wax.seal-cracking,
.clue-sealed-wax.seal-broken { animation: none; }

/* Klick vor Jagdbeginn: kurzes Kopfschütteln des Umschlags */
.clue-sealed-envelope.seal-nope { animation: seal-nope 0.4s ease-in-out 1; }
@keyframes seal-nope {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px) rotate(-0.4deg); }
  60% { transform: translateX(5px) rotate(0.4deg); }
}

/* Umschlag blendet nach dem Bruch aus */
.clue-sealed.seal-away {
  opacity: 0;
  transform: translateY(-10px) scale(0.985);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}
/* Tisch blendet nach dem Bruch weich ein (einmalige Klasse) */
.current-clue-section.seal-reveal .clue-carousel {
  animation: seal-desk-in 0.7s ease both;
}
@keyframes seal-desk-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .current-clue-section.seal-armed .clue-sealed-wax { animation: none; }
  .seal-shard { transition: opacity 0.3s ease; }
  .clue-sealed-wax.seal-broken .seal-shard { transform: none; }
  .seal-crack path,
  .clue-sealed-wax.seal-cracking .seal-crack path { animation: none; stroke-dashoffset: 0; }
  .current-clue-section.seal-reveal .clue-carousel { animation: none; }
  .clue-sealed-envelope.seal-nope { animation: none; }
}
