/* The interrogation (js/tasks/sorgu.js). Kim's office on Soru Gezegeni:
   one bulb (b.bulb, css/merak.css), one dark room, and a WANTED paper on the
   desk waiting for a name. Everything here sits inside the bulb's cone, so
   the colours are the warm end of the palette burnt down by the dark. */

.sorgu-room {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  padding-top: 2vh;
  transition: opacity 0.5s ease;
}
/* The room resetting itself after a wrong name: everything goes under for a
   breath, and the next paper lands on a dark desk. */
.sorgu-room.reset { opacity: 0.12; }
.sorgu-room.cleared { opacity: 0; transition: opacity 0.9s ease; }

/* ---------- The tally: one dosya tab per face ---------- */

.sorgu-tally {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}
.sorgu-tab {
  width: 1.1rem;
  height: 0.9rem;
  /* A file tab: a little folder corner, dark until its face has been named. */
  border-radius: 2px 2px 0 0;
  border: 1px solid rgba(243, 234, 216, 0.16);
  background: rgba(243, 234, 216, 0.05);
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
.sorgu-tab.done {
  background: #E8C16A;
  border-color: #E8C16A;
  box-shadow: 0 0 0.6em rgba(232, 193, 106, 0.5);
}

/* ---------- The desk and the paper on it ---------- */

.sorgu-desk {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 15.5rem;
}

/* Newsprint under a bare bulb: never white, always the colour paper goes when
   the only light in the room is orange. */
.sorgu-paper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: min(17rem, 74vw);
  padding: 0.9rem 1rem 1.1rem;
  background: linear-gradient(#E4D6B8, #CDBC98);
  color: #241B10;
  border-radius: 2px;
  box-shadow: 0 1.2rem 2.4rem rgba(0, 0, 0, 0.55);
  transform: translateY(-42vh) rotate(-9deg);
  opacity: 0;
  transition: transform 0.62s cubic-bezier(0.16, 0.9, 0.3, 1), opacity 0.4s ease;
}
.sorgu-paper.land {
  transform: translateY(0) rotate(var(--tilt, -1.6deg));
  opacity: 1;
}
/* Torn top edge, so it reads as something ripped off a stack. */
.sorgu-paper::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: repeating-linear-gradient(90deg,
    #E4D6B8 0 5px, transparent 5px 6px);
}

.sorgu-wanted {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: #6B4A22;
  border-bottom: 1px solid rgba(36, 27, 16, 0.25);
  padding-bottom: 0.4rem;
  width: 100%;
  text-align: center;
}

.sorgu-face {
  font-size: clamp(3.4rem, 12vw, 4.6rem);
  line-height: 1.1;
  /* Printed, not photographed: the mugshot is ink on cheap paper. */
  filter: grayscale(0.55) contrast(1.15) sepia(0.25);
}

/* The name line. Empty until the paper is named, then stamped. */
.sorgu-stamp {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
  min-height: 1.6em;
  color: #241B10;
  border-top: 1px dashed rgba(36, 27, 16, 0.3);
  width: 100%;
  text-align: center;
  padding-top: 0.35rem;
  opacity: 0;
  transform: scale(1.5) rotate(-7deg);
  transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.sorgu-paper.named .sorgu-stamp { opacity: 1; transform: scale(1) rotate(-3.5deg); }
.sorgu-paper.named { box-shadow: 0 1.2rem 2.4rem rgba(0, 0, 0, 0.55), 0 0 2.4em rgba(232, 193, 106, 0.28); }

/* Filed: named and away, off the side of the desk. */
.sorgu-paper.filed {
  transform: translate(26vw, 12vh) rotate(14deg);
  opacity: 0;
  transition: transform 0.6s ease-in, opacity 0.6s ease-in;
}
/* Crumpled: wrong name, and the paper goes back in the pile. */
.sorgu-paper.crumpled {
  transform: scale(0.35) rotate(-38deg);
  opacity: 0;
  transition: transform 0.55s ease-in, opacity 0.55s ease-in;
}

/* ---------- Kim's question, and the two names ---------- */

/* The game builds its own DOM inside the beat, which carries no text colour of
   its own, so kim's question states one. Without it the punctuation outside
   the gold [r:...] renders black on a black room and the ? disappears. */
.sorgu-ask {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.5rem, 4.4vw, 2rem);
  text-align: center;
  color: #F3EAD8;
}

.sorgu-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3rem;
}
.pill.sorgu-name.spent { pointer-events: none; }
.pill.sorgu-name.right {
  border-color: #E8C16A;
  box-shadow: 0 0 1.4em rgba(232, 193, 106, 0.45);
}
.pill.sorgu-name.wrong {
  border-color: #E8776A;
  color: #E8776A;
  animation: shake 0.4s ease;
}

/* The light lurches when a name is wrong. The rig is the engine's (syncBulb),
   so the game only sets a flag on the body and the swing lives here. */
body.bulb-lurch .bulb-rig {
  animation: sorgu-lurch 0.9s ease-in-out;
}
@keyframes sorgu-lurch {
  0%   { transform: rotate(0deg); }
  22%  { transform: rotate(-11deg); }
  48%  { transform: rotate(8deg); }
  72%  { transform: rotate(-4.5deg); }
  100% { transform: rotate(0deg); }
}
body.bulb-lurch .bulb-layer { animation: sorgu-flicker 0.9s steps(1, end); }
@keyframes sorgu-flicker {
  0%, 14%, 30%, 100% { opacity: 1; }
  8%, 22%            { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .sorgu-paper, .sorgu-paper.land, .sorgu-paper.filed, .sorgu-paper.crumpled { transition: opacity 0.3s ease; transform: none; }
  .sorgu-paper.filed, .sorgu-paper.crumpled { opacity: 0; }
  .sorgu-stamp { transition: opacity 0.3s ease; transform: none; }
  .sorgu-paper.named .sorgu-stamp { transform: none; }
  body.bulb-lurch .bulb-rig, body.bulb-lurch .bulb-layer { animation: none; }
}
