@font-face { font-family: "Bricolage"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

/* ---------- Tokens: oscuro por defecto, claro según el sistema ---------- */
:root {
  color-scheme: dark light;
  --bg: #0A0F1C;
  --bg-2: #0E1628;
  --surface: #131D33;
  --surface-2: #1B2744;
  --ink: #E7ECF4;
  --muted: #8E9BB3;
  --rule: #1F2B45;
  --rule-strong: #33436A;
  --blue: #5B8CFF;
  --blue-ink: #8FB0FF;
  --blue-soft: rgba(91, 140, 255, .14);
  --accent: #FF8A3D;
  --accent-ink: #FFA66B;
  --on-accent: #1A0E05;
  --glow: rgba(91, 140, 255, .18);
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, .8);

  --display: "Bricolage", "Arial Narrow", system-ui, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(1rem, 5vw, 4rem);
  --measure: 66ch;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #F4F6FA;
    --bg-2: #E9EEF6;
    --surface: #FFFFFF;
    --surface-2: #EEF2F8;
    --ink: #0B1221;
    --muted: #4B5873;
    --rule: #D3DAE6;
    --rule-strong: #A9B5CA;
    --blue: #2F5BE0;
    --blue-ink: #1F45B8;
    --blue-soft: rgba(47, 91, 224, .1);
    --accent: #F07A2B;
    --accent-ink: #B4500F;
    --glow: rgba(47, 91, 224, .12);
    --shadow: 0 24px 50px -30px rgba(11, 18, 33, .45);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1.0625rem/1.65 var(--text);
  display: flex; flex-direction: column; min-height: 100vh;
  overflow-x: clip;
}
main { flex: 1; }
img, svg { max-width: 100%; }
a { color: var(--blue-ink); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--accent); color: var(--on-accent); }

.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

h1, h2, h3 { font-family: var(--display); line-height: 1.04; letter-spacing: -0.025em; margin: 0; font-weight: 700; }
h1 { font-size: clamp(2.5rem, 7vw, 5.5rem); font-weight: 800; letter-spacing: -0.04em; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
h3 { font-size: 1.3rem; letter-spacing: -0.015em; line-height: 1.2; }
p { margin: 0 0 1em; }
.lede { font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.55; max-width: 46ch; color: var(--muted); }
.hl { font-style: normal; color: var(--accent); }

/* Etiqueta técnica sobre los títulos */
.kicker { font: 500 .8rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 1rem; }
.kicker::before { content: "// "; color: var(--muted); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem;
  padding: .9rem var(--gutter); border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 800 1.15rem/1 var(--display); letter-spacing: -0.03em; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 1.75rem; height: 1.75rem; border-radius: 7px; display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 1rem; position: relative; }
.brand-mark::after { content: ""; position: absolute; top: -3px; right: -3px; width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.site-header nav { display: flex; flex-wrap: wrap; gap: .25rem 1.4rem; font: 500 .98rem var(--display); }
.site-header nav a { color: var(--muted); text-decoration: none; padding: .25rem 0; border-bottom: 2px solid transparent; }
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current] { color: var(--ink); border-color: var(--accent); }

/* ---------- Layout ---------- */
.wrap { padding: 0 var(--gutter); max-width: 84rem; margin: 0 auto; }
.section { padding-block: clamp(3rem, 8vw, 6rem); border-top: 1px solid var(--rule); }
.section > h2 { margin-bottom: 1.75rem; }
.section > .lede { margin-bottom: 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center; padding-block: clamp(3rem, 9vw, 7rem);
}
.hero::before {
  content: ""; position: absolute; inset: 0 -20% auto auto; width: 70%; height: 100%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, var(--glow), transparent);
}
.hero h1 { margin-bottom: 1.5rem; max-width: 13ch; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; font: 600 1rem var(--display); text-decoration: none;
  padding: .8rem 1.35rem; border: 1px solid var(--rule-strong); color: var(--ink); background: transparent; border-radius: 8px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }

/* ---------- Chat ilustrativo de Guitia ---------- */
.chat-wrap { margin: 0; }
.chat {
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow); font: 400 .95rem/1.45 var(--text); max-width: 26rem; margin-inline: auto;
}
.chat-head { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-bottom: 1px solid var(--rule); background: var(--surface-2); }
.chat-avatar { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font: 800 1rem var(--display); }
.chat-name { font-weight: 600; line-height: 1.2; }
.chat-status { display: block; font: 400 .78rem var(--mono); color: var(--muted); }
.chat-status::before { content: ""; display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent); margin-right: .35rem; vertical-align: .05rem; }
.chat-body { list-style: none; margin: 0; padding: 1rem; display: flex; flex-direction: column; gap: .55rem; }
.msg { max-width: 85%; padding: .55rem .8rem; border-radius: 14px; }
.msg.in { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--blue-soft); border: 1px solid color-mix(in srgb, var(--blue) 35%, transparent); border-bottom-right-radius: 4px; }
.msg p { margin: 0; }
.msg .num { font-family: var(--mono); font-size: .88em; color: var(--accent-ink); }
.msg .row { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.msg .row b { color: var(--ink); font-weight: 600; }
.voice { display: flex; align-items: center; gap: .6rem; }
.voice-play { width: 0; height: 0; border-left: 9px solid var(--ink); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.wave { display: flex; align-items: center; gap: 2px; height: 1.2rem; }
.wave i { display: block; width: 3px; border-radius: 2px; background: var(--blue-ink); }
.wave i:nth-child(1) { height: 30%; }
.wave i:nth-child(2) { height: 70%; }
.wave i:nth-child(3) { height: 45%; }
.wave i:nth-child(4) { height: 90%; }
.wave i:nth-child(5) { height: 55%; }
.wave i:nth-child(6) { height: 80%; }
.wave i:nth-child(7) { height: 35%; }
.wave i:nth-child(8) { height: 65%; }
.wave i:nth-child(9) { height: 40%; }
.wave i:nth-child(10) { height: 75%; }
.wave i:nth-child(11) { height: 50%; }
.wave i:nth-child(12) { height: 25%; }
.wave i:nth-child(13) { height: 60%; }
.wave i:nth-child(14) { height: 35%; }
.voice time { font: .78rem var(--mono); color: var(--muted); }
.chat-wrap figcaption { font-size: .88rem; color: var(--muted); margin-top: .9rem; text-align: center; }
@media (prefers-reduced-motion: no-preference) {
  .chat { animation: arrive .7s cubic-bezier(.2,.8,.2,1) .15s both; }
  .chat-body > li { animation: pop .45s cubic-bezier(.2,.8,.2,1) both; }
  .chat-body > li:nth-child(1) { animation-delay: .6s; }
  .chat-body > li:nth-child(2) { animation-delay: 1.1s; }
  .chat-body > li:nth-child(3) { animation-delay: 1.7s; }
  .chat-body > li:nth-child(4) { animation-delay: 2.2s; }
  .chat-body > li:nth-child(5) { animation-delay: 2.9s; }
}
@keyframes arrive { from { opacity: 0; transform: translateY(18px) scale(.98); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Proyectos ---------- */
.projects { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.project {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) 9rem; gap: 1rem 3rem;
  padding-block: 2.25rem; border-bottom: 1px solid var(--rule); align-items: start;
}
.project h3 { font-size: clamp(1.9rem, 4vw, 3rem); letter-spacing: -0.035em; line-height: 1; }
.project h3 a { color: var(--ink); text-decoration: none; }
.project h3 a::after { content: " →"; color: var(--accent); opacity: 0; transition: opacity .15s; }
.project h3 a:hover { color: var(--ink); }
.project h3 a:hover::after { opacity: 1; }
.project p { margin: 0 0 1rem; max-width: 50ch; color: var(--muted); }
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li { font: 500 .78rem var(--mono); padding: .2rem .55rem; border: 1px solid var(--rule-strong); border-radius: 6px; color: var(--muted); }
.status {
  display: inline-flex; align-items: center; gap: .45rem; font: 500 .8rem var(--mono); padding: .3rem .7rem;
  border-radius: 99px; white-space: nowrap; border: 1px solid var(--rule-strong); color: var(--ink);
}
.status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--blue); }
.status.live { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.status.live::before { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.project .status { justify-self: end; }
.page-head .status { margin-bottom: 1.25rem; }

/* ---------- Stack ---------- */
.facts { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr; gap: 0; margin: 0; max-width: 56rem; }
.facts dt, .facts dd { padding: .9rem 0; border-bottom: 1px solid var(--rule); }
.facts dt { font: 500 .85rem var(--mono); color: var(--accent-ink); padding-top: 1.05rem; }
.facts dd { margin: 0; }

/* ---------- Texto de lectura ---------- */
.page-head { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 3vw, 2.5rem); }
.page-head h1 { font-size: clamp(2.3rem, 6vw, 4.25rem); max-width: 18ch; margin-bottom: 1rem; }
.page-head .lede { margin-bottom: 0; }
.page-body { padding-bottom: clamp(3rem, 8vw, 6rem); }
.prose { max-width: var(--measure); padding-bottom: clamp(3rem, 8vw, 6rem); }
.prose h2 { margin: 2.4em 0 .6em; font-size: 1.7rem; }
.prose h3 { margin: 1.8em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--accent); }
.prose code { font: .9em var(--mono); background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.prose .facts { margin-bottom: 1rem; }
.meta { color: var(--muted); font: .85rem var(--mono); }
.notice { border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 8px 8px 0; padding: .9rem 1.2rem; margin: 1.75rem 0; }
.notice p:last-child { margin: 0; }
.todo { background: color-mix(in srgb, var(--accent) 22%, transparent); outline: 1px dashed var(--accent); padding: 0 .3em; border-radius: 3px; }

.legal-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 3rem; align-items: start; }
.toc { position: sticky; top: 5rem; font: 500 .9rem/1.4 var(--display); padding-top: .4rem; }
.toc p { font: 500 .78rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); margin-bottom: .6rem; }
.toc a { display: block; padding: .3rem 0 .3rem .8rem; color: var(--muted); text-decoration: none; border-left: 1px solid var(--rule); }
.toc a:hover { color: var(--ink); border-color: var(--accent); }

/* ---------- FAQ ---------- */
details { border-top: 1px solid var(--rule); padding: 1.1rem 0; }
details:last-of-type { border-bottom: 1px solid var(--rule); }
summary { font: 600 1.2rem/1.3 var(--display); letter-spacing: -0.015em; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font: 400 1.3rem/1 var(--mono); color: var(--accent); }
details[open] summary::after { content: "−"; }
details p { margin: .8rem 0 0; color: var(--muted); }

/* ---------- Contacto ---------- */
.contact-list { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: 0; margin: 2rem 0; }
.contact-list dt, .contact-list dd { padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.contact-list dt { font: 500 .85rem var(--mono); color: var(--accent-ink); padding-top: .95rem; }
.contact-list dd { margin: 0; }
.big-mail { font: 700 clamp(1.3rem, 4vw, 2.2rem) var(--display); letter-spacing: -0.03em; word-break: break-word; }

/* ---------- Sobre mí ---------- */
.links { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 0; }

/* ---------- Footer ---------- */
.site-footer {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem 3rem; padding: 2.75rem var(--gutter) 2rem;
  background: var(--bg-2); border-top: 1px solid var(--rule); color: var(--muted); font-size: .95rem;
}
.site-footer a { color: var(--ink); text-decoration-color: var(--rule-strong); }
.site-footer a:hover { color: var(--accent-ink); }
.site-footer address { font-style: normal; margin-bottom: .6em; }
.site-footer p { margin: 0 0 .4em; }
.footer-name { font: 800 1.3rem var(--display); color: var(--ink); letter-spacing: -0.02em; }
.footer-social { display: flex; gap: 1.2rem; font-family: var(--display); }
.site-footer nav { display: flex; flex-direction: column; gap: .35rem; font-family: var(--display); }
.footer-fine { grid-column: 1 / -1; font: .8rem var(--mono); border-top: 1px solid var(--rule); padding-top: 1.25rem; margin-top: .5rem; }

@media (max-width: 52rem) {
  .hero, .project, .legal-layout, .site-footer { grid-template-columns: 1fr; }
  .hero::before { width: 100%; inset: auto 0 0 0; height: 60%; }
  .project { gap: .75rem; }
  .project .status { justify-self: start; }
  .toc { position: static; border-bottom: 1px solid var(--rule); padding-bottom: 1rem; }
  .facts, .contact-list { grid-template-columns: 1fr; }
  .facts dt, .contact-list dt { border-bottom: 0; padding-bottom: 0; }
  .hero h1 { max-width: none; }
  .site-header { position: static; }
}
