/* ============ Reset & tokens ============ */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --bg-soft: #111c33;
  --surface: #17223b;
  --surface-2: #1e2b4a;
  --border: #24325a;
  --text: #e7ecf5;
  --text-muted: #94a3b8;
  --primary: #4f8cff;
  --primary-hover: #6ea1ff;
  --accent: #22d3ee;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(79, 140, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

/* ============ Header ============ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(15, 23, 42, 0.75);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.25rem;
}
.logo { font-weight: 700; font-size: 1.15rem; color: var(--text); letter-spacing: .3px; }
.logo:hover { color: var(--accent); }
.nav { display: flex; gap: 1.25rem; }
.nav a { color: var(--text-muted); font-weight: 500; }
.nav a:hover { color: var(--text); }

/* ============ Hero ============ */
.hero { padding: 3rem 0 1.5rem; }
.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.5px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.muted { color: var(--text-muted); }

/* ============ Banner offline ============ */
.banner {
  margin: 1rem 0;
  padding: .8rem 1rem;
  background: linear-gradient(90deg, rgba(79,140,255,.15), rgba(34,211,238,.1));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .95rem;
}

/* ============ Grid de posts ============ */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem 0 3rem;
}
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.card img { width: 100%; height: 180px; object-fit: cover; display: block; }
.card-content { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .35rem; }
.card-content h3 { font-size: 1.1rem; line-height: 1.35; }
.card-content h3 a { color: var(--text); }
.card-content h3 a:hover { color: var(--primary); }
.card-content small { font-size: .8rem; }
.card-content p { font-size: .92rem; color: var(--text-muted); }
.read-more {
  margin-top: .6rem; font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; gap: .3rem;
}

/* ============ Post individual ============ */
.post-container { padding: 2rem 0 3rem; }
.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2.5rem);
  box-shadow: var(--shadow-sm);
}
.post h1 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); line-height: 1.25; margin-bottom: .5rem; }
.post-meta { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.25rem; }
.post-cover {
  width: 100%; max-height: 420px; object-fit: cover;
  border-radius: var(--radius-sm); margin: .5rem 0 1.25rem;
}
.post-body { font-size: 1.02rem; }
.post-body p { margin: 0 0 1rem; }
.post-body h2, .post-body h3 { margin: 1.4rem 0 .6rem; }
.post-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.post-body pre {
  background: #0b1220; padding: 1rem; border-radius: var(--radius-sm);
  overflow-x: auto; border: 1px solid var(--border);
}
.post-body code { background: #0b1220; padding: .15rem .35rem; border-radius: 4px; font-size: .92em; }
.back-link { display: inline-block; margin-top: 1.5rem; font-weight: 600; }

/* ============ Formularios admin ============ */
.admin-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  margin: 2.5rem auto;
  max-width: 720px;
  box-shadow: var(--shadow);
}
.admin-container h1 { font-size: 1.5rem; margin-bottom: .35rem; }
.form { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-weight: 600; font-size: .92rem; color: var(--text); }
input[type="text"],
input[type="password"],
input[type="url"],
textarea {
  width: 100%; padding: .75rem .9rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .2);
}
textarea { resize: vertical; min-height: 90px; }

.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  padding: .8rem 1.4rem;
  border: none; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .98rem; cursor: pointer;
  transition: transform .15s ease, filter .2s;
  text-align: center;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.status {
  margin-top: 1rem; padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  border: 1px solid var(--border);
}
.status.info    { background: rgba(79,140,255,.12); border-color: rgba(79,140,255,.4); }
.status.success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.45); }
.status.error   { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.5); }

/* ============ Offline screen ============ */
.offline-screen { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.offline-card {
  text-align: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2.5rem 2rem; max-width: 420px; box-shadow: var(--shadow);
}
.offline-icon { font-size: 3rem; margin-bottom: .5rem; }

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .88rem;
}

/* ============ Responsive ============ */
@media (max-width: 600px) {
  .hero { padding: 2rem 0 1rem; }
  .posts-grid { grid-template-columns: 1fr; gap: 1.1rem; }
  .card img { height: 160px; }
  .header-inner { padding: .8rem 1rem; }
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-2); }
