/* Hive Home (task-0132 hologram revamp) — hex panel grid + 3D lift effects.
   Glass morphism panels with amber/gold glow, 3D tilt on hover, staggered
   entrance animations, live stat pulse. Tokens from shell.css. */

.home-main {
  --gold:           #f59e0b;
  --gold-2:         #fbbf24;
  --gold-dim:       #92680a;
  --gold-glow:      rgba(245, 158, 11, 0.40);
  --gold-glow-soft: rgba(245, 158, 11, 0.18);
  --cyan:           #06b6d4;
  --panel-bg:       rgba(8, 10, 20, 0.75);
  --panel-border:   rgba(245, 158, 11, 0.22);
  --bevel:          14px;

  max-width: 1640px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 2rem;
  width: 100%;
  /* 3D perspective for child card transforms */
  perspective: 1200px;
  perspective-origin: 50% 30%;
}

/* --- Honeycomb grid -------------------------------------------------------- */
.home-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(240px, 0.95fr) minmax(0, 2.4fr) minmax(240px, 0.95fr);
  grid-template-areas:
    "kanban  hive   status"
    "jobs    hive   knowledge"
    "trading trading trading";
  align-items: stretch;
}

.hive-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.home-main .hive-stage {
  width: 100%;
  margin: 0;
  max-height: none;
}

/* --- Panel: glass morphism with hex bevel + 3D lift ----------------------- */
.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel-bg);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--panel-border);
  clip-path: polygon(
    var(--bevel) 0, 100% 0, 100% calc(100% - var(--bevel)),
    calc(100% - var(--bevel)) 100%, 0 100%, 0 var(--bevel)
  );
  /* Hex motif behind panel content */
  background-image:
    linear-gradient(var(--panel-bg), var(--panel-bg)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='48' viewBox='0 0 56 48'%3E%3Cpath d='M14 0H42L56 24L42 48H14L0 24Z' fill='none' stroke='%23f59e0b' stroke-opacity='0.14' stroke-width='1'/%3E%3C/svg%3E");
  background-size: auto, 34px 30px;
  background-blend-mode: normal;
  padding: 0.05rem;
  transition: border-color 0.25s ease, filter 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  transform-style: preserve-3d;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.5));
  box-shadow: inset 0 1px 0 rgba(245,158,11,0.08);
}

/* Glowing top accent edge */
.panel::after {
  content: "";
  position: absolute;
  left: var(--bevel);
  right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2), var(--cyan));
  opacity: 0.75;
  pointer-events: none;
}

/* 3D lift + glow on hover */
.panel:hover {
  border-color: rgba(245,158,11,0.45);
  transform: translateY(-4px) rotateX(2deg) rotateY(0.5deg);
  filter: drop-shadow(0 0 18px var(--gold-glow)) drop-shadow(0 8px 24px rgba(0,0,0,0.6));
}

/* Staggered entrance animations */
@media (prefers-reduced-motion: no-preference) {
  .panel {
    animation: panel-rise 0.5s ease both;
  }
  .panel:nth-child(1) { animation-delay: 0.05s; }
  .panel:nth-child(2) { animation-delay: 0.10s; }
  .panel:nth-child(3) { animation-delay: 0.15s; }
  .panel:nth-child(4) { animation-delay: 0.20s; }
  .panel:nth-child(5) { animation-delay: 0.25s; }
  .panel:nth-child(6) { animation-delay: 0.30s; }
  .panel:nth-child(7) { animation-delay: 0.35s; }
}
@keyframes panel-rise {
  from { opacity: 0; transform: translateY(16px) rotateX(4deg); }
  to   { opacity: 1; transform: translateY(0) rotateX(0); }
}

/* Panel head: hex icon + title + arrow */
.panel-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.85rem 0.55rem;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid rgba(245,158,11,0.10);
}
.panel-hex {
  color: var(--gold);
  font-size: 1.05rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px var(--gold-glow));
}
.panel-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f6e7bd;
  text-shadow: 0 0 12px rgba(245,158,11,0.25);
}
.panel-go {
  margin-left: auto;
  color: var(--gold-dim);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  transition: color 0.18s ease, transform 0.18s ease;
}
.panel:hover .panel-go {
  color: var(--gold);
  transform: translateX(3px);
}

/* Panel body */
.panel-body {
  flex: 1;
  padding: 0.7rem 0.85rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.panel-skel {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  opacity: 0.6;
  letter-spacing: 0.08em;
}
.panel-empty {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  opacity: 0.7;
}

/* --- Stat strip ----------------------------------------------------------- */
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.stat-val {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold-glow-soft);
}
.stat-val.live { animation: gold-pulse 2.5s ease-in-out infinite; }
@keyframes gold-pulse {
  0%, 100% { text-shadow: 0 0 8px var(--gold-glow-soft); }
  50%       { text-shadow: 0 0 22px var(--gold-glow), 0 0 40px rgba(245,158,11,0.15); }
}
.stat-val.muted { color: var(--text-dim); text-shadow: none; }
.stat-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* --- List items ----------------------------------------------------------- */
.panel-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.34rem 0.5rem;
  background: rgba(245,158,11,0.04);
  border-left: 2px solid rgba(245,158,11,0.35);
  border-radius: 0 4px 4px 0;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
a.li:hover {
  background: rgba(245,158,11,0.09);
  border-left-color: var(--gold);
  box-shadow: inset 0 0 8px rgba(245,158,11,0.06);
}
.li-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.li-title {
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.li-sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chips */
.chip {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  background: rgba(245,158,11,0.12);
  color: #f6e7bd;
  border: 1px solid rgba(245,158,11,0.28);
  white-space: nowrap;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip.ok   { background: var(--ok-bg);     color: var(--ok);     border-color: rgba(46,230,168,0.4); }
.chip.fail { background: var(--danger-bg); color: var(--danger); border-color: rgba(255,92,108,0.4); }
.chip.dim  { background: var(--chip-bg);   color: var(--text-dim); border-color: var(--border); }

.li-when {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--gold-2);
}

/* --- Trading card --------------------------------------------------------- */
.trade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.trade-state {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(245,158,11,0.40);
  background: rgba(245,158,11,0.12);
  color: var(--gold);
  box-shadow: 0 0 8px rgba(245,158,11,0.15);
}
.trade-state.paused {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: rgba(255,200,87,0.4);
  box-shadow: 0 0 8px rgba(255,200,87,0.15);
}
.trade-state.shutdown {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(255,92,108,0.45);
  box-shadow: 0 0 8px rgba(255,92,108,0.15);
}
.trade-pnl {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.trade-pnl.trade-up   { color: var(--ok);     text-shadow: 0 0 10px rgba(46,230,168,0.4); }
.trade-pnl.trade-down { color: var(--danger); text-shadow: 0 0 10px rgba(255,92,108,0.4); }
.trade-pct { font-size: 0.78rem; font-weight: 600; }

/* --- Wiki strip ----------------------------------------------------------- */
.panel[data-panel="wiki"] { margin-top: 1rem; }
.panel[data-panel="wiki"] .panel-body {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
}
.wiki-page {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  background: rgba(245,158,11,0.04);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.wiki-page:hover {
  border-color: var(--gold);
  background: rgba(245,158,11,0.09);
  box-shadow: var(--glow-soft, 0 0 14px rgba(245,158,11,0.22));
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .home-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "hive hive"
      "kanban status"
      "jobs knowledge"
      "trading trading";
  }
  .home-main .hive-stage { max-height: 70vh; }
}
@media (max-width: 640px) {
  .home-main { padding: 0.75rem 0.7rem 1.5rem; perspective: none; }
  .home-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hive"
      "kanban"
      "status"
      "jobs"
      "knowledge"
      "trading";
  }
  .stat-val { font-size: 1.2rem; }
  .panel:hover { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .panel-go, .stat-val.live {
    transition: none !important;
    animation: none !important;
  }
}
