/* ==========================================================
   Magnificat Atelier — Maniquí a medida
   Usa las variables, tipografías y componentes de styles.css
   ========================================================== */

.mq {
  padding-top: clamp(7rem, 11vw, 8.5rem);
  background: var(--cream);
}

.mq-intro { text-align: center; margin-bottom: clamp(2rem, 4vw, 3rem); }
.mq-intro .eyebrow { justify-content: center; }
.mq-lead {
  max-width: 36em;
  margin: 1.2rem auto 0;
  color: var(--muted);
}

.mq-app {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: clamp(1.5rem, 3.5vw, 3.5rem);
  align-items: start;
  padding-bottom: clamp(4rem, 8vw, 7rem);
}

/* ---------- Escenario 3D ---------- */
.mq-stage {
  position: sticky;
  top: 76px;
  height: calc(100vh - 100px);
  height: calc(100svh - 100px);
  min-height: 520px;
  max-height: 980px;
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 50% 38%, #fffdf8 0%, #f8f2e7 48%, #efe5d3 100%);
  overflow: hidden;
}
.mq-stage::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(169, 138, 88, 0.16);
  pointer-events: none;
  z-index: 1;
}
.mq-canvas { position: absolute; inset: 0; }
.mq-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.mq-canvas canvas:active { cursor: grabbing; }
.mq-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-style: italic;
  color: var(--muted);
}

.mq-stage-top {
  position: absolute;
  z-index: 2;
  top: 1.4rem;
  left: 1.6rem;
  right: 1.6rem;
  pointer-events: none;
}
.mq-summary {
  margin: 0;
  font-family: var(--serif-display);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}
.mq-notes p {
  margin: 0 0 1rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.94);
  border-left: 2px solid var(--gold);
}

.mq-toolbar {
  position: absolute;
  z-index: 2;
  left: 1rem;
  right: 1rem;
  bottom: 2.7rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}
.mq-views,
.mq-actions-3d { display: flex; }
.mq-toolbar button {
  padding: 0.6rem 0.95rem;
  font-family: var(--serif-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.mq-toolbar button + button { border-left: 0; }
.mq-toolbar button:hover { color: var(--gold); }
.mq-toolbar button[aria-pressed="true"] {
  color: var(--paper);
  background: var(--gold);
  border-color: var(--gold);
}
.mq-hint {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0.9rem;
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
  pointer-events: none;
}

/* ---------- Panel ---------- */
.mq-types {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 1.4rem;
  border: 1px solid var(--line);
  background: var(--paper);
}
.mq-type {
  padding: 0.95rem 0.3rem;
  font-family: var(--serif-display);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background .3s var(--ease), color .3s var(--ease);
}
.mq-type + .mq-type { border-left: 1px solid var(--line); }
.mq-type:hover { color: var(--gold); }
.mq-type[aria-checked="true"] { color: var(--paper); background: var(--gold); }

.mq-group { border-top: 1px solid var(--line); }
.mq-group:last-child { border-bottom: 1px solid var(--line); }
.mq-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  font-family: var(--serif-display);
  font-size: 1.5rem;
  font-weight: 400;
  cursor: pointer;
  list-style: none;
}
.mq-group summary::-webkit-details-marker { display: none; }
.mq-group summary::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--gold);
}
.mq-group[open] summary::after { content: "–"; }

.mq-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem 1.5rem;
  padding: 0.2rem 0 1.6rem;
}
.mq-field-head { display: flex; align-items: center; gap: 0.5rem; min-height: 1.6em; }
.mq-field label {
  font-family: var(--serif-display);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--gold);
}
.mq-badge {
  padding: 0.05rem 0.45rem;
  font-family: var(--serif-display);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--gold-soft);
}
.mq-input {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  border-bottom: 1px solid var(--line);
  transition: border-color .3s var(--ease);
}
.mq-input:focus-within { border-color: var(--gold); }
.mq-input input {
  width: 100%;
  min-width: 0;
  padding: 0.15rem 0;
  font-family: var(--serif-display);
  font-size: 1.65rem;
  font-weight: 400;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.mq-input input::-webkit-outer-spin-button,
.mq-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mq-input span { font-style: italic; color: var(--muted); }
.mq-field.is-invalid .mq-input { border-color: #9a4b3a; }

.mq-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  margin: 0.25rem 0 0;
  background: transparent;
  cursor: pointer;
}
.mq-range::-webkit-slider-runnable-track { height: 1px; background: var(--line); }
.mq-range::-moz-range-track { height: 1px; background: var(--line); }
.mq-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--gold);
}
.mq-range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--gold);
}

.mq-help {
  display: none;
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
}
.mq-field:focus-within .mq-help { display: block; }
.mq-error { margin: 0.3rem 0 0; font-size: 0.88rem; line-height: 1.4; color: #9a4b3a; }

.mq-buttons { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.8rem; }
.mq .button { margin-top: 0; cursor: pointer; }
.mq .button-ghost { color: var(--gold); background: transparent; }
.mq .button-ghost:hover,
.mq .button-ghost:focus-visible { color: var(--paper); background: var(--gold); }
.mq-status { min-height: 1.5em; margin: 0.9rem 0 0; font-style: italic; color: var(--muted); }
.mq-small { margin: 0.4rem 0 0; font-size: 0.95rem; color: var(--muted); }
.mq-link {
  padding: 0;
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-color: rgba(123, 107, 87, 0.45);
  text-underline-offset: 0.25em;
  cursor: pointer;
}
.mq-link:hover { color: var(--gold); }

/* ---------- Comprobación geométrica ---------- */
.mq-report {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.mq-report h2 { font-size: clamp(1.7rem, 1.4rem + 1vw, 2.1rem); font-weight: 400; margin-bottom: 0.4rem; }
.mq-report-summary { margin: 0 0 1rem; font-style: italic; color: var(--muted); }
.mq-credit { font-size: 0.85rem; }
.mq-table-wrap { overflow-x: auto; }
.mq-table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.mq-table th, .mq-table td { padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); text-align: right; }
.mq-table th:first-child { text-align: left; font-weight: 400; }
.mq-table thead th {
  font-family: var(--serif-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.mq-table tr.is-off td, .mq-table tr.is-off th { color: #9a4b3a; }
.mq-ok { color: var(--gold); }
.mq-warn { font-weight: 500; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mq-canvas.is-busy::after {
  content: "";
  position: absolute;
  top: 1.5rem;
  right: 1.6rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  animation: mq-pulse 0.9s ease-in-out infinite alternate;
}
@keyframes mq-pulse { from { opacity: 0.25; } to { opacity: 1; } }

/* ---------- Fotografías ---------- */
.mq-photo {
  margin-top: 2.5rem;
  padding: clamp(1.5rem, 3vw, 2.2rem);
  background: var(--paper);
  border: 1px solid var(--line);
}
.mq-photo .eyebrow { margin-bottom: 0.9rem; }
.mq-photo h2 { margin-bottom: 0.9rem; font-size: clamp(1.7rem, 1.4rem + 1vw, 2.1rem); font-weight: 400; }
.mq-photo > p { margin: 0 0 1.3rem; color: var(--muted); }
.mq-photo-root { margin-top: 1.6rem; }
.mq-photo-steps { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--ink); }
.mq-photo-steps li { margin-bottom: 0.35rem; }
.mq-photo-steps li::marker { color: var(--gold); }
.mq-photo-height { margin: 0 0 1.2rem; color: var(--muted); }
.mq-photo-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.2rem; }
.mq-photo-drop {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  border: 1px dashed var(--gold-soft);
  background: var(--cream);
  cursor: pointer;
}
.mq-photo-drop span {
  font-family: var(--serif-display);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
}
.mq-photo-drop span em { text-transform: none; letter-spacing: 0; font-family: var(--serif-body); color: var(--muted); }
.mq-photo-drop input { font: inherit; font-size: 0.85rem; max-width: 100%; color: var(--muted); }
.mq-photo-drop canvas { max-width: 100%; height: auto; }
.mq-photo-sub { margin: 1.5rem 0 0.8rem; font-size: 1.5rem; font-weight: 400; }
.mq-photo-sub span { font-style: italic; color: var(--muted); font-size: 1.1rem; }
@media (max-width: 560px) { .mq-photo-inputs { grid-template-columns: 1fr; } }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .mq-app { grid-template-columns: 1fr; }
  .mq-stage {
    position: relative;
    top: 0;
    height: 74vh;
    height: 74svh;
    min-height: 460px;
  }
}

@media (max-width: 560px) {
  .mq-app { width: 100%; }
  .mq-stage { border-left: 0; border-right: 0; }
  .mq-stage::before { display: none; }
  .mq-panel { width: min(var(--wrap), 100% - 3rem); margin-inline: auto; }
  .mq-toolbar { bottom: 2.4rem; gap: 0.45rem; }
  .mq-toolbar button { padding: 0.55rem 0.62rem; font-size: 0.66rem; letter-spacing: 0.14em; }
  .mq-type { font-size: 0.7rem; letter-spacing: 0.14em; }
  .mq-fields { gap: 1.1rem 1.1rem; }
  .mq-input input { font-size: 1.45rem; }
}
