/* ============================================================
 * AKTENABLAGE TABS — Karteireiter aus Manila-Kraftpapier, die
 * oben aus der dunklen Holz-Ablage herausragen. Gleiche Material-
 * sprache wie die .file-tab-reiter der Aktenmappen (Verlauf
 * #dfc48a → --manila, --manila-dark-Kante, runde Oberkanten),
 * nur größer. Der aktive Reiter steht voll aufgerichtet mit
 * rotem Stempel-Strich an der Unterkante; der inaktive steckt
 * 5px tiefer in der Ablage und ist dunkler abgesoffen — wie ein
 * dahinterliegendes Register.
 * ============================================================ */
.cabinet-tabs {
  position: absolute;
  top: -37px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 3;
  align-items: flex-end;
}
.cabinet-tab {
  /* Inaktiv: abgedunkeltes Kraftpapier, leicht versunken */
  background: linear-gradient(to bottom, #c9ac6e 0%, #b3955a 100%);
  border: 1px solid var(--manila-deep);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  padding: 9px 28px 12px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: rgba(42, 31, 15, 0.6);
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  transform: translateY(5px);
  transition: color 0.15s, background 0.15s, box-shadow 0.2s, transform 0.2s;
  font-weight: 500;
  line-height: 1.45;
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 230, 0.25),
    0 3px 8px rgba(0, 0, 0, 0.35);
}
.cabinet-tab:hover {
  color: var(--ink);
  transform: translateY(3px);
}
.cabinet-tab.active {
  /* Aktiv: helles Manila wie die Mappen-Reiter, voll aufgerichtet,
     roter Stempel-Strich als "hier bist du"-Markierung */
  background: linear-gradient(to bottom, #dfc48a 0%, var(--manila) 100%);
  border-color: var(--manila-dark);
  color: var(--ink);
  transform: translateY(0);
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 230, 0.4),
    inset 0 -3px 0 var(--stamp-red),
    0 5px 12px rgba(0, 0, 0, 0.4);
}

/* Tab attention shimmer — a continuously running, much brighter
   sweep over the inactive Finalakten tab to draw the user's eye
   peripherally. The previous version (one-shot, dim, every 9-14s)
   was too subtle to register. This one runs nonstop with a 3s
   cycle: ~1.3s sweep across, then ~1.7s pause/wait off-screen.
   Result: every few seconds something glints across the tab,
   easy to catch even from the corner of your eye.

   Subtle background tint also makes the tab itself stand out a bit
   even when the shimmer isn't actively sweeping — so users glancing
   at it during the off-cycle still see "this looks different".

   Activated by JS via the .attention class on the inactive Finalakten
   tab. Removed automatically when the user clicks that tab (= already
   discovered, no need to keep nudging). */
.cabinet-tab {
  overflow: hidden;
}
.cabinet-tab.attention {
  background: linear-gradient(180deg, #f4e9c8 0%, #e6d59f 100%);
  border-color: rgba(176, 140, 58, 0.6);
  color: var(--ink);
}
.cabinet-tab.attention::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 80%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 25%,
    rgba(255, 245, 200, 0.95) 50%,
    transparent 75%
  );
  /* One sweep across, then a long pause off-screen, then repeat.
     Total cycle: 6s. Of that, the sweep itself happens in the first
     ~25% (~1.5s) and the remaining 75% (~4.5s) parks the gradient
     off-screen so the user gets a calm rest period before the next
     glimmer. The sweep duration is the same as before — we just
     stretched the pause to make it less frequent. */
  animation: cabinet-tab-shimmer 6s ease-in-out infinite;
}
@keyframes cabinet-tab-shimmer {
  0%   { left: -100%; }
  25%  { left: 130%; }
  100% { left: 130%; }
}
@media (prefers-reduced-motion: reduce) {
  .cabinet-tab.attention::after { animation: none; }
}

/* ============================================================
   MOBILE (≤720px): Tabs als kompaktes 2-Spalten-Grid ÜBER der
   Ablage statt als herausragende Karteireiter.
   WICHTIG ZUR KASKADE: Diese Regeln MÜSSEN hier stehen (nicht in
   css/12-postits.css) — diese Datei lädt später, und die Basis-
   Regeln oben (.cabinet-tabs absolute/top/transform) würden
   gleichspezifische Overrides aus früher geladenen Dateien
   überschreiben. Genau das war passiert: Die Mobile-Regeln in
   12-postits waren wirkungslos, die Reiter klebten absolut
   positioniert in voller Breite über dem Sektions-Untertitel.
   ============================================================ */
@media (max-width: 720px) {
  .cabinet-tabs {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    gap: 4px;
    padding: 0 0.5rem;
    box-sizing: border-box;
    align-items: flex-end;
    /* Reiter über die Tischoberkante ziehen: Die Ablage hat 3rem
       (48px) Innenabstand oben; -3rem hebt die Leiste exakt auf die
       Holzkante, die weiteren -16px lassen die obere Reiterhälfte
       darüber hinausragen — untere Hälfte steckt im Holz, wie beim
       Desktop-Karteikasten. Die Kopffreiheit dafür liefert das
       margin-top von .file-cabinet (2.4rem, css/04-desk-props.css). */
    margin-top: calc(-3rem - 16px);
    margin-bottom: 0.7rem;
  }
  .cabinet-tab {
    flex: 1 1 0;
    min-width: 0;
    /* Kompakt: kleines Padding + Schrift, damit auch "Monatsakten"
       (11 Zeichen, Uppercase) auf 320px-Screens reinpasst.
       white-space: normal als Notnagel für 2-Zeilen-Umbruch. */
    padding: 8px 4px 10px;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
    word-break: keep-all;
    /* Karteireiter-Optik wie auf dem Desktop: offene Unterkante
       (Papier läuft ins Holz), nur oben gerundet, inaktiver Reiter
       steckt 3px tiefer. */
    border-bottom: none;
    border-radius: 7px 7px 0 0;
    transform: translateY(3px);
  }
  .cabinet-tab:hover { transform: translateY(3px); }
  .cabinet-tab.active { transform: translateY(0); }
}

/* ============================================================
 * FINALE GRID — uses the same grid template as the regular
 * .files-grid so cards have identical size. The 4 cases simply
 * fill the first 4 slots of a 6-col grid (with breakpoints
 * matching the regular grid below).
 * ============================================================ */
.finale-grid {
  /* No template override here — inherits from .files-grid above */
}

/* ============================================================
 * RARITY-COLORED FINALE FOLDERS — each finale folder is tinted
 * in the color of its rarity tier, so the 4 cards are visually
 * distinct from each other and from the manila regular folders.
 *
 * The body layers the tier tint OVER the illustrated kraft-paper
 * folder (assets/akte-mappe-*.webp) — same paper structure as the
 * monthly folders, shimmering through the semi-transparent tint.
 * The tab-reiter on top
 * uses a deeper, fully-saturated tier color so the folder reads
 * "this is a Bronze folder" / "this is a Gold folder" at a glance.
 * ============================================================ */
.file-folder.tier-bronze {
  --tier-tab-bg:  linear-gradient(140deg, #b07840 0%, #d29555 50%, #8a5e2d 100%);
  --tier-tab-fg:  #2a1808;
  --tier-body:    linear-gradient(170deg, rgba(176, 110, 50, 0.72), rgba(176, 110, 50, 0.32) 60%), url("/assets/akte-mappe-1.webp") center / 100% 100% no-repeat;
  --tier-edge:    rgba(122, 70, 28, 0.75);
  --tier-glow:    rgba(230, 150, 70, 0.45);
}
.file-folder.tier-silber {
  --tier-tab-bg:  linear-gradient(140deg, #a8b2bc 0%, #d8dfe5 50%, #8e98a3 100%);
  --tier-tab-fg:  #1a2026;
  --tier-body:    linear-gradient(170deg, rgba(140, 158, 174, 0.70), rgba(140, 158, 174, 0.32) 60%), url("/assets/akte-mappe-2.webp") center / 100% 100% no-repeat;
  --tier-edge:    rgba(95, 110, 124, 0.7);
  --tier-glow:    rgba(220, 232, 245, 0.55);
}
.file-folder.tier-gold {
  --tier-tab-bg:  linear-gradient(140deg, #c9a227 0%, #f0d060 50%, #a07f1c 100%);
  --tier-tab-fg:  #2a1f04;
  --tier-body:    linear-gradient(170deg, rgba(212, 165, 32, 0.65), rgba(212, 165, 32, 0.28) 60%), url("/assets/akte-mappe-3.webp") center / 100% 100% no-repeat;
  --tier-edge:    rgba(160, 120, 24, 0.75);
  --tier-glow:    rgba(255, 220, 80, 0.55);
}
.file-folder.tier-diamant {
  /* Diamant-Akte: eisig-blau-weißer Verlauf mit Frost-Glanz statt
     dunklem Mitternachts-Schwarz. Funkelnde Sterne werden vom JS
     injiziert (siehe script.js wireDiamantSparkles). */
  --tier-tab-bg:  linear-gradient(140deg, #e8eef4 0%, #f8fbfe 50%, #c8d8e8 100%);
  --tier-tab-fg:  #1a3050;
  /* Frost-Verlauf ueber der Papier-Illustration: oben (0.85) fast
     deckend eisig, nach unten (0.45) scheint die Papierstruktur
     frostig durch. Falls das dem Diamant zu viel Struktur gibt,
     hier einfach wieder auf flaches #d8e4f0 zuruecksetzen. */
  --tier-body:    linear-gradient(170deg, rgba(220, 232, 245, 0.85), rgba(180, 200, 220, 0.45) 60%), url("/assets/akte-mappe-4.webp") center / 100% 100% no-repeat;
  --tier-edge:    rgba(120, 150, 180, 0.55);
  --tier-glow:    rgba(180, 210, 235, 0.55);
}
.file-folder.tier-bronze,
.file-folder.tier-silber,
.file-folder.tier-gold,
.file-folder.tier-diamant {
  background: var(--tier-body);
  /* Layered shadow for the noble feel: subtle inner highlight, sharp
     edge, soft outer glow in the tier color */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 0 0 1px var(--tier-edge),
    0 6px 18px rgba(0, 0, 0, 0.15),
    0 0 22px var(--tier-glow);
  position: relative;
  /* Promote to its own GPU compositor layer. With 5 stacked shadows
     the rasterized result gets cached and composited rather than
     re-painted on every frame (e.g. when other things on the page
     animate or scroll). Hover transforms then run on the GPU. */
  will-change: transform;
  /* NOTE: we deliberately DO NOT set overflow:hidden here, because the
     .file-tab-reiter has top:-14px and protrudes above the folder. The
     shimmer overlay clips itself via its own overflow:hidden inside
     the .tier-shimmer span. */
}
.file-folder.tier-bronze .file-tab-reiter,
.file-folder.tier-silber .file-tab-reiter,
.file-folder.tier-gold .file-tab-reiter,
.file-folder.tier-diamant .file-tab-reiter {
  background: var(--tier-tab-bg);
  color: var(--tier-tab-fg);
  text-shadow: none;
  font-weight: 700;
  letter-spacing: 0.18em;
  /* Reiter overhangs the top edge by 14px; let it stay visible above
     the overflow:hidden clip by repositioning into the folder slightly */
  z-index: 5;
}
/* Diamant-Akte hat hellen Hintergrund — Text bleibt dunkel, im
   Gegensatz zum vorherigen Mitternachts-Schwarz wo wir hier auf
   helle Goldschrift wechseln mussten. Bei Diamant ist's also nicht
   nötig, die Default-Textfarbe zu überschreiben.
   Aber wir setzen einen feinen "Frost"-Schimmer auf den Status-Text. */
.file-folder.tier-diamant .file-tab-title,
.file-folder.tier-diamant .file-tab-status {
  color: #1a3050;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.file-folder.tier-diamant .file-tab-meta {
  color: rgba(40, 60, 90, 0.7);
}

/* ============================================================
 * SHIMMER OVERLAY — periodic light-sweep across each finale folder
 * to suggest noble, valuable, "worth opening" treasure.
 *
 * Implementation: a span.tier-shimmer is rendered inside each
 * finale article (see script.js buildFinaleGrid). It is absolutely
 * positioned over the entire folder, clipped by overflow:hidden.
 * Inside it, a ::after pseudo holds a 200%-wide diagonal gradient
 * that slides from left to right when the .shimmer-on class is
 * added.
 *
 * Triggering is JS-driven (script.js startFinaleShimmer): about once
 * every 12-20s a randomly picked folder gets the .shimmer-on class
 * for ~1.6s, then the class is removed so it can fire again later.
 * This produces an organic, asymmetric pattern instead of the
 * sequential, metronomic feel of an infinite CSS animation.
 * ============================================================ */
.tier-shimmer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;  /* above the .file-tab::after paper-texture (z:auto) */
}
.tier-shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    115deg,
    transparent 38%,
    var(--shimmer-color, rgba(255, 255, 255, 0.55)) 50%,
    transparent 62%
  );
  /* Default: parked off-screen left. The animation only runs when
     .shimmer-on is added by JS — and runs ONCE (forwards), then
     stops. JS removes the class after the run completes so the
     animation can be triggered again later. */
  transform: translateX(-100%);
  /* Avoid jagged edges from the diagonal gradient */
  filter: blur(1px);
}
.tier-shimmer.shimmer-on::after {
  animation: tier-shimmer-sweep 1.6s ease-in-out forwards;
}
@keyframes tier-shimmer-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Per-tier shimmer color so the sweep takes on the metal's tint */
.file-folder.tier-bronze   .tier-shimmer { --shimmer-color: rgba(255, 220, 170, 0.55); }
.file-folder.tier-silber   .tier-shimmer { --shimmer-color: rgba(255, 255, 255, 0.65); }
.file-folder.tier-gold     .tier-shimmer { --shimmer-color: rgba(255, 240, 170, 0.70); }
.file-folder.tier-diamant .tier-shimmer { --shimmer-color: rgba(220, 240, 255, 0.75); }

/* Respect reduced-motion preferences — disable the shimmer for users
   who've opted out of unnecessary animations. */
@media (prefers-reduced-motion: reduce) {
  .tier-shimmer.shimmer-on::after { animation: none; }
}

/* ============================================================
 * LOCKED FINALE FOLDER — visually IDENTICAL to unlocked.
 * Click behavior differs (modal opens) but the folder shows no
 * lock icon, no dimming, no grayscale. The user only finds out
 * it's locked by clicking it.
 * ============================================================ */
.file-folder.locked {
  cursor: pointer;
}

/* ============================================================
 * FINALE LOCK MODAL — appears when user clicks a locked folder
 * ============================================================ */
.finale-lock-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 6, 0.85);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.finale-lock-modal.active { display: flex; }
.finale-lock-panel {
  background: var(--paper);
  border: 1px solid var(--manila-deep);
  padding: 2rem 2rem 1.5rem;
  max-width: 460px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  position: relative;
}
.finale-lock-panel .lock-tier-pill {
  display: inline-block;
  padding: 0.3rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 1rem;
}
.lock-tier-pill.tier-bronze   { background: rgba(168, 116, 60, 0.15);  color: #6e4520; }
.lock-tier-pill.tier-silber   { background: rgba(176, 170, 176, 0.18); color: #45525e; }
.lock-tier-pill.tier-gold     { background: rgba(212, 165, 32, 0.18);  color: #6a5210; }
.lock-tier-pill.tier-diamant { background: rgba(220, 235, 250, 0.92);    color: #1a3050; }

.finale-lock-panel h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 0 0 0.6rem;
  color: var(--ink);
}
.finale-lock-panel p {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
  line-height: 1.5;
}
.finale-lock-panel .lock-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
}
.finale-lock-panel .btn {
  padding: 0.7rem 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--ink);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.finale-lock-panel .btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.finale-lock-panel .btn-primary:hover {
  background: var(--stamp-red);
  border-color: var(--stamp-red);
}
.finale-lock-panel .btn-secondary {
  background: transparent;
  color: var(--ink);
}
.finale-lock-panel .btn-secondary:hover {
  background: var(--ink);
  color: var(--paper);
}


/* ============================================================
   Finalakten im geoeffneten Ordner-Modal
   ------------------------------------------------------------
   Die grosse Mappe nutzt die Manila-Illustrationen (akte-mappe-*).
   Fuer Finalakten setzt js/09 die Klasse .folder-tier-<stufe> am
   #folder; die Filterketten toenen Deckel (geschlossen + fliegende
   Cover-Vorderseite) in die jeweilige Metallfarbe. Die Innenseiten
   (Papier) bleiben unangetastet.
   ============================================================ */
.folder-tier-bronze #folder-closed,
.folder-tier-bronze .folder-cover .fc-front {
  filter: sepia(0.55) saturate(1.5) hue-rotate(-12deg) brightness(0.98);
}
.folder-tier-silber #folder-closed,
.folder-tier-silber .folder-cover .fc-front {
  filter: saturate(0.15) brightness(1.12) contrast(1.03);
}
.folder-tier-gold #folder-closed,
.folder-tier-gold .folder-cover .fc-front {
  filter: sepia(0.85) saturate(1.9) hue-rotate(-6deg) brightness(1.06);
}
.folder-tier-diamant #folder-closed,
.folder-tier-diamant .folder-cover .fc-front {
  filter: sepia(1) hue-rotate(160deg) saturate(0.55) brightness(1.15);
}
