/* ==========================================================================
   CENTERNESS — Design System
   Palette derived from the "Núcleo Orbital" isologo:
   deep navy · turquoise · graphite · white
   ========================================================================== */

:root {
  /* ---- Brand ---- */
  --navy-950: #04101f;
  --navy-900: #071a33;
  --navy-850: #0a2140;
  --navy-800: #0b2447;
  --navy-700: #103058;
  --navy-600: #16406f;
  --navy-500: #1d5490;

  --cyan-300: #6ff0f8;
  --cyan-400: #22d9e6;
  --cyan-500: #00c5d4;
  --cyan-600: #00a3b0;
  --cyan-700: #04808c;

  --graphite-300: #a9b6c4;
  --graphite-400: #8b9aab;
  --graphite-500: #6b7b8d;
  --graphite-600: #52606f;

  --ink: #04101f;
  --paper: #ffffff;
  --mist: #f2f6fa;
  --mist-2: #e6edf4;

  /* ---- Semantic ---- */
  --ok: #17b978;
  --ok-soft: rgba(23, 185, 120, 0.14);
  --warn: #f0a020;
  --warn-soft: rgba(240, 160, 32, 0.14);
  --danger: #ef4d5a;
  --danger-soft: rgba(239, 77, 90, 0.14);

  /* ---- Surface (dark context) ---- */
  --surface-0: #04101f;
  --surface-1: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border-soft: rgba(255, 255, 255, 0.09);
  --border-mid: rgba(255, 255, 255, 0.16);

  --text-hi: #ffffff;
  --text-mid: rgba(226, 238, 248, 0.76);
  --text-low: rgba(226, 238, 248, 0.52);

  /* ---- Type ---- */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0: clamp(0.94rem, 0.91rem + 0.15vw, 1rem);
  --step-1: clamp(1.1rem, 1.03rem + 0.35vw, 1.3rem);
  --step-2: clamp(1.35rem, 1.2rem + 0.7vw, 1.75rem);
  --step-3: clamp(1.7rem, 1.4rem + 1.4vw, 2.5rem);
  --step-4: clamp(2.1rem, 1.5rem + 2.8vw, 3.6rem);
  --step-5: clamp(2.6rem, 1.5rem + 4.6vw, 5rem);

  /* ---- Space & shape ---- */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
  --sp-5: 1.5rem;   --sp-6: 2rem;     --sp-7: 3rem;     --sp-8: 4rem;
  --sp-9: 6rem;     --sp-10: 8rem;

  --r-sm: 8px;  --r-md: 14px;  --r-lg: 20px;  --r-xl: 28px;  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(4, 16, 31, 0.18);
  --shadow-md: 0 8px 24px -8px rgba(4, 16, 31, 0.35);
  --shadow-lg: 0 24px 64px -16px rgba(4, 16, 31, 0.5);
  --glow-cyan: 0 0 0 1px rgba(0, 197, 212, 0.3), 0 8px 40px -8px rgba(0, 197, 212, 0.45);

  --maxw: 1200px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Reset
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text-mid);
  background: var(--surface-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

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

button, input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  color: var(--text-hi);
  line-height: 1.12;
  letter-spacing: -0.022em;
  font-weight: 650;
  text-wrap: balance;
}

h1 { font-size: var(--step-5); letter-spacing: -0.035em; }
h2 { font-size: var(--step-4); letter-spacing: -0.03em; }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { text-wrap: pretty; }

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

::selection { background: var(--cyan-500); color: var(--ink); }

@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;
  }
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

.wrap-narrow { max-width: 760px; }

.section { padding-block: var(--sp-9); position: relative; }

@media (max-width: 640px) {
  .section { padding-block: var(--sp-8); }
}

.stack > * + * { margin-top: var(--flow, var(--sp-4)); }

.grid { display: grid; gap: var(--sp-5); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan-400);
}

.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan-500));
}

.lede {
  font-size: var(--step-1);
  color: var(--text-mid);
  max-width: 62ch;
}

.muted { color: var(--text-low); }

.accent {
  background: linear-gradient(120deg, var(--cyan-300), var(--cyan-500) 55%, var(--navy-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text-hi);
  --btn-bd: var(--border-mid);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.72rem 1.35rem;
  border-radius: var(--r-full);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--step-0);
  font-weight: 580;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
              background 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--cyan-400), var(--cyan-600));
  --btn-fg: var(--ink);
  --btn-bd: transparent;
  font-weight: 650;
  box-shadow: 0 6px 24px -8px rgba(0, 197, 212, 0.6);
}
.btn-primary:hover { box-shadow: var(--glow-cyan); }

.btn-ghost { --btn-bg: var(--surface-1); }
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-bd: var(--cyan-600); }

.btn-quiet { --btn-bd: transparent; --btn-fg: var(--text-mid); }
.btn-quiet:hover { --btn-fg: var(--text-hi); --btn-bg: var(--surface-1); }

.btn-sm { padding: 0.42rem 0.85rem; font-size: var(--step--1); }
.btn-lg { padding: 0.92rem 1.8rem; font-size: var(--step-1); }
.btn-block { width: 100%; }

.btn-danger {
  --btn-bg: var(--danger-soft);
  --btn-fg: #ffb9bf;
  --btn-bd: rgba(239, 77, 90, 0.35);
}
.btn-danger:hover { --btn-bg: rgba(239, 77, 90, 0.24); }

/* ==========================================================================
   Cards & surfaces
   ========================================================================== */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.card-hover {
  transition: transform 0.4s var(--ease), border-color 0.3s, background 0.3s;
}
.card-hover:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 197, 212, 0.35);
  background: var(--surface-2);
}

/* Hairline that lights up on hover */
.card-lit::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan-500), transparent);
  opacity: 0;
  transition: opacity 0.4s;
}
.card-lit:hover::before { opacity: 1; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.28rem 0.72rem;
  border-radius: var(--r-full);
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  font-size: var(--step--1);
  font-weight: 550;
  color: var(--text-mid);
}

.pill-ok { border-color: rgba(23,185,120,0.32); background: var(--ok-soft); color: #6ee7b0; }
.pill-warn { border-color: rgba(240,160,32,0.32); background: var(--warn-soft); color: #f7c76a; }
.pill-danger { border-color: rgba(239,77,90,0.32); background: var(--danger-soft); color: #ffa8b0; }
.pill-cyan { border-color: rgba(0,197,212,0.32); background: rgba(0,197,212,0.12); color: var(--cyan-300); }

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.field { display: block; }
.field + .field { margin-top: var(--sp-4); }

.label {
  display: block;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: var(--sp-2);
  letter-spacing: 0.01em;
}

.input, .select, .textarea {
  width: 100%;
  padding: 0.78rem 0.95rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border-mid);
  background: rgba(4, 16, 31, 0.55);
  color: var(--text-hi);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input::placeholder { color: var(--text-low); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--cyan-500);
  background: rgba(4, 16, 31, 0.8);
  box-shadow: 0 0 0 4px rgba(0, 197, 212, 0.14);
}

.input[aria-invalid='true'] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 77, 90, 0.12);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b9aab' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.4rem;
  cursor: pointer;
}

.select option { background: var(--navy-900); color: var(--text-hi); }

.hint { font-size: var(--step--1); color: var(--text-low); margin-top: var(--sp-2); }
.error-text { font-size: var(--step--1); color: #ffa8b0; margin-top: var(--sp-2); }

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: var(--step--1);
  color: var(--text-mid);
  cursor: pointer;
}

.checkbox input {
  appearance: none;
  width: 18px; height: 18px;
  flex: none;
  margin-top: 2px;
  border: 1px solid var(--border-mid);
  border-radius: 5px;
  background: rgba(4,16,31,0.6);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.checkbox input:checked {
  background: var(--cyan-500)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath fill='none' stroke='%2304101f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='m1 5 3.5 3.5L11 1.5'/%3E%3C/svg%3E") center/12px no-repeat;
  border-color: var(--cyan-500);
}

/* Alerts */
.alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  font-size: var(--step--1);
  line-height: 1.5;
}
.alert-error { border-color: rgba(239,77,90,0.32); background: var(--danger-soft); color: #ffc4c9; }
.alert-ok { border-color: rgba(23,185,120,0.32); background: var(--ok-soft); color: #8ff0c2; }
.alert-warn { border-color: rgba(240,160,32,0.32); background: var(--warn-soft); color: #fadaa2; }
.alert[hidden] { display: none; }

/* ==========================================================================
   Brand mark (inline SVG orbital)
   ========================================================================== */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.68rem;
}

.brand-mark { width: 38px; height: 38px; flex: none; }

.brand-name {
  font-size: 1.12rem;
  font-weight: 640;
  letter-spacing: 0.16em;
  color: var(--text-hi);
  text-transform: uppercase;
}

.brand-name .e { color: var(--cyan-400); }

.brand-tag {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--text-low);
  text-transform: none;
  font-weight: 450;
  margin-top: 1px;
}

/* The mark itself stays still — a logo that reads differently every second
   is not a logo. Motion belongs to the hero orbital only. */
.orbit-a, .orbit-b { transform-origin: 50% 50%; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .brand-tag { display: none; }
}

/* ==========================================================================
   Language switcher
   ========================================================================== */

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  flex: none;
}

.lang-switch button {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 0.24rem 0.6rem;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-low);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  line-height: 1.5;
  transition: color 0.2s, background 0.2s;
}

.lang-switch button:hover { color: var(--text-hi); }

.lang-switch button[aria-pressed='true'] {
  background: rgba(0, 197, 212, 0.16);
  color: var(--cyan-300);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

/* The UA rule for [hidden] is display:none at the lowest precedence, so any
   utility class that sets display (.flex, .grid) silently defeats it. Every
   scene and HUD toggle in the app relies on the attribute, so force it. */
[hidden] { display: none !important; }

.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;
}

.skip-link {
  position: absolute; top: -100%; left: var(--sp-4); z-index: 999;
  padding: var(--sp-3) var(--sp-4);
  background: var(--cyan-500); color: var(--ink);
  border-radius: var(--r-md); font-weight: 600;
}
.skip-link:focus { top: var(--sp-4); }

.center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.wrap-flex { flex-wrap: wrap; }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }

/* Scroll-reveal: opt-in, and inert when motion is reduced */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* Thin scrollbars in dark surfaces */
* { scrollbar-width: thin; scrollbar-color: var(--graphite-600) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--graphite-600); border-radius: 99px;
  border: 3px solid var(--surface-0);
}
*::-webkit-scrollbar-track { background: transparent; }
