:root {
  color-scheme: dark;
  --bg: #151719;
  --ink: #f2efe8;
  --muted: #a8b0b6;
  --card: #22262a;
  --line: #4a5560;
  --accent: #f05223;
  --accent-soft: #3f2218;
  --accent-deep: #c93d14;
  --on-accent: #f2efe8;
  --glow: #2a1c18;
  --media: #1a1d20;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --radius-control: 8px;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23f05223' d='M1.2 1.2 6 6l4.8-4.8'/%3E%3C/svg%3E");
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3efe6;
  --ink: #161513;
  --muted: #5d5850;
  --card: #fffcf7;
  --line: #c9c2b4;
  --accent: #c44b1b;
  --accent-soft: #f6d9cc;
  --accent-deep: #a63d16;
  --on-accent: #fff;
  --glow: #f7d7c4;
  --media: #e8e0d4;
  --shadow: 0 10px 30px rgba(40, 28, 14, 0.08);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23c44b1b' d='M1.2 1.2 6 6l4.8-4.8'/%3E%3C/svg%3E");
}

@font-face {
  font-family: "Causten";
  src: url("fonts/causten-medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
}

.back-to-top {
  display: none;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, var(--glow) 0%, transparent 50%),
    var(--bg);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero, main {
  width: min(1100px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom-color: transparent;
  backdrop-filter: saturate(1.15) blur(16px);
  -webkit-backdrop-filter: saturate(1.15) blur(16px);
}

.site-header-inner {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.site-header-logo {
  justify-self: start;
  display: flex;
  align-items: center;
}

.site-header-title {
  justify-self: center;
  color: inherit;
  text-decoration: none;
  overflow: visible;
}

.site-header-title .lettering {
  display: block;
  height: 54px;
  width: auto;
}

.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;
}

.site-header-tools {
  justify-self: end;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 48px;
}

.header-search {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-radius: var(--radius-control);
}

.header-search.is-open:focus-within {
  box-shadow: 0 0 0 2px var(--accent);
}

.header-search-input {
  width: 0;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-control) 0 0 var(--radius-control);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition: width 0.18s ease, opacity 0.18s ease, padding 0.18s ease, border-color 0.18s ease;
}

.header-search.is-open .header-search-input {
  width: min(220px, 42vw);
  padding: 0 10px 0 14px;
  border-color: var(--line);
  border-right: 0;
  opacity: 1;
  pointer-events: auto;
}

.header-search-input:focus,
.header-search-input:focus-visible,
.header-search-btn:focus,
.header-search-btn:focus-visible {
  outline: none;
}

.header-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.header-search.is-open .header-search-btn {
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  border-left: 0;
}

.header-search-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.header-search-btn:hover,
.header-search-btn:focus-visible {
  color: var(--accent);
}

.header-logout {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.header-logout:hover,
.header-logout:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.theme-toggle .icon-moon {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.logo,
.lettering {
  filter: invert(1) brightness(1.08);
}

html[data-theme="light"] .logo,
html[data-theme="light"] .lettering {
  filter: none;
}

.hero {
  padding: 28px 0 20px;
}

.logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: block;
}

.eyebrow {
  margin: 0 0 4px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.updated {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.site-nav {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-control);
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.site-nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.menciones {
  margin: 0;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.filters {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 8px 0 24px;
}

.filters-split {
  justify-content: space-between;
}

.filters-end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.crear-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px 22px;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.crear-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.crear-acciones button[type="submit"] {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-control);
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.crear-extra {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.crear-extra textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  font-weight: 500;
  resize: vertical;
  min-height: 120px;
}

.crear-extra textarea:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
  border-color: var(--accent);
}

.filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.filter select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card) var(--select-chevron) no-repeat right 12px center;
  color: var(--ink);
  border-radius: var(--radius-control);
  padding: 8px 36px 8px 14px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  max-width: min(100%, 360px);
}

.filter select:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
  border-color: var(--accent);
}

.status {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding-bottom: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 220px;
}

.card-media {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--media);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px 18px;
  flex: 1;
}

.pager {
  display: flex;
  justify-content: center;
  padding: 8px 0 48px;
}

.pager button {
  border: 1px solid var(--accent);
  background: var(--card);
  color: var(--accent);
  border-radius: var(--radius-control);
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pager button:hover,
.pager button:focus-visible {
  background: var(--accent);
  color: var(--on-accent);
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.fuente {
  font-weight: 700;
  color: var(--accent);
}

.card h2 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.resumen {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  flex: 1;
}

.leer {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  width: fit-content;
}

.leer:hover,
.leer:focus-visible {
  text-decoration: underline;
}

footer {
  margin-top: 24px;
  background: var(--accent);
  color: var(--on-accent);
}

.footer-inner {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px 20px;
}

.footer-inner p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  opacity: 0.92;
}

.footer-legal {
  max-width: 64ch;
  text-align: center;
}

.footer-inner .credit {
  justify-self: end;
  text-align: right;
  font-family: "Causten", "Segoe UI", sans-serif;
  font-weight: 500;
  white-space: nowrap;
}

.footer-key {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--on-accent);
  border-radius: var(--radius-control);
  color: var(--on-accent);
  background: transparent;
  text-decoration: none;
}

.footer-key svg {
  width: 22px;
  height: 22px;
  display: block;
}

.footer-inner a.footer-key {
  text-decoration: none;
  opacity: 1;
}

.footer-inner a.footer-key:hover,
.footer-inner a.footer-key:focus-visible,
.footer-inner a.footer-key[aria-current="page"] {
  background: var(--on-accent);
  color: var(--accent);
  opacity: 1;
}

.admin-login {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 0 64px;
  min-height: min(60vh, 520px);
}

.admin-login .eyebrow {
  margin: 0 0 22px;
}

.admin-login .filter {
  flex-direction: column;
  align-items: center;
}

.admin-login .filter input {
  min-width: 240px;
}

.gate {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  gap: 16px;
  padding: 0;
}

.gate-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.gate-back {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-control);
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.gate-back:hover,
.gate-back:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.gate .filter input {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-control);
  padding: 8px 14px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  min-width: 180px;
}

.gate .filter input:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
  border-color: var(--accent);
}

.pill,
.gate button {
  border: 1px solid var(--accent);
  background: var(--card);
  color: var(--accent);
  border-radius: var(--radius-control);
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pill:disabled {
  opacity: 0.6;
  cursor: wait;
}

.pill:hover,
.pill:focus-visible,
.gate button:hover,
.gate button:focus-visible {
  background: var(--accent);
  color: var(--on-accent);
}

.pill-current {
  background: var(--accent);
  color: var(--on-accent);
  cursor: default;
}

.pill-current:hover,
.pill-current:focus-visible {
  background: var(--accent);
  color: var(--on-accent);
}

.guion-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px 32px;
  margin-bottom: 48px;
}

.guion-card h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin: 0 0 8px;
}

.guion-card h2 {
  margin: 28px 0 10px;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.guion-card h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
  color: var(--accent);
}

.guion-card p,
.guion-card li {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
}

.guion-card ul {
  margin: 0 0 12px;
  padding-left: 1.2em;
}

.guion-card a {
  color: var(--accent);
}

.footer-inner a {
  color: var(--on-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-inner a:hover,
.footer-inner a:focus-visible {
  opacity: 0.85;
}

@media (max-width: 860px) {
  .header-logout {
    font-size: 0;
  }

  .header-logout::after {
    content: "Salir";
    font-size: 0.82rem;
  }
}

@media (max-width: 640px) {
  .hero {
    padding-top: 20px;
  }

  .site-header-inner {
    padding: 10px 0;
    gap: 8px;
  }

  .logo {
    width: 40px;
    height: 40px;
  }

  .site-header-title .lettering {
    height: 42px;
    transition: height 0.18s ease;
  }

  .site-header.is-search-open .site-header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .site-header.is-search-open .site-header-title {
    justify-self: start;
  }

  .site-header.is-search-open .lettering {
    height: 34px;
  }

  .site-header-tools {
    min-width: 40px;
  }

  .header-search-btn,
  .header-search-input,
  .theme-toggle {
    height: 36px;
  }

  .header-search-btn,
  .theme-toggle {
    width: 36px;
  }

  .header-search.is-open .header-search-input {
    width: min(150px, 38vw);
    padding: 0 8px 0 12px;
  }

  .header-logout {
    height: 36px;
    padding: 0 10px;
    font-size: 0;
  }

  .header-logout::after {
    content: "Salir";
    font-size: 0.78rem;
  }

  .footer-inner {
    grid-template-columns: auto 1fr auto;
    padding-right: 56px;
  }

  .footer-legal {
    max-width: none;
  }

  .footer-inner .credit {
    white-space: normal;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .filter {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .admin-login {
    min-height: min(56vh, 480px);
    padding: 28px 0 40px;
  }

  .admin-login .filter {
    width: auto;
    align-items: center;
  }

  .admin-login .filter input {
    width: min(260px, calc(100vw - 48px));
    min-width: 0;
  }

  .filter select {
    width: 100%;
    max-width: none;
  }

  .card {
    min-height: 0;
  }

  html {
    scroll-behavior: smooth;
  }

  .back-to-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 16px;
    bottom: 20px;
    z-index: 30;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-control);
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: var(--shadow);
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .back-to-top svg {
    width: 22px;
    height: 22px;
  }

  .back-to-top:hover,
  .back-to-top:focus-visible {
    background: var(--accent-deep);
  }
}
