/* Farming-strategy library. Token-driven; hard edges per the app style. */

.page-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.strat-tagbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 1.25rem;
}
.strat-tagbar .pill { text-decoration: none; }
.strat-tagbar .pill.is-active {
  background: var(--color-gold-dim, #8a6d2f);
  color: var(--color-bg, #14100b);
  border-color: var(--color-gold-bright, #d4af5a);
}

.strat-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.strat-card-head h2,
.strat-card-head h3 { margin: 0; }
.strat-card.is-draft { opacity: 0.75; }

/* Whole-tile click: the title link's ::after covers the card. Anything that
   must stay independently clickable (the vote button) is raised above it. */
.strat-grid .strat-card {
  position: relative;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.strat-grid .strat-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-gold-dim, #8a6d2f);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.strat-grid .strat-card:focus-within {
  border-color: var(--color-gold-bright, #d4af5a);
}
.stretched-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.strat-grid .strat-vote-form {
  position: relative;
  z-index: 2;
}
.strat-summary { margin: 0.4rem 0 0.6rem; }

/* Condensed map device on a library card: recessed mini-slots in one row,
   wrapping on narrow screens. Deliberately un-positioned and un-layered so the
   stretched title link's ::after still sits on top and the whole card stays
   clickable straight through the icons. */
.device-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin: 0 0 0.6rem;
  text-decoration: none;
  /* The strip is itself a link raised above the card's stretched-link
     overlay, so the icons get native title tooltips AND clicks on them
     still navigate to the strategy. */
  position: relative;
  z-index: 2;
  width: fit-content;
}
.device-strip-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid #5c4a22;
  background: linear-gradient(180deg, #0c0a07 0%, #171208 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.9);
}
.device-strip-slot > img,
.device-strip-slot > .strip-icon {
  width: 50px;
  height: 50px;
  display: block;
  object-fit: contain;
}
.device-strip-slot.is-mechanic { border-color: #6b5528; margin-left: 0.35rem; }
.device-strip-slot.is-mechanic + .device-strip-slot.is-mechanic { margin-left: 0; }
.device-strip-slot.is-influence { border-color: var(--color-gold-dim, #8a6d2f); margin-left: 0.35rem; }
.device-strip-abbr {
  font-size: 0.75rem;
  line-height: 1;
  text-transform: uppercase;
  color: var(--color-gold, #c9a24a);
}

.strat-vote {
  border: 1px solid var(--color-border-strong, #4a3d28);
  background: var(--color-bg-raised, #1d1712);
  color: var(--color-parchment-dim, #b9a98c);
  padding: 0.2rem 0.6rem;
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
}
.strat-vote:hover { border-color: var(--color-gold-dim, #8a6d2f); }
.strat-vote.is-voted {
  color: var(--color-gold-bright, #d4af5a);
  border-color: var(--color-gold-dim, #8a6d2f);
}
.strat-vote-form { display: inline; }
/* Read-only tally shown to logged-out visitors. */
span.strat-vote { cursor: default; }
span.strat-vote:hover { border-color: var(--color-border-strong, #4a3d28); }

.strat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0;
}
.strat-tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--color-border, #33291b);
  color: var(--color-parchment-dim, #b9a98c);
  font-size: 0.8rem;
  text-decoration: none;
}
a.strat-tag:hover { border-color: var(--color-gold-dim, #8a6d2f); }

.strat-byline { font-size: 0.85rem; margin: 0.35rem 0 0; }

.strat-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.strat-actions form { display: inline; }

.strat-body { padding: 1rem 1.25rem; margin: 1rem 0 1.5rem; }

.strat-facts { margin: 0.5rem 0; }
.strat-facts div {
  display: flex;
  gap: 0.5rem;
  padding: 0.15rem 0;
}
.strat-facts dt {
  min-width: 9rem;
  color: var(--color-parchment-dim, #b9a98c);
  font-variant: small-caps;
  letter-spacing: 0.04em;
}
.strat-facts dd { margin: 0; }

.strat-subhead {
  margin: 0.75rem 0 0.25rem;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  color: var(--color-parchment-dim, #b9a98c);
}
.strat-scarabs {
  margin: 0;
  padding-left: 1.2rem;
}

.strat-form { max-width: 46rem; }
.strat-form .help-text { font-size: 0.8rem; margin: 0.2rem 0 0; }

/* --- Atlas tree viewer / editor ---------------------------------------- */

.atlas-wrap {
  position: relative;
  border: 1px solid var(--color-border-strong, #4a3d28);
  background: radial-gradient(ellipse at center, #131019 0%, #0b0910 70%, #080709 100%);
  margin: 1rem 0;
}
.atlas-wrap svg {
  display: block;
  width: 100%;
  height: min(72vh, 56rem);
  cursor: grab;
  touch-action: none;
}
.atlas-wrap svg:active { cursor: grabbing; }

.atlas-toolbar {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.atlas-count {
  font-variant-numeric: tabular-nums;
  color: var(--color-gold-bright, #d4af5a);
  background: rgba(10, 8, 6, 0.8);
  border: 1px solid var(--color-border-strong, #4a3d28);
  padding: 0.2rem 0.6rem;
}
.atlas-count.is-over { color: var(--color-crimson, #c0392b); }
/* Over-budget click refused: brief red pulse so the ignored click is explained. */
.atlas-count.is-denied {
  color: var(--color-crimson, #c0392b);
  border-color: var(--color-crimson, #c0392b);
  animation: atlas-deny 0.45s ease-out;
}
@keyframes atlas-deny {
  0%, 55% { background: rgba(192, 57, 43, 0.45); }
  100% { background: rgba(10, 8, 6, 0.8); }
}

.atlas-tip {
  position: absolute;
  z-index: 3;
  max-width: 24rem;
  pointer-events: none;
  background: rgba(12, 10, 7, 0.95);
  border: 1px solid var(--color-gold-dim, #8a6d2f);
  padding: 0.5rem 0.75rem;
}
.atlas-tip-name {
  color: var(--color-gold-bright, #d4af5a);
  font-variant: small-caps;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}
.atlas-tip-stats { font-size: 0.85rem; color: var(--color-parchment, #e8dcc0); }
.atlas-tip-stats div { margin: 0.1rem 0; }

.atlas-import-row {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.atlas-import-row input[type="url"] { flex: 1; min-width: 0; }
.atlas-save-row { margin-top: 0.75rem; }

/* SVG node/edge states (classes emitted by atlas_render + toggled by JS). */
.atlas-node { cursor: pointer; }
[data-mode="view"] .atlas-node { cursor: default; }
/* The circle is only the hit-target / fallback; real GGG frame art conveys
   allocation state (frame-off/frame-on sprites swapped inside the SVG). */
.atlas-node .node-shape {
  fill: transparent;
  stroke: none;
  /* A transparent fill is unpainted, so default SVG hit-testing would skip
     it entirely — force the circle to stay the node's click target. */
  pointer-events: all;
}
.atlas-node.is-allocated .node-shape {
  fill: transparent;
  stroke: var(--color-gold-bright, #d4af5a);
  stroke-width: 4;
  stroke-opacity: 0.5;
}
/* Declared before the preview states below so a hovered node still shows the
   path/removal colour rather than the generic hover ring. */
.atlas-node:hover .node-shape {
  stroke: var(--color-gold-bright, #d4af5a);
  stroke-width: 6;
  stroke-opacity: 0.9;
}
/* Pan/zoom is driven by this group's transform attribute (static viewBox), so
   pointer input costs one attribute write per animation frame.
   NOTE: deliberately NO `will-change: transform` here. It was tried and
   measured: promoting a layer this large (a ~12700x11800-unit tree of ~5000
   sprite rects) makes Chrome rasterise the whole thing, taking the pan from
   ~2.8ms to ~400ms per frame. Leave the tree unpromoted. */
/* While dragging, the tree must not eat pointer events for hover work. */
.atlas-wrap.is-panning .atlas-node { pointer-events: none; }

/* Connectors: thin, muted, round-capped; the renderer trims each end back to
   the node's frame radius and bends same-orbit edges into arcs. */
.atlas-edge {
  fill: none;
  stroke: #3a3450;
  stroke-width: 9;
  stroke-opacity: 0.75;
  stroke-linecap: round;
}
.atlas-edge.is-allocated {
  stroke: var(--color-gold-bright, #d4af5a);
  stroke-width: 12;
  stroke-opacity: 0.9;
}
/* Pathing preview: the tentative shortest path in warm gold — deliberately a
   different hue from the site accent that marks *committed* allocation — and
   the nodes a removal would take with it in red. Both are hover-transient. */
.atlas-edge.is-path { stroke: #e8c46a; stroke-width: 12; stroke-opacity: 0.95; }
.atlas-edge.is-removing { stroke: var(--color-crimson, #c0392b); stroke-width: 12; }
.atlas-node.is-path .node-shape {
  fill: transparent;
  stroke: #e8c46a;
  stroke-width: 8;
  stroke-opacity: 0.95;
}
.atlas-node.is-path .node-icon { opacity: 0.9; }
.atlas-node.is-removing .node-shape {
  fill: transparent;
  stroke: var(--color-crimson, #c0392b);
  stroke-width: 8;
  stroke-opacity: 0.9;
}

.atlas-thumb-link {
  display: block;
  margin-top: 0.6rem;
  text-decoration: none;
}
.atlas-thumb-link svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--color-border, #33291b);
  background: #0b0910;
}
.atlas-thumb-link span { display: block; margin-top: 0.25rem; font-size: 0.85rem; }

/* --- Variant tabs (strategy detail) ------------------------------------ */

.variant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.5rem 0 -1px;
}
.variant-tab {
  border: 1px solid var(--color-border, #33291b);
  border-bottom-color: transparent;
  background: var(--color-bg-raised, #1a1610);
  color: var(--color-parchment-dim, #b8a888);
  font: inherit;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
}
.variant-tab:hover { color: var(--color-gold-bright, #e8c76c); }
.variant-tab.is-active {
  color: var(--color-gold-bright, #e8c76c);
  border-color: var(--color-border-strong, #4a3d28);
  background: var(--color-bg-card, #1c1710);
}

.strat-variant .strat-facts { margin-top: 0.75rem; }
.strat-scarabs-extra { margin-top: 0.5rem; }
.atlas-count-static { font-size: 0.85rem; }
.atlas-lazy { min-height: 6rem; }

/* --- Combined variant editor ------------------------------------------- */

.variant-editor .variant-fields { margin-top: 1rem; }
.variant-editor .atlas-import-row { margin-bottom: 0.5rem; }
.atlas-import-row input[type="text"] { flex: 1; min-width: 0; }

/* The share-link import is a side errand, not a headline field: one compact
   right-aligned row sitting just above the tree it imports into. */
.atlas-import-compact {
  max-width: 28rem;
  margin-left: auto;
  margin-bottom: 0.35rem;
}

/* Editor page head: share link + the top "Save variant" copy. */
.variant-head-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* --- poe.ninja scarab cost (detail page fact row) ----------------------- */

.strat-cost { cursor: help; }        /* the title="" carries the per-scarab breakdown */
.strat-cost-src {
  font-size: 0.78rem;
  margin-left: 0.35rem;
}
