/* ============================================================================
 * cmos486.css
 * Custom skin para Quark theme
 * Aesthetic: post-terminal / refined retro-tech
 * ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

/* --- Tokens ---------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg-0: #0a0d11;
  --bg-1: #0d1117;
  --bg-2: #161b22;
  --bg-3: #1c2128;

  /* Borders */
  --border: #30363d;
  --border-strong: #484f58;

  /* Text */
  --text-0: #f0f6fc;
  --text-1: #e6edf3;
  --text-2: #9ca5b0;
  --text-3: #6e7681;

  /* Accent (refined phosphor green) */
  --accent: #39d353;
  --accent-hover: #56d364;
  --accent-text: #79e891;
  --accent-dim: rgba(57, 211, 83, 0.12);
  --accent-glow: rgba(57, 211, 83, 0.35);

  /* Other semantic */
  --link: #58a6ff;
  --warn: #d29922;
  --error: #f85149;

  /* Type */
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Fira Code', ui-monospace, monospace;
  --font-sans: 'Manrope', system-ui, -apple-system, sans-serif;

  /* Layout */
  --content-max: 760px;
  --wide-max: 1200px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* --- Reset & globals ------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html {
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-1);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  margin: 0;
  padding: 0;
}

/* Override Quark's Spectre defaults that conflict */
body, .body, p, li, td, th, span {
  color: var(--text-1);
}

::selection {
  background: var(--accent);
  color: var(--bg-0);
}

/* --- Typography ------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  color: var(--text-0);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-top: 2em;
  margin-bottom: 0.6em;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 0.5em;
}

h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5, h6 { font-size: 1rem; }

p {
  margin: 0 0 1.1em 0;
  color: var(--text-1);
}

strong, b {
  color: var(--text-0);
  font-weight: 700;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent);
}

/* Code */
code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

:not(pre) > code {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--accent-text);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
}
/* Neutralizar estilos inline heredados de Joomla en code blocks */
pre, pre * {
  background: transparent !important;
  background-color: transparent !important;
  color: var(--text-1) !important;
  border-color: var(--border) !important;
  font-family: var(--font-mono) !important;
}

pre {
  background: var(--bg-2) !important;
  background-color: var(--bg-2) !important;
}

pre table, pre tr, pre td, pre th {
  border: none !important;
  padding: 0 !important;
}

:not(pre) > code, :not(pre) > code * {
  background: var(--bg-3) !important;
  color: var(--accent-text) !important;
}

pre {
  background: var(--bg-2) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.88em;
  line-height: 1.55;
  color: var(--text-1);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-2);
  padding: 0.8em 1.2em;
  margin: 1.5em 0;
  color: var(--text-1);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

blockquote p:last-child { margin-bottom: 0; }

hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 3em 0;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
  margin: 1.2em auto;
}

ul, ol {
  padding-left: 1.5em;
  margin: 1em 0;
}

li {
  margin: 0.3em 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 0.92em;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.5em 0.8em;
  text-align: left;
}

th {
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-0);
}

/* --- Hide Quark default header/footer (we use our own) -------------------- */
body > #top, body > .top-bar, body > .header-wrapper, .navbar.fixed-top {
  display: none !important;
}
body > footer.site-footer-default,
.copyright,
.footer .copyright,
body > footer:not(.site-footer) > .columns,
body > footer:not(.site-footer) > .container {
  display: none !important;
}

/* --- Our own header ------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--wide-max);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.site-brand {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-decoration: none;
  font-weight: 500;
  border-bottom: none !important;
  white-space: nowrap;
}

.site-brand .brand-prompt { color: var(--text-3); }
.site-brand .brand-name   { color: var(--text-0); }
.site-brand .brand-cursor {
  color: var(--accent);
  margin-left: 0.25em;
  animation: blink 1.05s steps(2) infinite;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--text-2);
  text-decoration: none;
  text-transform: lowercase;
  border-bottom: none !important;
  transition: color 0.15s ease;
}

.site-nav a:hover { color: var(--accent-text); }
.site-nav a.active { color: var(--accent-text); }

.site-nav a::before {
  content: "$ ";
  color: var(--text-3);
}

/* --- Our own footer ------------------------------------------------------- */
.site-footer {
  background: var(--bg-0);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.5rem;
  margin-top: 4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
}

.site-footer a {
  color: var(--text-2);
  text-decoration: none;
  border-bottom: none;
}

.site-footer a:hover { color: var(--accent-text); }

.footer-inner {
  max-width: var(--wide-max);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 0.6em;
  align-items: center;
  flex-wrap: wrap;
}

.footer-inner .sep { color: var(--border-strong); }

/* --- Layout containers ---------------------------------------------------- */
main, .main-content, .content-wrapper {
  background: var(--bg-1);
}

.container, .grid-lg, .columns {
  max-width: var(--wide-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.blog-article, .article-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Article title with $ cat foo.md prompt — solo para articulos del blog */
.blog-article > .article-header h1 {
  position: relative;
  padding-bottom: 0.4em;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 0.6em;
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.02em;
}

.blog-article > .article-header h1::before {
  content: "$ cat ";
  color: var(--text-3);
  font-weight: 400;
  font-size: 0.75em;
}

.blog-article > .article-header h1::after {
  content: ".md";
  color: var(--text-3);
  font-weight: 400;
  font-size: 0.75em;
  margin-left: 0.2em;
}

.blog-article .article-nav-top {
  margin-bottom: 1.2rem;
}

.blog-article .back-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-2);
  text-decoration: none;
  border-bottom: none;
}

.blog-article .back-link:hover {
  color: var(--accent-text);
}

.blog-article .article-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-3);
  display: flex;
  gap: 0.5em;
  align-items: center;
  margin-bottom: 1.5em;
}

.blog-article .article-meta::before {
  content: "// ";
  color: var(--border-strong);
}

.blog-article .article-meta .cat {
  color: var(--accent-text);
}

.blog-article .article-meta .sep {
  color: var(--border-strong);
}

/* Tags */
.tags, .taxonomy {
  margin: 2em 0 1em;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.tags a, .taxonomy a {
  display: inline-block;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 0.15em 0.6em;
  margin: 0.2em 0.3em 0.2em 0;
  border-radius: var(--radius-sm);
  color: var(--text-2);
}

.tags a::before, .taxonomy a::before {
  content: "[";
  color: var(--text-3);
}

.tags a::after, .taxonomy a::after {
  content: "]";
  color: var(--text-3);
}

.tags a:hover, .taxonomy a:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

/* --- Blog listing --------------------------------------------------------- */
.blog-listing-section {
  max-width: var(--wide-max);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.blog-header {
  margin-bottom: 2rem;
}

.blog-title {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-0);
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
}

.blog-title .prompt {
  color: var(--accent);
  margin-right: 0.4em;
}

.blog-subtitle {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-3);
  margin: 0;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 700px) {
  .blog-grid { grid-template-columns: 1fr; }
}

.blog-card {
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.3rem 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

.blog-card:hover {
  border-color: var(--accent);
  background: var(--bg-3);
  transform: translateY(-2px);
}

.blog-card-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 0.6rem;
  display: flex;
  gap: 0.8em;
  align-items: center;
}

.blog-card-meta time::before {
  content: "// ";
  color: var(--border-strong);
}

.blog-card-meta .cat {
  color: var(--accent-text);
}

.blog-card-title {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--text-0);
}

.blog-card:hover .blog-card-title {
  color: var(--accent-text);
}

.blog-card-excerpt {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pagination override (Quark default has its own) */
.pagination {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin: 2.5em 0 0;
  display: flex;
  justify-content: center;
  gap: 0.4em;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
}

.pagination li, .pagination a, .pagination span {
  padding: 0.35em 0.75em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  background: var(--bg-2);
  text-decoration: none;
  display: inline-block;
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.pagination .active, .pagination .current {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-text);
}

.pagination .disabled {
  color: var(--text-3);
  background: var(--bg-1);
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination .ellipsis {
  background: transparent;
  border: none;
  color: var(--text-3);
  padding: 0.35em 0.3em;
}

/* ============================================================================
 * HOME PAGE
 * ========================================================================== */

body.home, .home-page {
  background: var(--bg-0);
}

/* Hide global header on home for full-bleed effect (optional) */
.home-page .top-bar { background: transparent; border-bottom: none; }

/* Hero ---------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 45vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem 2.5rem;
  overflow: hidden;
  background-color: var(--bg-0);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
background: linear-gradient(
    180deg,
    rgba(10, 13, 17, 0.55) 0%,
    rgba(10, 13, 17, 0.7) 50%,
    rgba(10, 13, 17, 0.95) 100%
);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--wide-max);
  width: 100%;
  text-align: left;
}

.hero-prompt {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  opacity: 0;
  animation: fadeUp 0.5s ease 0.1s forwards;
}

.hero-name {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0 0 0.4rem 0;
  color: var(--text-0);
  opacity: 0;
  animation: fadeUp 0.5s ease 0.25s forwards;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.85), 0 0 4px rgba(0, 0, 0, 0.6);
}

.hero-name::after {
  content: "_";
  color: var(--accent);
  animation: blink 1.05s steps(2) infinite;
  margin-left: 0.05em;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--text-2);
  max-width: 580px;
  margin: 0;
  opacity: 0;
  animation: fadeUp 0.5s ease 0.4s forwards;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}

.hero-tagline::before {
  content: "// ";
  color: var(--text-3);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Links grid --------------------------------------------------------------- */
.links-section {
  background: var(--bg-1);
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: var(--wide-max);
  margin: 0 auto;
}

@media (max-width: 900px) {
  .links-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .links-grid { grid-template-columns: 1fr; }
}

.link-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.4rem;
  text-decoration: none;
  color: var(--text-1);
  min-height: 140px;
  position: relative;
  transition: border-color 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
  overflow: hidden;
  opacity: 0;
  animation: fadeUp 0.5s ease forwards;
}

.link-card:nth-child(1) { animation-delay: 0.55s; }
.link-card:nth-child(2) { animation-delay: 0.60s; }
.link-card:nth-child(3) { animation-delay: 0.65s; }
.link-card:nth-child(4) { animation-delay: 0.70s; }
.link-card:nth-child(5) { animation-delay: 0.75s; }
.link-card:nth-child(6) { animation-delay: 0.80s; }
.link-card:nth-child(7) { animation-delay: 0.85s; }
.link-card:nth-child(8) { animation-delay: 0.90s; }

.link-card:hover {
  border-color: var(--accent);
  background: var(--bg-3);
  transform: translateY(-2px);
}

.link-card:hover .link-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.link-card .link-icon {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: auto;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 32px;
  height: 32px;
}

.link-card .link-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}

/* Per-platform brand color on hover (cards stay green by default) */
.link-card.brand-blog       { --brand: #39d353; }
.link-card.brand-github     { --brand: #f0f6fc; }
.link-card.brand-instagram  { --brand: #e84393; }
.link-card.brand-photo      { --brand: #d4a574; }
.link-card.brand-twitter    { --brand: #e6edf3; }
.link-card.brand-linkedin   { --brand: #4a90e2; }
.link-card.brand-youtube    { --brand: #ff5252; }
.link-card.brand-rss        { --brand: #ff8800; }

.link-card[class*="brand-"]:hover {
  border-color: var(--brand);
  background: var(--bg-3);
  box-shadow: 0 0 0 1px var(--brand), 0 0 18px -8px var(--brand);
}

.link-card[class*="brand-"]:hover .link-icon svg {
  stroke: var(--brand);
}

.link-card[class*="brand-"]:hover .link-icon {
  color: var(--brand);
}

.link-card[class*="brand-"]:hover .link-arrow {
  color: var(--brand);
}

.link-card .link-label {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-0);
  margin-top: 1.5rem;
  letter-spacing: -0.01em;
}

.link-card .link-sub {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 0.2rem;
  line-height: 1.4;
}

.link-card .link-arrow {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-3);
  transition: color 0.18s ease, transform 0.18s ease;
}

/* Border ASCII corners ------------------------------------------------------ */
.section-divider {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
  text-align: center;
  margin: 0;
  padding: 0.5rem 0;
  background: var(--bg-1);
  letter-spacing: 0.1em;
  user-select: none;
}

/* --- Responsive tweaks ---------------------------------------------------- */
@media (max-width: 720px) {
  body { font-size: 15px; }
  article, .article-content { padding: 1.5rem 1rem 3rem; }
  .hero { min-height: 60vh; padding: 4rem 1.5rem 3rem; }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.3rem; }
}

/* --- Print ---------------------------------------------------------------- */
@media print {
  body { background: white; color: black; }
  .hero, .links-section, nav, footer { display: none; }
}
