/* Project styles that Tailwind utilities cannot express on their own:
   fonts, glass surfaces, the background glow, field states and motion. */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

html,
body {
  overflow-x: clip;
}

/* Focus and in-page scrolling stop below the floating top bar. */
html {
  scroll-padding-top: 96px;
}

.min-h-screen {
  overflow-x: clip;
}

body {
  margin: 0;
  background: #0b1014;
  color-scheme: dark;
}

/* Glass surfaces: only the top bar, the form and the locked summary. */
.glass-bar {
  background: rgba(17, 24, 29, 0.72);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
}

.glass-panel {
  background: rgba(17, 26, 31, 0.62);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

#generation-status[hidden],
#generation-alert[hidden],
#generated-result[hidden] {
  display: none;
}

/* P3 plan renderer: the SVG viewBox scales the same drawing in both sizes. */
.preview-status,
.preview-alert,
.preview-position,
.preview-disclaimer {
  margin: 0;
  font-size: 13px;
}

.preview-status,
.preview-position,
.preview-disclaimer {
  color: #8fa3ad;
}

.preview-alert {
  color: #f4a6b7;
}

.preview-retry {
  min-height: 44px;
  margin-top: 12px;
  padding: 0 16px;
  border: 1px solid #34505a;
  border-radius: 10px;
  background: transparent;
  color: #e4eef1;
  font: inherit;
  cursor: pointer;
}

.preview-gallery {
  min-width: 0;
}

.preview-position {
  margin-bottom: 10px;
  font-weight: 600;
}

/* Scoped under the stage so Tailwind's button preflight, loaded later, cannot override it. */
.preview-stage {
  position: relative;
}

.preview-stage .preview-arrow {
  position: absolute;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  border: 1px solid #34505a;
  border-radius: 50%;
  background: rgba(17, 24, 29, 0.78);
  color: #e4eef1;
  font: 600 28px/1 "Geist", system-ui, sans-serif;
  cursor: pointer;
  transform: translateY(-50%);
}

.preview-stage .preview-arrow-previous {
  left: 8px;
}

.preview-stage .preview-arrow-next {
  right: 8px;
}

.preview-stage .preview-arrow:hover:not(:disabled) {
  border-color: #8ed8c6;
  background: rgba(17, 24, 29, 0.92);
}

.preview-stage .preview-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.preview-main {
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #22303a;
  border-radius: 12px;
  background: #11181d;
}

.preview-main svg,
.preview-thumbnail-frame svg {
  display: block;
  width: 100%;
  height: 100%;
}

.preview-thumbnails {
  display: flex;
  gap: 10px;
  min-width: 0;
  margin-top: 12px;
  padding: 3px 2px 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: #34505a transparent;
}

.preview-thumbnail {
  display: flex;
  flex: 0 0 clamp(108px, 20vw, 156px);
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 6px;
  border: 1px solid #22303a;
  border-radius: 10px;
  background: #11181d;
  color: #8fa3ad;
  text-align: left;
  cursor: pointer;
}

.preview-thumbnail[aria-pressed="true"] {
  border-color: #8ed8c6;
  box-shadow: 0 0 0 1px #8ed8c6;
  color: #e4eef1;
}

.preview-thumbnail-number {
  padding-left: 2px;
  color: #8ed8c6;
  font: 600 11px/1.2 "Geist Mono", ui-monospace, monospace;
}

.preview-thumbnail-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 5px;
  background: #11181d;
}

.preview-disclaimer {
  margin-top: 9px;
}

.preview-thumbnail:focus-visible,
.preview-retry:focus-visible,
.preview-arrow:focus-visible {
  outline: 2px solid #8ed8c6;
  outline-offset: 3px;
}

/* The single light behind the form block. */
.glow {
  position: absolute;
  left: 50%;
  top: -170px;
  width: min(1000px, 120vw);
  height: 560px;
  transform: translateX(-50%);
  background: radial-gradient(
    closest-side,
    rgba(142, 216, 198, 0.26),
    rgba(147, 226, 234, 0.09) 55%,
    transparent 100%
  );
  filter: blur(24px);
  pointer-events: none;
}

/* Text fields and selects. */
.field {
  background: rgba(11, 16, 20, 0.6);
  border: 1px solid #22303a;
  border-radius: 10px;
  color: #e4eef1;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field:hover {
  border-color: #2e414b;
}

.field:focus {
  outline: none;
  border-color: #8ed8c6;
  box-shadow: 0 0 0 3px rgba(142, 216, 198, 0.18);
}

.field::placeholder {
  color: #677c86;
}

.field[aria-invalid="true"] {
  border-color: #f4a6b7;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #8ed8c6;
  outline-offset: 2px;
}

/* The hidden attribute must win over Tailwind display utilities. */
[hidden] {
  display: none !important;
}

input[type="range"] {
  accent-color: #8ed8c6;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #34505a;
}

/* --- Four-step form ------------------------------------------------------ */

/* Without the wizard script the panels stack and every step is visible. */
.wizard-panels {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.wizard-panel-title {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 600;
  color: #8ed8c6;
}

.wizard-actions {
  display: none;
}

/* The wizard script adds .js-wizard to the form and shows one step at a
   time. The form takes the height of the current step, so short steps and
   their messages sit right under the content. */
.js-wizard .wizard-panels {
  display: block;
}

.js-wizard [data-step-panel][aria-hidden="true"] {
  display: none;
}

.js-wizard .wizard-panel-title,
.js-wizard .wizard-nojs {
  display: none;
}

.js-wizard .wizard-actions {
  display: flex;
}

/* Step indicator: pending by default, active with aria-current, done with
   data-state="done". */
.wizard-step {
  background: transparent;
  transition: background 0.15s;
}

.wizard-step .step-num {
  border: 1.5px solid #2e414b;
  color: #7f949e;
}

.wizard-step .step-label {
  font-weight: 500;
  color: #8fa3ad;
}

.wizard-step .step-check {
  display: none;
}

.wizard-step[aria-current="step"] {
  background: rgba(142, 216, 198, 0.1);
}

.wizard-step[aria-current="step"] .step-num {
  border-color: transparent;
  background: #8ed8c6;
  color: #04252b;
}

.wizard-step[aria-current="step"] .step-label {
  font-weight: 600;
  color: #e4eef1;
}

.wizard-step[data-state="done"] .step-num {
  border-color: transparent;
  background: rgba(142, 216, 198, 0.16);
  color: #8ed8c6;
}

.wizard-step[data-state="done"] .step-label {
  color: #e4eef1;
}

.wizard-step[data-state="done"] .step-digit {
  display: none;
}

.wizard-step[data-state="done"] .step-check {
  display: block;
}

/* Selectable cards backed by a hidden radio input. Same look for every list. */
.option {
  background: rgba(11, 16, 20, 0.55);
  border: 1px solid #22303a;
  color: #e4eef1;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.option:hover {
  border-color: #2e414b;
}

.option:has(input:checked) {
  background: rgba(147, 226, 234, 0.14);
  border-color: #8ed8c6;
  box-shadow: inset 0 0 0 1px #8ed8c6;
}

.option:has(input:focus-visible) {
  outline: 2px solid #8ed8c6;
  outline-offset: 2px;
}

fieldset[aria-invalid="true"] .option {
  border-color: #f4a6b7;
}

/* Style thumbnails: a 16:9 sketch of each style. */
.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #f1f4f5;
}

.thumb > span {
  position: absolute;
  display: none;
}

.thumb-title {
  left: 12px;
  color: #14171c;
}

.thumb-line,
.thumb-line2 {
  height: 4px;
  border-radius: 2px;
  background: rgba(20, 23, 28, 0.2);
}

.thumb-formal .thumb-band {
  display: block;
  inset: 0 0 auto 0;
  height: 16%;
  background: #3c4a50;
}

.thumb-formal .thumb-title {
  display: block;
  top: 28%;
  font-size: 14px;
  font-weight: 700;
}

.thumb-formal .thumb-title::before {
  content: "Informe anual";
}

.thumb-formal .thumb-line {
  display: block;
  left: 12px;
  top: 54%;
  width: 58%;
}

.thumb-formal .thumb-line2 {
  display: block;
  left: 12px;
  top: 66%;
  width: 42%;
  background: rgba(20, 23, 28, 0.14);
}

.thumb-minimalista .thumb-title {
  display: block;
  top: 40%;
  font-size: 15px;
  font-weight: 500;
}

.thumb-minimalista .thumb-title::before {
  content: "Una idea";
}

.thumb-academico .thumb-band {
  display: block;
  left: 12px;
  right: 12px;
  top: 32%;
  height: 1px;
  background: rgba(20, 23, 28, 0.3);
}

.thumb-academico .thumb-title {
  display: block;
  top: 12%;
  font-family: Georgia, serif;
  font-size: 14px;
  font-style: italic;
}

.thumb-academico .thumb-title::before {
  content: "Capítulo 2";
}

.thumb-academico .thumb-line {
  display: block;
  left: 12px;
  top: 46%;
  width: 38%;
}

.thumb-academico .thumb-line2 {
  display: block;
  left: 54%;
  top: 46%;
  width: 34%;
}

/* Creativo: a large color block stands in for the photo of the prototype. */
.thumb-creativo .thumb-band {
  display: block;
  inset: 0 0 0 auto;
  width: 48%;
  background: linear-gradient(135deg, #0b7f74, #93e2ea);
}

.thumb-creativo .thumb-title {
  display: block;
  bottom: 16%;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.thumb-creativo .thumb-title::before {
  content: "Mira esto";
}

/* Example cards: the picture zooms in slightly on hover. */
.example-img {
  transition: transform 0.4s ease-out;
}

.example:hover .example-img {
  transform: scale(1.04);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rise {
  animation: rise 0.5s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Account deletion: native modal dialog (Escape closes it, focus stays inside). */
.delete-dialog::backdrop {
  background: rgba(5, 8, 10, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
