/* IA de Diario — oscuro + morado · móvil + escritorio */

:root {
  --bg: #05010a;
  --bg-elev: rgba(12, 8, 22, 0.85);
  --purple: #9d5cff;
  --purple-deep: #7b2ff7;
  --purple-bright: #bc13fe;
  --purple-soft: #a280ff;
  --pink-label: #d147ff;
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --border: rgba(157, 92, 255, 0.35);
  --glow: rgba(157, 92, 255, 0.5);
  --code: #8b9cff;
  --radius: 20px;
  --radius-sm: 14px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --pad-inline: clamp(1rem, 4vw, 1.75rem);
  --main-max: 1100px;
  --caso-max: 40rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  /* Fondo simple: color base + un halo muy suave arriba */
  background-image: radial-gradient(
    ellipse 120% 70% at 50% -10%,
    rgba(123, 47, 247, 0.08) 0%,
    transparent 45%
  );
  line-height: 1.55;
  padding-top: var(--safe-top);
  padding-bottom: calc(1rem + var(--safe-bottom));
}

.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;
}

a {
  color: var(--purple-soft);
  text-decoration: none;
}

a:hover {
  color: var(--purple);
  text-decoration: underline;
}

/* Cabecera */
.site-header {
  position: relative;
  z-index: 2;
  padding: 1rem var(--pad-inline);
  padding-top: calc(1rem + var(--safe-top));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(5, 1, 10, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.site-header__inner {
  max-width: var(--main-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: var(--text);
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-bright));
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 0 22px var(--glow);
}

.brand__text {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 600;
}

.header__handle {
  font-size: clamp(0.72rem, 2.5vw, 0.82rem);
  color: rgba(160, 160, 160, 0.55);
  white-space: nowrap;
}

/* Contenido principal */
.main {
  position: relative;
  z-index: 1;
  max-width: var(--main-max);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem) var(--pad-inline);
  padding-bottom: calc(2rem + var(--safe-bottom));
}

.flash-wrap {
  margin-bottom: 1rem;
}

.flash {
  margin: 0 0 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.flash--success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

.flash--error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.flash--info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.28);
  color: #bfdbfe;
}

/* Hero */
.hero {
  text-align: center;
  padding: clamp(1.25rem, 5vw, 2.5rem) 0 clamp(1.5rem, 4vw, 2.25rem);
}

.hero__eyebrow {
  margin: 0 0 0.65rem;
  font-size: clamp(0.68rem, 2.2vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pink-label);
}

.hero__title {
  margin: 0 auto 1rem;
  font-size: clamp(1.35rem, 4.5vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  max-width: 22ch;
}

/* Aberración cromática suave (texto blanco) */
.hero__title--fx {
  text-shadow: 2px 0 0 rgba(255, 90, 120, 0.35), -2px 0 0 rgba(80, 160, 255, 0.35);
}

.hero__lead {
  margin: 0 auto;
  max-width: 36ch;
  color: var(--text-muted);
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
}

.section {
  margin-top: 0.25rem;
}

.section__title {
  margin: 0 0 1rem;
}

/* Tarjetas — lista de casos */
.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(0.75rem, 3vw, 1rem);
  grid-template-columns: 1fr;
}

@media (min-width: 520px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: clamp(1.1rem, 3vw, 1.35rem);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  color: inherit;
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

.card:hover {
  border-color: rgba(157, 92, 255, 0.65);
  box-shadow: 0 0 28px var(--glow), 0 12px 40px rgba(0, 0, 0, 0.45);
  transform: translateY(-2px);
  text-decoration: none;
}

.card:active {
  transform: translateY(0);
}

.card__num {
  font-size: clamp(1.65rem, 5vw, 2rem);
  font-weight: 800;
  color: var(--purple);
  line-height: 1;
}

.card__title {
  font-weight: 700;
  font-size: clamp(0.95rem, 3vw, 1.05rem);
  line-height: 1.35;
}

.card__cta {
  margin-top: auto;
  padding-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--purple-soft);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: clamp(2rem, 6vw, 3rem) 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

/* Pie */
.site-footer {
  position: relative;
  z-index: 1;
  padding: 1.25rem var(--pad-inline) calc(1.5rem + var(--safe-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.site-footer__domain {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
}

.site-footer__handle {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(160, 160, 160, 0.45);
}

/* Detalle caso */
.caso {
  max-width: var(--caso-max);
  margin: 0 auto;
}

.caso__head {
  text-align: center;
  margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

.caso__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: 0.06em;
}

.caso__title {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 800;
  line-height: 1.25;
}

.caso__title--fx {
  text-shadow: 1px 0 0 rgba(255, 90, 120, 0.28), -1px 0 0 rgba(80, 160, 255, 0.28);
}

.prompt-block {
  margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

.caso .prompt-box {
  min-height: 12rem;
}

.prompt-block__label {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--purple-bright);
}

.prompt-block__label--code {
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--code);
  font-size: 0.82rem;
}

.prompt-box {
  margin: 0 0 1rem;
  padding: clamp(1rem, 3vw, 1.2rem);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--font);
  font-size: clamp(0.88rem, 2.8vw, 0.95rem);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.55;
  color: var(--text);
}

.prompt-box--sm {
  font-size: clamp(0.85rem, 2.6vw, 0.9rem);
}

/* Botones — área táctil cómoda en móvil */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-bright));
  box-shadow: 0 0 20px var(--glow);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  filter: brightness(1.06);
  text-decoration: none;
  color: #fff;
}

.btn:focus-visible {
  outline: 2px solid var(--purple-soft);
  outline-offset: 3px;
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--text);
}

.btn--ghost:hover {
  border-color: rgba(157, 92, 255, 0.55);
  color: var(--purple-soft);
}

.caso__back {
  margin-top: 2rem;
  font-size: 0.92rem;
}

/* Admin — misma línea visual */
.page-admin .site-header {
  border-bottom-color: rgba(157, 92, 255, 0.12);
}

.admin-wrap {
  max-width: 32rem;
  margin: 0 auto;
}

.admin-wrap--wide {
  max-width: min(100%, 52rem);
}

.admin-title {
  margin: 0 0 1.25rem;
  font-size: clamp(1.35rem, 4vw, 1.55rem);
  font-weight: 800;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.admin-toolbar__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-form .field {
  margin-bottom: 1rem;
}

.field__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field__label--inline {
  display: inline;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.field__input,
.field__textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  font-size: max(16px, 0.95rem);
}

.field__textarea {
  min-height: 11rem;
  resize: vertical;
  line-height: 1.45;
}

.field__textarea--sm {
  min-height: 6.5rem;
}

.field__checkbox {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--purple);
}

.field--inline {
  display: flex;
  align-items: center;
}

.field__error {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #f87171;
}

.admin-hint {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.admin-table {
  width: 100%;
  min-width: 17rem;
  border-collapse: collapse;
  font-size: clamp(0.82rem, 2.5vw, 0.9rem);
}

.admin-table th,
.admin-table td {
  padding: 0.65rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (min-width: 640px) {
  .admin-table th,
  .admin-table td {
    padding: 0.65rem 0.75rem;
  }
}

.admin-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-table__actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.inline-form {
  display: inline;
  margin: 0;
}

.link {
  background: none;
  border: none;
  padding: 0.35rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-size: 0.88rem;
  color: var(--purple-soft);
  cursor: pointer;
  text-decoration: underline;
}

.link--danger {
  color: #f87171;
}

.pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill--muted {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(160, 160, 160, 0.85);
}

.pill--ok {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

@media (max-width: 639px) {
  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3) {
    display: none;
  }
}
