/* ============================================================
   Retxus — stylesheet (elegant dark theme)
   NOTE: code generated 100% with AI (author is not a web dev);
   the site content is original. Design is hand-editable.
   Order: tokens → base → navigation → hero → cards → post → TOC
   → footer → search → responsive
   ============================================================ */

:root {
  --bg: #0a0c11;
  --surface: #121623;
  --border: rgba(146, 161, 196, .14);
  --border-2: rgba(146, 161, 196, .28);
  --text: #e5e9f2;
  --text-2: #bcc4d8;
  --muted: #8b95ad;
  --accent: #82a6ff;
  --grad: linear-gradient(115deg, #6d9aff 10%, #b28cff 90%);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 62px;
  --font-sans: "Inter", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  --shadow: 0 14px 44px rgba(2, 5, 18, .55);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-color: #2a3350 var(--bg);
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 85% -8%, rgba(109, 120, 255, .075), transparent 60%),
    radial-gradient(900px 500px at 8% -10%, rgba(178, 140, 255, .06), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.72 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* max-width shrinks; height:auto honors the w/h attrs' aspect-ratio (NO CLS) */
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #a9c0ff; }

::selection { background: rgba(130, 166, 255, .32); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #262e48; border-radius: 8px; border: 2.5px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.container {
  width: min(1120px, calc(100% - 44px));
  margin-inline: auto;
}
.container.narrow { width: min(860px, calc(100% - 44px)); }

.skip-link {
  position: absolute; top: -48px; left: 14px;
  background: var(--accent); color: #0b1020; font-weight: 600;
  padding: 9px 16px; border-radius: 10px; z-index: 60; transition: top .15s;
}
.skip-link:focus-visible { top: 10px; }

/* ---------- navigation ---------- */

.site-nav {
  position: sticky; top: 0; z-index: 40;
  height: var(--nav-h);
  background: rgba(10, 12, 17, .78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.nav-inner { display: flex; align-items: center; gap: 26px; height: 100%; }

.brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.06rem; letter-spacing: .2px;
  color: var(--text); display: flex; align-items: baseline;
}
.brand .dot { color: var(--accent); }
.brand-note { color: var(--muted); font-size: .82rem; font-family: var(--font-mono); }

.nav-links {
  display: flex; gap: 4px; margin-left: auto;
  font-size: .92rem;
}
.nav-links a {
  color: var(--text-2); padding: 7px 13px; border-radius: 9px;
  transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); background: rgba(146, 161, 196, .09); }
.nav-links a.on { color: var(--text); background: rgba(130, 166, 255, .13); }

.nav-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 35px; height: 35px; border-radius: 9px;
  color: var(--muted); background: transparent; border: 0; cursor: pointer;
  transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: rgba(146, 161, 196, .1); }
.icon-btn svg { display: block; }

.burger { display: none; }

.mobile-menu {
  display: none;
  border-top: 1px solid var(--border);
  background: rgba(10, 12, 17, .97);
  padding: 14px 22px 20px;
}
.mobile-menu nav { display: grid; }
.mobile-menu a {
  color: var(--text-2); padding: 11px 4px;
  border-bottom: 1px solid var(--border); font-size: 1rem;
}
.mobile-menu a:hover { color: var(--text); }
.menu-socials { display: flex; gap: 14px; padding-top: 16px; }
.menu-socials a { color: var(--muted); border: 0; padding: 2px; }
.menu-socials a:hover { color: var(--text); }

/* ---------- portada (hero) ---------- */

.hero {
  padding: 66px 0 10px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}

.avatar {
  display: inline-flex; padding: 3px; border-radius: 38px;
  background: var(--grad);
  box-shadow: 0 8px 30px rgba(130, 140, 255, .22);
}
.avatar img {
  display: block; width: 130px; height: 130px;
  border-radius: 35px; border: 4px solid var(--bg); object-fit: cover;
}

.hero h1 {
  margin: 20px 0 4px;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 6vw, 3.1rem);
  line-height: 1.05; letter-spacing: .3px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero .role {
  margin: 0; color: var(--text); font-weight: 500; font-size: 1.02rem;
}
.hero .lede {
  margin: 12px auto 0; max-width: 640px;
  color: var(--muted); font-size: .98rem;
}

.socials { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 20px; }

/* chips shared by everything */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(130, 166, 255, .10);
  border: 1px solid rgba(130, 166, 255, .16);
  color: #9db6f2; border-radius: 99px;
  padding: 3.5px 11px;
  font-size: .74rem; font-weight: 500; letter-spacing: .1px;
  line-height: 1.65;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { background: rgba(130, 166, 255, .2); color: #baccff; border-color: rgba(130, 166, 255, .3); }
.chip-social { font-size: .89rem; padding: 6.5px 15px; gap: 7px; }
.chip-social svg { opacity: .85; width: 15px; height: 15px; }
.chip-more { color: var(--muted); background: rgba(146, 161, 196, .08); border-color: transparent; }

/* ---------- secciones y tarjetas ---------- */

.section-posts { padding: 44px 0 30px; }

.section-title {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: 1.32rem; font-weight: 600; letter-spacing: .2px;
}
.section-title::before {
  content: ""; width: 22px; height: 3px; border-radius: 2px;
  background: var(--grad);
}
.badge {
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
  color: var(--muted); background: rgba(146, 161, 196, .1);
  border-radius: 7px; padding: 2px 8px;
}

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

.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(130, 166, 255, .38);
  box-shadow: 0 14px 40px rgba(80, 105, 235, .13);
}
.card-cover { aspect-ratio: 16 / 8.4; overflow: hidden; border-bottom: 1px solid var(--border); }
.card-cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease;
}
.card:hover .card-cover img { transform: scale(1.04); }
/* cards without a cover get extra breathing room on top */
.card.card-nocover { padding-top: 16px; }

.card-body { padding: 15px 17px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.card-meta {
  display: flex; gap: 8px; align-items: baseline;
  color: var(--muted); font-size: .78rem; font-family: var(--font-mono);
}
.card-meta .sep { opacity: .55; }

.card h3 {
  margin: 0; font-size: 1.06rem; line-height: 1.34; font-weight: 600;
  color: var(--text);
  transition: color .15s;
}
.card:hover h3 { color: #a9c0ff; }

.card p {
  margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.card-tags .chip { font-size: .68rem; padding: 2.5px 9px; }

.empty { color: var(--muted); font-style: italic; }

/* ---------- inner pages (headings) ---------- */

.page-title {
  font-family: var(--font-display);
  font-size: 1.9rem; margin: 46px 0 4px;
}
.page-sub { color: var(--muted); margin: 0 0 30px; }

.page-hero {
  display: flex; align-items: center; gap: 18px; margin-bottom: 8px;
}
.page-hero .avatar { flex: 0 0 auto; }
.page-hero .avatar img { width: 140px; height: 140px; }

/* archive / tags — filas */

.archive-year h2 {
  font-family: var(--font-display);
  font-size: 1.06rem; color: var(--muted);
  margin: 34px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.post-rows { display: grid; gap: 4px; }

.row {
  display: flex; align-items: baseline; gap: 16px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-2);
  transition: background .14s;
}
.row:hover { background: rgba(130, 166, 255, .09); color: var(--text); }
.row time { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); flex: 0 0 auto; }
.row-title { flex: 1; font-weight: 500; font-size: .95rem; }
.row:hover .row-title { color: #a9c0ff; }
.row-meta { font-size: .78rem; color: var(--muted); font-family: var(--font-mono); }

.chips-filter { display: flex; flex-wrap: wrap; gap: 7px; margin: 6px 0 22px; }
.chip-filter { cursor: pointer; }
.chip-filter em { font-style: normal; opacity: .55; font-family: var(--font-mono); font-size: .7rem; }
.chip-filter.active {
  background: var(--grad); color: #0b1020; font-weight: 600; border-color: transparent;
}
.chip-filter.active em { opacity: .7; }

/* ---------- writeup (post) ---------- */

.post-shell {
  display: grid;
  grid-template-columns: minmax(0, 900px) minmax(220px, 275px);
  gap: 46px;
  padding: 40px 0 60px;
  /* writeups render on a wider canvas than the standard container:
     the TEXT column stays capped (editorial line-length), media soak the rest */
  width: min(1280px, calc(100% - 44px));
}
.post-shell.no-toc { grid-template-columns: minmax(0, 760px); justify-content: center; }
.post-shell.no-toc .post { justify-self: center; }

.post { min-width: 0; }

.back {
  display: inline-block; color: var(--muted); font-size: .86rem;
  margin-bottom: 18px;
}
.back:hover { color: var(--text); }

.post-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  line-height: 1.16; letter-spacing: .2px; margin: 0 0 12px;
}
.post-meta {
  display: flex; gap: 8px; align-items: baseline;
  color: var(--muted); font-size: .86rem;
}
.post-meta .sep { opacity: .5; }
.post-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }

.post-cover { margin: 26px 0 0; }
.post-cover img {
  border-radius: var(--radius); border: 1px solid var(--border);
  width: 100%;
}

.prose { color: var(--text-2); font-size: 1.02rem; line-height: 1.82; }
/* editorial hybrid: comfortable line-length for TEXT + full column for MEDIA
   (images, tables, terminal code and standalone screenshot paragraphs span all) */
.prose :is(p, h2, h3, h4, ul, ol, blockquote, hr) { max-width: 700px; }
.prose p:has(img) { max-width: 100%; }  /* image paragraphs escape the text cap */
.prose > sup { line-height: 0; }

.prose h2, .prose h3, .prose h4 {
  color: var(--text); font-family: var(--font-display);
  letter-spacing: .2px; scroll-margin-top: calc(var(--nav-h) + 20px);
}
.prose h2 {
  font-size: 1.42rem; line-height: 1.3;
  margin: 2.2rem 0 1rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.prose h3 { font-size: 1.15rem; margin: 1.8rem 0 .8rem; }
.prose h4 { font-size: 1rem; margin: 1.4rem 0 .6rem; }

.prose h2 .headerlink, .prose h3 .headerlink, .prose h4 .headerlink {
  margin-left: .55rem; opacity: 0; transition: opacity .15s;
  color: var(--muted); font-size: .78em; vertical-align: middle;
}
.prose h2:hover .headerlink, .prose h3:hover .headerlink, .prose h4:hover .headerlink { opacity: .8; }

.prose p { margin: 1em 0; }
.prose strong { color: var(--text); font-weight: 600; }
.prose li { margin: .35em 0; }
.prose ul, .prose ol { padding-left: 1.5rem; }

.prose blockquote {
  margin: 1.4em 0; padding: 10px 18px;
  border-left: 3px solid var(--accent);
  background: rgba(130, 166, 255, .06);
  border-radius: 0 10px 10px 0;
}
.prose blockquote p { margin: .4em 0; }
.prose a { text-decoration: underline; text-decoration-color: rgba(130, 166, 255, .35); text-underline-offset: 3px; }

.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.4rem auto; }

/* inline code and code blocks */
.prose code {
  font-family: var(--font-mono); font-size: .86em;
  background: rgba(130, 166, 255, .12);
  color: #a6bff5;
  border-radius: 6px; padding: .14em .4em;
}
.codehilite {
  background: #0d1018 !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 1.25em 0;
  overflow-x: auto;
  position: relative;
}
.codehilite pre {
  margin: 0; padding: 15px 17px;
  background: transparent;
  font-family: var(--font-mono); font-size: .845rem;
  line-height: 1.62;
}
.codehilite pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

.copy-btn {
  position: absolute; top: 9px; right: 9px;
  font-size: .7rem; font-weight: 600; letter-spacing: .3px;
  color: var(--muted);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  border-radius: 7px; padding: 4px 10px; cursor: pointer;
  opacity: 0; transition: opacity .15s, color .15s, background .15s;
}
.codehilite:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text); background: rgba(255, 255, 255, .09); }
.copy-btn[data-ok="1"] { color: #8ee5b0; }

/* tablas */
.prose table {
  width: 100%; border-collapse: collapse;
  margin: 1.4em 0; font-size: .9rem;
}
.prose th {
  text-align: left; color: var(--text); font-weight: 600;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border-2);
}
.prose td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.prose tbody tr:nth-child(odd) { background: rgba(146, 161, 196, .045); }

/* post images */
.prose figure { margin: 1.7em 0; text-align: center; }
.prose figure img {
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.prose figcaption {
  color: var(--muted); font-size: .82rem; margin-top: .55em; font-style: italic;
}

/* notas al pie */
.prose .footnote { font-size: .84rem; color: var(--muted); margin-top: 2rem; }
.prose .footnote hr { width: 90px; margin: 0 0 .8rem; }

/* post footer + prev/next nav */
.post-license {
  margin-top: 3rem; padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: .82rem;
}

.post-nav { margin-top: 10px; padding-bottom: 40px; }
.post-nav-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.post-nav-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 17px;
  color: inherit;
  transition: border-color .15s;
  min-width: 0;
}
.post-nav-card:hover { border-color: rgba(130, 166, 255, .4); color: inherit; }
.post-nav-card .dir { color: var(--muted); font-size: .78rem; }
.post-nav-card .tt {
  color: var(--text); font-weight: 600; font-size: .93rem; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-nav-card:hover .tt { color: #a9c0ff; }
.post-nav-card.newer { text-align: right; }

/* ---------- TOC lateral ---------- */

.toc {
  align-self: start;
  position: sticky; top: calc(var(--nav-h) + 26px);
  font-size: .84rem;
  border-left: 1px solid var(--border);
  padding: 4px 0 4px 18px;
  max-height: calc(100vh - var(--nav-h) - 60px);
  overflow-y: auto;
}
.toc h4 {
  margin: 0 0 10px; font-size: .74rem;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted);
}
.toc ul, .toc ol { list-style: none; margin: 0; padding: 0; }
.toc ul ul, .toc ol ol { padding-left: 15px; }
.toc li { margin: 2px 0; }
.toc a {
  display: block; padding: 2.5px 0;
  color: var(--muted);
  line-height: 1.45;
  transition: color .12s;
}
.toc a:hover { color: var(--text); }
.toc a.toc-active { color: var(--accent); font-weight: 500; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 30px;
  padding: 26px 0 34px;
  font-size: .82rem; color: var(--muted);
}
.footer-inner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 26px;
}
.footer-inner p { margin: 0; }
.footer-icons { display: flex; gap: 4px; margin-left: auto; }
.footer-icons a {
  display: inline-flex; padding: 7px; border-radius: 8px; color: var(--muted);
}
.footer-icons a:hover { color: var(--text); background: rgba(146, 161, 196, .1); }

/* ---------- buscador ---------- */

#search-dialog {
  margin-inline: auto;
  width: min(580px, calc(100vw - 40px));
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 0;
  box-shadow: var(--shadow);
  margin-top: 12vh;
}
#search-dialog::backdrop {
  background: rgba(5, 7, 12, .6);
  backdrop-filter: blur(4px);
}
#search-dialog[open] { display: flex; flex-direction: column; }

.search-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
#search-input {
  flex: 1; background: none; border: 0; outline: none;
  color: var(--text); font: 1rem var(--font-sans);
}
#search-input::placeholder { color: var(--muted); }
#search-dialog kbd {
  font-family: var(--font-mono); font-size: .68rem;
  color: var(--muted); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 6px;
}

#search-results {
  list-style: none; margin: 0; padding: 8px;
  max-height: 330px; overflow-y: auto;
}
#search-results a {
  display: block; padding: 10px 12px; border-radius: 9px;
  color: inherit;
}
#search-results a:hover, #search-results a.selected { background: rgba(130, 166, 255, .1); }
#search-results .r-title { font-weight: 600; color: var(--text); font-size: .93rem; }
#search-results .r-meta { color: var(--muted); font-size: .78rem; margin-top: 2px; font-family: var(--font-mono); }
#search-results li { border-radius: 9px; }

.search-empty { text-align: center; color: var(--muted); padding: 22px 0 26px; margin: 0; }

/* ---------- lightbox (screenshot viewer, click any writeup image) ---------- */

html:has(dialog[open]) { overflow: hidden; }  /* no background scrolling while a dialog is open */

#lightbox {
  margin: auto;
  background: transparent; border: 0; padding: 14px;
  width: fit-content; max-width: 96vw; max-height: 96vh;
  color: var(--text);
}
#lightbox:focus { outline: none; }  /* no focus ring on the viewer itself */

#lightbox::backdrop {
  background: rgba(6, 9, 17, .84);
  backdrop-filter: blur(7px);
  animation: lb-fade .22s ease;
}
#lightbox[open] { animation: lb-in .24s cubic-bezier(.2, .8, .3, 1); }
@keyframes lb-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes lb-fade { from { opacity: 0; } }

#lightbox .lb-stage {
  position: relative; width: fit-content; margin: 0 auto;
}
#lightbox .lb-img {
  display: block;
  max-width: min(88vw, 1600px); max-height: 78vh; object-fit: contain;
  border-radius: 14px;
  border: 1px solid rgba(130, 166, 255, .26);
  background: var(--surface);
  box-shadow: 0 34px 90px rgba(0, 0, 0, .55), 0 0 70px rgba(130, 140, 255, .12);
  cursor: zoom-out;  /* click on the photo closes the viewer */
}
#lightbox .lb-count {
  position: absolute; bottom: 10px; right: 12px;
  font-family: var(--font-mono); font-size: .72rem;
  color: #cfe0ff;
  background: rgba(10, 14, 24, .78);
  border: 1px solid rgba(130, 166, 255, .24);
  border-radius: 99px; padding: 3px 10px;
  pointer-events: none;
}
#lightbox .lb-caption {
  color: var(--muted); text-align: center; font-size: .82rem; font-style: italic;
  max-width: 84vw; margin: 12px auto 0;
}

/* ---------- 404 ---------- */

.not-found { text-align: center; padding: 90px 0 70px; }
.not-found h1 {
  font-family: var(--font-display); font-size: clamp(4rem, 14vw, 6.5rem);
  margin: 0; line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.not-found p { color: var(--muted); margin: 14px 0 26px; }
.not-found em { color: var(--text-2); }

.btn {
  display: inline-block;
  background: var(--grad);
  color: #0b1020; font-weight: 600; font-size: .92rem;
  padding: 10px 20px; border-radius: 11px;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.1); color: #0b1020; }

/* about page (social row at the end) */
.about-socials {
  display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  margin-top: 34px; padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: .88rem;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .nav-links { display: none; }
  .only-desktop { display: none; }
  .burger { display: inline-flex; }
  .mobile-menu:not([hidden]) { display: block; }

  .post-shell { grid-template-columns: 1fr; gap: 0; padding-top: 26px; }
  .toc { display: none; }

  .brand-note { display: none; }

  .post-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
