/* NASA Space Apps — Ciudad del Este · Catálogo de Mentores
   Marca: Overpass (texto) · Fira Sans (títulos) · Fira Code (datos)
   Paleta oficial: Deep Blue / Electric Blue / Neon Blue / Blue Yonder / Rocket Red / Neon Yellow */
:root {
  --deep: #07173F;
  --electric: #0042A6;
  --neon-blue: #0960E1;
  --yonder: #2E96F5;
  --rocket: #E43700;
  --martian: #8E1100;
  --yellow: #EAFE07;
  --white: #fff;
  --muted: #B9C6E4;          /* texto secundario sobre Deep Blue (AAA) */
  --line: rgba(255, 255, 255, .14);
  --card: rgba(255, 255, 255, .06);
  --card-hover: rgba(255, 255, 255, .10);
  --radius: 16px;
  --f-title: 'Fira Sans', system-ui, sans-serif;
  --f-body: 'Overpass', system-ui, sans-serif;
  --f-mono: 'Fira Code', ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--white);
  font-family: var(--f-body); font-size: 1.0625rem; line-height: 1.55;
  background: var(--deep) linear-gradient(135deg, var(--electric) 0%, var(--deep) 62%) no-repeat;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-family: var(--f-title); font-weight: 900; line-height: 1.08; margin: 0; letter-spacing: -.01em; }
a { color: var(--yellow); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.wrap { width: min(1180px, 100% - 2rem); margin-inline: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }

/* ---------- cabecera ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; }
.logo { height: 58px; width: auto; aspect-ratio: 5 / 2; }
.top nav a { font-family: var(--f-mono); font-size: .82rem; text-decoration: none; color: var(--muted); padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 999px; }
.top nav a:hover { color: var(--white); border-color: var(--yonder); }

.hero { padding: 2.2rem 0 1.4rem; max-width: 820px; }
.kicker { font-family: var(--f-mono); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--yonder); margin: 0 0 .8rem; }
.hero h1 { font-size: clamp(2.3rem, 6vw, 4.2rem); }
.hero h1 em { font-style: normal; color: var(--yellow); }
.hero p.lead { color: var(--muted); font-size: 1.2rem; font-weight: 300; margin: 1rem 0 0; max-width: 60ch; }

/* ---------- buscador ---------- */
.search { position: relative; margin-top: 1.8rem; }
.search svg { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; stroke: var(--muted); fill: none; stroke-width: 2; pointer-events: none; }
.search input {
  width: 100%; padding: 1.1rem 3.6rem 1.1rem 3.2rem; font-size: 1.15rem;
  background: rgba(7, 23, 63, .7); border: 2px solid rgba(255, 255, 255, .25); border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: #9fb1d8; }
.search input:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(234, 254, 7, .18); }
.search kbd { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); font-family: var(--f-mono); font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .45rem; }
.search .clear { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 1.6rem; line-height: 1; color: var(--muted); padding: .3rem .6rem; display: none; }
.search.has-q .clear { display: block; } .search.has-q kbd { display: none; }
.try { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .9rem; font-size: .92rem; color: var(--muted); }
.try button { background: none; border: 1px dashed rgba(255, 255, 255, .3); color: var(--white); border-radius: 999px; padding: .2rem .8rem; cursor: pointer; font-size: .9rem; }
.try button:hover { border-color: var(--yellow); color: var(--yellow); }

/* ---------- filtros ---------- */
.filters { margin: 1.6rem 0 1rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(7, 23, 63, .45); }
.filters-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.2rem; margin-bottom: .9rem; }
.filters-head h2 { font-size: 1rem; font-family: var(--f-mono); font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { background: none; border: 0; padding: .35rem .85rem; font-size: .88rem; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--deep); font-weight: 700; }
select.sel { background: rgba(7, 23, 63, .8); border: 1px solid var(--line); border-radius: 999px; padding: .38rem .9rem; font-size: .88rem; max-width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  background: var(--card); border: 1px solid rgba(255, 255, 255, .22); color: var(--white);
  padding: .38rem .85rem; border-radius: 999px; font-size: .93rem; transition: background .12s, border-color .12s, transform .12s;
}
.chip:hover { background: var(--card-hover); border-color: var(--yonder); }
.chip .n { font-family: var(--f-mono); font-size: .74rem; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--yellow); border-color: var(--yellow); color: var(--deep); font-weight: 700; }
.chip[aria-pressed="true"] .n { color: var(--deep); }
.more { background: none; border: 0; color: var(--yellow); cursor: pointer; text-decoration: underline; padding: .4rem .3rem; font-size: .92rem; }

.status { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 1.2rem 0 1rem; min-height: 2rem; }
.status .count { font-family: var(--f-mono); font-size: .9rem; color: var(--muted); }
.status .count b { color: var(--white); font-size: 1.1rem; }
.reset { background: none; border: 1px solid var(--line); color: var(--white); border-radius: 999px; padding: .25rem .85rem; cursor: pointer; font-size: .88rem; }
.reset:hover { border-color: var(--rocket); }
.expanded { font-size: .9rem; color: var(--muted); }
.expanded b { color: var(--yellow); font-weight: 600; }

/* ---------- tarjetas ---------- */
.grid > li { content-visibility: auto; contain-intrinsic-size: auto 380px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; padding-bottom: 3rem; list-style: none; margin: 0; padding-inline: 0; }
.card {
  position: relative; display: flex; flex-direction: column; height: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; cursor: pointer; text-align: left; width: 100%;
  transition: transform .18s ease, background .18s, border-color .18s;
}
.card:hover { transform: translateY(-4px); background: var(--card-hover); border-color: rgba(255, 255, 255, .35); }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, var(--neon-blue), var(--deep)); margin-bottom: 1rem; }
.photo img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.photo .ini { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-title); font-weight: 900; font-size: 3.4rem; color: rgba(255, 255, 255, .85); }
.card h3 { font-size: 1.28rem; }
.card .org { color: var(--muted); font-size: .95rem; margin: .25rem 0 0; font-weight: 300; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; padding-top: .9rem; }
.tag { font-family: var(--f-mono); font-size: .74rem; padding: .22rem .6rem; border-radius: 6px; background: rgba(46, 150, 245, .18); border: 1px solid rgba(46, 150, 245, .5); color: #d8e9ff; }
.tag.hit { background: var(--yellow); border-color: var(--yellow); color: var(--deep); font-weight: 600; }
mark { background: rgba(234, 254, 7, .85); color: var(--deep); border-radius: 3px; padding: 0 .1em; }
.empty { grid-column: 1 / -1; text-align: center; padding: 3rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty h3 { color: var(--white); margin-bottom: .6rem; }
.empty button { margin: .25rem; }

/* ---------- modal ---------- */
dialog { border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(680px, calc(100% - 1.5rem)); color: var(--white); background: linear-gradient(135deg, var(--electric), var(--deep) 70%); max-height: 90vh; }
dialog::backdrop { background: rgba(3, 9, 28, .82); }
.modal { display: grid; grid-template-columns: 210px 1fr; gap: 1.6rem; padding: 1.8rem; }
.modal .photo { margin: 0; }
.modal h2 { font-size: 2rem; }
.modal .org { color: var(--muted); margin: .4rem 0 0; }
.modal h4 { font-family: var(--f-mono); font-size: .75rem; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; color: var(--yonder); margin: 1.3rem 0 .5rem; }
.modal .tags { padding-top: 0; }
.modal .bio { margin: 0; color: #e6edfb; }
.x { position: absolute; top: .7rem; right: .8rem; background: rgba(255, 255, 255, .1); border: 0; border-radius: 50%; width: 38px; height: 38px; font-size: 1.4rem; cursor: pointer; line-height: 1; }
.x:hover { background: rgba(255, 255, 255, .22); }
@media (max-width: 620px) { .modal { grid-template-columns: 1fr; padding: 1.3rem; } .modal .photo { max-width: 200px; } }

footer { border-top: 1px solid var(--line); padding: 1.6rem 0 2.4rem; color: var(--muted); font-size: .88rem; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem; }
.skeleton { height: 360px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card), var(--card-hover), var(--card)); background-size: 200% 100%; animation: sh 1.4s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- admin ---------- */
.btn { display: inline-flex; align-items: center; gap: .5rem; border: 0; cursor: pointer; background: var(--yellow); color: var(--deep); font-weight: 700; padding: .65rem 1.2rem; border-radius: 10px; text-decoration: none; }
.btn:hover { filter: brightness(.93); }
.btn.ghost { background: none; color: var(--white); border: 1px solid rgba(255, 255, 255, .3); font-weight: 400; }
.btn.ghost:hover { border-color: var(--white); }
.btn.danger { background: none; color: #ff9d85; border: 1px solid rgba(255, 157, 133, .5); font-weight: 400; }
.btn.danger:hover { background: rgba(228, 55, 0, .2); }
.btn[disabled] { opacity: .5; cursor: wait; }
.login { max-width: 420px; margin: 8vh auto; padding: 2rem; border: 1px solid var(--line); border-radius: 20px; background: rgba(7, 23, 63, .65); }
.login h1 { font-size: 2rem; margin-bottom: .3rem; }
.login p { color: var(--muted); margin: 0 0 1.4rem; }
label.f { display: block; margin-bottom: 1rem; font-size: .9rem; color: var(--muted); }
label.f small { color: #8fa2cc; }
.in { display: block; width: 100%; margin-top: .35rem; padding: .7rem .85rem; border-radius: 10px; background: rgba(7, 23, 63, .8); border: 1px solid rgba(255, 255, 255, .25); color: var(--white); }
.in:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(234, 254, 7, .18); }
textarea.in { min-height: 90px; resize: vertical; }
.err { color: #ffb4a0; font-size: .95rem; min-height: 1.4rem; margin: .2rem 0 .8rem; }
.ok { color: #9be7a5; }
.bar { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; justify-content: space-between; margin: 1.2rem 0; }
.bar .in { width: min(340px, 100%); margin: 0; }
.tbl { width: 100%; border-collapse: collapse; margin-bottom: 3rem; }
.tbl th { text-align: left; font-family: var(--f-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; padding: .6rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: rgba(255, 255, 255, .04); }
.av { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--neon-blue); }
.tbl .acts { white-space: nowrap; text-align: right; }
.tbl .acts button { padding: .35rem .8rem; font-size: .88rem; }
.pill { font-family: var(--f-mono); font-size: .72rem; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.off { border-color: var(--rocket); color: #ffb4a0; }
.form { padding: 1.6rem; display: grid; gap: 0 1.2rem; grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
.form h2 { grid-column: 1 / -1; margin-bottom: 1.2rem; font-size: 1.6rem; }
.photo-edit { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.photo-edit .av { width: 84px; height: 84px; }
.tagbox { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem; border-radius: 10px; background: rgba(7, 23, 63, .8); border: 1px solid rgba(255, 255, 255, .25); margin-top: .35rem; }
.tagbox:focus-within { border-color: var(--yellow); }
.tagbox .tag { display: inline-flex; gap: .4rem; align-items: center; }
.tagbox .tag button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; font-size: 1rem; line-height: 1; }
.tagbox input { flex: 1; min-width: 120px; background: none; border: 0; outline: none; color: var(--white); padding: .2rem; }
.sugs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.sugs button { background: none; border: 1px dashed rgba(255, 255, 255, .3); color: var(--muted); border-radius: 6px; padding: .12rem .55rem; font-size: .78rem; cursor: pointer; font-family: var(--f-mono); }
.sugs button:hover { color: var(--yellow); border-color: var(--yellow); }
.formbtns { grid-column: 1 / -1; display: flex; gap: .7rem; justify-content: flex-end; flex-wrap: wrap; margin-top: .6rem; }
.toast { position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%); background: var(--white); color: var(--deep); font-weight: 700; padding: .7rem 1.3rem; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); z-index: 50; }
@media (max-width: 680px) { .form { grid-template-columns: 1fr; } .tbl .hide-s { display: none; } }

/* ---------- táctil: objetivos de 44px y sin zoom en iOS ---------- */
@media (pointer: coarse) {
  .chip, .seg button, .reset, select.sel, .try button, .more { min-height: 44px; }
  select.sel, .in, textarea.in { font-size: 16px; }
}
@media (hover: none) { .card:hover { transform: none; } }

/* ---------- tablet ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
  .logo { height: 50px; }
}

/* ---------- móvil ---------- */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .wrap { width: calc(100% - 1.5rem); }
  .top { padding: .8rem 0; }
  .logo { height: 42px; }
  .top nav a { font-size: .75rem; padding: .4rem .65rem; }
  .hero { padding: 1.2rem 0 .6rem; }
  .hero p.lead { font-size: 1.02rem; }
  .search input { padding: .95rem 2.8rem .95rem 2.9rem; font-size: 1rem; }
  .search kbd { display: none; }
  .try { font-size: .85rem; }
  .filters { padding: .9rem; margin: 1.1rem 0 .6rem; }
  .filters-head { gap: .6rem; }
  .controls { width: 100%; }
  .controls select.sel { flex: 1 1 100%; min-width: 0; text-overflow: ellipsis; }
  /* chips en una sola fila deslizable; "Ver todas" las despliega */
  .chips:not(.open) { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; margin-inline: -.9rem; padding: .1rem .9rem .5rem; scrollbar-width: none; }
  .chips:not(.open)::-webkit-scrollbar { display: none; }
  .chips:not(.open) .chip, .chips:not(.open) .more { flex: none; scroll-snap-align: start; }
  /* tarjeta compacta: foto a la izquierda */
  .grid { grid-template-columns: minmax(0, 1fr); gap: .7rem; padding-bottom: 2rem; }
  .card > * { min-width: 0; }
  .card h3, .card .org { overflow-wrap: anywhere; }
  .card { display: grid; grid-template-columns: 88px 1fr; column-gap: .9rem; align-content: start; padding: .8rem; }
  .card .photo { grid-row: 1 / span 3; margin: 0; align-self: start; }
  .card .ini { font-size: 1.7rem; }
  .card h3 { font-size: 1.12rem; }
  .card .tags { grid-column: 2; margin-top: .5rem; padding-top: 0; }
  .card:not(:has(.org)) .tags { grid-row: 2; }
  .modal h2 { font-size: 1.5rem; }
  dialog { width: calc(100% - 1rem); max-height: 92vh; }
  .modal .photo { max-width: 150px; }
  footer .wrap { flex-direction: column; }
  /* admin */
  .login { margin: 4vh auto; padding: 1.4rem; }
  .bar .in { width: 100%; }
  .tbl th:first-child, .tbl td:first-child { padding-right: 0; }
  .tbl .acts button { padding: .45rem .7rem; }
  .form { padding: 1.1rem; }
}
