/* IKnowABot — holographic ash · tier trees · forestry guard
   materials: live wood · dropped log · ash residual · holo film
   residual of fire + Cosmic/Sweden sheen · not a full repaint */

:root {
  /* material language */
  --ash-char: #1a1614;
  --ash-soot: #2c2622;
  --ash-cinder: #4a4038;
  --ash-ember: #8a7060;
  --ash-film-a: #63d0df;
  --ash-film-b: #a8e6ff;
  --ash-film-c: #fecc00;
  --ash-film-d: #c48a94;
  --ash-film-e: #006aa7;
  --live-bark: #3d4a38;
  --live-leaf: #6b8f5e;
  --live-dew: rgba(168, 230, 255, 0.45);
  --log-matte: #5c4a38;
  --log-end: #3a2e22;
  --holo-ash: linear-gradient(
    125deg,
    var(--ash-cinder) 0%,
    var(--ash-film-e) 18%,
    var(--ash-film-a) 38%,
    var(--ash-film-d) 55%,
    var(--ash-film-c) 72%,
    var(--ash-soot) 100%
  );
  --holo-ash-shine: linear-gradient(
    105deg,
    transparent 0%,
    rgba(99, 208, 223, 0.15) 28%,
    rgba(254, 204, 0, 0.22) 48%,
    rgba(196, 138, 148, 0.18) 62%,
    transparent 100%
  );
}

/* —— global ash plate when body has ash-forest —— */
body.ash-forest {
  --border: color-mix(in srgb, var(--ash-ember) 35%, var(--border));
}

body.ash-forest::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  opacity: 0.14;
  mix-blend-mode: soft-light;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(99, 208, 223, 0.25), transparent 55%),
    radial-gradient(ellipse 60% 40% at 85% 20%, rgba(196, 138, 148, 0.2), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 90%, rgba(254, 204, 0, 0.12), transparent 45%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(28, 22, 18, 0.03) 2px,
      rgba(28, 22, 18, 0.03) 3px
    );
  animation: ash-film-drift 14s ease-in-out infinite alternate;
}

@keyframes ash-film-drift {
  from { opacity: 0.1; filter: hue-rotate(0deg); }
  to { opacity: 0.18; filter: hue-rotate(12deg); }
}

@media (prefers-reduced-motion: reduce) {
  body.ash-forest::after {
    animation: none;
    opacity: 0.1;
  }
  .ash-node .ash-spark,
  .forest-log-pile .log-stick {
    animation: none !important;
  }
}

/* holo-filter + ash together = holographic ash */
body.holo-filter.ash-forest::after {
  opacity: 0.22;
  mix-blend-mode: color-dodge;
}

/* —— forest section —— */
.forest-section {
  position: relative;
  margin: 1.5rem auto 2rem;
  max-width: var(--max, 960px);
  padding: 1.25rem 1.1rem 1.4rem;
  border-radius: calc(var(--radius, 14px) + 4px);
  border: 1px solid color-mix(in srgb, var(--ash-ember) 40%, var(--border));
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--ash-soot) 55%, var(--bg-elevated)) 0%, var(--bg-elevated) 100%);
  overflow: hidden;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--ash-film-a) 12%, transparent),
    0 18px 40px rgba(0, 0, 0, 0.28);
}

.forest-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--holo-ash-shine);
  background-size: 200% 100%;
  opacity: 0.55;
  animation: ash-sheen 9s linear infinite;
}

@keyframes ash-sheen {
  from { background-position: 0% 50%; }
  to { background-position: 200% 50%; }
}

.forest-section > * {
  position: relative;
  z-index: 1;
}

.forest-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.forest-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  letter-spacing: 0.04em;
  background: var(--holo-ash);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}

.forest-tag {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 36ch;
  line-height: 1.4;
}

.forest-tag em {
  font-style: normal;
  font-weight: 700;
  color: var(--ash-film-a);
}

.forest-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.forest-toolbar .btn,
.forest-toolbar button {
  font-size: 0.78rem;
  padding: 0.4rem 0.7rem;
}

.btn-ash {
  background: linear-gradient(145deg, var(--ash-cinder), var(--ash-char)) !important;
  color: #e8d4c8 !important;
  border: 1px solid color-mix(in srgb, var(--ash-film-a) 40%, var(--ash-ember)) !important;
  box-shadow: 0 0 12px color-mix(in srgb, var(--ash-film-c) 25%, transparent);
}

.btn-ash:hover {
  border-color: var(--ash-film-c) !important;
}

.btn-log {
  background: var(--log-matte) !important;
  color: #f0e6d8 !important;
  border: 1px solid var(--log-end) !important;
}

.btn-live {
  background: linear-gradient(145deg, var(--live-leaf), var(--live-bark)) !important;
  color: #f4fff0 !important;
  border: 1px solid color-mix(in srgb, var(--live-dew) 50%, var(--live-leaf)) !important;
}

/* material legend */
.forest-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: 0 0 1rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px dashed color-mix(in srgb, var(--ash-ember) 45%, transparent);
  background: color-mix(in srgb, var(--ash-char) 40%, transparent);
  font-size: 0.72rem;
  color: var(--muted);
}

.forest-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.swatch-live {
  background: linear-gradient(135deg, var(--live-leaf), var(--live-bark));
  box-shadow: 0 0 6px var(--live-dew);
}

.swatch-log {
  background: var(--log-matte);
}

.swatch-ash {
  background: radial-gradient(circle at 30% 30%, var(--ash-ember), var(--ash-char));
  box-shadow: 0 0 8px color-mix(in srgb, var(--ash-film-a) 40%, transparent);
}

.swatch-holo {
  background: var(--holo-ash);
  background-size: 200% 200%;
}

/* tier tree layout */
.tier-tree {
  display: grid;
  gap: 0.85rem;
}

.tier-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  align-items: stretch;
  position: relative;
}

.tier-row-label {
  flex: 0 0 100%;
  text-align: center;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim, var(--muted));
  font-weight: 700;
  margin-bottom: -0.15rem;
}

/* node cards */
.ash-node {
  --node-state: live;
  flex: 1 1 140px;
  max-width: 200px;
  min-width: 128px;
  padding: 0.65rem 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.ash-node:hover {
  transform: translateY(-2px);
}

.ash-node:focus-visible {
  outline: 2px solid var(--ash-film-a);
  outline-offset: 2px;
}

.ash-node .node-title {
  display: block;
  font-weight: 800;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
  letter-spacing: 0.02em;
}

.ash-node .node-desc {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.ash-node .node-state {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* LIVE wood */
.ash-node[data-state="live"] {
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--live-bark) 55%, var(--bg-elevated)), var(--bg-elevated));
  border-color: color-mix(in srgb, var(--live-leaf) 50%, var(--border));
  box-shadow: inset 0 0 20px color-mix(in srgb, var(--live-dew) 25%, transparent);
}

.ash-node[data-state="live"] .node-state {
  color: #d8f5c8;
  background: color-mix(in srgb, var(--live-leaf) 35%, transparent);
  border-color: var(--live-leaf);
}

/* LOG — dropped signal, matte, no system power */
.ash-node[data-state="log"] {
  background: repeating-linear-gradient(
      90deg,
      var(--log-matte) 0 8px,
      var(--log-end) 8px 10px
    ),
    var(--log-matte);
  border-color: #2a2018;
  box-shadow: none;
  filter: saturate(0.75);
}

.ash-node[data-state="log"] .node-title {
  color: #f0e4d4;
}

.ash-node[data-state="log"] .node-desc {
  color: #c4b09a;
}

.ash-node[data-state="log"] .node-state {
  color: #f0e4d4;
  background: rgba(0, 0, 0, 0.25);
  border-color: #2a2018;
}

/* ASH — residual after guard / burn */
.ash-node[data-state="ash"] {
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--ash-ember) 40%, transparent), transparent 55%),
    linear-gradient(165deg, var(--ash-soot), var(--ash-char));
  border-color: color-mix(in srgb, var(--ash-film-a) 35%, var(--ash-cinder));
  box-shadow:
    0 0 16px color-mix(in srgb, var(--ash-film-a) 22%, transparent),
    inset 0 0 24px rgba(0, 0, 0, 0.35);
}

.ash-node[data-state="ash"] .node-title {
  background: var(--holo-ash);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ash-node[data-state="ash"] .node-desc {
  color: #b8a898;
}

.ash-node[data-state="ash"] .node-state {
  color: #e8f8ff;
  border-color: var(--ash-film-a);
  background: color-mix(in srgb, var(--ash-film-a) 18%, transparent);
}

.ash-node[data-state="ash"] .ash-spark {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ash-film-c);
  opacity: 0.7;
  pointer-events: none;
  animation: ash-float 3.2s ease-in-out infinite;
}

.ash-node[data-state="ash"] .ash-spark:nth-child(1) { top: 12%; left: 18%; animation-delay: 0s; }
.ash-node[data-state="ash"] .ash-spark:nth-child(2) { top: 28%; right: 14%; animation-delay: 0.6s; background: var(--ash-film-a); }
.ash-node[data-state="ash"] .ash-spark:nth-child(3) { bottom: 18%; left: 40%; animation-delay: 1.2s; background: var(--ash-film-d); }

@keyframes ash-float {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-6px); opacity: 0.9; }
}

/* HOLO — come-to-tree / guarded dual unlock */
.ash-node[data-state="holo"] {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--ash-film-e) 35%, var(--bg-elevated)), var(--bg-elevated));
  border-color: color-mix(in srgb, var(--ash-film-c) 55%, var(--ash-film-a));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--ash-film-a) 40%, transparent),
    0 0 22px color-mix(in srgb, var(--ash-film-d) 30%, transparent),
    inset 0 0 30px color-mix(in srgb, var(--ash-film-a) 15%, transparent);
}

.ash-node[data-state="holo"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--holo-ash-shine);
  background-size: 200% 100%;
  opacity: 0.65;
  pointer-events: none;
  animation: ash-sheen 5s linear infinite;
}

.ash-node[data-state="holo"] .node-title {
  background: var(--holo-ash);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
  z-index: 1;
}

.ash-node[data-state="holo"] .node-desc,
.ash-node[data-state="holo"] .node-state {
  position: relative;
  z-index: 1;
}

.ash-node[data-state="holo"] .node-state {
  color: #fff8e8;
  border-color: var(--ash-film-c);
  background: color-mix(in srgb, var(--ash-film-c) 22%, transparent);
}

/* locked (not yet planted) */
.ash-node[data-state="seed"] {
  opacity: 0.55;
  background: color-mix(in srgb, var(--ash-char) 30%, var(--bg-elevated));
  border-style: dashed;
}

.ash-node[data-state="seed"] .node-state {
  color: var(--muted);
}

/* log pile — war / come-to-tree signal theater */
.forest-log-pile {
  margin-top: 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--log-end);
  background: color-mix(in srgb, var(--log-matte) 35%, transparent);
  min-height: 3rem;
}

.forest-log-pile h3 {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #d4c4b0;
}

.forest-log-pile .pile-note {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.pile-logs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 1.5rem;
  align-items: center;
}

.log-stick {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--log-end), var(--log-matte) 40%, var(--log-end));
  color: #f0e6d8;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid #2a2018;
  animation: log-drop 0.35s ease-out;
}

@keyframes log-drop {
  from { transform: translateY(-12px) rotate(-4deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.pile-empty {
  font-size: 0.72rem;
  color: var(--dim, var(--muted));
  font-style: italic;
}

/* status bar */
.forest-status {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  align-items: center;
}

.forest-status strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.forest-status .guard-msg {
  flex: 1 1 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ash-film-a) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ash-film-a) 28%, transparent);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.4;
}

.forest-status .guard-msg.warn {
  background: color-mix(in srgb, var(--log-matte) 30%, transparent);
  border-color: var(--log-end);
}

.forest-status .guard-msg.good {
  background: color-mix(in srgb, var(--live-leaf) 18%, transparent);
  border-color: color-mix(in srgb, var(--live-leaf) 45%, transparent);
}

/* holo shelf card gets ash residual edge */
body.ash-forest .holo-shelf {
  border-color: color-mix(in srgb, var(--ash-film-a) 35%, var(--border));
  box-shadow: 0 0 24px color-mix(in srgb, var(--ash-film-d) 12%, transparent);
}

body.ash-forest .holo-word {
  background: var(--holo-ash);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ASAP chip */
.asap-chip-ash {
  color: #1a1614 !important;
  background: linear-gradient(105deg, #63d0df, #c48a94 50%, #fecc00) !important;
  border: none !important;
  font-weight: 800;
}

/* nav highlight */
.nav a[href="#forest-tier"] {
  color: color-mix(in srgb, var(--ash-film-a) 70%, var(--text));
}

/* cards under ash-forest get soft residual */
body.ash-forest .card {
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--ash-ember) 25%, transparent);
}

body.ash-forest .features .card:nth-child(1) { border-top: 2px solid color-mix(in srgb, var(--live-leaf) 60%, transparent); }
body.ash-forest .features .card:nth-child(2) { border-top: 2px solid color-mix(in srgb, var(--ash-film-a) 55%, transparent); }
body.ash-forest .features .card:nth-child(3) { border-top: 2px solid color-mix(in srgb, var(--ash-film-c) 55%, transparent); }

/* aim-card forest plate */
.aim-card.forest-plate {
  border-color: color-mix(in srgb, var(--ash-ember) 45%, var(--border));
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, color-mix(in srgb, var(--ash-film-a) 14%, transparent), transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 100%, color-mix(in srgb, var(--ash-film-d) 12%, transparent), transparent 55%),
    var(--bg-elevated);
}

.forest-eq {
  margin: 0.5rem 0 0.75rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--ash-film-c) 40%, var(--border));
  font-size: 0.78rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--ash-char) 35%, transparent);
  color: var(--text);
}

.forest-doors {
  margin: 0 0 0.75rem;
  padding: 0 0 0 1.15rem;
  text-align: left;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.forest-doors em {
  font-style: normal;
  font-weight: 800;
  color: var(--ash-film-a);
}

/* light/cream themes: keep ash readable */
[data-theme="light"] .forest-section,
[data-theme="cream"] .forest-section {
  background: linear-gradient(165deg, #e8dcc8, var(--bg-elevated));
}

[data-theme="light"] body.ash-forest::after,
[data-theme="cream"] body.ash-forest::after {
  mix-blend-mode: multiply;
  opacity: 0.08;
}
