/* Machine UI panels for chain pages. Markup is generated by tools/lib/panels.js (see docs/CONTRIBUTING-CONTENT.md).
   Looks like a GregTech machine GUI: inputs left, machine in the middle, outputs right. Pure CSS, no JavaScript. */

.md-typeset .gt-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 36rem), 1fr));
  gap: 1.1rem;
  margin: 1rem 0 1.4rem;
}

.md-typeset .gt-panel {
  --gt-bg: #c6c6c6;
  --gt-shadow: #555;
  --gt-lite: #fff;
  --gt-ink: #3a3a3a;
  --tc: #7e57c2;
  background: var(--gt-bg);
  color: var(--gt-ink);
  border: 2px solid;
  border-color: var(--gt-lite) var(--gt-shadow) var(--gt-shadow) var(--gt-lite);
  outline: 2px solid #111;
  border-radius: 1px;
  padding: 0.45rem 0.6rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.2;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.55);
  position: relative;
}
.md-typeset .gt-panel::before {            /* tier colour strip */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--tc);
}

/* tier colours (badge + strip) */
.gt-panel.t-ulv, .gt-badge.t-ulv { --tc: #5d6670; }
.gt-panel.t-lv,  .gt-badge.t-lv  { --tc: #6b7785; }
.gt-panel.t-mv,  .gt-badge.t-mv  { --tc: #b4530a; }
.gt-panel.t-hv,  .gt-badge.t-hv  { --tc: #8a6d00; }
.gt-panel.t-ev,  .gt-badge.t-ev  { --tc: #6f3fb0; }
.gt-panel.t-iv,  .gt-badge.t-iv  { --tc: #1f6a9b; }
.gt-panel.t-luv, .gt-badge.t-luv { --tc: #b0368d; }
.gt-panel.t-zpm, .gt-badge.t-zpm { --tc: #0f7a6a; }
.gt-panel.t-uv,  .gt-badge.t-uv  { --tc: #a02323; }
.gt-panel.t-uhv, .gt-badge.t-uhv { --tc: #7a1d6e; }
.gt-panel.t-uev, .gt-badge.t-uev { --tc: #2c3fa6; }
.gt-panel.t-uiv, .gt-badge.t-uiv { --tc: #3b2a86; }
.gt-panel.t-multi, .gt-badge.t-multi { --tc: #2e6b3a; }
.gt-panel.t-mod, .gt-badge.t-mod { --tc: #5b5f66; }
.gt-badge.t-gen { --tc: #8f5a00; }

.md-typeset .gt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.15rem 0 0.45rem;
}
.md-typeset .gt-mname {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--gt-ink);
  margin-right: auto;
}
.md-typeset .gt-badge {
  background: var(--tc, #7e57c2);
  color: #fff;
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
}

.md-typeset .gt-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
}
.md-typeset .gt-col {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}
.md-typeset .gt-outc { align-items: stretch; }

.md-typeset .gt-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 5.2rem;
  text-align: center;
}
.md-typeset .gt-arrow {
  display: block;
  width: 2.6rem;
  height: 1.3rem;
  background: linear-gradient(90deg, var(--tc) 0 100%);
  clip-path: polygon(0 32%, 58% 32%, 58% 0, 100% 50%, 58% 100%, 58% 68%, 0 68%);
  opacity: 0.9;
}
.md-typeset .gt-stat {
  font-size: 0.64rem;
  font-weight: 600;
  background: #1f1f1f;
  color: #4cff7a;
  font-family: var(--md-code-font-family, monospace);
  padding: 0.1rem 0.35rem;
  border: 1px solid #000;
  white-space: nowrap;
}
.md-typeset .gt-empty {
  font-style: italic;
  color: #666;
  padding: 0.3rem;
}

/* slots */
.md-typeset .gt-slot {
  position: relative;
  display: block;
  min-height: 2.35rem;
  padding: 0.25rem 0.4rem;
  background: #747474;
  border: 2px solid;
  border-color: #373737 #fff #fff #373737;
  color: #fff;
  text-shadow: 1px 1px 0 #2b2b2b;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.md-typeset a.gt-slot:hover { background: #8660c8; color: #fff; }
.md-typeset .gt-slot:has(.gt-q) { padding-right: 2.6rem; }
.md-typeset .gt-ico {
  float: left;
  width: 1.6rem;
  height: 1.6rem;
  margin: 0.05rem 0.4rem 0 0;
  image-rendering: pixelated;
}
.md-typeset .gt-mid .gt-ico { float: none; width: 2.1rem; height: 2.1rem; margin: 0; }
.md-typeset .gt-nm { display: block; font-weight: 700; font-size: 0.7rem; }
.md-typeset .gt-note { display: block; opacity: 0.85; font-size: 0.62rem; }
.md-typeset .gt-q {                       /* stack count, bottom right like an item stack */
  position: absolute;
  right: 0.3rem;
  bottom: 0.1rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  text-align: right;
}
.md-typeset .gt-tag {
  display: inline-block;
  margin-top: 0.1rem;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #1f4d2c;
  padding: 0 0.3rem;
  border-radius: 2px;
}
.md-typeset .gt-sub { display: block; margin-top: 0.2rem; font-size: 0.62rem; opacity: 0.95; }
.md-typeset .gt-sub > span { display: block; }
.md-typeset .gt-sub i { opacity: 0.8; font-style: normal; }

.md-typeset .gt-fluid  { background: #3f6aa5; border-color: #23405f #cfe3ff #cfe3ff #23405f; }
.md-typeset .gt-power  { background: #8a6d1d; border-color: #4d3b0b #fff1c1 #fff1c1 #4d3b0b; }
.md-typeset .gt-mach   { background: #6b4fa0; border-color: #36265a #ddd0ff #ddd0ff #36265a; }
.md-typeset .gt-outp   { background: #3e7a4a; border-color: #1f4126 #d4f5dc #d4f5dc #1f4126; }
.md-typeset .gt-inf    { background: #2f7b86; border-color: #174047 #d1f3f7 #d1f3f7 #174047; }
.md-typeset .gt-group  { background: #66646f; }

.md-typeset .gt-foot { margin-top: 0.4rem; text-align: right; }
.md-typeset .gt-foot code {
  background: transparent;
  color: #4a4a4a;
  font-size: 0.6rem;
  padding: 0;
}

/* dark theme: keep the Minecraft grey but tone it down a little */
[data-md-color-scheme="slate"] .md-typeset .gt-panel {
  --gt-bg: #b4b4b4;
  box-shadow: 0 8px 22px -8px rgba(0, 0, 0, 0.9);
}

/* phones: stack inputs / machine / outputs */
@media (max-width: 36rem) {
  .md-typeset .gt-body { grid-template-columns: minmax(0, 1fr); }
  .md-typeset .gt-mid { flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .md-typeset .gt-arrow { transform: rotate(90deg); margin: 0.6rem 0.4rem; }
}

@media print {
  .md-typeset .gt-panel { break-inside: avoid; box-shadow: none; }
}

/* Demo video on the home page */
.atlas-demo { margin: 1rem 0 1.5rem; }
.atlas-demo video { width: 100%; max-width: 960px; border-radius: 8px; border: 1px solid var(--md-default-fg-color--lightest); background: #0b0f12; }
.atlas-demo p { font-size: .8rem; margin: .4rem 0 0; opacity: .8; }
