:root{
  --navy:#23255E; --navy-deep:#171840; --cyan:#01CCFD;
  --ink:#14152B; --paper:#F5F7FB; --mist:#E7F7FE; --slate:#6E7191; --white:#FFFFFF;
  --danger:#D64545;
}

*{ box-sizing:border-box; margin:0; padding:0; }
body{
  font-family:'Inter', sans-serif; color:var(--ink); background:var(--paper); line-height:1.6;
}
h1,h2,h3{ font-family:'Fraunces', serif; font-weight:600; letter-spacing:-0.01em; }
.wrap{ max-width:1080px; margin:0 auto; padding:0 24px; }
.eyebrow{ font-family:'IBM Plex Mono', monospace; font-size:12px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:#0091B5; }

/* ---------- Header ---------- */
.blog-header{ background:var(--navy); color:var(--white); padding:16px 0; }
.blog-header .wrap{ display:flex; align-items:center; justify-content:space-between; gap:20px; }
.brand span{ font-family:'Fraunces',serif; font-weight:700; font-size:19px; color:var(--white); text-decoration:none; }
.blog-nav{ display:flex; gap:22px; }
.blog-nav a{ color:rgba(255,255,255,.75); text-decoration:none; font-size:14.5px; font-weight:500; }
.blog-nav a.active, .blog-nav a:hover{ color:var(--white); }
.auth-area{ display:flex; align-items:center; gap:10px; font-size:14px; }
.auth-area .user-chip{ display:flex; align-items:center; gap:8px; color:var(--white); }
.auth-area .role-badge{
  font-family:'IBM Plex Mono',monospace; font-size:10.5px; padding:2px 8px; border-radius:100px;
  background:rgba(1,204,253,.18); color:var(--cyan); text-transform:uppercase;
}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:6px; padding:10px 18px; border-radius:100px;
  font-size:14px; font-weight:600; border:1.5px solid transparent; cursor:pointer;
  transition:transform .15s ease, background .2s ease, border-color .2s ease; font-family:'Inter',sans-serif;
}
.btn:hover{ transform:translateY(-1px); }
.btn-cyan{ background:var(--cyan); color:var(--navy-deep); }
.btn-cyan:hover{ background:#20D6FF; }
.btn-ghost{ background:transparent; color:var(--white); border-color:rgba(255,255,255,.4); }
.btn-ghost-dark{ background:transparent; color:var(--ink); border-color:#D6D9EA; }
.btn-danger{ background:var(--danger); color:var(--white); }
.btn:disabled{ opacity:.4; cursor:not-allowed; transform:none; }

/* ---------- List view ---------- */
main{ padding:48px 0 96px; }
.list-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:36px; flex-wrap:wrap; }
.list-head h1{ font-size:clamp(26px,3.4vw,36px); margin-top:8px; }

.posts-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:22px; }
.post-card{
  background:var(--white); border:1px solid #E4E6F1; border-radius:16px; overflow:hidden;
  display:flex; flex-direction:column; cursor:pointer; transition:transform .18s ease, box-shadow .18s ease;
}
.post-card:hover{ transform:translateY(-3px); box-shadow:0 16px 30px -18px rgba(23,24,64,.25); }
.post-card .cover{ height:150px; background:linear-gradient(135deg,var(--navy),var(--cyan)); }
.post-card .cover img{ width:100%; height:100%; object-fit:cover; display:block; }
.post-card .body{ padding:20px; display:flex; flex-direction:column; gap:8px; flex:1; }
.post-card .status-tag{
  font-family:'IBM Plex Mono',monospace; font-size:10.5px; text-transform:uppercase; letter-spacing:.06em;
  color:var(--slate); width:fit-content;
}
.post-card .status-tag.draft{ color:#B5810A; }
.post-card h3{ font-size:18px; line-height:1.3; }
.post-card p{ color:var(--slate); font-size:14px; flex:1; }
.post-card .meta{ font-size:12.5px; color:var(--slate); margin-top:6px; }

.list-pager{ display:flex; align-items:center; justify-content:center; gap:18px; margin-top:44px; }
.blog-tools{display:flex;gap:12px;align-items:center;margin:-16px 0 28px;flex-wrap:wrap}.blog-tools input,.blog-tools select,.admin-form input,.admin-form select,.authorized-row select{font:inherit;padding:9px 11px;border:1.5px solid #D6D9EA;border-radius:9px;background:#fff}.search-label{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:600}.admin-page h1{margin:8px 0 20px}.admin-form{display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin:26px 0}.admin-form label{display:flex;flex-direction:column;gap:5px;font-size:13px;font-weight:600}.authorized-row{background:#fff;border:1px solid #E4E6F1;border-radius:12px;padding:14px;display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:10px}.authorized-row strong{min-width:250px;flex:1}
.list-pager span{ font-family:'IBM Plex Mono',monospace; font-size:12.5px; color:var(--slate); }
.list-pager .btn-ghost{ color:var(--ink); border-color:#D6D9EA; }

/* ---------- Post reader ---------- */
.back-link{ display:inline-block; margin-bottom:24px; color:var(--slate); text-decoration:none; font-size:14px; }
.back-link:hover{ color:var(--ink); }

#post-article .cover-image{ width:100%; max-height:380px; object-fit:cover; border-radius:16px; margin-bottom:28px; }
#post-article h1{ font-size:clamp(28px,4vw,42px); margin-bottom:12px; }
#post-article .meta{ color:var(--slate); font-size:14px; margin-bottom:28px; }
#post-article .content{ font-size:17px; line-height:1.75; white-space:pre-wrap; }

.post-owner-actions{ display:flex; gap:10px; margin:28px 0; }

/* ---------- Comments ---------- */
.comments-section{ margin-top:56px; border-top:1px solid #E4E6F1; padding-top:36px; }
.comments-section h2{ font-size:22px; margin-bottom:20px; }

.comment-form{ display:flex; flex-direction:column; gap:10px; margin-bottom:28px; max-width:640px; }
.comment-form textarea{
  font-family:'Inter',sans-serif; font-size:14.5px; padding:12px 14px; border:1.5px solid #D6D9EA;
  border-radius:12px; resize:vertical;
}
.comment-form .btn{ align-self:flex-end; }
.comment-locked{ color:var(--slate); font-size:14.5px; margin-bottom:28px; }
.comment-locked a{ color:#0091B5; font-weight:600; text-decoration:none; }

.comments-list{ list-style:none; display:flex; flex-direction:column; gap:18px; max-width:720px; }
.comment-item{ border:1px solid #E4E6F1; border-radius:14px; padding:16px 18px; background:var(--white); }
.comment-item .comment-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.comment-item .author{ font-weight:700; font-size:14px; }
.comment-item .date{ font-size:12px; color:var(--slate); }
.comment-item .content{ font-size:14.5px; color:var(--ink); }
.comment-item .delete-comment{ background:none; border:none; color:var(--danger); font-size:12.5px; cursor:pointer; margin-top:8px; }

/* ---------- Modals ---------- */
.modal-overlay{
  position:fixed; inset:0; background:rgba(20,21,43,.55); display:flex; align-items:center;
  justify-content:center; padding:20px; z-index:100;
}
.modal{
  background:var(--white); border-radius:18px; padding:32px; width:100%; max-width:560px;
  max-height:90vh; overflow-y:auto; position:relative;
}
.modal-narrow{ max-width:400px; }
.modal-close{
  position:absolute; top:16px; right:16px; background:none; border:none; font-size:22px;
  cursor:pointer; color:var(--slate); line-height:1;
}
.modal h2{ font-size:22px; margin-bottom:22px; }
#post-form, .auth-form{ display:flex; flex-direction:column; gap:16px; }
#post-form label, .auth-form label{ display:flex; flex-direction:column; gap:6px; font-size:13.5px; font-weight:600; color:var(--ink); }
#post-form input, #post-form textarea, .auth-form input{
  font-family:'Inter',sans-serif; font-size:14.5px; padding:10px 12px; border:1.5px solid #D6D9EA;
  border-radius:10px; font-weight:400;
}
.checkbox-row{ flex-direction:row !important; align-items:center; gap:8px !important; }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:6px; }
.form-error{ color:var(--danger); font-size:13.5px; }

.auth-tabs{ display:flex; gap:8px; margin-bottom:22px; }
.auth-tab{
  flex:1; padding:10px; border-radius:10px; border:1.5px solid #D6D9EA; background:var(--white);
  font-weight:600; font-size:14px; cursor:pointer; color:var(--slate);
}
.auth-tab.active{ background:var(--navy); color:var(--white); border-color:var(--navy); }
.password-field{display:flex;align-items:stretch;gap:7px}.password-field input{min-width:0;flex:1}.password-toggle{border:1.5px solid #D6D9EA;background:#fff;border-radius:10px;padding:0 10px;cursor:pointer;font:600 12px 'Inter',sans-serif;color:var(--navy)}.form-success{color:#087d35;font-size:13.5px}

/* ---------- Responsive ---------- */
@media (max-width: 900px){
  .posts-grid{ grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 640px){
  .posts-grid{ grid-template-columns:1fr; }
  .blog-nav{ display:none; }
  .list-head{ flex-direction:column; align-items:flex-start; }
}

/* Encabezado blanco y logo enlazado al inicio. */
.blog-header { background: var(--white); color: var(--ink); padding: 7px 0; border-bottom: 1px solid #D9DFEA; }
.blog-header .brand { display: block; line-height: 0; }
.blog-header .brand img { display: block; width: 210px; height: auto; }
.blog-header .blog-nav a { color: var(--navy); font-weight: 600; }
.blog-header .blog-nav a.active, .blog-header .blog-nav a:hover { color: #008CB2; }
.blog-header .auth-area .user-chip { color: var(--navy); }
/* Honor the hidden state of authentication, post and comment controls. */
[hidden] { display: none !important; }
