/* Terminal-styled portfolio. One file, no build step, no webfonts. */

:root {
  --bg:        #0b0d10;
  --panel:     #111419;
  --bar:       #161a20;
  --line:      #232932;
  --fg:        #c8d0da;
  --dim:       #7b8593;
  --accent:    #5ee89a;  /* prompt user, links      */
  --accent-2:  #6cc4ff;  /* paths, language badge   */
  --accent-3:  #e8c15e;  /* tags                    */
  --radius:    6px;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", "SF Mono",
          Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:       #f6f7f8;
    --panel:    #ffffff;
    --bar:      #eceef1;
    --line:     #dde1e6;
    --fg:       #1b2027;
    --dim:      #5c6572;
    --accent:   #0c7c46;
    --accent-2: #0a5fbf;
    --accent-3: #96631a;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 var(--mono);
  /* faint scanline grid, the only decoration in the whole file */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  background-position: -1px -1px;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 18px 64px;
}

/* ── window chrome ───────────────────────────────────────────── */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 14px;
  background: var(--bar);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.bar-title {
  color: var(--dim);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-link {
  flex: none;
  color: var(--dim);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-link:hover { color: var(--accent); }

main {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 26px 22px 30px;
}

/* ── prompt lines ────────────────────────────────────────────── */

.block { margin: 0 0 40px; }
.block:last-of-type { margin-bottom: 24px; }

.ps1 {
  margin: 0 0 14px;
  color: var(--dim);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}
.ps1 .user { color: var(--accent); }
.ps1 .path { color: var(--accent-2); }
.ps1.last { margin: 0; }

.cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.5px;
}
.role  { margin: 0 0 16px; color: var(--dim); }
.about { margin: 0 0 10px; max-width: 68ch; }
.about:last-child { margin-bottom: 0; }

.quote {
  margin: 22px 0 0;
  padding-left: 14px;
  border-left: 2px solid var(--line);
  max-width: 68ch;
}
.quote blockquote {
  margin: 0;
  color: var(--fg);
}
.quote figcaption {
  margin-top: 4px;
  color: var(--dim);
  font-size: 13px;
}

/* ── search ──────────────────────────────────────────────────── */

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 0 0 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.search:focus-within { border-color: var(--accent); }
.search label { color: var(--accent-2); flex: none; }
.search input {
  flex: 1 1 auto;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--fg);
  font: inherit;
  padding: 2px 0;
}
.search input:focus { outline: none; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.search button {
  background: var(--bar);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  padding: 2px 10px;
  cursor: pointer;
}

/* htmx toggles .htmx-request on the indicator during the fetch */
.spin { color: var(--accent); opacity: 0; }
.spin.htmx-request { opacity: 1; animation: blink .6s steps(1) infinite; }

.count { margin: 0 0 14px; color: var(--dim); font-size: 13px; }
.empty { margin: 0; color: var(--dim); }
.empty code { color: var(--accent-3); }

/* ── project grid ────────────────────────────────────────────── */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 15px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .12s ease, transform .12s ease;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.card-head h2 {
  margin: 0;
  font-size: 15px;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.card-head h2::before { content: "./"; color: var(--dim); }

.lang {
  flex: none;
  font-size: 11.5px;
  color: var(--accent-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 6px;
}

.desc { margin: 0; font-size: 13.5px; color: var(--fg); flex: 1 1 auto; }

.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font-size: 11.5px;
  color: var(--accent-3);
  border: 1px dashed var(--line);
  border-radius: 3px;
  padding: 0 6px;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.year { color: var(--dim); }
.card-links { display: flex; gap: 12px; }

/* ── blog ────────────────────────────────────────────────────── */

.posts { list-style: none; margin: 0 0 16px; padding: 0; }
.post-row {
  padding: 0 0 18px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
  max-width: 74ch;
}
.posts .post-row:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.post-row h2 { margin: 2px 0 6px; font-size: 16px; }
.post-row .desc { margin: 0 0 6px; }

.post-date { margin: 0; color: var(--dim); font-size: 12.5px; }
.post-paper { margin: 0; color: var(--dim); font-size: 13px; }

.paper-ref {
  margin: 0 0 24px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13.5px;
  max-width: 74ch;
}

.sec {
  margin: 28px 0 10px;
  font-size: 16px;
  color: var(--accent-2);
}
.sec::before { content: "## "; color: var(--dim); }

/* ── links ───────────────────────────────────────────────────── */

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
.search input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 18px; }
.links a::before { content: "→ "; color: var(--dim); }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--accent);
  padding: 8px 12px;
  border-radius: 4px;
}

/* ── ficha de proyecto ──────────────────────────────────────── */

/* La tarjeta entera es clicable, pero el enlace sigue siendo el título:
   un ::after estirado cubre la tarjeta sin envolverla en un <a> gigante
   ni necesitar una línea de JavaScript. */
.card { position: relative; }
.card-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
/* Los enlaces del pie van por encima de esa capa, o serían inalcanzables. */
.card-links { position: relative; z-index: 1; }

.proj-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 8px;
}
.proj-head h1 { margin: 0; }
.proj-head .year { font-size: 12.5px; }

.block > .tags { margin: 0 0 18px; }

.upstream {
  margin: 0;
  max-width: 68ch;
  color: var(--dim);
  border-left: 2px solid var(--accent-3);
  padding-left: 12px;
}

.points {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 72ch;
}
.points li {
  position: relative;
  margin: 0 0 9px;
  padding-left: 20px;
}
.points li:last-child { margin-bottom: 0; }
.points li::before {
  content: "-";
  position: absolute;
  left: 4px;
  color: var(--accent-3);
}

.code {
  margin: 0;
  padding: 13px 15px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  font: inherit;
  font-size: 13px;
}

.meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0 0 18px;
  font-size: 13.5px;
}
.meta dt { color: var(--dim); }
.meta dd { margin: 0; }

@media (max-width: 520px) {
  body { font-size: 14px; }
  .wrap { padding: 16px 12px 40px; }
  main { padding: 20px 14px 24px; }
  h1 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
