/* ============================================================
   base.css — Variables, reset, cursor, toast
   Compartido entre index.html y seguridad.html
   ============================================================ */

:root {
  --mono: 'Space Mono', monospace;
  --disp: 'Syne', sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  --pad: clamp(20px, 4vw, 56px);
  --ez: cubic-bezier(.16, 1, .3, 1);
}

html[data-theme="ink"] {
  --bg: #0C0C0B;
  --ink: #EDEAE1;
  --mut: #8B8A80;
  --acid: #47A297;
  --acc: #47A297;
  --err: #FF6B57;
  --brand: #47A297;
  --brand-soft: #9FE0D6;
  --cur: #EDEAE1;
  --cur-blend: difference;
  --line: rgba(237, 234, 225, .16);
  --ghost: rgba(237, 234, 225, .13);
  --dot: rgba(237, 234, 225, .05);
  --grain: .05;
  color-scheme: dark;
}

html[data-theme="paper"] {
  --bg: #EFECDF;
  --ink: #151510;
  --mut: #787464;
  --acid: #357A71;
  --acc: #357A71;
  --err: #C03A1B;
  --brand: #357A71;
  --brand-soft: #9FE0D6;
  --cur: #151510;
  --cur-blend: normal;
  --line: rgba(21, 21, 16, .18);
  --ghost: rgba(21, 21, 16, .12);
  --dot: rgba(21, 21, 16, .06);
  --grain: .04;
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--disp);
}

body { transition: background-color .35s; }

::selection { background: var(--acid); color: #131311; }
:focus-visible { outline: 1px solid var(--acc); outline-offset: 3px; }

button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* Solo lectores de pantalla */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Textura de puntos */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.4px);
  background-size: 28px 28px;
}

/* Grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== CURSOR PERSONALIZADO ===== */
.cur-dot,
.cur-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 150;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: var(--cur-blend, normal);
  will-change: transform;
}

.cur-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cur, #EDEAE1);
}

.cur-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--cur, #EDEAE1);
  transition: width .25s, height .25s;
}

.cur-ring.hot { width: 58px; height: 58px; }

html.cur-on,
html.cur-on * { cursor: none !important; }

html.modal-open .cur-dot,
html.modal-open .cur-ring { display: none !important; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 120;
  pointer-events: none;
  transform: translate(-50%, 16px);
  opacity: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 11px 18px;
  font-size: 10px;
  letter-spacing: .14em;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: .35s var(--ez);
  max-width: min(88vw, 520px);
}

.toast i { width: 7px; height: 7px; background: var(--acc); display: inline-block; flex: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Botones cuadrados */
.ibtn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex: none;
  transition: border-color .25s, color .25s, transform .15s;
}

.ibtn:hover { border-color: var(--acc); color: var(--acc); }
.ibtn:active { transform: scale(.92); }
.ibtn svg { width: 16px; height: 16px; }
.ibtn.off { opacity: .25; pointer-events: none; }

/* Header */
.hd {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--pad);
  padding-left: max(var(--pad), env(safe-area-inset-left, 0px));
  padding-right: max(var(--pad), env(safe-area-inset-right, 0px));
}

.hd-logo { display: block; line-height: 0; flex-shrink: 0; }
.hd-logo img { height: 34px; width: auto; display: block; transition: opacity .25s, filter .25s; }
.hd-logo:hover img { opacity: .85; }
.hd-r { display: flex; align-items: center; gap: 10px; }

.hd-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--mut);
}
.hd-meta b { font-weight: 400; color: var(--ink); }

/* Cursor y reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cur-dot, .cur-ring { display: none !important; }
  html.cur-on, html.cur-on * { cursor: auto !important; }
}

@media (pointer: coarse) {
  .ibtn { width: 40px; height: 40px; }
}