
:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #101522;
  --muted: #697386;
  --line: #e3e6ed;
  --primary: #5b4bff;
  --shadow: 0 18px 50px #10152212;
  --banner-bg: #101522;
  --banner-text: #ffffff;
  --banner-muted: #c5ccda;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

/* Accesibilidad: salto al contenido y foco de teclado visible */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--primary);
  transform: translateY(-160%);
}
.skip-link:focus {
  transform: translateY(0);
}
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px max(22px, calc((100% - 1150px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-weight: 900;
  font-size: 21px;
  white-space: nowrap;
}

.brand:first-letter {
  color: var(--primary);
}

nav {
  display: flex;
  gap: 18px;
  align-items: center;
  font-weight: 650;
  font-size: 14px;
}

nav button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}

.login-link {
  color: #4f46e5 !important;
  font-weight: 750;
  white-space: nowrap;
}

.login-link:hover {
  color: #3730a3 !important;
}

/* Portada */
.hero {
  max-width: 1150px;
  margin: auto;
  padding: 70px 22px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 48px;
  align-items: center;
}

.hero-content {
  min-width: 0;
}

.eyebrow {
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 1.5px;
  color: var(--primary);
}

h1 {
  font-size: clamp(43px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -3px;
  margin: 18px 0;
}

h1 span {
  color: var(--primary);
}

.hero p {
  font-size: 19px;
  color: var(--muted);
  line-height: 1.65;
  max-width: 650px;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 12px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 750;
  margin: 8px 8px 0 0;
  background: var(--surface);
  color: var(--text);
  transition: transform 0.2s, background 0.2s;
}

/* Preserve the native hidden state even when a component sets display. */
[hidden] {
  display: none !important;
}

.btn:hover {
  transform: translateY(-2px);
}

.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Grupo de botones de portada */
.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hero-buttons .btn {
  margin: 0;
}

/* Mi espacio ocupa solo el ancho de su texto */
.hero-buttons .space-link {
  flex: 0 0 auto;
  width: fit-content;
  padding: 10px 16px;
  margin-top: 4px;
}

/* Panel de Calculadoras, apuntes y exámenes */
.hero-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
  border-radius: 26px;
}

.hero-panel div {
  padding: 21px;
  background: var(--bg);
  border-radius: 15px;
  margin: 9px 0;
  font-size: 19px;
}

.hero-panel small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 5px 0 0 30px;
}

/* Herramientas */
.section {
  max-width: 1150px;
  margin: auto;
  padding: 20px 22px 80px;
  scroll-margin-top: 90px;
}

.section h2 {
  font-size: 35px;
  margin: 8px 0 25px;
}

.search {
  width: 100%;
  max-width: 390px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  margin-bottom: 22px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 21px;
  padding: 24px;
  min-height: 180px;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card i {
  font-style: normal;
  font-size: 28px;
}

.card h3 {
  margin: 18px 0 7px;
}

.card p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.card b {
  position: absolute;
  right: 18px;
  top: 18px;
  font-size: 9px;
  background: #ebe8ff;
  color: var(--primary);
  padding: 5px 7px;
  border-radius: 7px;
}

/* Zona de estudio: contraste correcto en ambos modos */
.banner {
  max-width: 1150px;
  margin: 0 auto 75px;
  background: var(--banner-bg);
  color: var(--banner-text);
  border-radius: 27px;
  padding: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.banner p {
  color: var(--banner-muted);
  line-height: 1.6;
  max-width: 700px;
}

.banner .eyebrow {
  color: #a79eff;
}

footer {
  border-top: 1px solid var(--line);
  padding: 30px max(22px, calc((100% - 1150px) / 2));
  color: var(--muted);
}

/* Herramientas y formularios */
.page {
  max-width: 900px;
  margin: auto;
  padding: 55px 22px 90px;
}

.calc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 23px;
  padding: 27px;
  box-shadow: var(--shadow);
}

.form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.field label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 7px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.full {
  grid-column: 1 / -1;
}

.result {
  margin-top: 18px;
  padding: 18px;
  border-radius: 14px;
  background: #efedff;
  border: 1px solid #ddd8ff;
  color: #252044;
}

.result strong {
  font-size: 25px;
}

.upload {
  display: block;
  border: 2px dashed #cbd0db;
  border-radius: 18px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
}

.upload input {
  display: none;
}

.settings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.question {
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 15px;
  margin: 13px 0;
  background: var(--surface);
}

.question textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.score {
  margin-top: 18px;
  padding: 18px;
  border-radius: 14px;
  background: #edfff5;
  border: 1px solid #bce9ce;
  color: #123b27;
}

/* Modo oscuro */
.dark {
  --bg: #10141d;
  --surface: #1a2230;
  --text: #f2f5fb;
  --muted: #b3bdcc;
  --line: #303b4c;
  --primary: #9287ff;
  --shadow: 0 18px 50px #00000030;
  --banner-bg: #202a3a;
  --banner-text: #f5f7fc;
  --banner-muted: #c7d0df;
}

.dark .topbar {
  background: #141b27;
}

.dark .login-link {
  color: #b6adff !important;
}

.dark .login-link:hover {
  color: #d2ccff !important;
}

.dark .card b {
  background: #302a52;
  color: #c8c0ff;
}

.dark .result {
  background: #282443;
  border-color: #49416e;
  color: #f2efff;
}

.dark .score {
  background: #173426;
  border-color: #285b40;
  color: #d8fbe5;
}

.dark .upload {
  border-color: #46546a;
}

/* Adaptación a tablet y móvil */
@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 50px;
    gap: 30px;
  }

  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .banner {
    margin: 0 22px 60px;
    display: block;
  }

  .settings,
  .form {
    grid-template-columns: 1fr;
  }

  .full {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
    gap: 10px;
  }

  nav {
    gap: 10px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar nav {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px 12px;
  }

  nav > a:not(.login-link) {
    display: inline-flex;
  }

  .login-link {
    font-size: 13px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  h1 {
    letter-spacing: -2px;
  }

  .hero {
    padding: 45px 18px;
  }

  .section {
    padding-left: 18px;
    padding-right: 18px;
  }

  .banner {
    margin-left: 18px;
    margin-right: 18px;
    padding: 28px;
  }
}




/* Portada reorganizada: misma funcionalidad, jerarquía visual más clara */
.welcome {
  padding-top: 62px;
  padding-bottom: 58px;
  gap: clamp(28px, 5vw, 64px);
}
.welcome h1 {
  max-width: 720px;
  font-size: clamp(42px, 5.5vw, 66px);
  line-height: 1.03;
  letter-spacing: -2.7px;
}
.welcome .hero-content > p {
  max-width: 610px;
}
.welcome .welcome-note {
  font-size: 14px;
  margin-top: 20px;
}
.welcome-panel {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.welcome-action {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 13px;
  padding: 19px 16px;
  border-radius: 15px;
  transition: background .18s, transform .18s;
}
.welcome-action + .welcome-action {
  border-top: 1px solid var(--line);
}
.welcome-action:hover {
  background: var(--bg);
  transform: translateX(2px);
}
.action-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--bg);
  font-size: 23px;
}
.welcome-action b {
  display: block;
  margin-bottom: 5px;
  font-size: 16px;
}
.welcome-action small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}
.action-arrow {
  color: var(--primary);
  font-size: 18px;
}
.tools-section {
  padding-top: 26px;
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 26px;
}
.section-heading h2 {
  margin-bottom: 8px;
}
.section-intro {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.section-heading .search {
  flex: 0 1 330px;
  margin: 0 0 4px;
}
.no-results,
.search-status {
  color: var(--muted);
  padding: 12px 0;
}
@media (max-width: 800px) {
  .welcome {
    padding-top: 48px;
    padding-bottom: 40px;
  }
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .section-heading .search {
    flex-basis: auto;
    max-width: none;
  }
}
@media (max-width: 520px) {
  .welcome h1 {
    letter-spacing: -1.7px;
  }
  .welcome-action {
    grid-template-columns: 42px minmax(0, 1fr) 16px;
    gap: 10px;
    padding: 16px 9px;
  }
  .action-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  .welcome-action b {
    font-size: 15px;
  }
}


/* Respeta las preferencias de movimiento del sistema */
@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;
    scroll-behavior: auto !important;
  }
}
