/* ═══════════════════════════════════════════
   Juanjo PM — site.css
   Estilo editorial / terminal / papel, inspirado en trimmy.app
   ═══════════════════════════════════════════ */

:root {
  color-scheme: light;
  --paper: #efe7d6;
  --paper-shade: #e6dbc4;
  --ink: #14110d;
  --ink-soft: #2c2620;
  --pencil: #8a7d65;
  --rule: rgba(20, 17, 13, 0.22);
  --rule-soft: rgba(20, 17, 13, 0.12);
  --cut: #c4391f;
  --cut-soft: rgba(196, 57, 31, 0.14);

  --term-bg: #18140e;
  --term-paper: #f0e7d4;
  --term-amber: #e6b840;
  --term-green: #93b97a;
  --term-mute: #7a7263;

  --max: 1100px;
  --gutter-x: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--paper); }

body {
  color: var(--ink);
  font-family: "Fraunces", ui-serif, Georgia, "Iowan Old Style", serif;
  font-feature-settings: "ss01", "ss02";
  font-variation-settings: "opsz" 14, "SOFT" 50, "WONK" 0;
  font-size: 18px;
  line-height: 1.5;
  background:
    radial-gradient(900px 600px at 18% 4%, rgba(196, 57, 31, 0.05), transparent 55%),
    radial-gradient(900px 700px at 92% 100%, rgba(20, 17, 13, 0.05), transparent 55%),
    var(--paper);
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--cut); color: var(--paper); }

/* ── paper grain ── */
.grain {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: 0.55;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.07 0 0 0 0 0.05 0 0 0 0 0.04 0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ── corner crop marks ── */
.crops { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.crop { position: absolute; width: 26px; height: 26px; opacity: 0.55; }
.crop::before, .crop::after { content: ""; position: absolute; background: var(--ink); }
.crop::before { width: 100%; height: 1px; top: 50%; }
.crop::after { width: 1px; height: 100%; left: 50%; }
.crop.tl { top: 18px; left: 18px; }
.crop.tr { top: 18px; right: 18px; }
.crop.bl { bottom: 18px; left: 18px; }
.crop.br { bottom: 18px; right: 18px; }

/* ── layout containers ── */
.masthead, .paper {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter-x);
  padding-right: var(--gutter-x);
  position: relative;
  z-index: 3;
}

.masthead { padding-top: 56px; padding-bottom: 8px; }
.mast-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.mast-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mast-brand { display: inline-flex; align-items: center; gap: 12px; }
.mast-brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--paper-shade);
  box-shadow: 3px 3px 0 var(--cut);
}
.mast-name {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.mast-meta {
  display: block;
  margin-top: 2px;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 15px;
  font-variation-settings: "opsz" 14, "SOFT" 100, "WONK" 1;
}
.mast-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 18px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.mast-nav a { border-bottom: 1px solid transparent; }
.mast-nav a:hover { border-bottom-color: var(--cut); text-decoration: none; }
.mast-cta {
  border: 1px solid var(--rule) !important;
  padding: 7px 10px;
  color: var(--ink) !important;
  background: rgba(230, 219, 196, 0.62);
}
.mast-issue {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--pencil);
  text-transform: uppercase;
}
.mast-issue em { font-style: normal; color: var(--cut); font-weight: 700; }

/* ── rules ── */
.rule {
  border: 0; height: 1px; background: var(--rule);
  margin: 22px 0;
}
.rule.double {
  background: none; height: 5px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-top: 16px;
}

.paper { padding-top: 14px; padding-bottom: 80px; }

/* ── hero ── */
.hero { padding: 20px 0 16px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pencil);
}
.eyebrow span {
  width: 34px;
  height: 1px;
  background: var(--cut);
  display: inline-block;
}
.eyebrow.inline { margin-bottom: 10px; }

.headline {
  margin: 0;
  font-size: clamp(72px, 13.5vw, 192px);
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  font-weight: 400;
}
.headline.copy-heavy {
  font-size: clamp(54px, 8.8vw, 118px);
  max-width: 12ch;
}
.headline .line { display: block; white-space: nowrap; }
.headline.copy-heavy .line { white-space: normal; }
.headline em {
  font-style: italic;
  color: var(--cut);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.headline .comma { color: var(--cut); }

.hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 32px 56px;
  align-items: end;
  margin-top: clamp(18px, 3vw, 36px);
}
.hero-foot-wide {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  align-items: start;
  gap: 34px 52px;
}
.hero-copy {
  max-width: 66ch;
  padding-top: 4px;
}
.lead {
  margin: 0 0 14px;
  font-size: clamp(21px, 2.2vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.bio-line {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 17px;
  max-width: 58ch;
}
.proof-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.proof-list li {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  background: rgba(230, 219, 196, 0.55);
  padding: 7px 9px;
}

.hero-note {
  border-left: 1px solid var(--rule);
  padding: 8px 0 4px 22px;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 42ch;
}
.hero-note p { margin: 0 0 10px; }
.hero-note p:last-child { margin: 0; }
.hero-note .muted { color: var(--pencil); font-style: italic; }

.lineno {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--pencil);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero-cta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 14px;
}

/* ── buttons ── */
.btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  line-height: 1.25;
  letter-spacing: 0.05em;
  padding: 13px 18px 12px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition:
    transform 200ms cubic-bezier(.2,.8,.2,1),
    box-shadow 200ms cubic-bezier(.2,.8,.2,1);
  box-shadow: 4px 4px 0 var(--ink);
}
.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
  text-decoration: none;
}
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}
.btn.ink { background: var(--ink); color: var(--paper); border-color: var(--ink); box-shadow: 4px 4px 0 var(--cut); }
.btn.ink:hover { box-shadow: 6px 6px 0 var(--cut); }
.btn.ink:active { box-shadow: 0 0 0 var(--cut); }
.btn.ink .dim { color: rgba(239, 231, 214, 0.55); margin-left: 4px; }

/* ── ops card from the previous content, restyled as paper/terminal ── */
.ops-card {
  border: 1px solid var(--rule);
  background:
    linear-gradient(135deg, rgba(239, 231, 214, 0.82), rgba(230, 219, 196, 0.94)),
    var(--paper-shade);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 10px 10px 0 rgba(20, 17, 13, 0.08);
}
.ops-top {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.ops-top em {
  margin-left: auto;
  color: var(--cut);
  font-style: normal;
  letter-spacing: 0.12em;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cut);
  box-shadow: 0 0 0 4px var(--cut-soft);
}
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.metric-grid article {
  min-height: 88px;
  border: 1px solid var(--rule-soft);
  background: rgba(239, 231, 214, 0.72);
  padding: 13px;
}
.metric-grid article.wide { grid-column: 1 / -1; min-height: auto; }
.metric-grid span {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--pencil);
  text-transform: uppercase;
  margin-bottom: 7px;
}
.metric-grid strong {
  display: block;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.18;
}
.route-box {
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  color: var(--ink-soft);
  font-size: 15.5px;
}
.route-box p { margin: 0; }
.route-box b { color: var(--cut); font-weight: 700; }

/* ── section heads ── */
.sec-head {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 18px;
  align-items: baseline;
  margin: 30px 0 28px;
}
.sec-head .lineno { margin: 0; padding-top: 8px; align-self: flex-start; }
.sec-head h2 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 96, "SOFT" 100, "WONK" 0;
}
.sec-head .sec-sub {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
  max-width: 64ch;
  line-height: 1.5;
}
.sec-head code,
.sec-sub code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.86em;
  background: var(--paper-shade);
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid var(--rule-soft);
}

/* ── features list ── */
.feat-list {
  list-style: none;
  padding: 0; margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 56px;
}
.feat-list.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.feat-list li {
  position: relative;
  padding: 16px 0 4px 38px;
  border-top: 1px solid var(--rule);
}
.feat-list .num {
  position: absolute;
  left: 0;
  top: 16px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cut);
}
.feat-list h3 {
  margin: 0 0 6px;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 36, "SOFT" 100;
}
.feat-list p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.5;
  max-width: 40ch;
}
.feat-list code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85em;
  background: var(--paper-shade);
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--rule-soft);
}
.feat-list em { color: var(--cut); font-style: italic; font-variation-settings: "opsz" 24, "SOFT" 100, "WONK" 1; }

/* ── project cards ── */
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.project-grid.five .project-card.feature {
  grid-row: span 2;
}
.project-card {
  background: var(--paper-shade);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 24px 28px;
  transition: box-shadow 200ms ease, transform 200ms ease;
}
.project-card:hover {
  box-shadow: 0 8px 24px rgba(20, 17, 13, 0.12);
  transform: translateY(-2px);
}
.project-tag {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cut);
  margin-bottom: 12px;
}
.project-card h3 {
  margin: 0 0 8px;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 36, "SOFT" 100;
}
.project-card p {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.5;
}
.project-card a {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.project-card a:hover { border-bottom-color: var(--cut); text-decoration: none; }

/* ── manpage block ── */
.man {
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  padding: 28px 32px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  line-height: 1.75;
  position: relative;
  overflow: auto;
  box-shadow:
    0 30px 60px -30px rgba(20, 17, 13, 0.5),
    0 8px 18px -8px rgba(20, 17, 13, 0.18);
}
.man pre { margin: 0; }
.man-h {
  display: inline-block;
  color: var(--cut);
  font-weight: 700;
  letter-spacing: 0.14em;
}
.man strong { color: var(--term-amber); font-weight: 700; }

.arch-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.18fr);
  gap: 22px;
  align-items: stretch;
}
.profile-strip {
  height: 100%;
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 20px;
  background: var(--paper-shade);
}
.profile-strip img {
  width: 118px;
  height: 118px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--rule);
  filter: sepia(0.22) contrast(0.96);
}
.profile-strip h3 {
  margin: 0 0 6px;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.1;
}
.profile-strip p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.45;
}
.cta-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 28px 0;
}
.cta-block h2 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(32px, 4.6vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 400;
  font-variation-settings: "opsz" 96, "SOFT" 100, "WONK" 0;
}

/* ── colophon ── */
.colophon {
  padding: 24px 0 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: baseline;
}
.signature {
  margin: 0;
  font-style: italic;
  font-size: 17.5px;
  color: var(--ink-soft);
  font-variation-settings: "opsz" 18, "SOFT" 100, "WONK" 1;
}
.signature a {
  color: var(--cut);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.set {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--pencil);
  text-transform: uppercase;
}
.set a {
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.set a:hover { border-bottom-color: var(--cut); text-decoration: none; }
.set .serif {
  font-family: "Fraunces", serif;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  font-variation-settings: "opsz" 14, "SOFT" 100, "WONK" 1;
}
.set .mono {
  font-family: "JetBrains Mono", monospace;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}

/* ── entry choreography ── */
@media (prefers-reduced-motion: no-preference) {
  .headline .line {
    animation: rise 850ms cubic-bezier(.2,.85,.25,1) both;
  }
  .headline .line:nth-child(1) { animation-delay: 80ms; }
  .headline .line:nth-child(2) { animation-delay: 240ms; }
  .hero-note { animation: rise 850ms cubic-bezier(.2,.85,.25,1) both; animation-delay: 420ms; }
  .hero-cta { animation: rise 850ms cubic-bezier(.2,.85,.25,1) both; animation-delay: 560ms; }
  .crops .crop { animation: fade 700ms ease both; animation-delay: 200ms; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 0.55; } }

/* ── responsive ── */
@media (max-width: 920px) {
  :root { --gutter-x: 32px; }
  .hero { padding-top: 24px; }
  .hero-foot,
  .hero-foot-wide {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .headline.copy-heavy { max-width: 100%; }
  .hero-note {
    border-left: 0;
    border-top: 1px solid var(--rule);
    padding: 14px 0 0;
    max-width: 60ch;
  }
  .feat-list,
  .feat-list.three { grid-template-columns: 1fr; gap: 16px; }
  .project-grid,
  .project-grid.five { grid-template-columns: 1fr; }
  .project-grid.five .project-card.feature { grid-row: auto; }
  .arch-grid { grid-template-columns: 1fr; }
  .cta-block { grid-template-columns: 1fr; }
  .sec-head { grid-template-columns: 1fr; gap: 6px; }
  .sec-head .lineno { padding-top: 0; }
  .colophon { grid-template-columns: 1fr; }
  .crop { width: 16px; height: 16px; opacity: 0.4; }
  .mast-row { gap: 10px; }
  .mast-nav { justify-content: flex-start; }
}

@media (max-width: 540px) {
  :root { --gutter-x: 22px; }
  .masthead { padding-top: 36px; }
  .headline { font-size: clamp(60px, 18vw, 110px); }
  .headline.copy-heavy { font-size: clamp(47px, 14vw, 76px); }
  .brand-mark { width: 36px; height: 36px; box-shadow: 2px 2px 0 var(--cut); }
  .mast-nav { gap: 8px 12px; }
  .metric-grid { grid-template-columns: 1fr; }
  .profile-strip { grid-template-columns: 1fr; }
  .profile-strip img { width: 96px; height: 96px; }
  .man { padding: 22px 18px; font-size: 12px; }
  .project-card { padding: 20px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .headline .line { animation: none; }
  .hero-note, .hero-cta { animation: none; }
  .crops .crop { animation: none; }
}
