/* Entry 018 — The envy dial
   Series: Soulware.
   Scene art direction: a field of golden wind-blown grass at the low warm hour —
   everyone-else's-summer made into pure light — with one thread of green running
   through the gold. One light source: a soft sun raking from the right. One
   committed warm-gold temperature, cut by a single cool note: an envy-green dial.
   Three layers: blurred gold field → sunlit grass-haze → one dark frosted feed
   panel and its dial. Design focus: one instrument — a feed and the knob that
   tunes it — given the whole frame and plenty of air.
   Type: Playfair Display (the soul / captions + readout state) + Manrope (the
   machine / chrome, labels, data). Accent: envy-green #34b27a. */

.envy-scene {
  --green: #34b27a;
  --green-glow: #6fd6a6;
  --green-deep: #1d6a49;
  --on-dark: #f2efe6;
  --gold: #d9b688;
  display: grid;
  place-items: center;
  min-height: 780px;
  padding: 120px 32px;
  border-color: rgba(40, 34, 18, 0.6);
  /* background-first: a real photograph (golden grass, green at the roots) carries
     the scene; a cool-leaning scrim keeps the dark panel and type legible. */
  background-image:
    linear-gradient(176deg, rgba(28, 26, 14, 0.42) 0%, rgba(24, 24, 16, 0.20) 40%, rgba(18, 20, 14, 0.66) 100%),
    url("../../public/media/backgrounds/warm-10-eugene.jpg");
  background-size: cover, cover;
  background-position: center, center 42%;
  background-repeat: no-repeat, no-repeat;
}

/* mid layer — a warm sun-bloom from the right, the gold spilled and blurred */
.glow {
  position: absolute;
  z-index: 0;
  right: 6%;
  top: 30%;
  width: min(680px, 70%);
  height: 460px;
  transform: translateY(-50%);
  background:
    radial-gradient(58% 58% at 60% 45%, rgba(255, 210, 138, 0.30), transparent 70%);
  filter: blur(64px);
  pointer-events: none;
  transition: opacity 800ms ease;
}

/* ------------------------------------------------------------------ */
/* THE COMPONENT — one feed + one dial, on dark frosted glass          */
/* ------------------------------------------------------------------ */

.rig {
  position: relative;
  z-index: 2;
  width: min(940px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 30px;
  align-items: stretch;
  padding: 34px;
  border-radius: 30px;
  font-family: var(--ui-sans, "Manrope", system-ui, sans-serif);
  /* dark frosted glass: a thin film over the golden field */
  background:
    linear-gradient(168deg, rgba(38, 44, 36, 0.30), rgba(16, 20, 16, 0.52));
  border: 1px solid rgba(180, 200, 178, 0.18);
  box-shadow:
    0 1px 0 rgba(214, 230, 210, 0.22) inset,
    0 0 0 1px rgba(10, 14, 10, 0.22),
    0 60px 130px rgba(14, 16, 8, 0.62),
    0 16px 50px rgba(60, 50, 20, 0.30);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
  color: var(--on-dark);
  transition: filter 700ms ease;
}

/* ---- the feed ---- */
.feed {
  position: relative;
  display: grid;
  align-content: end;
  min-height: 300px;
  isolation: isolate;
}

.post {
  border-radius: 20px;
  border: 1px solid rgba(214, 226, 210, 0.16);
  background: linear-gradient(168deg, rgba(60, 66, 56, 0.46), rgba(26, 30, 24, 0.52));
  box-shadow: 0 18px 44px rgba(10, 14, 8, 0.42);
  transition: transform 600ms cubic-bezier(0.2, 0.6, 0.2, 1),
    opacity 600ms ease, filter 600ms ease;
}

/* the two ghosts of "more to envy" stacked behind the main post */
.post-3, .post-2 {
  position: absolute;
  left: 0;
  right: 0;
  padding: 14px 18px;
  color: rgba(232, 236, 226, 0.8);
}
.post-3 .caption, .post-2 .caption {
  margin: 0;
  font-family: "Playfair Display", "Newsreader", Georgia, serif;
  font-size: 15px;
  font-style: italic;
  line-height: 1.3;
}
.post-3 {
  top: -2px;
  transform: translateY(-46px) scale(0.9);
  filter: saturate(1.1);
}
.post-2 {
  top: -2px;
  transform: translateY(-24px) scale(0.95);
}
.post-3 .caption::before, .post-2 .caption::before {
  content: "";
  display: inline-block;
  width: 16px; height: 16px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: -3px;
  background: radial-gradient(circle at 30% 30%, #e7c79a, #b98a52);
}

/* the main, fully-rendered post — the hero of the feed */
.post-1 {
  position: relative;
  z-index: 3;
  padding: 22px 24px 18px;
}

.post-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 12.5px;
}
.post-top .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffe6b8, #cf9a55 60%, #9c6f38);
  box-shadow: 0 0 0 1px rgba(255, 240, 210, 0.3), 0 4px 12px rgba(120, 84, 30, 0.4);
  flex: none;
}
.post-top .who { font-weight: 600; color: rgba(238, 240, 230, 0.92); letter-spacing: 0.01em; }
.post-top .ago { margin-left: auto; color: rgba(214, 220, 206, 0.5); font-size: 11.5px; }

.caption.main {
  margin: 0;
  font-family: "Playfair Display", "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: clamp(21px, 2.6vw, 28px);
  line-height: 1.22;
  letter-spacing: 0.004em;
  color: #f5f1e8;
  text-wrap: balance;
  transition: color 600ms ease;
}

.post-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(220, 226, 212, 0.62);
}
.post-foot .dot-sep { opacity: 0.5; }
.post-foot .quiet { color: rgba(220, 226, 212, 0.45); font-variant-numeric: tabular-nums; }

/* ---- the console (readout + dial + stops) ---- */
.console {
  display: grid;
  align-content: start;
  gap: 18px;
  padding-left: 30px;
  border-left: 1px solid rgba(190, 206, 186, 0.14);
}

.readout {
  display: grid;
  gap: 3px;
  margin: 0;
}
.readout-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(206, 214, 198, 0.55);
}
.readout-value {
  font-family: "Playfair Display", "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1;
  color: var(--green-glow);
  transition: color 500ms ease;
}

/* the dial — the hero control */
.dial-wrap { display: grid; place-items: center; padding: 6px 0 2px; }
.dial {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  cursor: grab;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(58, 66, 56, 0.6), rgba(18, 22, 18, 0.7) 72%);
  box-shadow:
    0 1px 0 rgba(220, 234, 216, 0.16) inset,
    0 -10px 30px rgba(10, 14, 10, 0.5) inset,
    0 22px 46px rgba(8, 12, 8, 0.5);
  touch-action: none;
  outline: none;
}
.dial:active { cursor: grabbing; }
.dial:focus-visible { box-shadow: 0 0 0 3px rgba(111, 214, 166, 0.5), 0 22px 46px rgba(8, 12, 8, 0.5); }

/* the progress arc, drawn with conic-gradient driven by --deg (0..270) */
.dial-track {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background:
    conic-gradient(from 225deg,
      var(--green) 0deg,
      var(--green) calc(var(--deg, 270) * 1deg),
      rgba(150, 168, 150, 0.16) calc(var(--deg, 270) * 1deg),
      rgba(150, 168, 150, 0.16) 270deg,
      transparent 270deg);
  -webkit-mask: radial-gradient(circle, transparent 60px, #000 61px);
  mask: radial-gradient(circle, transparent 60px, #000 61px);
  transition: filter 400ms ease;
}
.dial-fill {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(52, 178, 122, 0.18), transparent 70%);
  opacity: var(--lvl, 1);
  transition: opacity 400ms ease;
}

/* the knob's rotating pointer */
.dial-knob {
  position: absolute;
  inset: 0;
  transform: rotate(calc((var(--deg, 270) - 135) * 1deg));
  transition: transform 240ms cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: none;
}
.dial-pointer {
  position: absolute;
  left: 50%;
  top: 16px;
  width: 5px; height: 26px;
  margin-left: -2.5px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--green-glow), var(--green));
  box-shadow: 0 0 12px rgba(111, 214, 166, 0.8);
}
.dial-cap {
  font-family: var(--ui-sans, "Manrope", sans-serif);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(206, 214, 198, 0.6);
  pointer-events: none;
}

/* the labelled stops */
.stops {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.stop {
  font-family: var(--ui-sans, "Manrope", sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 6px;
  border-radius: 999px;
  border: 1px solid rgba(196, 210, 192, 0.2);
  background: rgba(150, 168, 150, 0.06);
  color: rgba(220, 226, 212, 0.66);
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}
.stop:hover { color: #f2efe6; border-color: rgba(196, 210, 192, 0.4); }
.stop.is-on {
  color: #08130d;
  background: linear-gradient(180deg, var(--green-glow), var(--green));
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(45, 150, 100, 0.4);
}

.offer {
  margin: 2px 0 0;
  font-family: "Playfair Display", "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 16px;
  line-height: 1.4;
  color: var(--green-glow);
  animation: rise 500ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
}

.whose {
  justify-self: start;
  margin-top: 2px;
  font-family: var(--ui-sans, "Manrope", sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px dashed rgba(196, 210, 192, 0.32);
  background: transparent;
  color: rgba(220, 226, 212, 0.7);
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease;
}
.whose:hover { color: #f2efe6; border-color: rgba(196, 210, 192, 0.6); }
.whose[aria-pressed="true"] {
  color: #08130d;
  background: rgba(214, 182, 136, 0.9);
  border-style: solid;
  border-color: transparent;
}

/* ---- level states: the feed responds to the dial ---- */
/* trimmed: the pile thins, gloss eases */
.rig[data-level="trimmed"] .post-3 { opacity: 0; transform: translateY(-46px) scale(0.86); }
.rig[data-level="trimmed"] .caption.main { color: #eef0e6; }

/* kind: one ghost left, colour drains from the provoking image */
.rig[data-level="kind"] .post-3,
.rig[data-level="off"] .post-3 { opacity: 0; }
.rig[data-level="kind"] .post-2 { opacity: 0.5; filter: saturate(0.35); }
.rig[data-level="kind"] .post-1 { filter: saturate(0.7); }
.rig[data-level="kind"] .caption.main { color: #e7eadf; }

/* off: just one ordinary line, the gloss gone */
.rig[data-level="off"] .post-2 { opacity: 0; }
.rig[data-level="off"] .post-1 { filter: saturate(0.42) brightness(0.98); }
.rig[data-level="off"] .post-top .avatar { background: radial-gradient(circle at 32% 28%, #cfd3c6, #8d9485); }
.rig[data-level="off"] .caption.main {
  color: #dfe3d6;
  font-style: italic;
  font-size: clamp(19px, 2.3vw, 24px);
}

/* the warm sun-bloom dims as you turn the envy down */
.envy-scene:has(.rig[data-level="kind"]) .glow { opacity: 0.55; }
.envy-scene:has(.rig[data-level="off"]) .glow { opacity: 0.3; }

/* whose-hand reveal: the readout flips to the platform's truth */
.rig[data-whose="platform"] .readout-value { color: var(--gold); }

/* unobtrusive photo attribution */
.scene-credit {
  position: absolute;
  right: 16px;
  bottom: 13px;
  z-index: 4;
  font-family: var(--ui-sans, "Manrope", sans-serif);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 238, 226, 0.34);
  pointer-events: none;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .post, .dial-knob, .offer { transition: none; animation: none; }
}

/* ---- small screens ---- */
@media (max-width: 760px) {
  .envy-scene { padding: 64px 14px; min-height: 0; }
  .rig {
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 24px;
    border-radius: 24px;
  }
  .console {
    padding-left: 0;
    padding-top: 24px;
    border-left: none;
    border-top: 1px solid rgba(190, 206, 186, 0.14);
  }
  .feed { min-height: 230px; }
}
