:root {
  --navy-950: #061f39;
  --navy-900: #092a49;
  --navy-800: #0b365f;
  --navy-700: #174d78;
  --cyan-700: #078ca4;
  --cyan-600: #0aa3b8;
  --cyan-200: #a8dbe7;
  --cyan-100: #dff3f7;
  --blue-050: #f4f9fc;
  --ink: #0a2743;
  --muted: #506b82;
  --line: #bad9e7;
  --surface: #ffffff;
  --shadow: 0 24px 68px rgba(6, 45, 77, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: clip;
  background: var(--blue-050);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 37%, rgba(255, 255, 255, 0.98) 0 16%, rgba(241, 249, 253, 0.82) 46%, transparent 70%),
    linear-gradient(180deg, #ffffff 0 14%, var(--blue-050) 41% 86%, #eaf5fa 100%);
  font-family: Inter, Avenir, "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.page-shell {
  display: flex;
  min-height: 100vh;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  flex-direction: column;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-header {
  min-height: 138px;
  border-bottom: 1px solid rgba(88, 158, 190, 0.25);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: min(76px, 20vw);
  height: min(76px, 20vw);
  object-fit: contain;
}

.brand-copy {
  display: grid;
  min-width: min(300px, 48vw);
  color: var(--navy-950);
}

.brand-copy strong {
  padding-bottom: 5px;
  border-bottom: 2px solid var(--navy-900);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 760;
  line-height: 1.1;
}

.brand-copy span {
  padding-top: 6px;
  color: var(--muted);
  font-size: clamp(0.6rem, 1vw, 0.76rem);
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.institutional-message {
  display: grid;
  position: relative;
  padding-left: 42px;
  border-left: 1px solid var(--cyan-200);
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.55;
  text-align: left;
}

.institutional-message span:first-child {
  color: var(--navy-950);
  font-size: 1.1rem;
  font-weight: 800;
}

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

.portal-content {
  position: relative;
  display: grid;
  flex: 1;
  align-content: center;
  gap: 52px;
  padding: 64px 0 78px;
}

.portal-content::before,
.portal-content::after {
  position: absolute;
  z-index: -1;
  width: 190px;
  height: 120px;
  opacity: 0.52;
  background:
    radial-gradient(circle at 16px 16px, var(--cyan-200) 0 5px, transparent 6px),
    linear-gradient(var(--cyan-200), var(--cyan-200)) 16px 15px / 94px 2px no-repeat,
    linear-gradient(135deg, transparent 47%, var(--cyan-200) 48% 51%, transparent 52%) 109px 15px / 42px 42px no-repeat,
    radial-gradient(circle at 151px 57px, var(--cyan-200) 0 5px, transparent 6px),
    linear-gradient(var(--cyan-200), var(--cyan-200)) 151px 56px / 39px 2px no-repeat;
  content: "";
}

.portal-content::before {
  top: 42px;
  left: -112px;
}

.portal-content::after {
  right: -104px;
  bottom: 76px;
  transform: rotate(180deg);
}

.intro {
  text-align: center;
}

.intro h1 {
  position: relative;
  margin: 0;
  padding-bottom: 28px;
  color: var(--navy-950);
  font-size: clamp(2.8rem, 6vw, 5.25rem);
  font-weight: 820;
  letter-spacing: -0.055em;
  line-height: 0.98;
  text-wrap: balance;
}

.intro h1::after {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 84px;
  height: 4px;
  transform: translateX(-50%);
  background: var(--cyan-600);
  content: "";
}

.intro p {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(1.15rem, 2.1vw, 1.55rem);
  font-weight: 470;
}

.tool-entry {
  display: grid;
  grid-template-columns: minmax(300px, 0.86fr) minmax(0, 1.55fr);
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.tool-entry:hover,
.tool-entry:focus-visible {
  transform: translateY(-5px);
  border-color: var(--cyan-600);
  box-shadow: 0 30px 78px rgba(6, 45, 77, 0.2);
}

.tool-entry:focus-visible {
  outline: 4px solid rgba(10, 163, 184, 0.24);
  outline-offset: 5px;
}

.tool-visual {
  display: grid;
  position: relative;
  min-width: 0;
  place-items: center;
  border-right: 1px solid #d4e8f1;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(246, 251, 253, 0.92)),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(38, 151, 181, 0.07) 48px),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(38, 151, 181, 0.07) 48px);
}

.tool-visual::after {
  position: absolute;
  top: 24px;
  right: 0;
  bottom: 24px;
  width: 3px;
  background: linear-gradient(180deg, transparent, var(--cyan-600), transparent);
  content: "";
}

.conversion-icon {
  width: min(90%, 390px);
  height: auto;
  overflow: visible;
}

.source-file {
  fill: url(#source-fill);
  stroke: var(--navy-950);
  stroke-width: 3;
}

.source-fold {
  fill: #17547e;
  stroke: #2c709a;
  stroke-width: 2;
}

.code-mark,
.source-line {
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
}

.source-line {
  stroke-width: 5;
}

.transfer {
  fill: none;
  stroke: var(--cyan-600);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
}

.output-file {
  fill: #fff;
  stroke: var(--cyan-700);
  stroke-linejoin: round;
  stroke-width: 4;
}

.output-file--back,
.output-fold--back {
  stroke: #1870aa;
}

.output-fold {
  fill: #e9f7fa;
  stroke: var(--cyan-700);
  stroke-linejoin: round;
  stroke-width: 4;
}

.format-tag--docx {
  fill: #1472ad;
}

.format-tag--pdf {
  fill: var(--cyan-700);
}

.format-text {
  fill: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
  font-weight: 800;
}

.output-line {
  fill: none;
  stroke: #adc6d2;
  stroke-linecap: round;
  stroke-width: 5;
}

.tool-copy {
  display: flex;
  position: relative;
  padding: 44px 54px;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(135deg, transparent calc(100% - 96px), rgba(10, 163, 184, 0.08) calc(100% - 96px)),
    var(--surface);
}

.tool-copy::after {
  position: absolute;
  right: 26px;
  bottom: 24px;
  width: 90px;
  height: 70px;
  opacity: 0.55;
  background:
    radial-gradient(circle at 7px 63px, var(--cyan-600) 0 4px, transparent 5px),
    linear-gradient(var(--cyan-200), var(--cyan-200)) 7px 62px / 36px 2px no-repeat,
    linear-gradient(135deg, transparent 47%, var(--cyan-200) 48% 51%, transparent 52%) 42px 19px / 44px 44px no-repeat,
    radial-gradient(circle at 85px 18px, var(--cyan-600) 0 4px, transparent 5px);
  content: "";
}

.tool-copy > strong {
  color: var(--navy-950);
  font-size: clamp(1.8rem, 3.3vw, 2.8rem);
  font-weight: 810;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.tool-copy > span:not(.tool-action) {
  max-width: 690px;
  margin-top: 17px;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.19rem);
  line-height: 1.55;
}

.tool-action {
  display: inline-flex;
  min-width: 248px;
  min-height: 56px;
  margin-top: 28px;
  padding: 13px 24px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 4px;
  color: #fff;
  background: linear-gradient(90deg, var(--cyan-700), var(--cyan-600));
  font-size: 1.05rem;
  font-weight: 780;
}

.tool-action svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
  transition: transform 180ms ease;
}

.tool-entry:hover .tool-action svg,
.tool-entry:focus-visible .tool-action svg {
  transform: translateX(5px);
}

.site-footer {
  min-height: 142px;
  color: #fff;
  background: var(--navy-900);
  box-shadow: 0 0 0 100vmax var(--navy-900);
  clip-path: inset(0 -100vmax);
}

.footer-identity {
  display: grid;
  gap: 3px;
}

.footer-identity strong {
  font-size: 1.08rem;
}

.footer-identity span {
  color: #a9ccdc;
}

.site-footer a {
  padding-left: 42px;
  border-left: 1px solid rgba(121, 202, 221, 0.65);
  color: #d8edf5;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 800px) {
  .site-header {
    min-height: 118px;
  }

  .institutional-message {
    padding-left: 24px;
    font-size: 0.8rem;
  }

  .institutional-message span:first-child {
    font-size: 0.94rem;
  }

  .portal-content {
    gap: 38px;
    padding: 48px 0 62px;
  }

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

  .tool-visual {
    min-height: 230px;
    border-right: 0;
    border-bottom: 1px solid #d4e8f1;
  }

  .tool-visual::after {
    top: auto;
    right: 24px;
    bottom: -2px;
    left: 24px;
    width: auto;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--cyan-600), transparent);
  }

  .conversion-icon {
    width: min(70%, 340px);
  }
}

@media (max-width: 600px) {
  .page-shell {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    min-height: auto;
    padding: 24px 0 22px;
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .brand {
    gap: 13px;
  }

  .brand-logo {
    width: 58px;
    height: 58px;
  }

  .brand-copy {
    min-width: 0;
  }

  .brand-copy strong {
    font-size: 1.35rem;
  }

  .brand-copy span {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
  }

  .institutional-message {
    padding-left: 16px;
    border-left-width: 3px;
  }

  .portal-content {
    padding: 42px 0 50px;
  }

  .intro h1 {
    padding-bottom: 22px;
    font-size: clamp(2.3rem, 12vw, 3.35rem);
  }

  .intro p {
    margin-top: 22px;
    font-size: 1.05rem;
  }

  .tool-entry {
    min-height: 0;
  }

  .tool-visual {
    min-height: 192px;
  }

  .conversion-icon {
    width: min(88%, 330px);
  }

  .tool-copy {
    padding: 34px 28px 38px;
  }

  .tool-copy > strong {
    font-size: 1.8rem;
  }

  .tool-action {
    width: 100%;
    min-width: 0;
  }

  .site-footer {
    min-height: auto;
    padding: 28px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer a {
    padding: 14px 0 0;
    border-top: 1px solid rgba(121, 202, 221, 0.65);
    border-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Accesos coordinados en la portada */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.tools-grid .tool-entry {
  grid-template-columns: 1fr;
  min-height: 410px;
}

.tools-grid .tool-visual {
  min-height: 164px;
  border-right: 0;
  border-bottom: 1px solid #d4e8f1;
}

.tools-grid .tool-visual::after {
  top: auto;
  right: 24px;
  bottom: -2px;
  left: 24px;
  width: auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--cyan-600), transparent);
}

.tools-grid .conversion-icon,
.normativa-icon,
.nexo-icon {
  width: min(72%, 300px);
  height: 142px;
}

.tools-grid .tool-copy {
  min-height: 246px;
  padding: 27px 32px 30px;
  justify-content: flex-start;
}

.tools-grid .tool-copy > strong {
  font-size: clamp(1.58rem, 2.35vw, 2.06rem);
}

.tools-grid .tool-copy > span:not(.tool-action) {
  margin-top: 13px;
  font-size: clamp(0.94rem, 1.35vw, 1.05rem);
}

.tools-grid .tool-action {
  width: 100%;
  min-height: 50px;
  min-width: 0;
  margin-top: auto;
}

.normativa-icon { overflow: visible; }
.norm-page { fill: #fff; stroke: var(--cyan-700); stroke-linejoin: round; stroke-width: 4; }
.normativa-page--back { fill: #eff9fb; stroke: #4e9ab6; }
.norm-fold { fill: #dff3f7; stroke: var(--cyan-700); stroke-linejoin: round; stroke-width: 4; }
.normativa-fold--back { stroke: #4e9ab6; }
.norm-line { fill: none; stroke: #8bb2c4; stroke-linecap: round; stroke-width: 6; }
.norm-scale { fill: none; stroke: var(--navy-800); stroke-linecap: round; stroke-linejoin: round; stroke-width: 5; }
.tool-entry--normativa .tool-action { background: linear-gradient(90deg, var(--navy-700), var(--cyan-700)); }
.nexo-icon { overflow: visible; }
.nexo-tile { fill: #1c1823; }
.nexo-mark { fill: none; stroke: url(#nexo-gradient); stroke-linecap: round; stroke-linejoin: round; stroke-width: 17; }
.nexo-node { fill: #fff; stroke: #8b7a9f; stroke-width: 3; }
.nexo-label { fill: #fff; font-family: Inter, Avenir, "Segoe UI", sans-serif; font-size: 22px; font-weight: 820; letter-spacing: 0.04em; }
.tool-entry--nexo .tool-visual {
  background:
    radial-gradient(circle at 74% 32%, rgba(117, 96, 139, 0.16), transparent 33%),
    linear-gradient(rgba(255, 255, 255, 0.8), rgba(248, 246, 250, 0.94));
}
.tool-entry--nexo .tool-visual::after { background: linear-gradient(90deg, transparent, #736183, transparent); }
.tool-entry--nexo .tool-action { background: linear-gradient(90deg, #493b58, #756187); }

@media (min-width: 801px) {
  .site-header { min-height: 112px; }
  .portal-content { gap: 34px; padding: 42px 0 56px; }
  .intro h1 { padding-bottom: 22px; font-size: clamp(2.7rem, 5.2vw, 4.4rem); }
  .intro p { margin-top: 20px; font-size: clamp(1.08rem, 1.8vw, 1.38rem); }
}

@media (max-width: 800px) {
  .tools-grid { grid-template-columns: 1fr; }
  .tools-grid .tool-entry { min-height: 0; }
}

@media (min-width: 801px) and (max-width: 1100px) {
  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .tools-grid .tool-visual { min-height: 192px; }
  .tools-grid .conversion-icon,
  .normativa-icon,
  .nexo-icon { width: min(88%, 330px); height: 170px; }
  .tools-grid .tool-copy { min-height: 294px; padding: 34px 28px 38px; }
}
