/* BitsLoop — tema terminal minimalista */
:root {
  --bg: #050805;
  --bg-2: #0b120c;
  --bg-3: #111c13;
  --line: #1f3524;
  --line-2: #2c4d33;
  --fg: #c9f5d0;
  --dim: #7fa688;
  --green: #39ff6a;
  --green-2: #22c55e;
  --amber: #ffcc4d;
  --red: #ff6b6b;
  --radius: 6px;
  --font: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 72rem;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.6 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-wrap: anywhere;
}
main { flex: 1; padding-block: 1.5rem 3rem; }
img, video, iframe { max-width: 100%; }
a { color: var(--green); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--green); color: var(--bg); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
p { margin: 0 0 1em; }
code { background: var(--bg-3); border: 1px solid var(--line); border-radius: 4px; padding: .05em .35em; font-size: .92em; }
pre { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; }
pre code { background: none; border: 0; padding: 0; }
blockquote { margin: 0 0 1em; padding-left: 1rem; border-left: 3px solid var(--line-2); color: var(--dim); }
hr { border: 0; border-top: 1px dashed var(--line-2); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 640px) { .wrap { padding-inline: 24px; } }
.narrow { max-width: 30rem; margin-inline: auto; }
.dim { color: var(--dim); }
.mono-sm { font-size: .85rem; }
.hint { color: var(--dim); font-size: .8rem; font-weight: 400; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--green); color: var(--bg); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* Cabecera */
.top { border-bottom: 1px solid var(--line); background: rgba(5, 8, 5, .92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 56px; flex-wrap: wrap; }
.brand { color: var(--fg); text-decoration: none; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.prompt { color: var(--green); }
.cursor { color: var(--green); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }
.nav { display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; }
.nav > a { color: var(--dim); text-decoration: none; padding: .55rem .6rem; border-radius: var(--radius); min-height: 44px; display: inline-flex; align-items: center; }
.nav > a:hover, .nav > a[aria-current="page"] { color: var(--green); background: var(--bg-3); }
.nav > a[aria-current="page"]::before { content: ">"; margin-right: .25rem; }
.nav > a.btn { color: var(--bg); background: var(--green); margin-left: .25rem; }
@media (max-width: 560px) {
  .top-in { padding-block: .35rem; }
  .nav { width: 100%; justify-content: space-between; }
  .nav > a { padding: .5rem .4rem; font-size: .92rem; }
  .hide-sm { display: none; }
}

/* Menú usuario */
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .5rem; min-height: 44px; border-radius: var(--radius); color: var(--fg); }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--bg-3); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); min-width: 12rem; padding: .35rem; display: grid; z-index: 6; }
.menu-pop a, .menu-pop .linkbtn { display: block; padding: .6rem .75rem; text-decoration: none; color: var(--fg); border-radius: 4px; width: 100%; text-align: left; }
.menu-pop a:hover, .menu-pop .linkbtn:hover { background: var(--bg-3); color: var(--green); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 700; color: var(--bg); background: var(--green); border: 1px solid var(--green); border-radius: var(--radius); padding: .6rem 1.1rem; min-height: 44px; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--green-2); border-color: var(--green-2); }
.btn-ghost { background: transparent; color: var(--green); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--bg-3); border-color: var(--green); }
.btn-sm { padding: .35rem .8rem; min-height: 36px; font-size: .9rem; }
.btn-block { width: 100%; }
.linkbtn { font: inherit; background: none; border: 0; color: var(--green); padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.danger, .linkbtn.danger { color: var(--red); }
.inline { display: inline; }

/* Mensajes */
.flash { border: 1px solid var(--line-2); border-left-width: 4px; border-radius: var(--radius); padding: .65rem 1rem; background: var(--bg-2); }
.flash p { margin: 0; }
.flash-ok { border-left-color: var(--green); }
.flash-info { border-left-color: var(--amber); }
.flash-err { border-left-color: var(--red); color: #ffd0d0; }
.empty { color: var(--dim); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 1.25rem; }

/* Tipografía de secciones */
.h-page { font-size: clamp(1.5rem, 4vw, 2rem); color: var(--green); }
.h-sec { font-size: 1.05rem; color: var(--fg); margin-top: 2.25rem; }
.h-sec > span { color: var(--green); }
.lead { font-size: 1.1rem; color: var(--fg); max-width: 40rem; }
.block { margin-top: 1rem; }
.block-sm { margin-top: .5rem; }
.prose-w { max-width: 46rem; color: var(--fg); }

/* Portada */
.hero { padding-block: clamp(1.5rem, 7vw, 4rem) 1rem; }
.hero-title { font-size: clamp(2.6rem, 11vw, 5.5rem); color: var(--green); letter-spacing: -.02em; margin: 0 0 .35rem; text-shadow: 0 0 24px rgba(57, 255, 106, .25); }
.social-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.social-card { display: flex; flex-direction: column; gap: .35rem; height: 100%; padding: 1.25rem; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg-2); color: var(--fg); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.social-card:hover, .social-card:focus-visible { border-color: var(--green); transform: translateY(-2px); box-shadow: 0 0 0 1px var(--green), 0 8px 30px rgba(57, 255, 106, .12); }
.social-card.featured { background: linear-gradient(160deg, #0f2414, var(--bg-2) 70%); border-color: var(--green-2); }
.sc-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.sc-name { color: var(--green); font-weight: 700; font-size: 1.15rem; }
.sc-handle { font-size: 1.35rem; font-weight: 700; color: var(--fg); }
.sc-desc { color: var(--dim); font-size: .95rem; flex: 1; }
.sc-go { color: var(--green); font-size: .9rem; margin-top: .5rem; }
@media (min-width: 900px) {
  .social-grid { grid-template-columns: 1.25fr 1fr 1fr; }
  .social-card.featured .sc-handle { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { .social-card { transition: none; } .social-card:hover { transform: none; } }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--bg); background: var(--green); border-radius: 3px; padding: .05rem .4rem; vertical-align: middle; }
.badge-warn { background: var(--amber); }
.role { color: var(--dim); font-size: .8rem; }

.cards3 { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; background: var(--bg-2); }
.card h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.card p:last-child { margin-bottom: 0; }

/* Blog */
.filters { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1.25rem; }
.filters a { color: var(--dim); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .85rem; min-height: 36px; display: inline-flex; align-items: center; }
.filters a:hover { color: var(--green); border-color: var(--line-2); }
.filters a[aria-current="page"] { color: var(--bg); background: var(--green); border-color: var(--green); }
.post-list { list-style: none; padding: 0; margin: 0; }
.post-row { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: baseline; padding: .8rem .25rem; border-bottom: 1px dashed var(--line); text-decoration: none; color: var(--fg); }
.post-row:hover .pr-title { color: var(--green); text-decoration: underline; }
@media (max-width: 560px) { .post-row { grid-template-columns: 1fr; gap: .15rem; } }
.post-item { padding-block: 1rem; border-bottom: 1px dashed var(--line); }
.pi-title { font-size: 1.2rem; margin: .1rem 0 .35rem; }
.pi-title a { color: var(--fg); text-decoration: none; }
.pi-title a:hover { color: var(--green); text-decoration: underline; }
.meta { color: var(--dim); font-size: .85rem; margin-bottom: .25rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.kind { color: var(--green); text-decoration: none; font-size: .85rem; }
.kind-opinion { color: #8be9fd; }
.kind-pregunta { color: var(--amber); }
.kind-video { color: #ff9ff3; }
.pager { display: flex; gap: .75rem; justify-content: space-between; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }

.article { max-width: 46rem; }
.prose { max-width: 46rem; }
.prose h2, .prose h3, .prose h4 { color: var(--green); margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: .3rem; }
.prose li::marker { color: var(--green); }
.media { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #000; margin-bottom: 1.25rem; }
.embed { position: relative; aspect-ratio: 16 / 9; margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Comentarios */
.comments { max-width: 46rem; margin-top: 2rem; border-top: 1px solid var(--line); }
.comment-list { list-style: none; padding: 0; margin: 1.25rem 0 0; }
.comment { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; padding-block: .9rem; border-bottom: 1px dashed var(--line); }
.c-author { display: inline-flex; gap: .5rem; align-items: center; text-decoration: none; color: var(--fg); }
.c-body, .comment form { grid-column: 1 / -1; }
.c-body p:last-child { margin-bottom: 0; }

/* Formularios */
.form { display: grid; gap: .35rem; margin-bottom: 1.5rem; }
.form-wide { max-width: 52rem; }
label { font-size: .9rem; color: var(--fg); margin-top: .5rem; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--fg); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: .65rem .8rem; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 2px rgba(57, 255, 106, .25); }
input::placeholder, textarea::placeholder { color: #557560; }
textarea { resize: vertical; }
textarea.mono { font-size: .92rem; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--green); width: 1.1rem; height: 1.1rem; }
.check { display: flex; gap: .55rem; align-items: flex-start; font-size: .9rem; color: var(--dim); }
.check input { margin-top: .2rem; flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: .75rem 0; display: grid; gap: .35rem; min-width: 0; }
legend { color: var(--green); padding-inline: .4rem; font-weight: 700; }
.grid2 { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .75rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding-block: .75rem; border-top: 1px solid var(--line); }
.file-btn { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: .35rem .8rem; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--green); cursor: pointer; margin: 0; font-size: .9rem; }
.file-btn:hover, .file-btn:focus-within { border-color: var(--green); }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-btn.has-file span::after { content: " ✓"; }
.file-prev { max-height: 220px; border-radius: var(--radius); border: 1px solid var(--line); margin-top: .5rem; }
.avatar-edit { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.search { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search input { flex: 1; }

/* Composer */
.composer { border: 1px solid var(--line-2); border-radius: var(--radius); padding: .75rem; background: var(--bg-2); margin-bottom: 1.25rem; }
.composer textarea { border: 0; background: transparent; padding: .25rem; min-height: 4.5rem; box-shadow: none !important; }
.composer-bar { display: flex; align-items: center; gap: .75rem; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .25rem; flex-wrap: wrap; }
.composer-bar .file-btn { margin-right: auto; }
.composer .hint { margin: .5rem 0 0; }

/* Avatares */
.av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-2); flex: none; background: var(--bg-3); }
.av-xs { width: 28px; height: 28px; }
.av-sm { width: 34px; height: 34px; }
.av-lg { width: 80px; height: 80px; }
.av-xl { width: 112px; height: 112px; }
.av-ph { display: inline-grid; place-items: center; color: var(--green); font-weight: 700; }
.av-xs.av-ph { font-size: .8rem; }
.av-xl.av-ph { font-size: 2.5rem; }

/* Forum */
.forum-layout { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .forum-layout { grid-template-columns: minmax(0, 1fr) 16rem; } .forum-side { position: sticky; top: 72px; align-self: start; } }
.forum-main { max-width: 44rem; width: 100%; }
.forum-side .h-sec { margin-top: 0; }
.feed { border-top: 1px solid var(--line); }
.fpost { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: .75rem; padding: 1rem .25rem; border-bottom: 1px solid var(--line); }
.fpost:target { background: var(--bg-2); box-shadow: inset 3px 0 0 var(--green); }
.fpost-big .fp-body { font-size: 1.1rem; }
.fp-head { display: flex; flex-wrap: wrap; gap: .15rem .5rem; align-items: baseline; font-size: .92rem; }
.fp-name { color: var(--fg); text-decoration: none; }
.fp-name:hover { text-decoration: underline; }
.fp-time { margin-left: auto; text-decoration: none; font-size: .82rem; }
.fp-body { margin-top: .25rem; }
.fp-body p:last-child { margin-bottom: .25rem; }
.fp-img img { display: block; margin-top: .5rem; border-radius: var(--radius); border: 1px solid var(--line); max-height: 480px; width: auto; }
.fp-actions { display: flex; gap: 1rem; margin-top: .5rem; align-items: center; flex-wrap: wrap; }
.act { font: inherit; font-size: .9rem; background: none; border: 0; color: var(--dim); cursor: pointer; padding: .35rem .25rem; min-height: 36px; min-width: 36px; display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; border-radius: 4px; }
.act:hover { color: var(--green); background: var(--bg-3); }
.act.on { color: var(--green); }
.act.danger { color: var(--dim); }
.act.danger:hover { color: var(--red); }
.replies .fpost { padding-left: .75rem; }
.tag, .mention { text-decoration: none; }
.tag:hover, .mention:hover { text-decoration: underline; }
.tag-cloud { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-cloud .tag { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; }

/* Perfil */
.profile { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.profile-info { flex: 1; min-width: 14rem; }
.profile .h-page { margin-bottom: .1rem; }
.bio { max-width: 36rem; }
.stats { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--dim); }
.stats strong { color: var(--fg); }

/* CV */
.cv { max-width: 50rem; }
.cv-head { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.cv-head .h-page { font-size: clamp(1.7rem, 5vw, 2.4rem); margin-bottom: .2rem; }
.cv-contact { display: flex; gap: .4rem 1rem; flex-wrap: wrap; margin: 0; }
.cv-sec { margin-top: .5rem; }
.timeline { list-style: none; padding: 0 0 0 1rem; margin: 0; border-left: 1px solid var(--line-2); }
.timeline li { position: relative; padding: 0 0 1.1rem .75rem; }
.timeline li::before { content: ""; position: absolute; left: calc(-1rem - 5px); top: .5rem; width: 9px; height: 9px; background: var(--green); border-radius: 50%; }
.tl-head { display: flex; justify-content: space-between; gap: .25rem 1rem; flex-wrap: wrap; align-items: baseline; }
.tl-head h3 { font-size: 1rem; margin: 0; }
.tl-period { color: var(--dim); }
.timeline p { margin: .25rem 0 0; color: var(--fg); }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li { border: 1px solid var(--line-2); border-radius: 999px; padding: .2rem .75rem; font-size: .9rem; }

/* Admin */
.stat-grid { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
.stat-grid .card { display: grid; }
.stat-n { font-size: 1.8rem; font-weight: 700; color: var(--green); }
.two-col { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.mod-list, .admin-list { list-style: none; padding: 0; margin: 0; }
.mod-list li { border-bottom: 1px dashed var(--line); padding-block: .6rem; }
.mod-list p { margin: 0 0 .25rem; }
.admin-list li { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; border-bottom: 1px dashed var(--line); padding-block: .75rem; }
.admin-list p { margin: 0; }
.row-actions { display: flex; gap: 1rem; align-items: center; }
.rep-item { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: .75rem; margin-bottom: .75rem; display: grid; gap: .3rem; }
.rep-item .rep-tools { display: flex; justify-content: flex-end; gap: 1rem; }

/* Pie */
.foot { border-top: 1px solid var(--line); color: var(--dim); font-size: .85rem; }
.foot-in { display: flex; justify-content: space-between; gap: .5rem 1.5rem; flex-wrap: wrap; padding-block: 1.25rem; }
.foot p { margin: 0; }
.foot-links { display: flex; gap: 1rem; }
.foot a { color: var(--dim); }
.foot a:hover { color: var(--green); }
.err { color: var(--red); }

.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); background: var(--green); color: var(--bg); padding: .5rem 1rem; border-radius: var(--radius); font-weight: 700; z-index: 20; }

/* Impresión del CV */
@media print {
  :root { --bg: #fff; --bg-2: #fff; --bg-3: #fff; --fg: #111; --dim: #444; --green: #0a6b2a; --line: #ccc; --line-2: #bbb; }
  .top, .foot, .no-print, .skip, .flash { display: none !important; }
  body { font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
  .h-page, .hero-title { text-shadow: none; }
}

/* Estados de carga y mensajes de formularios */
.loading { padding-block: 2rem; }
.form-msg:empty { display: none; }
.cv-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
button:disabled { opacity: .6; cursor: progress; }
