/* ── Factory Bit Loader — shared across all factory.fyi pages ── */

/* ── Theme vars ── */
:root {
  --bl-bg: #eeeee7;
  --bl-surface: #f7f7f3;
  --bl-ink: #1a1a1a;
  --bl-ink-muted: #999;
  --bl-ink-ghost: #bbb;
  --bl-border: #e8e8e8;
  --bl-heading: #1a1a1a;
}
[data-theme="dark"] {
  --bl-bg: #14130f;
  --bl-surface: #1c1b17;
  --bl-ink: #f2efe7;
  --bl-ink-muted: #7a7670;
  --bl-ink-ghost: #504c45;
  --bl-border: #26251f;
  --bl-heading: #f2efe7;
}

/* ── Corner grids ── */
.color-code {
  position: fixed;
  display: grid;
  grid-template-columns: repeat(3, 16px);
  grid-template-rows: repeat(3, 16px);
  gap: 0;
  z-index: 100;
}
.color-code.tr { top: 0; right: 0; }
.color-code.bl { bottom: 0; left: 0; }
@media (max-width: 600px) {
  .color-code.bl { bottom: env(safe-area-inset-bottom, 0px); }
}
.color-code span {
  display: block;
  width: 16px;
  height: 16px;
  background: transparent;
  transition: background 0.05s;
}
.color-code.tr span:nth-child(1) { grid-area: 1/1; }
.color-code.tr span:nth-child(2) { grid-area: 1/2; }
.color-code.tr span:nth-child(3) { grid-area: 1/3; }
.color-code.tr span:nth-child(4) { grid-area: 2/2; }
.color-code.tr span:nth-child(5) { grid-area: 2/3; }
.color-code.tr span:nth-child(6) { grid-area: 3/2; }
.color-code.tr span:nth-child(7) { grid-area: 3/3; }
.color-code.bl span:nth-child(1) { grid-area: 1/1; }
.color-code.bl span:nth-child(2) { grid-area: 1/2; }
.color-code.bl span:nth-child(3) { grid-area: 2/1; }
.color-code.bl span:nth-child(4) { grid-area: 2/2; }
.color-code.bl span:nth-child(5) { grid-area: 3/1; }
.color-code.bl span:nth-child(6) { grid-area: 3/2; }
.color-code.bl span:nth-child(7) { grid-area: 3/3; }

/* ── Corner info badge ── */
.corner-info {
  background: #f6c600 !important;
  color: #1a1a1a;
  font-family: 'Guggenheim Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4);
  animation: badge-glow 3s ease-in-out infinite;
}
.corner-info:hover { background: #e0b600 !important; }
.corner-info.is-close {
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  animation: none !important;
}
@keyframes badge-glow {
  0%   { box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4), 3px -2px 12px rgba(246,198,0,0.7); }
  25%  { box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4), 2px 3px 12px rgba(246,198,0,0.7); }
  50%  { box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4), -3px 2px 12px rgba(246,198,0,0.7); }
  75%  { box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4), -2px -3px 12px rgba(246,198,0,0.7); }
  100% { box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4), 3px -2px 12px rgba(246,198,0,0.7); }
}

/* ── Theme toggle ── */
.color-code.bl .theme-toggle { grid-area: 2/2; }
.theme-toggle {
  width: 16px;
  height: 16px;
  background: var(--bl-bg) !important;
  color: var(--bl-ink);
  border: 0;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.25s ease, color 0.25s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { transform: scale(1.1); }
.theme-toggle svg {
  width: 11px;
  height: 11px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ── Factory tag ── */
.factory-tag {
  background: #f6c600;
  color: #1a1a1a;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 8px 3px;
  border-radius: 8px;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4);
  animation: badge-glow 3s ease-in-out infinite;
}

/* ── Colophon overlay (bits grid) ── */
.colophon-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}
.colophon-overlay.active { display: block; pointer-events: none; }
.colophon-overlay.filled { pointer-events: auto; }
.colophon-grid {
  position: absolute;
  inset: 0;
  display: grid;
  pointer-events: none;
  z-index: 1;
}
.colophon-overlay.filled .colophon-grid { pointer-events: auto; }
.colophon-center {
  position: relative;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 48px 24px;
  pointer-events: none;
}
.colophon-overlay.filled .colophon-center { display: flex; }
.colophon-card {
  position: relative;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 0.5px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 24px;
  width: 340px;
  max-width: calc(100% - 48px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.colophon-overlay.filled .colophon-card { opacity: 1; pointer-events: auto; }
.colophon-brand { display: flex; align-items: center; gap: 8px; justify-content: center; }
.colophon-brand-name { font-size: 16px; font-weight: 800; color: #fff; }
.colophon-divider { width: 100%; height: 0.5px; background: rgba(255,255,255,0.15); margin: 4px 0; }
.colophon-watermark { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.colophon-overline { font-size: 10px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255,255,255,0.45); }
.colophon-studio { position: relative; display: inline-flex; align-items: center; font-family: 'Perpetua Titling', 'Georgia', serif; font-size: 22px; font-weight: 300; letter-spacing: 0.06em; color: #fff; text-decoration: none; transition: opacity 0.2s ease; }
.colophon-studio .stuck-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  opacity: 1;
  animation: colophon-arrow-nudge 1.2s ease-in-out infinite;
}
@keyframes colophon-arrow-nudge {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(4px); }
}
@media (hover: hover) {
  .colophon-studio:hover { opacity: 0.85; }
}
.colophon-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  position: absolute;
  top: 12px;
  right: 12px;
  transition: color 0.15s, background 0.15s;
}
.colophon-close:hover { color: #fff; background: rgba(255,255,255,0.15); }
.colophon-close::before, .colophon-close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
}
.colophon-close::before { transform: translate(-50%,-50%) rotate(45deg); }
.colophon-close::after { transform: translate(-50%,-50%) rotate(-45deg); }
