/* ─────────────────────────────────────────────
   Argo · Private Server
   ───────────────────────────────────────────── */

:root {
  --bg: #F2F2F0;
  --surface: #F3F3F1;
  --ink: #0A0A0A;
  --ink-2: #3B3B39;
  --muted: #8E8E8A;
  --line: #BDBDB8;
  --cover: #5C5C5A;
  --danger: #B42318;
  --shadow: 0 0 0 1px rgba(0,0,0,.02), 0 34px 80px -26px rgba(0,0,0,.24), 0 0 46px rgba(0,0,0,.06);
  --shadow-lift: 0 0 0 1px rgba(0,0,0,.02), 0 50px 90px -24px rgba(0,0,0,.30), 0 0 60px rgba(0,0,0,.09);
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* Riel de proyectos (escritorio, medido sobre el diseño 1512×982) */
  --card-w: 199px;
  --gap: 100px;
  --pad-x: 88px;
  --rest: 58.6vh;   /* dónde descansa la tarjeta */
  --lift: 32vh;     /* cuánto sube al hover */

  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--bg); }
body { overflow: hidden; overscroll-behavior: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ── Marca ── */
.eyebrow { display: block; font-size: 24px; font-weight: 400; line-height: 1.15; letter-spacing: -.005em; }
.title { display: block; font-size: 48px; font-weight: 700; line-height: 1.02; letter-spacing: -.028em; }

/* ── Pantalla de carga ── */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg);
  transition: opacity .45s var(--ease), visibility 0s linear .45s;
}
.splash .brand { width: 200px; animation: fadeUp .7s var(--ease) both; }
.splash-bar { width: 200px; height: 1px; margin-top: 22px; background: rgba(0,0,0,.1); overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 0; background: var(--ink); animation: load 1.4s var(--ease) forwards; }
.splash.is-done { opacity: 0; visibility: hidden; }
.splash.is-done .splash-bar i { width: 100%; animation: none; transition: width .25s; }

/* ── Login / setup / recuperación ── */
.auth { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.auth-card {
  position: relative;
  width: 322px;
  margin: 35vh auto 0;
  min-height: 65vh;
  padding: 30px 20px 48px;
  background: var(--surface);
  border-radius: 5px 5px 0 0;
  box-shadow: var(--shadow);
  animation: rise .85s var(--ease) both;
}
.auth.is-tall .auth-card { margin-top: 18vh; min-height: 82vh; }
.auth-card .brand { margin-bottom: 46px; }
.auth.is-leaving .auth-card { animation: sink .5s cubic-bezier(.6,0,.8,.2) both; }

.field { display: block; position: relative; }
.field + .field { margin-top: 47px; }
.field.tight + .field.tight { margin-top: 14px; }
.field > span {
  position: absolute; top: 9px; left: 17px;
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
  color: #A3A39E; pointer-events: none;
}
.field input {
  width: 100%; height: 50px;
  padding: 21px 16px 6px;
  border: 1px solid var(--line); border-radius: 4px;
  background: transparent;
  font-size: 16px;               /* 16px: iOS no hace zoom al enfocar */
  outline: none;
  transition: border-color .2s;
}
.field input:focus { border-color: var(--ink); }
.field input:focus + i, .field:focus-within > span { color: var(--ink-2); }

.btn {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 50px; margin-top: 23px;
  background: #000; color: #fff; border-radius: 3px;
  font-size: 14px; font-weight: 500; letter-spacing: .01em;
  transition: transform .15s, opacity .2s;
}
.btn:active { transform: scale(.985); }
.btn svg { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn.is-busy { pointer-events: none; }
.btn.is-busy > * { opacity: 0; }
.btn.is-busy::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 35%;
  background: #fff; animation: slide .9s linear infinite;
}

.msg { min-height: 18px; margin-top: 12px; font-size: 12px; line-height: 1.45; color: var(--danger); }
.msg.is-ok { color: var(--ink-2); }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 14px; height: 14px; accent-color: #000; }
.link { font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link:hover { color: var(--ink); }
.hint { margin: -22px 0 26px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.shake { animation: shake .38s; }

/* ── Home ── */
.home-head {
  position: fixed; z-index: 3;
  top: calc(env(safe-area-inset-top) + 30px); left: 30px; right: 30px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
  transition: opacity .3s;
}
.home-head > * { pointer-events: auto; }
.home-head .brand { animation: fadeUp .6s var(--ease) both; }
.home-actions { display: flex; gap: 22px; padding-top: 6px; animation: fadeUp .6s .15s var(--ease) both; }
.ghost { font-size: 13px; color: var(--ink-2); padding: 6px 0; border-bottom: 1px solid transparent; transition: border-color .2s, color .2s; }
.ghost:hover { color: var(--ink); border-color: var(--ink); }

.rail {
  position: fixed; inset: 0; z-index: 1;
  display: flex; gap: var(--gap);
  padding: 0 var(--pad-x);
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  outline: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail::after { content: ''; flex: 0 0 1px; }   /* respeta el padding final al hacer scroll */

.card {
  position: relative; display: block;
  flex: 0 0 var(--card-w);
  height: 100vh; height: 100lvh;
  margin-top: var(--rest);
  padding: 13px;
  background: var(--surface);
  border-radius: 5px 5px 0 0;
  box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
  outline: none;
  isolation: isolate;
  /* Solo transform y opacity: ambas las resuelve la GPU sin repintar */
  transition: transform .6s var(--ease), opacity .35s;
  will-change: transform;
  backface-visibility: hidden;
  animation: rise .95s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms + 60ms);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
/* La sombra "levantada" vive en una capa aparte que solo cambia de opacidad.
   Animar box-shadow directamente obliga a repintar un blur de 90px en cada cuadro. */
.card::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transition: opacity .6s var(--ease);
  pointer-events: none;
}
@media (hover: hover) {
  .card:hover { transform: translateY(calc(var(--lift) * -1)); }
  .card:hover::before { opacity: 1; }
}
.card:focus-visible, .card.is-focus { transform: translateY(calc(var(--lift) * -1)); }
.card:focus-visible::before, .card.is-focus::before { opacity: 1; }
.card:focus-visible { box-shadow: var(--shadow), 0 0 0 2px var(--ink); }

.cover { aspect-ratio: 1; background: var(--cover); overflow: hidden; display: grid; place-items: center; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover--icon { background: #E4E4E1; }
.cover--icon img { width: 54%; height: 54%; object-fit: contain; border-radius: 22%; }
.cover--empty span { color: rgba(255,255,255,.3); font-size: 44px; font-weight: 700; letter-spacing: -.04em; }

.card h2 { margin-top: 11px; font-size: 20px; font-weight: 700; line-height: 1.2; letter-spacing: -.015em; overflow-wrap: anywhere; }
.card p { margin-top: 9px; max-width: 128px; min-height: 3.66em; font-size: 10px; line-height: 1.22; color: var(--ink-2); }
.card time { display: block; margin-top: 38px; font-size: 9px; color: var(--ink-2); }
.badge {
  position: absolute; top: 20px; right: 20px;
  padding: 3px 6px; border-radius: 2px;
  background: var(--surface); color: var(--ink);
  font-size: 9px; letter-spacing: .07em; text-transform: uppercase;
}

/* Al entrar a un proyecto: la tarjeta termina de subir y el resto se retira */
body.is-leaving .card:not(.is-launch) { opacity: 0; }
body.is-leaving .home-head { opacity: 0; }
.card.is-launch {
  z-index: 2;
  transform: translateY(calc(var(--rest) * -1)) !important;
  transition: transform .45s cubic-bezier(.5, 0, .2, 1);
}

.empty {
  position: fixed; left: 30px; bottom: calc(env(safe-area-inset-bottom) + 40px);
  max-width: 380px; font-size: 13px; line-height: 1.55; color: var(--ink-2);
  animation: fadeUp .6s .2s var(--ease) both;
}
.empty code { font-size: 12px; background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 3px; }

/* ── Gestionar ── */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end; }
.scrim { position: absolute; inset: 0; background: rgba(20,20,18,.2); animation: fade .3s both; }
.sheet {
  position: relative; width: min(540px, 100%); height: 100%;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 28px calc(env(safe-area-inset-bottom) + 60px);
  background: var(--bg);
  box-shadow: -30px 0 80px rgba(0,0,0,.14);
  animation: slideIn .5s var(--ease) both;
}
.sheet-wrap.is-closing .sheet { animation: slideOut .35s cubic-bezier(.6,0,.8,.2) both; }
.sheet-wrap.is-closing .scrim { animation: fade .35s reverse both; }
.sheet-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 26px) 0 16px;
  background: var(--bg);
}
.sheet-head h2 { font-size: 30px; font-weight: 700; letter-spacing: -.025em; }
.sheet h3 { margin: 30px 0 12px; font-size: 11px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.sheet-note { font-size: 12px; line-height: 1.5; color: var(--ink-2); }

.status { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; line-height: 1.5; }
.status::before { content: ''; flex: none; width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: #2E7D4F; }
.status.is-bad::before { background: #C77700; }
.status .link { margin-left: 4px; }

.rows { list-style: none; padding: 0; display: grid; gap: 12px; }
.row {
  display: grid; gap: 12px; padding: 14px;
  background: var(--surface); border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.03), 0 14px 30px -22px rgba(0,0,0,.3);
  transition: opacity .2s;
}
.row.is-off { opacity: .62; }
.row-top { display: flex; gap: 12px; align-items: center; }
.thumb { flex: none; width: 48px; height: 48px; border-radius: 3px; overflow: hidden; background: var(--cover); display: grid; place-items: center; color: rgba(255,255,255,.4); font-weight: 700; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-icon { background: #E4E4E1; }
.thumb.is-icon img { width: 62%; height: 62%; object-fit: contain; }
.row-id { flex: 1; min-width: 0; }
.row-id strong { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-id small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.row-move { display: flex; gap: 6px; }
.row-move button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 3px; font-size: 14px; color: var(--ink-2); }
.row-move button:hover { border-color: var(--ink); color: var(--ink); }
.row-move button:disabled { opacity: .3; pointer-events: none; }

.mini { display: grid; gap: 5px; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.mini input, .mini textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 4px; background: transparent;
  font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--ink);
  outline: none; resize: vertical;
}
.mini input:focus, .mini textarea:focus { border-color: var(--ink); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--ink-2); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 15px; height: 15px; accent-color: #000; }
.row-actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.warn { padding: 9px 11px; border-radius: 3px; background: #FBF1DD; color: #7A4A00; font-size: 12px; line-height: 1.45; }

.account { display: grid; gap: 10px; }
.account .btn { margin-top: 6px; }
.danger-zone { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 16px; }

/* ── Aviso flotante ── */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px);
  padding: 10px 16px; border-radius: 999px;
  background: #0A0A0A; color: #fff; font-size: 13px;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── Mobile ── */
@media (max-width: 700px) {
  :root {
    --card-w: min(66vw, 290px);
    --gap: 16px;
    --rest: 47vh;
    --lift: 17vh;
  }
  .eyebrow { font-size: 18px; }
  .title { font-size: 40px; }
  .home-head { top: calc(env(safe-area-inset-top) + 18px); left: 20px; right: 20px; }
  .home-actions { gap: 16px; }
  .ghost { font-size: 14px; padding: 8px 0; }

  .rail {
    padding: 0 calc((100vw - var(--card-w)) / 2);
    scroll-snap-type: x mandatory;
  }
  .card { scroll-snap-align: center; scroll-snap-stop: always; padding: 12px; }
  .card h2 { font-size: 24px; margin-top: 14px; }
  .card p { max-width: none; min-height: 4.05em; font-size: 13px; line-height: 1.35; }
  .card time { margin-top: 22px; font-size: 11px; }
  .badge { top: 19px; right: 19px; }

  .auth-card { width: auto; margin: 22vh 14px 0; min-height: 78vh; padding: 28px 18px 48px; }
  .auth.is-tall .auth-card { margin-top: 10vh; min-height: 90vh; }
  .field + .field { margin-top: 14px; }
  .auth-card .brand { margin-bottom: 34px; }
  .hint { margin-top: -12px; }
  .auth-row { margin-top: 8px; font-size: 13px; }
  .link { font-size: 13px; }

  .sheet-wrap { align-items: flex-end; }
  .sheet { width: 100%; height: 94%; border-radius: 12px 12px 0 0; padding: 0 16px calc(env(safe-area-inset-bottom) + 60px); animation-name: sheetUp; }
  .sheet-wrap.is-closing .sheet { animation-name: sheetDown; }
  .sheet-head { padding-top: 20px; }
  .mini input, .mini textarea { font-size: 16px; }
  .pair { grid-template-columns: 1fr; }
  .empty { left: 20px; right: 20px; }
}

@media (max-height: 640px) and (min-width: 701px) {
  :root { --rest: 50vh; --lift: 24vh; }
}

/* ── Movimiento ── */
@keyframes rise { from { translate: 0 100vh; } to { translate: 0 0; } }
@keyframes sink { from { translate: 0 0; } to { translate: 0 110vh; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes load { 0% { width: 0; } 60% { width: 70%; } 100% { width: 88%; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes slideOut { from { transform: none; } to { transform: translateX(100%); } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { from { transform: none; } to { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
