/* ============================================================
   PB&J 101 — ജീവി's Kitchen
   Realistic redesign (from Claude Design handoff), warm amber
   palette, ജീവി's Kitchen branding. Token values mirror the
   design system with the dc.html amber overrides applied.
   ============================================================ */

:root {
  /* surfaces & ink (amber overrides) */
  --bg: #ffffff;
  --bg-soft: #fdfaf1;
  --surface: #ffffff;
  --ink: #2a2417;
  --ink-soft: #6f6552;
  --ink-on-pastel: #6a5a3a;

  /* the amber pop */
  --highlight: #f4b63a;
  --highlight-ink: #9a6a0c;
  --lavender: #eccb73;
  --lavender-200: #f0ddb0;
  --lavender-050: #fdf3d7;

  --p-butter: #fdeec2;
  --line: #efe7d6;
  --grid-line: rgba(212, 160, 46, 0.06);
  --grid-size: 46px;

  /* type */
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-ml: "Anek Malayalam", "Inter", sans-serif;
  --fs-lede: clamp(1.05rem, 2vw, 1.25rem);
  --fs-ui: 0.95rem;
  --fs-kicker: 0.78rem;
  --ls-kicker: 0.2em;

  /* radii & shadows (warm) */
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(150, 116, 40, 0.08);
  --shadow-raised: 0 18px 50px rgba(150, 116, 40, 0.10);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
.pbj-stage img, .stage img { -webkit-user-drag: none; user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: flex; height: 100vh; width: 100%; overflow: hidden; }

.sidebar {
  width: 266px; flex: 0 0 266px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  background: var(--bg); padding: 22px 18px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 6px 4px; }
.brand-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--lavender-050); border: 1px solid var(--lavender-200);
  flex: 0 0 auto;
}
.brand-tile svg { width: 22px; height: 22px; }
.brand-titles { min-width: 0; }
.brand-course { font-family: var(--font-display); font-weight: 800; font-size: 0.98rem; letter-spacing: -0.02em; line-height: 1; }
.brand-by { font-size: 0.72rem; color: var(--ink-soft); margin-top: 3px; }

.outline-kicker {
  font-size: var(--fs-kicker); font-weight: 700; letter-spacing: var(--ls-kicker);
  text-transform: uppercase; color: var(--highlight-ink); margin: 22px 8px 10px;
}
.modnav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.modnav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: 12px; padding: 10px;
  font: inherit; cursor: pointer; transition: background 0.16s ease; color: var(--ink-soft);
}
.modnav-item:hover { background: var(--lavender-050); }
.modnav-item:disabled { cursor: default; }
.modnav-item .mn-badge {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; font-family: var(--font-display);
  background: var(--lavender-050); color: var(--ink-soft); border: 1.5px solid transparent;
}
.modnav-item .mn-label { font-size: 0.88rem; font-weight: 500; line-height: 1.2; }
.modnav-item.active .mn-badge { background: #fff; color: var(--highlight-ink); border-color: var(--highlight); }
.modnav-item.active .mn-label { font-weight: 700; color: var(--ink); }
.modnav-item.done .mn-badge { background: var(--highlight); color: var(--ink); border-color: var(--highlight); }

.signed {
  border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px;
  display: flex; align-items: center; gap: 10px;
}
.signed .avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 999px;
  background: var(--lavender-050); color: var(--highlight-ink);
  font-weight: 700; font-family: var(--font-display);
}
.signed .s-label { font-size: 0.7rem; color: var(--ink-soft); }
.signed .s-name { font-size: 0.86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; flex: 0 0 62px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; gap: 24px;
}
.mod-name { font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap; }
.prog { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.prog .pct { font-size: 0.76rem; font-weight: 600; color: var(--ink-soft); width: 34px; text-align: right; }
.prog .track { width: 160px; height: 7px; border-radius: 999px; background: var(--lavender-050); overflow: hidden; }
.prog .fill { height: 100%; border-radius: 999px; background: var(--highlight); width: 0%; transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1); }

.stage-scroll {
  flex: 1; overflow-y: auto; background: var(--bg);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}
.stage-scroll::-webkit-scrollbar { width: 10px; }
.stage-scroll::-webkit-scrollbar-thumb { background: var(--lavender-200); border-radius: 999px; }
.stage { max-width: 920px; margin: 0 auto; padding: 40px 32px 48px; min-height: 100%; }

.footbar {
  flex: 0 0 auto; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; gap: 16px; background: var(--bg);
}

/* mobile menu toggle (hidden on desktop) */
.menu-toggle {
  display: none; background: none; border: 1.5px solid var(--line);
  border-radius: 10px; width: 38px; height: 38px; cursor: pointer; color: var(--ink);
  align-items: center; justify-content: center;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-family: var(--font-body); font-size: var(--fs-ui);
  border-radius: 999px; cursor: pointer; transition: all 0.18s ease; border: none;
}
.btn-primary {
  font-weight: 700; padding: 0.74rem 1.9rem;
  background: var(--highlight); color: var(--ink);
  box-shadow: 0 6px 16px rgba(212, 160, 46, 0.26);
}
.btn-primary:hover { background: var(--highlight-ink); color: #fff; transform: translateY(-2px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost {
  font-weight: 600; padding: 0.7rem 1.5rem;
  background: var(--bg); color: var(--ink-soft); border: 1.5px solid var(--lavender-200);
}
.btn-ghost:hover { border-color: var(--lavender); color: var(--ink); background: var(--lavender-050); }

/* ============================================================
   ജീവി TOOLTIP
   ============================================================ */
.ml { font-family: var(--font-ml); font-weight: 600; color: var(--highlight-ink); }
.jeevi-tip { position: relative; cursor: help; border-bottom: 2px dotted var(--highlight); }
.jeevi-tip::after {
  content: attr(data-tip);
  position: absolute; left: 0; top: calc(100% + 10px); width: 270px;
  background: var(--ink); color: #fff; font-family: var(--font-body); font-weight: 400;
  font-size: 0.78rem; line-height: 1.5; padding: 0.7rem 0.9rem; border-radius: 12px;
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease; z-index: 60;
}
.jeevi-tip::before {
  content: ""; position: absolute; left: 16px; top: calc(100% + 4px);
  border: 6px solid transparent; border-bottom-color: var(--ink);
  opacity: 0; transition: opacity 0.18s ease; z-index: 60;
}
.jeevi-tip:hover::after, .jeevi-tip:focus-visible::after,
.jeevi-tip:hover::before, .jeevi-tip:focus-visible::before { opacity: 1; transform: translateY(0); }

/* ============================================================
   INTERACTION CLASSES (ported from design)
   ============================================================ */
@keyframes pbjSparkle { 0% { transform: scale(0) rotate(-30deg); opacity: 0; } 55% { transform: scale(1.2) rotate(0); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 0.95; } }
.pbj-spark { animation: pbjSparkle 0.5s ease both; color: var(--highlight); }
.pbj-spread-board { touch-action: none; cursor: grab; }
.pbj-spread-board:active { cursor: grabbing; }
@keyframes pbjFadeRise { from { transform: translateY(12px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes pbjPop { from { transform: scale(0.96); } to { transform: scale(1); } }
@keyframes pbjDrop { 0% { transform: translateY(-130px); opacity: 0; } 68% { transform: translateY(0); opacity: 1; } 84% { transform: translateY(-7px); } 100% { transform: translateY(0); } }
@keyframes pbjSeal { from { transform: rotate(-18deg) scale(0.5); } to { transform: rotate(-8deg) scale(1); } }
.pbj-drop-anim { animation: pbjDrop 0.62s cubic-bezier(0.22, 1, 0.36, 1) both; }
.pbj-pop { animation: pbjPop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.pbj-rise { animation: pbjFadeRise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.pbj-seal-anim { animation: pbjSeal 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both; }
.pbj-clickable { cursor: pointer; transition: transform 0.18s ease, filter 0.18s ease; }
.pbj-clickable:hover { transform: translateY(-4px); filter: drop-shadow(0 10px 18px rgba(150, 116, 40, 0.20)); }

@media (prefers-reduced-motion: reduce) {
  .pbj-rise, .pbj-pop, .pbj-drop-anim, .pbj-seal-anim, .pbj-spark { animation: none !important; }
}

/* ============================================================
   COOKING GAME (spread + cut station)
   ============================================================ */
.pbj-spread-board img { position: relative; z-index: 2; }
.pbj-spread-fill { z-index: 3; }
.pbj-board-shadow {
  position: absolute; left: 24px; right: 24px; bottom: 6px; height: 22px;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(90, 56, 12, 0.22), transparent 78%);
  filter: blur(3px); z-index: 0;
}
.pbj-knife-shadow {
  position: absolute; top: 64%; width: 124px; height: 24px; transform: translate(-46%, -50%);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(60, 40, 10, 0.30), transparent 75%);
  filter: blur(4px); transition: opacity 0.14s ease; pointer-events: none; z-index: 6;
}
.pbj-spread-knife {
  position: absolute; top: 44%; width: 162px;
  transform: translate(-46%, -50%) rotate(7deg); transform-origin: center;
  transition: transform 0.1s ease; pointer-events: none;
  filter: drop-shadow(0 9px 9px rgba(150, 116, 40, 0.30)); z-index: 7;
}
/* cut step: knife is vertical and travels top to bottom */
.pbj-cut-knife { width: 150px; transform: translate(-50%, -50%) rotate(92deg); }
.pbj-cut-line {
  position: absolute; top: 30px; left: 50%; width: 3px; height: 178px;
  transform: translateX(-50%) scaleY(0); transform-origin: top center; border-radius: 2px;
  background: linear-gradient(180deg, rgba(120,86,30,0.15) 0%, rgba(120,86,30,0.6) 50%, rgba(120,86,30,0.15) 100%);
  transition: opacity 0.12s ease; pointer-events: none; z-index: 5;
}
@media (prefers-reduced-motion: reduce) {
  .pbj-spread-knife { transition: none; }
}

/* ============================================================
   LAYER STACK (What is a PB&J)
   ============================================================ */
.pbj-stack .pbj-layer {
  position: absolute; left: 115px; transform: translateX(-50%);
  filter: drop-shadow(0 7px 7px rgba(120, 86, 30, 0.22));
}
.pbj-layer-label {
  position: absolute; left: 230px; transform: translateY(-50%);
  white-space: nowrap; font-size: 0.76rem; font-weight: 700;
  color: var(--ink-soft); padding-left: 12px; border-left: 2px solid var(--highlight);
  line-height: 1.1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; inset: 0 28% 0 0; z-index: 50;
    transform: translateX(-105%); transition: transform 0.25s ease; box-shadow: var(--shadow-raised);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .stage { padding: 28px 18px 36px; }
  .pbj-recipe-card { padding: 24px 22px 18px !important; }
  .pbj-recipe-cols { grid-template-columns: 1fr !important; gap: 22px !important; }
  .pbj-recipe-cols > div:last-child { border-left: none !important; padding-left: 0 !important; border-top: 1.5px solid rgba(31,78,121,0.18); padding-top: 22px !important; }
}
