/* MiniPack shared styles — self-hosted fonts, no external requests.
   Warm, clean, Apple-ish light-default SaaS. Design tokens are the product set. */

/* ---- Self-hosted fonts (variable woff2, cover the full weight range) ---- */
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/outfit-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/jetbrainsmono-latin.woff2") format("woff2");
}

/* ---- Design tokens ---- */
:root {
  --bg: #f7f6f3;
  --bg-card: #ffffff;
  --bg-inset: #f0efec;
  --bg-hover: #f5f4f1;
  --bg-nav: #ffffffe6;
  --border: #e8e6e1;
  --border-light: #f0efec;
  --text: #1c1c1e;
  --text-mid: #48484a;
  --text-soft: #8a8a8e;
  --text-muted: #aeaeb2;
  --blue: #3478f6;
  --blue-light: #ebf2ff;
  --blue-hover: #2563eb;
  --green: #30d158;
  --green-bg: #edfbf0;
  --green-text: #1b8a2e;
  --red: #ff453a;
  --red-bg: #ffefee;
  --orange: #e68a00;
  --orange-bg: #fff8ec;
  --warning: #b45309;
  --warning-bg: #fff8ec;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --font-ui: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #141416;
  --bg-card: #1c1c1e;
  --bg-inset: #252528;
  --bg-hover: #2c2c2e;
  --bg-nav: #141416e6;
  --border: #333338;
  --border-light: #2a2a2e;
  --text: #f5f5f7;
  --text-mid: #b0b0b5;
  --text-soft: #7c7c82;
  --text-muted: #5a5a5e;
  --blue: #3b8df8;
  --blue-light: #3b8df81f;
  --blue-hover: #5da3fa;
  --green: #30d158;
  --green-bg: #30d1581a;
  --green-text: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --warning: #fbbf24;
  --warning-bg: #fbbf241f;
  --card-shadow: none;
  color-scheme: dark;
}

/* ---- Base ---- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top nav ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-nav);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.wordmark:hover { text-decoration: none; }
.wordmark svg { display: block; border-radius: 6px; }

/* theme toggle */
.theme-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-mid);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---- Layout ---- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 8px 20px 72px; }

/* ---- Hero ---- */
.hero { text-align: center; padding: 56px 8px 28px; }
.hero h1 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  max-width: 720px;
  margin-inline: auto;
}
.hero p {
  color: var(--text-mid);
  font-size: 18px;
  line-height: 1.5;
  max-width: 600px;
  margin: 0 auto;
}
.badges {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}
.badge {
  font-size: 13px;
  color: var(--text-mid);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px;
}
.badge .dot { color: var(--green); font-weight: 700; margin-right: 5px; }

/* ---- Tabs (segmented control) ---- */
.tabs {
  display: flex;
  gap: 4px;
  margin-top: 20px;
  padding: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tab {
  flex: 1 1 0;
  padding: 10px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--card-shadow);
}
[data-theme="dark"] .tab.active { box-shadow: 0 0 0 1px var(--border); }

.panel { display: none; }
.panel.active { display: block; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 24px;
  margin-top: 20px;
}

/* ---- Drop zone ---- */
#drop-zone, #gcode-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-inset);
  transition: border-color var(--transition), background var(--transition);
}
#drop-zone:hover, #gcode-drop:hover { border-color: var(--text-muted); }
#drop-zone.drag, #gcode-drop.drag { border-color: var(--blue); background: var(--blue-light); }
#drop-zone .big, #gcode-drop .big { font-size: 17px; font-weight: 600; color: var(--text); }
#drop-zone .sub, #gcode-drop .sub { color: var(--text-soft); font-size: 13.5px; margin-top: 7px; }
#file-name {
  margin-top: 12px;
  color: var(--green-text);
  font-weight: 600;
  min-height: 1.2em;
}
input[type="file"] { display: none; }

/* ---- Controls ---- */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input,
.field select {
  width: 100%;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 14px;
  font-family: var(--font-ui);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-light);
}
.bed-pair { display: flex; gap: 8px; align-items: center; }
.bed-pair span { color: var(--text-soft); }
.checkrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  color: var(--text-mid);
  font-size: 14px;
}
.checkrow input { width: 16px; height: 16px; accent-color: var(--blue); }

/* ---- Buttons ---- */
button.primary {
  margin-top: 22px;
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
}
button.primary:hover { background: var(--blue-hover); }
button.primary:disabled { opacity: 0.45; cursor: not-allowed; }

button.download {
  margin-top: 20px;
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background var(--transition);
}
button.download:hover { background: var(--blue-hover); }

/* ---- Progress ---- */
#progress,
#gcode-progress {
  margin-top: 18px;
  display: none;
  flex-direction: column;
  gap: 8px;
  color: var(--text-mid);
  font-size: 14px;
}
#progress.show,
#gcode-progress.show { display: flex; }
#progress-text,
#gcode-progress-text { color: var(--text-mid); }
.bar {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: var(--bg-inset);
  overflow: hidden;
}
.bar::after {
  content: "";
  position: absolute;
  left: -35%;
  top: 0;
  height: 100%;
  width: 35%;
  border-radius: 999px;
  background: var(--blue);
  animation: indeterminate 1.1s ease-in-out infinite;
}
@keyframes indeterminate {
  0% { left: -35%; }
  60% { left: 100%; }
  100% { left: 100%; }
}

#error,
#gcode-error {
  margin-top: 16px;
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  display: none;
}
#error.show,
#gcode-error.show { display: block; }

/* ---- Result ---- */
#result,
#swaps-result { display: none; }
#result.show,
#swaps-result.show { display: block; }
.svg-holder {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  overflow-x: auto;
}
.svg-holder svg { max-width: 100%; height: auto; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.stat {
  background: var(--bg-inset);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
}
.stat .k {
  font-size: 11.5px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.stat .v {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--text);
}
#warnings { margin-top: 14px; color: var(--warning); font-size: 13px; }
#warnings ul { margin: 6px 0 0; padding-left: 18px; }

/* ---- Color-swap results ---- */
.notice {
  margin-top: 16px;
  display: none;
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
}
.notice.show { display: block; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  vertical-align: middle;
  white-space: nowrap;
}
[data-theme="dark"] .chip { border-color: rgba(255, 255, 255, 0.16); }

/* Swatch chip + exact hex read as one unit; the hex is the color's identity. */
.chip-wrap { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.chip-wrap .hex {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

.swap-block { margin-top: 22px; }
.swap-block:first-child { margin-top: 0; }
.swap-block h3 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.swap-block .lead { color: var(--text-soft); font-size: 13.5px; margin: 0 0 12px; }

.loadout { display: flex; flex-wrap: wrap; gap: 10px; }
.loadout .slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-inset);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-size: 13px;
  color: var(--text-mid);
}

.pause-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 11px 13px;
  margin-top: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-mid);
}
.pause-row .pause-tag {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: #fff;
  background: var(--blue);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.pause-row .arrow { color: var(--text-soft); }
.pause-row .need { color: var(--text-soft); }

.infeasible {
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13.5px;
}

.merge-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.merge-opt:first-of-type { border-top: none; }
.merge-opt .pairs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.merge-opt select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 12.5px;
  font-family: var(--font-ui);
}
.merge-opt .desc { flex: 1 1 12rem; color: var(--text-soft); font-size: 13px; }
.merge-opt .apply {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-mid);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.merge-opt .apply input { width: 16px; height: 16px; accent-color: var(--blue); }

/* ---- FAQ ---- */
.faq h2 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.faq details { border-top: 1px solid var(--border); padding: 14px 0; }
.faq details:first-of-type { border-top: none; }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+";
  color: var(--text-soft);
  font-weight: 400;
  margin-right: 10px;
  display: inline-block;
  width: 12px;
}
.faq details[open] summary::before { content: "\2212"; }
.faq p { color: var(--text-mid); margin: 10px 0 0; }

/* ---- Footer ---- */
footer { margin-top: 48px; text-align: center; color: var(--text-muted); font-size: 13px; }
#ad-slot { display: none; }
#affiliate-slot { display: none; }
footer .priv { margin-top: 10px; color: var(--text-soft); }
footer .copy { margin-top: 6px; }

/* ---- Privacy page ---- */
.doc { max-width: 720px; margin: 0 auto; padding: 32px 20px 72px; }
.doc h1 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
}
.doc h2 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-top: 28px;
}
.doc p { color: var(--text-mid); }
.doc .muted { color: var(--text-soft); font-size: 0.85rem; }

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .hero { padding: 36px 4px 20px; }
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 16px; }
  .wrap { padding: 8px 16px 56px; }
  .card { padding: 20px; }
}
@media (max-width: 380px) {
  .hero h1 { font-size: 26px; }
}

/* How it works / examples */
.howto h2 { margin: 0 0 14px; }
.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.howto-col h3 { margin: 0 0 8px; font-size: 16px; }
.howto-col ol { margin: 0 0 14px; padding-left: 20px; color: var(--text-mid); }
.howto-col ol li { margin-bottom: 6px; }
.howto-col figure { margin: 0; }
.howto-col figure img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff;
}
.howto-col figcaption {
  margin-top: 8px; font-size: 12.5px; color: var(--text-soft); line-height: 1.45;
}
@media (max-width: 760px) { .howto-grid { grid-template-columns: 1fr; } }

.drop-icon {
  width: 34px; height: 34px; margin: 0 auto 10px; display: block;
  color: var(--text-muted); transition: color var(--transition);
}
#drop-zone:hover .drop-icon, #gcode-drop:hover .drop-icon,
#drop-zone.drag .drop-icon, #gcode-drop.drag .drop-icon { color: var(--blue); }

#lightbox {
  position: fixed; inset: 0; z-index: 50; cursor: zoom-out;
  background: rgba(10, 10, 12, 0.82);
  display: flex; align-items: center; justify-content: center; padding: 4vmin;
}
#lightbox[hidden] { display: none; }
#lightbox img {
  max-width: 100%; max-height: 100%; border-radius: var(--radius);
  background: #fff; box-shadow: 0 12px 48px rgba(0,0,0,.5);
}
.howto-col figure img { cursor: zoom-in; }

.promo-inner { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.promo-inner > div { flex: 1 1 380px; }
.promo h2 { margin: 0 0 6px; }
.promo p { margin: 0 0 6px; color: var(--text-mid); }
.promo .disclosure { font-size: 12px; color: var(--text-soft); }
.promo-btn {
  flex: 0 0 auto; display: inline-block; padding: 11px 20px;
  background: var(--blue); color: #fff; text-decoration: none; font-weight: 600;
  border-radius: var(--radius-md); transition: background var(--transition);
}
.promo-btn:hover { background: var(--blue-hover); }
