/* ============================================================================
   recipes.css - how recipes look: the dictionary's "Recipes" view (game page)
   and "My recipes" (account page).
   File: game/static/game/css/recipes.css

   HOW TO EDIT
   1. Section 1 holds the colors. They follow the page's own palette, so light /
      dark mode just works; replace a var(...) with a hex value to force a color.
   2. Section 2 is the recipe line (A + B = C) shared by both places.
   3. Section 3 is the Dictionary | Recipes switch in the dictionary panel.
   4. Section 4 is the account page's "My elements" list (filters, sort, pages).
   5. Section 5 is the stage-by-stage recipe tree. (Rarity colors: rarity.css.)
   ============================================================================ */


/* ---------- 1. COLORS ---------- */
:root {
  --recipe-pill-bg:       var(--pill-bg, var(--bg, #ffffff));              /* inside a label */
  --recipe-pill-border:   var(--pill-border, var(--auth-border, #e4e4e7));
  --recipe-text:          var(--auth-text, var(--text-dark, #18181b));
  --recipe-muted:         var(--auth-muted, var(--text-muted, #71717a));   /* + and = signs, notes */
  --recipe-accent:        var(--auth-accent, var(--accent, #f97316));      /* the element being made */
  --recipe-accent-light:  var(--auth-accent-light, var(--accent-light, #fff7ed));
  --recipe-line:          var(--sidebar-border, var(--auth-border, #e5e7eb));  /* lines between recipes */
}


/* ---------- 2. A RECIPE LINE:  [Water] + [Fire] = [Steam] ---------- */
.recipe-list,
.recipe-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recipe-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--recipe-line);
}
.recipe-row:last-child { border-bottom: 0; }

.recipe-pill {                         /* one element: emoji + name */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: calc(5px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
  border: 1px solid var(--recipe-pill-border);
  border-radius: var(--radius-pill, 10px);
  background: var(--recipe-pill-bg);
  color: var(--recipe-text);
  font: inherit;
  font-size: calc(14px * var(--ui-scale, 1));
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
button.recipe-pill { cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
button.recipe-pill:hover {
  border-color: var(--recipe-accent);
  background: var(--recipe-accent-light);
}
.recipe-pill.is-result {               /* the element the recipe makes */
  border-color: var(--recipe-accent);
  background: var(--recipe-accent-light);
}
.recipe-emoji { font-size: calc(16px * var(--ui-scale, 1)); line-height: 1; }

.recipe-op {                           /* the + and = signs */
  color: var(--recipe-muted);
  font-weight: 700;
}

.recipe-note,
.recipe-more {
  margin: 8px 0;
  color: var(--recipe-muted);
  font-size: calc(13.5px * var(--ui-scale, 1));
  line-height: 1.7;
}

/* steps are a real sequence, so they are numbered */
.recipe-steps { counter-reset: step; }
.recipe-steps .recipe-row::before {
  counter-increment: step;
  content: counter(step) ".";
  min-width: 1.8em;
  color: var(--recipe-muted);
  font-size: calc(13px * var(--ui-scale, 1));
}


/* ---------- 3. DICTIONARY PANEL: the Dictionary | Recipes switch ---------- */
.dict-switch {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) 0;
}
.dict-switch-btn {
  flex: 1 1 0;
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border: 1px solid var(--recipe-pill-border);
  border-radius: 10px;
  background: transparent;
  color: var(--recipe-muted);
  font-size: calc(13.5px * var(--ui-scale, 1));
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.dict-switch-btn:hover { color: var(--recipe-text); border-color: var(--recipe-accent); }
.dict-switch-btn.active {
  background: var(--recipe-accent);
  border-color: var(--recipe-accent);
  color: #ffffff;
}


/* ---------- 4. ACCOUNT PAGE: "My elements" ---------- */
.account-card { --auth-card-width: 700px; }    /* wide enough for the elements and the recipe tree */

.my-elements,
.my-recipes {
  margin-top: 28px;
  text-align: start;
}
.my-recipes-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.6;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* filter buttons (All / Common / Rare ...) and the sort menu */
.el-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
}
.el-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.el-filter {
  padding: 3px 12px;
  border: 1px solid var(--recipe-pill-border);
  border-radius: 999px;
  color: var(--tier, var(--recipe-text));          /* each filter wears its tier color */
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.7;
  text-decoration: none;
}
.el-filter:hover { border-color: var(--tier, var(--recipe-accent)); }
.el-filter.is-active {
  background: var(--tier, var(--recipe-text));
  border-color: var(--tier, var(--recipe-text));
  color: var(--recipe-pill-bg);
}
.el-filter-count { opacity: 0.7; font-weight: 500; }

.el-sort { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--recipe-muted); }
.el-sort select {
  padding: 4px 8px;
  border: 1px solid var(--recipe-pill-border);
  border-radius: 8px;
  background: var(--recipe-pill-bg);
  color: var(--recipe-text);
  font: inherit;
}

/* the elements */
.el-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.el-chip { text-decoration: none; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.el-chip:hover { border-color: var(--recipe-accent); }
.el-chip.is-selected { box-shadow: 0 0 0 2px var(--recipe-accent); }   /* the one whose recipe is open */

/* page numbers */
.el-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }
.el-page, .el-gap {
  min-width: 32px;
  padding: 3px 9px;
  border: 1px solid var(--recipe-pill-border);
  border-radius: 8px;
  color: var(--recipe-text);
  font-size: 13.5px;
  line-height: 1.7;
  text-align: center;
  text-decoration: none;
}
.el-gap { border-color: transparent; color: var(--recipe-muted); }
.el-page:hover { border-color: var(--recipe-accent); }
.el-page.is-current { background: var(--recipe-accent); border-color: var(--recipe-accent); color: #ffffff; }

/* the open element's header */
.recipe-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.recipe-count { margin-inline-start: auto; color: var(--recipe-muted); font-size: 13px; }
.recipe-meta { margin: 6px 0 10px; }


/* ---------- 5. THE RECIPE TREE: numbered stages ----------
   Stage 1 uses only the starting elements, stage 2 only what stage 1 made, and so on.
   Recipes in one stage sit side by side, so a long recipe stays short on the page. */
.stage-tree {
  --stage-num-size: 26px;                       /* the numbered circle */
  list-style: none;
  margin: 0;
  padding: 0;
}
.stage {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 12px;
}
.stage:last-child { padding-bottom: 0; }
.stage::before {                                /* the line down to the next stage */
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--stage-num-size) / 2 - 1px);
  top: var(--stage-num-size);
  bottom: 0;
  width: 2px;
  background: var(--recipe-line);
}
.stage:last-child::before { display: none; }

.stage-num {
  position: relative;                           /* above the line */
  flex: 0 0 var(--stage-num-size);
  width: var(--stage-num-size);
  height: var(--stage-num-size);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--recipe-accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.stage.is-start .stage-num {                    /* "start with" is a hollow circle */
  background: var(--recipe-pill-bg);
  border: 2px solid var(--recipe-accent);
  color: var(--recipe-accent);
  font-size: 9px;
}
.stage-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-height: var(--stage-num-size);
  min-width: 0;
}
.stage-label { color: var(--recipe-muted); font-size: 13px; }
.stage-recipes { display: flex; flex-wrap: wrap; gap: 6px 8px; }

.stage-recipe {                                 /* one recipe:  [A] + [B] = [C] */
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 5px;
  padding: 3px 6px;
  border: 1px dashed var(--recipe-line);
  border-radius: 12px;
}
.stage .recipe-pill {                           /* smaller labels than in the dictionary */
  padding: 2px 8px;
  font-size: 13px;
}
.stage .recipe-emoji { font-size: 14px; }
