/* ============================================================
   Repositorio de proyectos — warm paper + hand-drawn ink
   ============================================================ */

:root {
  --bg: #f8f2e2;
  --bg-soft: #f2ead6;
  --ink: #0a0a0a;
  --ink-soft: #3a352c;
  --ink-mute: #6b6355;
  --rule: #0a0a0a;
  --accent: #b3341f;
  --card: #fbf7ec;
  --grain-opacity: 0.055;
  --shadow: 3px 3px 0 var(--ink);
  --maxw: 1120px;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

html[data-theme="dark"] {
  --bg: #14120e;
  --bg-soft: #1c1913;
  --ink: #f4eddc;
  --ink-soft: #d8cfba;
  --ink-mute: #a49a86;
  --rule: #f4eddc;
  --accent: #e8795a;
  --card: #1b1812;
  --grain-opacity: 0.075;
  --shadow: 3px 3px 0 rgba(244, 237, 220, 0.35);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #14120e;
    --bg-soft: #1c1913;
    --ink: #f4eddc;
    --ink-soft: #d8cfba;
    --ink-mute: #a49a86;
    --rule: #f4eddc;
    --accent: #e8795a;
    --card: #1b1812;
    --grain-opacity: 0.075;
    --shadow: 3px 3px 0 rgba(244, 237, 220, 0.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 0, "WONK" 1;
  font-size: 1.0625rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
  overflow-x: hidden;
}

/* animated noise field over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  filter: url(#grain);
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
}
html[data-theme="dark"] body::before { mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body::before { mix-blend-mode: screen; }
}

.noise-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

img, video { max-width: 100%; height: auto; display: block; }

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

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

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem);
  position: relative;
  z-index: 1;
}

/* ---------------- header ---------------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
}

.top-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 62px;
  flex-wrap: wrap;
  padding-block: 0.55rem;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}
.mark-square {
  width: 13px; height: 13px;
  border: 2px solid var(--ink);
  border-radius: 1px 3px 2px 4px;
  transform: rotate(-4deg);
  display: inline-block;
}

.nav {
  display: flex;
  gap: 1.15rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.nav a {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.5rem 0.15rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav a:hover { color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px 5px 3px 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.theme-toggle:hover { background: var(--ink); color: var(--bg); }
.theme-icon { font-size: 0.95rem; line-height: 1; }

/* ---------------- hero ---------------- */

.hero {
  padding-block: clamp(3rem, 9vw, 6.5rem) clamp(2.5rem, 6vw, 4rem);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 1.5rem;
}

.stacked {
  font-size: clamp(2.6rem, 9vw, 6.2rem);
  line-height: 0.94;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 clamp(1.8rem, 4vw, 2.8rem);
  font-variation-settings: "SOFT" 20, "WONK" 1;
}
.stacked span { display: block; }
.stacked span:nth-child(1) { margin-left: 0; }
.stacked span:nth-child(2) { margin-left: clamp(0.8rem, 6vw, 3.4rem); }
.stacked span:nth-child(3) {
  margin-left: clamp(0rem, 2vw, 1rem);
  font-style: italic;
  font-weight: 400;
}

.hero-foot {
  display: grid;
  gap: 1.4rem;
  max-width: 46rem;
  margin-left: clamp(0rem, 8vw, 6rem);
}
.lede {
  font-size: clamp(1.02rem, 1.6vw, 1.18rem);
  color: var(--ink-soft);
  margin: 0;
}
.lede-note {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--ink-mute);
  margin: 0;
  max-width: 34rem;
}

/* hand-drawn scribble underline */
.scribble {
  position: relative;
  color: var(--ink);
  white-space: nowrap;
}
.scribble::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -3px;
  height: 6px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 8' preserveAspectRatio='none'><path d='M1 5.5 C 18 1.5, 34 7.5, 52 4.2 S 88 1.2, 119 5' fill='none' stroke='%23b3341f' stroke-width='1.6' stroke-linecap='round'/></svg>");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
html[data-theme="dark"] .scribble::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 8' preserveAspectRatio='none'><path d='M1 5.5 C 18 1.5, 34 7.5, 52 4.2 S 88 1.2, 119 5' fill='none' stroke='%23e8795a' stroke-width='1.6' stroke-linecap='round'/></svg>");
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .scribble::after {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 8' preserveAspectRatio='none'><path d='M1 5.5 C 18 1.5, 34 7.5, 52 4.2 S 88 1.2, 119 5' fill='none' stroke='%23e8795a' stroke-width='1.6' stroke-linecap='round'/></svg>");
  }
}

/* ---------------- section titles ---------------- */

.section-title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 1.6rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
}

/* ---------------- broken bento ---------------- */

.bento { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

.bento-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 2px 6px 3px 5px;
  padding: clamp(1.15rem, 2.6vw, 1.6rem);
  position: relative;
}
.card:nth-child(odd) { border-width: 1px 2px 2px 1px; }
.card:nth-child(even) { border-width: 2px 1px 1px 2px; }

.card h3 {
  font-size: clamp(1.22rem, 2.4vw, 1.5rem);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.7rem;
  letter-spacing: -0.012em;
}
.card p { margin: 0 0 0.85rem; color: var(--ink-soft); font-size: 0.97rem; }
.card p:last-child { margin-bottom: 0; }

.card-kicker {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem !important;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0 0 0.9rem;
}
.tags li {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--ink) 45%, transparent);
  border-radius: 2px 4px 2px 3px;
  padding: 0.18rem 0.45rem;
  color: var(--ink-soft);
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem !important;
  letter-spacing: 0.02em;
  color: var(--ink-mute) !important;
  border-top: 1px dashed color-mix(in srgb, var(--ink) 30%, transparent);
  padding-top: 0.7rem;
}
.card-meta strong { color: var(--ink); font-weight: 500; }

.card-note {
  background: transparent;
  border-style: dashed;
  border-width: 1px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.note-body {
  font-style: italic;
  font-size: 0.95rem !important;
  color: var(--ink-mute) !important;
  margin: 0 !important;
}

@media (min-width: 720px) {
  .bento-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 1.3rem;
    align-items: start;
  }
  .card-wide   { grid-column: 1 / 5; }
  .card-tall   { grid-column: 5 / 7; margin-top: 2.6rem; }
  .card-offset { grid-column: 2 / 5; margin-top: -0.6rem; }
  .card-note   { grid-column: 5 / 7; margin-top: 1.4rem; }
  .card-wide2  { grid-column: 1 / 4; margin-top: 1.1rem; }
  .card-small  { grid-column: 4 / 7; margin-top: 3.2rem; }
}

/* ---------------- drag band ---------------- */

.band-section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  border-top: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  background: var(--bg-soft);
  position: relative;
  z-index: 1;
}

.band-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  margin: -0.9rem 0 1.4rem;
}

.band {
  overflow: hidden;
  cursor: grab;
  padding-block: 0.4rem 1.2rem;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.band.is-dragging { cursor: grabbing; }
.band:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

.band-track {
  display: flex;
  gap: 1.1rem;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem);
  width: max-content;
  will-change: transform;
}

.band-item {
  flex: 0 0 auto;
  width: min(78vw, 300px);
  background: var(--card);
  border: 1px solid var(--ink);
  border-width: 1px 2px 2px 1px;
  border-radius: 2px 6px 3px 5px;
  padding: 1.15rem;
}
.band-item h3 {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.55rem;
}
.band-item p { margin: 0; font-size: 0.92rem; color: var(--ink-soft); }
.band-date {
  font-family: var(--font-mono);
  font-size: 0.66rem !important;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent) !important;
  margin-bottom: 0.55rem !important;
}

/* ---------------- método ---------------- */

.metodo { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

.metodo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.6rem;
}
.metodo-col h3 {
  font-size: 1.18rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
.metodo-col p { margin: 0; color: var(--ink-soft); font-size: 0.97rem; }

@media (min-width: 720px) {
  .metodo-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 1.6rem 1.4rem;
  }
  .metodo-col { grid-column: 1 / 4; }
  .metodo-col-offset { grid-column: 4 / 7; margin-top: 2.2rem; }
  .metodo-col:last-child { grid-column: 2 / 6; margin-top: 0.6rem; }
}

/* ---------------- contacto ---------------- */

.contacto {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5rem);
}

.contacto-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 780px) {
  .contacto-grid { grid-template-columns: 1fr 1fr; gap: 3rem; }
}

.contacto-lede { font-size: 1.05rem; color: var(--ink-soft); margin: 0 0 1.4rem; }

.contacto-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 2.1;
  color: var(--ink-mute);
}
.contacto-list a { color: var(--ink); }

.ph {
  border-bottom: 1px dotted var(--ink-mute);
  color: var(--ink-mute);
}

.form {
  display: grid;
  gap: 0.45rem;
  align-content: start;
}
.form label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 0.5rem;
}
.form input,
.form textarea {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--ink);
  border-width: 1px 2px 2px 1px;
  border-radius: 2px 5px 3px 4px;
  padding: 0.7rem 0.8rem;
  width: 100%;
  min-height: 44px;
  resize: vertical;
}
.form input:focus-visible,
.form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.form button {
  margin-top: 1rem;
  min-height: 44px;
  padding: 0.7rem 1.4rem;
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px 6px 3px 5px;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.18s ease;
}
.form button:hover { transform: translate(-1px, -1px); }
.form button:disabled { opacity: 0.6; cursor: wait; transform: none; }

.form-status {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin: 0.6rem 0 0;
}

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

.foot {
  border-top: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  padding-block: 1.6rem 2.4rem;
  position: relative;
  z-index: 1;
}
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.foot-mark {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0;
}
.attribution {
  position: static;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 1;
  margin: 0;
  color: var(--ink-mute);
}
.attribution a { color: var(--ink-mute); text-decoration: underline; }
.attribution a:hover { color: var(--accent); }

/* ---------------- motion: staggered line reveal ---------------- */

@keyframes riseIn {
  from { opacity: 0; translate: 0 20px; }
  to   { opacity: 1; translate: 0 0; }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .hero .eyebrow,
    .hero .lede,
    .hero .lede-note,
    .card,
    .metodo-col,
    .contacto-grid > *,
    .band-item {
      animation: riseIn linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 38%;
    }
    .hero .lede { animation-range: entry 0% cover 30%; }
    .card:nth-child(2n) { animation-range: entry 0% cover 44%; }
    .card:nth-child(3n) { animation-range: entry 0% cover 34%; }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .band { overflow-x: auto; }
  .band-track { will-change: auto; }
}
